User Dialog Overview Update Statement TABLES customers. SELECT SINGLE * FROM customers WHERE id = 1. IF sy-subrc = 0. customers-name = ‘John’. UPDATE customers. ENDIF. SAP System : Dialog Processing SAP GUI Report zpsm1. Request Tables customers. List 1 Send Request Application Server Store request to queue Select single * from Generate Screen(List) customers where id = 1. 11 Write: / customers-name. Dispatcher 3 Send List 2 10 Request Queue Send request to WP SAP Buffer Search for free WP Check Program in Program Buffer Program 6 4 D D D … … D User Context Area 5 9 Database Server SQL Request customers 7 Roll in Load&Gen Program D010S 8 Execute ABAP statement Dialog WP : Report Dialog Work Process Local Memory User Context TaskHandler Memory Space ABAP Processor DYNPRO Processor DB Interface Result Set Memory Database Server List Buffer SAP System : Dialog Processing SAP GUI Request PROGRAM sapmzex001. Screen 1 Send Request Application Server Store request to queue INCLUDE …. Generate Dialog Screen CALL SCREEN 100. 11 … Dispatcher 3 Send List 2 10 Request Queue Send request to WP SAP Buffer Search for free WP Check Program in Program Buffer Program 6 4 D D D … … D User Context Area 5 9 Database Server SQL Request customers 7 Roll in Load&Gen Program D010S 8 Execute ABAP statement Dialog WP : Dialog Program Dialog Work Process Local Memory User Context TaskHandler Memory Space ABAP Processor DYNPRO Processor DB Interface Result Set Memory Database Server Screen Buffer Dialog Program : Transaction Dialog Program Components Transaction Code Dialog Program Program Naming Convention : SAPM[Z/Y]… Screen : 100 (Screen Layout) ABAP Module Pool PAI ABAP Module Pool Flow Logic Screen : 200 (Screen Layout) PBO PBO ABAP Module Pool PAI ABAP Module Pool Flow Logic Data Transfer (Local Memory) Local Memory Screen Work Area ok_code Element List ABAP Work Area Screen Buffer ABAP Memory Space PBO customers id customers-id PAI name 0000000 ok_code city … Flow Logic Process Before Output(PBO) After it has processed all of the modules in the PBO processing block, the system copies the contents of the fields in the ABAP work area to their corresponding fields in the screen work area. Process After Input(PAI) Before it processes the first module in the PAI processing block, the system copies the contents of the fields in the screen work area to their corresponding fields in the ABAP work area. OK Code Field in Screen OK Code Field or Command Field (ok_code in Element List) Defining Screen (4 Steps) Screen Attribute Screen Layout Flow Logic Element List Element List(ok_code field) Flow Logic in Screen 100 PROCESS BEFORE OUTPUT. MODULE STATUS_0100. PROCESS AFTER INPUT. MODULE USER_COMMAND_0100. PBO in Screen 100 MODULE status_0100 OUTPUT. SET PF-STATUS ‘0100’. SET TITLEBAR ‘0100’. ENDMODULE. PAI in Screen 100 MODULE user_command_0100 INPUT. CASE ok_code. WHEN ‘BACK’. LEAVE PROGRAM. WHEN space. SELECT SINGLE * FROM customers WHERE id = customers-id. IF sy-subrc = 0. LEAVE TO SCREEN 200. ENDIF. ENDCASE. ENDMODULE. How to Create Dialog Program Transaction SE80 : Create Dialog Program (SAPMY/Z…) Create Screen(4 steps) Screen Attribute (Description) Screen Layout (Graphic Screen Painter) Flow Logic(PBO,PAI) Define Variable ok_code in Element List Define Data Objects in ABAP Work Area at TOP Include(TABLES, DATA,...) Check and Activate Dialog Program Create Transaction Code (Y/Z…) Example I Maintain Customers Data Screen : 100 Screen : 200 Example I Create Dialog Program SAPMZEX<nn> for changing Customers table Screen 100 Field customers-id Screen 200 Field customers-id and customers-name Example I Screen 100 PROCESS BEFORE OUTPUT. MODULE STATUS_0100. PROCESS AFTER INPUT. MODULE USER_COMMAND_0100. Example I Screen 100 MODULE status_0100 OUTPUT. SET PF-STATUS ‘0100’. SET TITLEBAR ‘0100’. CLEAR ok_code. ENDMODULE. Example I Screen 100 MODULE user_command_0100 INPUT. CASE ok_code. WHEN ‘BACK’. LEAVE PROGRAM. “leave to screen 0 WHEN space. SELECT SINGLE * FROM customers WHERE id = customers-id. LEAVE TO SCREEN 200. ENDCASE. ENDMODULE. Example I Screen 200 PROCESS BEFORE OUTPUT. MODULE STATUS_0200. PROCESS AFTER INPUT. MODULE USER_COMMAND_0200. Example I Screen 200 MODULE status_0200 OUTPUT. SET PF-STATUS ‘0200’. SET TITLEBAR ‘0200’. CLEAR ok_code. ENDMODULE. Example I Screen 200 MODULE user_command_0200 INPUT. CASE ok_code. WHEN ‘BACK’. LEAVE TO SCREEN 100. “SET SCREEN 100. LEAVE SCREEN. WHEN ‘SAVE’. UPDATE customers. MESSAGE s000(38) WITH ‘Update OK!’. LEAVE TO SCREEN 100. ENDCASE. ENDMODULE. Example I TOP Include TABLES customers. DATA ok_code TYPE sy-ucomm. Create Transaction Code Transaction Code : ZEX<nn> Exercise Create Dialog Program : SAPMZCUST<nn> Transaction Code : ZCUST<nn> Exercise : Customers Maintenance Screen : 100 Screen : 200 Checking User Input Check Input Data Using FIELD Statement FIELD Statement Screen 100 : Flow Logic (PAI) PROCESS AFTER INPUT. FIELD customers-id MODULE user_command_0100. Example I Screen 100 : PAI MODULE user_command_0100 INPUT. ... WHEN SPACE. SELECT SINGLE * FROM customers WHERE id = customers-id. IF sy-subrc <> 0. MESSAGE e000(38) WITH ‘Customers data not found’. ELSE. LEAVE TO SCREEN 200. ENDIF. ENDCASE. ENDMODULE.