SlideShare a Scribd company logo
Updating Single Record (ABAP)
Task: Changing a Single Record
Program: SAPMZ##_CUSTOMER1
Transaction: Z##_CUSTOMER1
Copy template: SAPBC414T_CREATE_CUSTOMER_01
Model Solution: SAPBC414S_CREATE_CUSTOMER_01

Our Program name: Z027393A_CUSTOMER1

The exercise makes you copy the template SAPBC414T_CREATE_CUSTOMER_01 to
SAPMZ##_CUSTOMER1 where ## is the student number, but here we will create
the complete exercise from scratch. Also, the exercise uses Module Pool to create
the program; here we are creating the program using Function Pool.

Information: SCUSTOM is the database table that holds the Customer data. The
application is written to save the data to this table. Use Transaction Code SE11 for
getting the record description and field description. And use Transaction Code SE16
to see the existing data. After the program is completed and executed, a new row
will be added to this table and can be viewed using the same transaction code
SE16.

Table and Fields:
SCUSTOM --> Flight Customer Data
 MANDT - Client
 ID - Customer Number
 NAME - Customer name
 FORM - Form of address
 STREET - Street
 POSTBOX - PO Box
 POSTCODE - Postal Code
 CITY - City
 COUNTRY - Country code
 REGION - Region
 TELEPHONE - Telephone number of flight customer
 CUSTTYPE - Customer type
 DISCOUNT - Discount rate
 LANGU - Language Key

Launch SE80.

Ensure that you are on the ‘Repository Browser’.

Select Package from the drop down and enter your Package name [ZxxxxxxA]
where xxxxxx is your SAP Login ID or Oracle ID, then click on the [Display] button.
Create the package if the package does not already exist.

Now create a Function Module, by right clicking the ‘Function Group’ item and
selecting ‘Create’ as shown.




                                                                                1 of 31
Updating Single Record (ABAP)




Enter the Function Group (name) and Short Text (description.)




                                                                2 of 31
Updating Single Record (ABAP)




Click on Save.




Click on Save Symbol Icon.




Click on Continue Icon or hit Enter.

The system automatically creates two include functions as shown below.




                                                                         3 of 31
Updating Single Record (ABAP)




Double click on the LZ027393A_CUSTOMER1TOP include file and enter the following
code.

FUNCTION-POOL Z027393A_CUSTOMER1 MESSAGE-ID bc414.

DATA: answer, flag.
DATA: ok_code LIKE sy-ucomm, save_ok LIKE ok_code.
TABLES: scustom. “This command is not obsolete for use in this situation




The command TABLES: scustom creates the SCUSTOM structure that retains the
newly entered (created) customer data.



                                                                           4 of 31
Updating Single Record (ABAP)

The BC414 message class is declared as a program default in the PROGRAM
statement (see syntax MESSAGE-ID bc414 in the above code) and therefore valid
throughout the programs.

Save the Function Module by clicking on the Save button at the top.

Since we need to generate a unique ID for each new customer generated, we need
to use SAP functionality that does that. This Number Range Object/Buffer can be
created new or existing one used [Use Transaction Code SNRO to create and
maintain new Number Range Object.] We are using the existing object 'SBUSPID'.
SAP also provides us with a function NUMBER_GET_NEXT to get the IDS using this
object. We will first create a Subroutine to access the function in addition to other
subroutines been created.

Create the following subroutines as shown below, by right clicking on the Function
Group name and selecting Create > Subroutine.




                                                                                5 of 31
Updating Single Record (ABAP)




Enter the name of the subroutine ‘ASK_LOSS’, SAP suggest a new Include for this
subroutine, select the suggested name ‘LZ027393A_CUSTOMER1F01’ – we will use
the same include to save all the subroutines that we will create shortly.




                                                                          6 of 31
Updating Single Record (ABAP)




Accept the warning that may show as follows:




                                                  7 of 31
Updating Single Record (ABAP)

FORM ask_loss USING p_answer.
 CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
    EXPORTING
       textline1 = 'Continue?'(004)
       titel   = 'Create Customer'(003)
    IMPORTING
       answer = p_answer.
ENDFORM.                       " ASK_LOSS


Similarly create the following subroutines by right clicking on the Function Group
name and selecting Create > Subroutine.

ASK_SAVE
NUMBER_GET_NEXT
SAVE
SAVE_SCUSTOM

FORM NUMBER_GET_NEXT USING p_scustom LIKE scustom.
 DATA: return TYPE inri-returncode.
