Aabap Dialog Program Overview
Aabap Dialog Program Overview
Report zpsm1.
Request Tables customers.
List Select single * from
Generate Screen(List)
1 10
customers where id = 1.
8 6
ABAP Processor
DYNPRO Processor
List Buffer
DB Interface
Result Set Memory
Database
Types of ABAP Report
1. Report Listing
4 2. Drill-down Report
3. Control-break Report
4. ALV Report
SAP System : Dialog Processing (DIALOG)
SAP GUI
Program sapmzex001.
Request Include ….
Screen Set screen 100.
Generate Dialog Screen
1 10
…
8 6
ABAP Processor
DYNPRO Processor
Screen Buffer
DB Interface
Result Set Memory
Database
Dialog Program : Transaction
Dialog Program Components
Transaction Code
Transaction Code
Screen Buffer
ABAP Memory Space
PBO
Element List
customers
id name city …
customers-id 0000000
customers-name
ok_code
PAI
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.
OK Code Field or
Command Field
(ok_code in Element List)
Defining Screen (4 Steps)
Screen Attribute
Screen Layout
Flow Logic Element List(ok_code field)
Element List
Flow Logic in Screen 100
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
Screen Layout
Flow Logic(PBO,PAI)
Field customers-id
Screen 200
f3 f4
Required Field
Required Field
Required Field
At exit-command
Function Type : Exit Command
At exit-command
When user chooses a function with type
E,the screen flow logic jumps directly to the
following statement
MODULE <module> AT EXIT-COMMAND
No other screen fields are transported to the
program except OK Code field
At exit-command
Screen 100 : Flow Logic
‘POPUP_TO_CONFIRM_LOSS_OF_DATA’
Example IV
TOP Include
...
DATA ans.
Example IV
Screen 100 : PAI
MODULE exit INPUT.
CALL FUNCTION ‘POPUP_TO_CONFIRM_LOSS_OF_DATA’
EXPORTING
textline1 = ‘Are you sure?’
titel = ‘Please Confirm!!!’
IMPORTING
answer = ans.
IF ans = ‘J’. “J = Ja in German= Yes in English
LEAVE PROGRAM.
ELSE.
ENDIF.
ENDMODULE.
SAP Transaction : Enqueue Lock Object
SAP Transaction & DB Transaction
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
SAP Database Maintenance Steps
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>’
SAP Lock Object
Transaction SE11 : Lock object
ENQUEUE_<lock object>
DEQUEUE_<lock object>
SAP Lock Object : Function Module
Example IV
ENQUEUE /DEQUEUELock Object(SE11)
CALL FUNCTION ‘ENQUEUE_EZCUST<nn>’
CALL FUNCTION ‘DEQUEUE_EZCUST<nn>’
User 1 User 2
Example IV (I)
Screen 100 : PAI
MODULE user_command_0100 INPUT.
...
WHEN SPACE.
CALL FUNCTION ‘ENQUEUE_EZCUST00’
EXPORTING
…
id = customers-id
EXCEPTIONS
...
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
SELECT SINGLE * FROM customers WHERE id = customers-id.
...
Example IV (II)
Screen 100 : PAI
MODULE user_command_0100 INPUT.
...
WHEN SPACE.
CALL FUNCTION ‘ENQUEUE_EZCUST00’
EXPORTING message id sy-msgid type sy-msgty number
id = customers-id
... sy-msgno with sy-msgv1 sy-msgv2
IF sy-subrc <> 0.
CONCATENATE ‘Data was locked by :’ sy-msgv1 INTO mess.
sy-msgv3 sy-msgv4.
MESSAGE E000(38) WITH mess.
ELSE.
SELECT SINGLE * FROM customers WHERE id = customers-id.
...
Example IV
Screen 200 : PAI
MODULE user_command_0200 INPUT.
...
WHEN ‘BACK’.
CALL FUNCTION ‘DEQUEUE_EZCUST00’
EXPORTING
…
id = customers-id.
LEAVE TO SCREEN 100.
…
Example IV
Screen 200 : PAI
MODULE user_command_0200 INPUT.
...
WHEN ‘SAVE’.
UPDATE customers.
MESSAGE S000(38) WITH ‘Update OK!’.
CALL FUNCTION ‘DEQUEUE_EZCUST00’
EXPORTING
…
id = customers-id.
LEAVE TO SCREEN 100.
...
...
Monitoring Enqueue Lock : SM12