Dialog Programming Overview
Dialog Programming Overview
Dialog Programming Overview
Request
Tables customers.
Application Server
Store request to queue
3
Send Request
Generate Screen(List)
10
List
Dispatcher
Send List
2 9
SAP Buffer
Program
D
8
D
SQL Request
D
6
Load&Gen Program
Database Server
Local Memory
Memory Space
ABAP Processor
DYNPRO Processor
List Buffer
DB Interface
Result Set Memory
Database
1. Report Listing
Request
Include .
Application Server
Store request to queue
3
Send Request
Screen
Dispatcher
Send List
2 9
SAP Buffer
Program
D
8
D
SQL Request
D
6
Load&Gen Program
Database Server
Local Memory
ABAP Memory
ABAP Processor
DYNPRO Processor
Screen Buffer
DB Interface
Result Set Memory
Database
Dialog Program
Screen : 100
(Screen Layout)
Flow Logic
PBO
PAI
Screen : 200
(Screen Layout)
Flow Logic
PBO PAI
SAP Transaction
DB Commit DB Commit
An SAP transaction consists of Dialog steps. A Dialog step begins when the user press Enter,activates a function by pressing a function key,double-clicks or chooses a function from a menu.It ends when the next screen is display In the course of a Dialog step,The PAI modules belonging to the current screen and the PBO modules belonging to the next screen
Screen Buffer
Element List
PBO
customers-id customers-name
0000000
PAI
ok_code
Flow Logic
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.
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.
Transaction SE80 : Create Dialog Program Create Screen(4 steps) Screen Attribute Screen Layout Flow Logic(PBO,PAI) Define Variable ok_code in Element List Define Data Object in ABAP Work Area at TOP Include(Tables, Data,...) Check and Activate Dialog Program Create Transaction Code
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. ENDMODULE.
Example I
Screen 100
MODULE user_command_0100 INPUT. CASE ok_code. WHEN BACK. LEAVE PROGRAM. leave to screen 0 WHEN space. if not assign Enter Key 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. ENDMODULE.
Example I
Screen 200
MODULE user_command_0200 INPUT. CASE ok_code. WHEN BACK. LEAVE TO SCREEN 100. set screen 100 WHEN SAVE. UPDATE customers. MESSAGE S000(38) WITH Update OK!. LEAVE TO SCREEN 100. ENDCASE. ENDMODULE.
Example I
Exercise
Create Dialog Program : SAPMZCUST<nn> Transaction Code : ZCUST<nn>
Screen : 200
Cursor Position
TOP Include
TABLES customers. DATA ok_code TYPE sy-ucomm. DATA save_ok TYPE sy-ucomm.
Example I - Change
Example I - Change
ENDMODULE.
ENDMODULE.
Example II
Maintain Customers Data
Example II
Example III
Maintain Customers Data
Example III
If you want to check input values in the module pool and start dialog in the event of a negative result,you use the FIELD statement with the addition MODULE. If the module results in an error(E) or warning(W) message,the screen is redisplayed without processing the PBO modules.The message text is displayed and only the field being checked by this module becomes ready for input again
PROCESS AFTER INPUT. CHAIN. FIELD customers-id MODULE user_command_0100. FIELD customers-custtype MODULE user_command_0100. ENDCHAIN.
Transfer f3,f4 Call module a Transfer f1 Call module b Transfer f2 Call module c Call module d
Required Field
Required Field
Required Field
At exit-command
At exit-command
When user chooses a function with type E,the screen flow logic jumps directly to the following statement
No other screen fields are transported to the program except OK Code field
At exit-command
At exit-command
LEAVE PROGRAM.
Example IV
Maintain Customer Data
Example IV
TOP Include
... DATA ans.
Example IV
ENDMODULE.
Each Dialog step can contain update requests(INSERT,DELETE,UPDATE) After each Dialog step,the R/3 system automatically passes a database commit to the database system.The database system then distributes the update requests from the individual dialog steps across several database transactions A rollback in one Dialog step has no effect on database updates performed in previous Dialog steps
SAP Transaction(LUW)
DB Commit DB Commit
DB LUW
SAP LUW
Check data locking by calling function ENQUEUE_<lock object> Read data from Database Ex. Select single Data Processing Ex. Update ... Release lock by calling function DEQUEUE_<lock object>
Example IV
User 1
User 2
Example IV (I)
Example IV (II)
Example IV
Example IV