* get next free number in the number range '01'
* of number object'SBUSPID'
 CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
         nr_range_nr = '01'
         object    = 'SBUSPID'
      IMPORTING
         number     = p_scustom-id
         returncode = return
      EXCEPTIONS
         OTHERS      = 1.
 CASE sy-subrc.
   WHEN 0.
     CASE return.
       WHEN 1.
* number of remaining numbers critical
        MESSAGE s070.
       WHEN 2.
* last number
        MESSAGE s071.
       WHEN 3.
* no free number left over
        MESSAGE a072.
     ENDCASE.
   WHEN 1.
* internal error
     MESSAGE a073 WITH sy-subrc.


                                                                               8 of 31
Updating Single Record (ABAP)
 ENDCASE.
ENDFORM.                         " NUMBER_GET_NEXT

FORM ASK_SAVE USING p_answer.

* POPUP_TO_CONFIRM_STEP is obsolete, so using POPUP_TO_CONFIRM below
* CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
*    EXPORTING
*        textline1 = 'Data has been changed.'(001)
*        textline2 = 'Save before leaving transaction?'(002)
*        titel   = 'Create Customer'(003)
*    IMPORTING
*        answer = p_answer.

call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'Create Customer'(003)
text_question = 'Data has been changed. Save before leaving transaction? '
text_button_1 = 'Yes'
icon_button_1 = 'ICON_YES'
text_button_2 = 'No'
icon_button_2 = 'ICON_NO'
default_button = '2'
display_cancel_button = 'X'
importing
answer = p_answer.

ENDFORM.                         " ASK_SAVE


FORM SAVE.
* get SCUSTOM-ID from number range object BC_SCUSTOM
 PERFORM number_get_next USING scustom.
* save new customer
 PERFORM save_scustom.
ENDFORM.

FORM SAVE_SCUSTOM.
 INSERT INTO scustom VALUES scustom.
 IF sy-subrc <> 0.
* insertion of dataset in DB-table not possible
   MESSAGE a048.
 ELSE.
* insertion successfull
   MESSAGE s015 WITH scustom-id.
 ENDIF.
ENDFORM.




                                                                             9 of 31
Updating Single Record (ABAP)

Create GUI Status (Menu) as shown below.




                                                  10 of 31
Updating Single Record (ABAP)




Click on the ‘+’ next to the Menu Bar and add the following text and labels.




Now double click on the ‘Edit’ text (next to the Customer Data label that was
entered)




                                                                                11 of 31
Updating Single Record (ABAP)




Delete all the following entries using   button on the top menu, except the
Cancel line and add the Code as shown




Save the changes.


                                                                          12 of 31
Updating Single Record (ABAP)

Now maximize the Function Keys by clicking on the ‘+’ sign next to it.




Enter SAVE, BACK, EXIT and CANCEL function code next (above) the save, back,
exit and Cancel icon as shown below under the Standard Toolbar button.




Enter the fast text as shown below for these buttons. Leave Function Type as blank
(Blank defaults to Application Function) for Save and Back button and E (exit) for
Exit and Cancel.




                                                                           13 of 31
Updating Single Record (ABAP)




                                14 of 31
Updating Single Record (ABAP)




Save the GUI Status.

Now create GUI title




                                                   15 of 31
Updating Single Record (ABAP)




Enter the Title Code and Title as shown below




Click on enter to save the GUI title.

Save and Activate the program, by clicking on the Activate button.

Creating the screen.

Now create a Screen, by right clicking the ‘Function Group’ item and selecting
‘Create’ and then ‘Screen’ as shown.




                                                                             16 of 31
Updating Single Record (ABAP)




Enter Screen number as shown




Click Continue button or hit enter.




                                                    17 of 31
Updating Single Record (ABAP)




Click on the Layout button (or Control + F7)




                                                   18 of 31
Updating Single Record (ABAP)




Click on the Dictionary/Program Field Window button or hit F6.

In the Table/Field Name field enter ‘SCUSTOM’ and then click on the ‘Get from
Dictionary’ button. Important note – by selecting these fields from the database
tables [in repository] all the fields automatically get all the labels/field help/etc
defaulted from their respective fields’ definition in the data dictionary.




Select the fields as shown.



                                                                                 19 of 31
Updating Single Record (ABAP)




Click on the Continue button.

Click on the blank screen somewhere near the top left corner, so that the selected
fields get copied over to the screen.




                                                                            20 of 31
Updating Single Record (ABAP)




Do not convert any fields if requested (in this simple example.)




Rearrange the fields as shown. Add 4 boxes around the groupings.




                                                                   21 of 31
Updating Single Record (ABAP)




Save the screen and exit the Screen Painter (Screen > Exit)

