abap dialog programming examples(scribd)
TRANSCRIPT
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
1/52
ABAP Dialog ProgrammingExamples
1
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
2/52
SAP System : Dialog Processing (Report)
Database Server
Application Server
Dispatcher
RequestQueue
D D D D
SAP Buffer
Program
1
3
4
5
68
9
10
Report zpsm1.
Tables customers.
Select single * from
customers where id = 1.
Write: / customers-name.
Execute ABAP
statement
Check Program in Program Buffer 7
Load&Gen ProgramSQL Request
Send List
Generate Screen(List)
Send Request
Request
List
2 Search for free WP
Store request to queue
Send request to WP
SAP GUI
2
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
3/52
Dialog WP : Executable ProgramDialog WP
TaskHandler
DYNPRO Processor
ABAP Processor
Database
Local Memory
Memory Space
DB Interface
List Buffer
Result Set Memory
3
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
4/52
Types of ABAP Report
1. Report Listing
2. Drill-down Report
3. Control-break Report
4. ALV Report
13
44
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
5/52
SAP System : Dialog Processing (DIALOG)
Database Server
Application Server
Dispatcher
RequestQueue
D D D D
SAP Buffer
Program
1
3
4
5
68
9
10
Program sapmzex001.
Include .
Set screen 100.
Execute ABAP
statement
Check Program in Program Buffer 7
Load&Gen ProgramSQL Request
Send List
Generate Dialog Screen
Send Request
Request
Screen
2 Search for free WP
Store request to queue
Send request to WP
SAP GUI
5
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
6/52
Dialog WP : Dialog ProgramDialog WP
TaskHandler
DYNPRO Processor
ABAP Processor
Database
Local Memory
ABAP Memory
DB Interface
Screen Buffer
Result Set Memory
6
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
7/52
Dialog Program : Transaction
7
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
8/52
Dialog Program ComponentsTransaction Code
Screen : 100(Screen Layout)
Screen : 200(Screen Layout)
Flow Logic
Flow Logic
PBOPAI
ABAP Module Pool
ABAP Module Pool
PBO
PAI
ABAP Module Pool
ABAP Module Pool
Dialog Program Program Naming Convention : SAPM
8
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
9/52
SAP Transaction
An SAP transaction consists of Dialog steps. A Dialog stepbegins when the user press Enter,activates a function bypressing a function key,double-clicks or chooses a function froma menu.It ends when the next screen is display
In the course of a Dialog step,The PAI modules belonging to thecurrent screen and the PBO modules belonging to the nextscreen
DB Commit DB Commit
9
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
10/52
Data Transfer (Local Memory)
Screen BufferABAP Memory Space
Screen Work Area ABAP Work Area
PBO
PAIcustomers-idcustomers-name
customers
id name city
0000000
ok_code
ok_code
Local Memory
Element List
10
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
11/52
Flow Logic
Process Before Output(PBO) After it has processed all of the modules in the
PBO processing block, the system copies thecontents of the fields in the ABAP work area totheir 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 contentsof the fields in the screen work area to theircorresponding fields in the ABAP work area.
11
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
12/52
OK Code Field in Screen
OK Code Field or
Command Field(ok_code in Element List)
12
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
13/52
Defining Screen (4 Steps) Screen Attribute
Screen Layout
Flow Logic
Element List
Element List(ok_code field)
13
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
14/52
Flow Logic in Screen 100
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
14
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
15/52
PBO in Screen 100
MODULE status_0100 OUTPUT.
SET PF-STATUS 0100.SET TITLEBAR0100.
ENDMODULE.
15
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
16/52
PAI in Screen 100
MODULE user_command_0100 INPUT.CASE ok_code.
WHEN EXIT. Leave programSET SCREEN 0. LEAVE SCREEN. Leave to screen 0
WHEN SAVE.
UPDATE customers.MESSAGE S000(38) WITH Update OK.
SET SCREEN 50. LEAVE SCREEN.ENDCASE.
ENDMODULE.16
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
17/52
How to Create Dialog Program
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 TOPInclude(Tables, Data,...)
Check and Activate Dialog Program
Create Transaction Code 17
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
18/52
Example IMaintain Customers Data
Screen : 100 Screen : 200
18
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
19/52
Example I
Create Dialog Program SAPMZEXforchanging Customers table
Screen 100 Field customers-id
Screen 200
Field customers-id and customers-name
19
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
20/52
Example I
Screen 100
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.MODULE USER_COMMAND_0100.
20
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
21/52
Example I
Screen 100
MODULE status_0100 OUTPUT.
SET PF-STATUS 0100.
SET TITLEBAR0100.ENDMODULE.
21
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
22/52
Example I
Screen 100MODULE 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. 22
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
23/52
Example I
Screen 200
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0200.
23
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
24/52
Example I
Screen 200
MODULE status_0200 OUTPUT.
SET PF-STATUS 0200.
SET TITLEBAR0200.ENDMODULE.
24
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
25/52
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.
25
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
26/52
Example I TOP IncludeTABLES customers.
DATA ok_code TYPE sy-ucomm.
Create Transaction CodeTransaction Code : ZEX
26
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
27/52
ExerciseCreate Dialog Program : SAPMZCUST
Transaction Code : ZCUST27
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
28/52
Exercise : Customers Maintenance
Screen : 100 Screen : 200
28
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
29/52
Setting the Cursor Position Dynamically
Cursor Position
PROCESS BEFORE OUTPUT.MODULE STATUS_0200.
MODULE set_cursor.
MODULE set_cursor OUTPUT.
SET CURSOR FIELD CUSTOMERS-CITYOFFSET 3.
ENDMODULE.
29
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
30/52
Avoiding the UnexpectedProcessing Step of ok_code Field
30
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
31/52
1. Auxiliary OK_CODE Variable
TOP IncludeTABLES customers.
DATA ok_code TYPE sy-ucomm.
DATA save_ok TYPE sy-ucomm.
31
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
32/52
Example I - Change
Screen 100 : PAIMODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN BACK.
LEAVE PROGRAM.
WHEN space.
SELECT SINGLE * FROM customers WHERE id = customers-id.
LEAVE TO SCREEN 200.
ENDCASE.
ENDMODULE. 32
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
33/52
Example I - Change Screen 200 : PAI
MODULE user_command_0200 INPUT.
save_ok = ok_code.
CLEAR ok_code.CASE save_ok.
WHEN BACK.
LEAVE TO SCREEN 100.
WHEN space.
LEAVE TO SCREEN 200.WHEN SAVE.
UPDATE customers.
MESSAGE s000(38) WITH Update OK!.
LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE. 33
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
34/52
2. Specify the Enter Function at GUI Status
34
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
35/52
Check Enter Function
Screen 100 : PAIMODULE user_command_0100 INPUT.
CASE ok_code.
WHEN BACK.
LEAVE PROGRAM.
WHEN ENTE.
SELECT SINGLE * FROM customers
WHERE id = customers-id.
LEAVE TO SCREEN 200.
ENDCASE.
ENDMODULE. 35
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
36/52
3. Clear OK_CODE at PBO
Screen 100 : Flow Logic
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE clear_ok_code.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
36
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
37/52
Clear OK_CODE at PBO
Screen 100 : PBOMODULE status_0100 OUTPUT.
SET PF-STATUS 0100.SET TITLEBAR0100.
ENDMODULE.
MODULE clear_ok_code OUTPUT.CLEAR ok_code.
ENDMODULE.
37
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
38/52
Checking User Input
38
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
39/52
Example IIMaintain Customers Data
Check Input Data Manually
39
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
40/52
Example II Screen 100 : PAI
MODULE user_command_0100 INPUT.
...
WHEN SPACE.
SELECT SINGLE * FROM customers WHERE id = customers-id.
IF sy-subrc 0.
MESSAGE S000(38) WITH Customers data not found.
LEAVE TO SCREEN 100.ELSE.
LEAVE TO SCREEN 200.
ENDIF.
ENDCASE.
ENDMODULE. 40
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
41/52
Example IIIMaintain Customers Data
Check Input Data UsingFieldCommand
41
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
42/52
Example III Field Statement Screen 100 : Flow Logic (PAI)
PROCESS AFTER INPUT.
FIELD customers-id MODULE user_command_0100.
42
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
43/52
Example III 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. 43
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
44/52
Field Input Checking If you want to check input values in the module
pool and start dialog in the event of a negativeresult,you use the FIELD statement with theaddition MODULE.
If the module results in an error(E) orwarning(W) message,the screen is redisplayedwithout processing the PBO modules.Themessage text is displayed and only the fieldbeing checked by this module becomes ready forinput again
44
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
45/52
Field Statement With More Than 1 Field Screen 100 : Flow Logic (PAI)
PROCESS AFTER INPUT.
CHAIN.
FIELD:customers-id,customers-custtype
MODULE user_command_0100.ENDCHAIN.
PROCESS AFTER INPUT.CHAIN.FIELD customers-id MODULE user_command_0100.FIELDcustomers-custtype MODULE user_command_0100.ENDCHAIN.
45
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
46/52
Field Statement & Data TransportPROCESS AFTER INPUT.
MODULE a.
FILED f1 MODULE b.
FILED f2 MODULE c.
MODULE d.
f1 f2
f3 f4
Screen 100
Transfer f3,f4
Call module aTransfer f1Call module bTransfer f2
Call module cCall module d
46
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
47/52
Required Field
47
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
48/52
Required Field
48
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
49/52
Required Field
49
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
50/52
At exit-command
50
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
51/52
Function Type : Exit Command
51
-
7/28/2019 ABAP Dialog Programming Examples(Scribd)
52/52
When user chooses a function with typeE,the screen flow logic jumps directly to the
following statementMODULE AT EXIT-COMMAND
No other screen fields are transported to theprogram except OK Codefield
At exit-command