Go to the ‘Element List’ tab of the Screen (this tab is between the ‘Attributes’ and
‘Flow Logic’ tab. On the ‘General Attributes’ sub tab enter the Frame01, Frame02,
Frame03 and Frame04 for the four unnamed boxes created. Also enter the
‘OK_CODE’ name for the field name that has the ‘Type of screen element’ OK (this
is automatically created by the screen when the screen is created – we provide a
name.) During run time this field OK_CODE will have the name of the function code
of the button or key that was clicked by user.




                                                                             22 of 31
Updating Single Record (ABAP)




On the ‘Flow Logic’ tab enter the following code for the Process Before Output
(PBO) and Process After Input (PAI) logic.




PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.

PROCESS AFTER INPUT.
 MODULE EXIT AT EXIT-COMMAND.
 MODULE SAVE_OK_CODE.




                                                                             23 of 31
Updating Single Record (ABAP)
 FIELD: scustom-name MODULE mark_changed ON REQUEST.
 MODULE USER_COMMAND_0100.

Save the changes.

Create the modules STATUS_0100 and USER_COMMAND_0100 by forward
navigation (i.e., double click on any module name(s), since these modules do not
exist currently, the system will prompt us, to create these.) These modules are
created in the appropriate INCLUDE file.

Double click on STATUS_0100 in the above ABAP editor. At the following prompt
select ‘Yes’.




Select the recommended new include file that the system shows.




Note that the alphabet ‘O’ in the name (3rd character from last) stands for OUTPUT
of PROCESS BEFORE OUTPUT (PBO) modules and all the output modules may be
created here.




                                                                            24 of 31
Updating Single Record (ABAP)




Select Continue button or hit Enter.

Modify the module definition as shown below.




*----------------------------------------------------------------------*
***INCLUDE LZ027393A_CUSTOMER1O01 .
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
 SET PF-STATUS 'DYN_0100'.
 SET TITLEBAR 'DYN_0100'.
ENDMODULE.                  " STATUS_0100 OUTPUT


Save and hit the Back button (F3) to go back to the Flow Logic of the screen.

Now double click on the USER_COMMAND_0100 name.




Select Yes.


                                                                            25 of 31
Updating Single Record (ABAP)


Accept the new INCLUDE file name for this new INPUT (PAI – Process after Input)
module.




Click on Continue button or hit Enter.

Enter the following code in this INCLUDE function.

*----------------------------------------------------------------------*
***INCLUDE LZ027393A_CUSTOMER1I01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&     Module EXIT INPUT
*&---------------------------------------------------------------------*
MODULE exit INPUT.
 CASE ok_code.
   WHEN 'EXIT'.
    IF sy-datar IS INITIAL AND flag IS INITIAL.
* no changes on screen 100
      LEAVE PROGRAM.
    ELSE.



                                                                           26 of 31
Updating Single Record (ABAP)
     PERFORM ask_save USING answer.
*      CASE answer.
*       WHEN 'J'.
*         ok_code = 'SAVE&EXIT'.
*       WHEN 'N'.
*         LEAVE PROGRAM.
*       WHEN 'A'.
*         CLEAR ok_code.
*         SET SCREEN 100.
*      ENDCASE.
     CASE answer.
       WHEN '1'.
        ok_code = 'SAVE&EXIT'.
       WHEN '2'.
        LEAVE PROGRAM.
       WHEN 'A'.
        CLEAR ok_code.
        SET SCREEN 100.
     ENDCASE.
    ENDIF.
   WHEN 'CANCEL'.
    IF sy-datar IS INITIAL AND flag IS INITIAL.
* no changes on screen 100
     LEAVE TO SCREEN 0.
    ELSE.
     PERFORM ask_loss USING answer.
     CASE answer.
       WHEN 'J'.
        LEAVE TO SCREEN 0.
       WHEN 'N'.
        CLEAR ok_code.
        SET SCREEN 100.
     ENDCASE.
    ENDIF.
  ENDCASE.
ENDMODULE.                       " EXIT INPUT

*&---------------------------------------------------------------------*
*&     Module SAVE_OK_CODE INPUT
*&---------------------------------------------------------------------*
MODULE save_ok_code INPUT.
 save_ok = ok_code.
 CLEAR ok_code.
ENDMODULE.                           " SAVE_OK_CODE INPUT

*&---------------------------------------------------------------------*
*&     Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*


                                                                           27 of 31
Updating Single Record (ABAP)
MODULE user_command_0100 INPUT.
 CASE save_ok.
  WHEN 'SAVE&EXIT'.
   PERFORM save.
   LEAVE PROGRAM.
  WHEN 'SAVE'.
   IF flag IS INITIAL.
    SET SCREEN 100.
   ELSE.
    PERFORM save.
    SET SCREEN 0.
   ENDIF.
  WHEN 'BACK'.
   IF flag IS INITIAL.
    SET SCREEN 0.
   ELSE.
    PERFORM ask_save USING answer.
    CASE answer.
      WHEN 'J'.
        PERFORM save.
        SET SCREEN 0.
      WHEN 'N'.
        SET SCREEN 0.
      WHEN 'A'.
        SET SCREEN 100.
    ENDCASE.
   ENDIF.
 ENDCASE.
ENDMODULE.                  " USER_COMMAND_0100 INPUT

*&---------------------------------------------------------------------*
*&      Module MARK_CHANGED INPUT
*&---------------------------------------------------------------------*
MODULE mark_changed INPUT.
* set flag to mark changes were made on screen 100
 flag = 'X'.
ENDMODULE.                           " MARK_CHANGED INPUT


Save and Activate the program (including the screens, etc)

Create a transaction code to execute this program.




                                                                           28 of 31
Updating Single Record (ABAP)




Enter the program name and description.




Click on Continue button or hit Enter.




                                                    29 of 31
Updating Single Record (ABAP)




Save - choose the appropriate package and workbench request.




                                                               30 of 31
Updating Single Record (ABAP)




Run the transaction.




                                                   31 of 31

More Related Content

Viewers also liked

Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksMilind Patil
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandlingMilind Patil
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and dataMilind Patil
 
Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesMilind Patil
 

Viewers also liked (7)

Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checks
 
Abap slides set1
Abap slides set1Abap slides set1
Abap slides set1
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandling
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and data
 
SAP PM: Test Equipment Management/Calibration process
SAP PM: Test Equipment Management/Calibration processSAP PM: Test Equipment Management/Calibration process
SAP PM: Test Equipment Management/Calibration process
 
Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfiles
 
Abap reports
Abap reportsAbap reports
Abap reports
 

Similar to Step bystep abap_changinga_singlerecord

Lsmw for master data upload simple explanation
Lsmw for master data upload simple explanationLsmw for master data upload simple explanation
Lsmw for master data upload simple explanation
Manoj Kumar
 
Change transport system in SAP
Change transport system in SAP Change transport system in SAP
Change transport system in SAP
chinu141
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basicsAbhishek Dixit
 
Db2
Db2Db2
Db2
yboren
 
Calibration process
Calibration processCalibration process
Calibration process
Krish Penjarla
 
Calibration process
Calibration processCalibration process
Calibration process
darshanaudaya
 
Page 8 of 8Delete this text and type your name here This fil.docx
Page 8 of 8Delete this text and type your name here This fil.docxPage 8 of 8Delete this text and type your name here This fil.docx
Page 8 of 8Delete this text and type your name here This fil.docx
alfred4lewis58146
 
Page 3 of 11Delete this text and type your name here This .docx
Page 3 of 11Delete this text and type your name here This .docxPage 3 of 11Delete this text and type your name here This .docx
Page 3 of 11Delete this text and type your name here This .docx
alfred4lewis58146
 
Sap application log
Sap application logSap application log
Sap application log
Adaikalam Alexander Rayappa™
 
Report exchange designer
Report exchange designerReport exchange designer
Report exchange designerrlsotto
 
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docxCASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
keturahhazelhurst
 
SAP BPC 10.1 NW Master Data loading
SAP BPC 10.1 NW Master Data loading SAP BPC 10.1 NW Master Data loading
SAP BPC 10.1 NW Master Data loading Manoj Kumar
 
Sap basis administration handbook
Sap basis administration handbookSap basis administration handbook
Sap basis administration handbook
blackgoldboy
 
Sap ecatt - mass data uploading
Sap ecatt -  mass data uploadingSap ecatt -  mass data uploading
Sap ecatt - mass data uploading
Capgemini
 
Ch03 supplement 1
Ch03 supplement 1Ch03 supplement 1
Ch03 supplement 1
Akash Ghosh
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
confidencial
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
Marcio Miranda
 
User exit training
User exit trainingUser exit training
User exit trainingJen Ringel
 
Change and Transport System (CTS) in SAP
Change and Transport System (CTS) in SAPChange and Transport System (CTS) in SAP
Change and Transport System (CTS) in SAP
Kunal Chadha
 

Similar to Step bystep abap_changinga_singlerecord (20)

Lsmw for master data upload simple explanation
Lsmw for master data upload simple explanationLsmw for master data upload simple explanation
Lsmw for master data upload simple explanation
 
Change transport system in SAP
Change transport system in SAP Change transport system in SAP
Change transport system in SAP
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basics
 
Db2
Db2Db2
Db2
 
Calibration process
Calibration processCalibration process
Calibration process
 
Calibration process
Calibration processCalibration process
Calibration process
 
Page 8 of 8Delete this text and type your name here This fil.docx
Page 8 of 8Delete this text and type your name here This fil.docxPage 8 of 8Delete this text and type your name here This fil.docx
Page 8 of 8Delete this text and type your name here This fil.docx
 
Page 3 of 11Delete this text and type your name here This .docx
Page 3 of 11Delete this text and type your name here This .docxPage 3 of 11Delete this text and type your name here This .docx
Page 3 of 11Delete this text and type your name here This .docx
 
Sap application log
Sap application logSap application log
Sap application log
 
Report exchange designer
Report exchange designerReport exchange designer
Report exchange designer
 
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docxCASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
 
SAP BPC 10.1 NW Master Data loading
SAP BPC 10.1 NW Master Data loading SAP BPC 10.1 NW Master Data loading
SAP BPC 10.1 NW Master Data loading
 
Sap basis administration handbook
Sap basis administration handbookSap basis administration handbook
Sap basis administration handbook
 
Sap ecatt - mass data uploading
Sap ecatt -  mass data uploadingSap ecatt -  mass data uploading
Sap ecatt - mass data uploading
 
Ch03 supplement 1
Ch03 supplement 1Ch03 supplement 1
Ch03 supplement 1
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
Visual Logic User Guide
Visual Logic User GuideVisual Logic User Guide
Visual Logic User Guide
 
User exit training
User exit trainingUser exit training
User exit training
 
Change and Transport System (CTS) in SAP
Change and Transport System (CTS) in SAPChange and Transport System (CTS) in SAP
Change and Transport System (CTS) in SAP
 

More from Milind Patil

Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on lineMilind Patil
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on lineMilind Patil
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on lineMilind Patil
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on lineMilind Patil
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on lineMilind Patil
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on lineMilind Patil
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on lineMilind Patil
 
Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on lineMilind Patil
 
Lecture07 abap on line
Lecture07 abap on lineLecture07 abap on line
Lecture07 abap on lineMilind Patil
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on lineMilind Patil
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on lineMilind Patil
 
Lecture04 abap on line
Lecture04 abap on lineLecture04 abap on line
Lecture04 abap on lineMilind Patil
 
Lecture03 abap on line
Lecture03 abap on lineLecture03 abap on line
Lecture03 abap on lineMilind Patil
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on lineMilind Patil
 
Lecture01 abap on line
Lecture01 abap on lineLecture01 abap on line
Lecture01 abap on lineMilind Patil
 
Lecture15 abap on line
Lecture15 abap on lineLecture15 abap on line
Lecture15 abap on lineMilind Patil
 
Abap course chapter 6 specialities for erp software
Abap course   chapter 6 specialities for erp softwareAbap course   chapter 6 specialities for erp software
Abap course chapter 6 specialities for erp softwareMilind Patil
 
Abap course chapter 5 dynamic programs
Abap course   chapter 5 dynamic programsAbap course   chapter 5 dynamic programs
Abap course chapter 5 dynamic programsMilind Patil
 

More from Milind Patil (18)

Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on line
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on line
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on line
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on line
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on line
 
Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on line
 
Lecture07 abap on line
Lecture07 abap on lineLecture07 abap on line
Lecture07 abap on line
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on line
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on line
 
Lecture04 abap on line
Lecture04 abap on lineLecture04 abap on line
Lecture04 abap on line
 
Lecture03 abap on line
Lecture03 abap on lineLecture03 abap on line
Lecture03 abap on line
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on line
 
Lecture01 abap on line
Lecture01 abap on lineLecture01 abap on line
Lecture01 abap on line
 
Lecture15 abap on line
Lecture15 abap on lineLecture15 abap on line
Lecture15 abap on line
 
Abap course chapter 6 specialities for erp software
Abap course   chapter 6 specialities for erp softwareAbap course   chapter 6 specialities for erp software
Abap course chapter 6 specialities for erp software
 
Abap course chapter 5 dynamic programs
Abap course   chapter 5 dynamic programsAbap course   chapter 5 dynamic programs
Abap course chapter 5 dynamic programs
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Step bystep abap_changinga_singlerecord

  • 1. Updating Single Record (ABAP) Task: Changing a Single Record Program: SAPMZ##_CUSTOMER1 Transaction: Z##_CUSTOMER1 Copy template: SAPBC414T_CREATE_CUSTOMER_01 Model Solution: SAPBC414S_CREATE_CUSTOMER_01 Our Program name: Z027393A_CUSTOMER1 The exercise makes you copy the template SAPBC414T_CREATE_CUSTOMER_01 to SAPMZ##_CUSTOMER1 where ## is the student number, but here we will create the complete exercise from scratch. Also, the exercise uses Module Pool to create the program; here we are creating the program using Function Pool. Information: SCUSTOM is the database table that holds the Customer data. The application is written to save the data to this table. Use Transaction Code SE11 for getting the record description and field description. And use Transaction Code SE16 to see the existing data. After the program is completed and executed, a new row will be added to this table and can be viewed using the same transaction code SE16. Table and Fields: SCUSTOM --> Flight Customer Data MANDT - Client ID - Customer Number NAME - Customer name FORM - Form of address STREET - Street POSTBOX - PO Box POSTCODE - Postal Code CITY - City COUNTRY - Country code REGION - Region TELEPHONE - Telephone number of flight customer CUSTTYPE - Customer type DISCOUNT - Discount rate LANGU - Language Key Launch SE80. Ensure that you are on the ‘Repository Browser’. Select Package from the drop down and enter your Package name [ZxxxxxxA] where xxxxxx is your SAP Login ID or Oracle ID, then click on the [Display] button. Create the package if the package does not already exist. Now create a Function Module, by right clicking the ‘Function Group’ item and selecting ‘Create’ as shown. 1 of 31
  • 2. Updating Single Record (ABAP) Enter the Function Group (name) and Short Text (description.) 2 of 31
  • 3. Updating Single Record (ABAP) Click on Save. Click on Save Symbol Icon. Click on Continue Icon or hit Enter. The system automatically creates two include functions as shown below. 3 of 31
  • 4. Updating Single Record (ABAP) Double click on the LZ027393A_CUSTOMER1TOP include file and enter the following code. FUNCTION-POOL Z027393A_CUSTOMER1 MESSAGE-ID bc414. DATA: answer, flag. DATA: ok_code LIKE sy-ucomm, save_ok LIKE ok_code. TABLES: scustom. “This command is not obsolete for use in this situation The command TABLES: scustom creates the SCUSTOM structure that retains the newly entered (created) customer data. 4 of 31
  • 5. Updating Single Record (ABAP) The BC414 message class is declared as a program default in the PROGRAM statement (see syntax MESSAGE-ID bc414 in the above code) and therefore valid throughout the programs. Save the Function Module by clicking on the Save button at the top. Since we need to generate a unique ID for each new customer generated, we need to use SAP functionality that does that. This Number Range Object/Buffer can be created new or existing one used [Use Transaction Code SNRO to create and maintain new Number Range Object.] We are using the existing object 'SBUSPID'. SAP also provides us with a function NUMBER_GET_NEXT to get the IDS using this object. We will first create a Subroutine to access the function in addition to other subroutines been created. Create the following subroutines as shown below, by right clicking on the Function Group name and selecting Create > Subroutine. 5 of 31
  • 6. Updating Single Record (ABAP) Enter the name of the subroutine ‘ASK_LOSS’, SAP suggest a new Include for this subroutine, select the suggested name ‘LZ027393A_CUSTOMER1F01’ – we will use the same include to save all the subroutines that we will create shortly. 6 of 31
  • 7. Updating Single Record (ABAP) Accept the warning that may show as follows: 7 of 31
  • 8. Updating Single Record (ABAP) FORM ask_loss USING p_answer. CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA' EXPORTING textline1 = 'Continue?'(004) titel = 'Create Customer'(003) IMPORTING answer = p_answer. ENDFORM. " ASK_LOSS Similarly create the following subroutines by right clicking on the Function Group name and selecting Create > Subroutine. ASK_SAVE NUMBER_GET_NEXT SAVE SAVE_SCUSTOM FORM NUMBER_GET_NEXT USING p_scustom LIKE scustom. DATA: return TYPE inri-returncode. * get next free number in the number range '01' * of number object'SBUSPID' CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING nr_range_nr = '01' object = 'SBUSPID' IMPORTING number = p_scustom-id returncode = return EXCEPTIONS OTHERS = 1. CASE sy-subrc. WHEN 0. CASE return. WHEN 1. * number of remaining numbers critical MESSAGE s070. WHEN 2. * last number MESSAGE s071. WHEN 3. * no free number left over MESSAGE a072. ENDCASE. WHEN 1. * internal error MESSAGE a073 WITH sy-subrc. 8 of 31
  • 9. Updating Single Record (ABAP) ENDCASE. ENDFORM. " NUMBER_GET_NEXT FORM ASK_SAVE USING p_answer. * POPUP_TO_CONFIRM_STEP is obsolete, so using POPUP_TO_CONFIRM below * CALL FUNCTION 'POPUP_TO_CONFIRM_STEP' * EXPORTING * textline1 = 'Data has been changed.'(001) * textline2 = 'Save before leaving transaction?'(002) * titel = 'Create Customer'(003) * IMPORTING * answer = p_answer. call function 'POPUP_TO_CONFIRM' exporting titlebar = 'Create Customer'(003) text_question = 'Data has been changed. Save before leaving transaction? ' text_button_1 = 'Yes' icon_button_1 = 'ICON_YES' text_button_2 = 'No' icon_button_2 = 'ICON_NO' default_button = '2' display_cancel_button = 'X' importing answer = p_answer. ENDFORM. " ASK_SAVE FORM SAVE. * get SCUSTOM-ID from number range object BC_SCUSTOM PERFORM number_get_next USING scustom. * save new customer PERFORM save_scustom. ENDFORM. FORM SAVE_SCUSTOM. INSERT INTO scustom VALUES scustom. IF sy-subrc <> 0. * insertion of dataset in DB-table not possible MESSAGE a048. ELSE. * insertion successfull MESSAGE s015 WITH scustom-id. ENDIF. ENDFORM. 9 of 31
  • 10. Updating Single Record (ABAP) Create GUI Status (Menu) as shown below. 10 of 31
  • 11. Updating Single Record (ABAP) Click on the ‘+’ next to the Menu Bar and add the following text and labels. Now double click on the ‘Edit’ text (next to the Customer Data label that was entered) 11 of 31
  • 12. Updating Single Record (ABAP) Delete all the following entries using button on the top menu, except the Cancel line and add the Code as shown Save the changes. 12 of 31
  • 13. Updating Single Record (ABAP) Now maximize the Function Keys by clicking on the ‘+’ sign next to it. Enter SAVE, BACK, EXIT and CANCEL function code next (above) the save, back, exit and Cancel icon as shown below under the Standard Toolbar button. Enter the fast text as shown below for these buttons. Leave Function Type as blank (Blank defaults to Application Function) for Save and Back button and E (exit) for Exit and Cancel. 13 of 31
  • 14. Updating Single Record (ABAP) 14 of 31
  • 15. Updating Single Record (ABAP) Save the GUI Status. Now create GUI title 15 of 31
  • 16. Updating Single Record (ABAP) Enter the Title Code and Title as shown below Click on enter to save the GUI title. Save and Activate the program, by clicking on the Activate button. Creating the screen. Now create a Screen, by right clicking the ‘Function Group’ item and selecting ‘Create’ and then ‘Screen’ as shown. 16 of 31
  • 17. Updating Single Record (ABAP) Enter Screen number as shown Click Continue button or hit enter. 17 of 31
  • 18. Updating Single Record (ABAP) Click on the Layout button (or Control + F7) 18 of 31
  • 19. Updating Single Record (ABAP) Click on the Dictionary/Program Field Window button or hit F6. In the Table/Field Name field enter ‘SCUSTOM’ and then click on the ‘Get from Dictionary’ button. Important note – by selecting these fields from the database tables [in repository] all the fields automatically get all the labels/field help/etc defaulted from their respective fields’ definition in the data dictionary. Select the fields as shown. 19 of 31
  • 20. Updating Single Record (ABAP) Click on the Continue button. Click on the blank screen somewhere near the top left corner, so that the selected fields get copied over to the screen. 20 of 31
  • 21. Updating Single Record (ABAP) Do not convert any fields if requested (in this simple example.) Rearrange the fields as shown. Add 4 boxes around the groupings. 21 of 31
  • 22. Updating Single Record (ABAP) Save the screen and exit the Screen Painter (Screen > Exit) Go to the ‘Element List’ tab of the Screen (this tab is between the ‘Attributes’ and ‘Flow Logic’ tab. On the ‘General Attributes’ sub tab enter the Frame01, Frame02, Frame03 and Frame04 for the four unnamed boxes created. Also enter the ‘OK_CODE’ name for the field name that has the ‘Type of screen element’ OK (this is automatically created by the screen when the screen is created – we provide a name.) During run time this field OK_CODE will have the name of the function code of the button or key that was clicked by user. 22 of 31
  • 23. Updating Single Record (ABAP) On the ‘Flow Logic’ tab enter the following code for the Process Before Output (PBO) and Process After Input (PAI) logic. PROCESS BEFORE OUTPUT. MODULE STATUS_0100. PROCESS AFTER INPUT. MODULE EXIT AT EXIT-COMMAND. MODULE SAVE_OK_CODE. 23 of 31
  • 24. Updating Single Record (ABAP) FIELD: scustom-name MODULE mark_changed ON REQUEST. MODULE USER_COMMAND_0100. Save the changes. Create the modules STATUS_0100 and USER_COMMAND_0100 by forward navigation (i.e., double click on any module name(s), since these modules do not exist currently, the system will prompt us, to create these.) These modules are created in the appropriate INCLUDE file. Double click on STATUS_0100 in the above ABAP editor. At the following prompt select ‘Yes’. Select the recommended new include file that the system shows. Note that the alphabet ‘O’ in the name (3rd character from last) stands for OUTPUT of PROCESS BEFORE OUTPUT (PBO) modules and all the output modules may be created here. 24 of 31
  • 25. Updating Single Record (ABAP) Select Continue button or hit Enter. Modify the module definition as shown below. *----------------------------------------------------------------------* ***INCLUDE LZ027393A_CUSTOMER1O01 . *----------------------------------------------------------------------* MODULE STATUS_0100 OUTPUT. SET PF-STATUS 'DYN_0100'. SET TITLEBAR 'DYN_0100'. ENDMODULE. " STATUS_0100 OUTPUT Save and hit the Back button (F3) to go back to the Flow Logic of the screen. Now double click on the USER_COMMAND_0100 name. Select Yes. 25 of 31
  • 26. Updating Single Record (ABAP) Accept the new INCLUDE file name for this new INPUT (PAI – Process after Input) module. Click on Continue button or hit Enter. Enter the following code in this INCLUDE function. *----------------------------------------------------------------------* ***INCLUDE LZ027393A_CUSTOMER1I01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module EXIT INPUT *&---------------------------------------------------------------------* MODULE exit INPUT. CASE ok_code. WHEN 'EXIT'. IF sy-datar IS INITIAL AND flag IS INITIAL. * no changes on screen 100 LEAVE PROGRAM. ELSE. 26 of 31
  • 27. Updating Single Record (ABAP) PERFORM ask_save USING answer. * CASE answer. * WHEN 'J'. * ok_code = 'SAVE&EXIT'. * WHEN 'N'. * LEAVE PROGRAM. * WHEN 'A'. * CLEAR ok_code. * SET SCREEN 100. * ENDCASE. CASE answer. WHEN '1'. ok_code = 'SAVE&EXIT'. WHEN '2'. LEAVE PROGRAM. WHEN 'A'. CLEAR ok_code. SET SCREEN 100. ENDCASE. ENDIF. WHEN 'CANCEL'. IF sy-datar IS INITIAL AND flag IS INITIAL. * no changes on screen 100 LEAVE TO SCREEN 0. ELSE. PERFORM ask_loss USING answer. CASE answer. WHEN 'J'. LEAVE TO SCREEN 0. WHEN 'N'. CLEAR ok_code. SET SCREEN 100. ENDCASE. ENDIF. ENDCASE. ENDMODULE. " EXIT INPUT *&---------------------------------------------------------------------* *& Module SAVE_OK_CODE INPUT *&---------------------------------------------------------------------* MODULE save_ok_code INPUT. save_ok = ok_code. CLEAR ok_code. ENDMODULE. " SAVE_OK_CODE INPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* 27 of 31
  • 28. Updating Single Record (ABAP) MODULE user_command_0100 INPUT. CASE save_ok. WHEN 'SAVE&EXIT'. PERFORM save. LEAVE PROGRAM. WHEN 'SAVE'. IF flag IS INITIAL. SET SCREEN 100. ELSE. PERFORM save. SET SCREEN 0. ENDIF. WHEN 'BACK'. IF flag IS INITIAL. SET SCREEN 0. ELSE. PERFORM ask_save USING answer. CASE answer. WHEN 'J'. PERFORM save. SET SCREEN 0. WHEN 'N'. SET SCREEN 0. WHEN 'A'. SET SCREEN 100. ENDCASE. ENDIF. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* *& Module MARK_CHANGED INPUT *&---------------------------------------------------------------------* MODULE mark_changed INPUT. * set flag to mark changes were made on screen 100 flag = 'X'. ENDMODULE. " MARK_CHANGED INPUT Save and Activate the program (including the screens, etc) Create a transaction code to execute this program. 28 of 31
  • 29. Updating Single Record (ABAP) Enter the program name and description. Click on Continue button or hit Enter. 29 of 31
  • 30. Updating Single Record (ABAP) Save - choose the appropriate package and workbench request. 30 of 31
  • 31. Updating Single Record (ABAP) Run the transaction. 31 of 31