CR10 Module Pool Day 1
CR10 Module Pool Day 1
DAY 1
Agenda - Day 1
Introduction Why Module Pool? Components of Module Pool Program Screen Painter Flow Logic and Events Screen Painter - Layout Basic Screen Design Menu Painter
Program Organization
Program Organization
Create Program
Program Organization
Program
SAPMZ##BC410_SOLUTION
System Help
Object Navigator
Object name
SAPMZ##BC410_SOLUTION
Global Global declarations declarations PBO PBO modules modules PAI PAI modules modules Subroutines Subroutines Events Events
SAP AG 2002
Dictionary structures Fields PBO modules PAI modules Subroutines Screens GUI status GUI title Transactions Includes
MZ##BC410_SOLUTION TOP MZ##BC410_SOLUTION O01 MZ##BC410_SOLUTION I01 MZ##BC410_SOLUTION F01 MZ##BC410_SOLUTION E01
Events
The screen flow logic is built using events. There are four event blocks
1) PROCESS BEFORE OUTPUT : Triggered before current screen is displayed. At end of PBO current screen is displayed. 2) PROCESS AFTER INPUT: Triggered when user chooses a function on screen. At end of PAI another screen is called or PBO of current screen is triggered.
Events
3) PROCESS ON HELP-REQUEST: User requests for field help (Presses F1 on a field) 4) PROCESS ON VALUE-REQUEST: User request for value request (Presses F1 on a field)
10
11
Screen Attributes
Program Name of ABAP program Screen Number 4 digit number Screen Type Normal, Modal Dialog, Subscreen Size Screen Size Sequence Next Screen
12
13
Identical Names
Data Exchange: Screens - ABAP Programs
IDENTICAL NAMES
Time PBO MODULE trans_to_100 After PBO
SDYN_CONN-CARRID LH SDYN_CONN-CONNID 0402 Program work area
TABLES:
LH CARRID
sdyn_conn.
0400 CONNID
MODULE trans_to_100 OUTPUT. MOVE-CORRESPONDING wa_spfli TO sdyn_conn. ENDMODULE. TABLES: Before PAI
LH CARRID
sdyn_conn.
0402 CONNID
SAP AG 2002
14
15
16
ABAP ABAP
General attributes
Field name ... OK_CODE Type OK . ..
MODULE MODULE user_command_100 user_command_100 INPUT. INPUT. CASE CASE ok_code. ok_code. WHEN WHEN 'BACK'. 'BACK'. LEAVE LEAVE TO TO SCREEN SCREEN 0. 0. ENDCASE. ENDCASE. ENDMODULE. ENDMODULE. The ok_code ABAP data field still contains the old function code after processing
17
Exit Command
Type E function codes Identifies exit command function codes
19
20
PROCESS AFTER INPUT. CHAIN. FIELD: <Field name 1>, 1> <Field name 2>, 2> . . . <Field name n>. MODULE check_input. ENDCHAIN.
ABAP
1 1 1
SAP AG 2002
21
Screen Painter
PROCESS AFTER INPUT. CHAIN. FIELD: <Field name <Field name . . . <Field name MODULE <module> ON ENDCHAIN. . . .
SAP AG 2002
Screen Painter
22
Screen Painter
Screen Painter PROCESS AFTER INPUT. CHAIN. FIELD: <Field name 1>, <Field name 2>, . . . <Field name n>. MODULE <module>ON CHAIN-REQUEST. ENDCHAIN. . . .
SAP AG 2002
23
Termination
Program call
Error
Warning
Information
Success
Screen 100
Screen 100
Screen 100
Screen 100
E message
W message
Screen 100
Restart
I message
A message X message
Screen 100
Screen 200
SAP AG 2002
24
Screen Painter
ABAP
MODULE exit INPUT. CASE ok_code. WHEN 'CANCEL'. CLEAR ok_code. LEAVE TO SCREEN 0. WHEN 'EXIT'. LEAVE PROGRAM. ENDCASE. ENDMODULE. " EXIT
SAP AG 2002
INPUT
25
26
Screen Attributes
Screen number Next screen 300 400
PBO
PAI
PBO
PAI
400
MODULE ... SET SCREEN 300. LEAVE SCREEN. ENDMODULE.
SAP AG 2002
27
Dialog Boxes
Calling a Dialog Box Dynamically
Screen 101
ENDMODULE. 101 101 Screen Attributes Screen type . . . Modal dialog box . . . Next screen 101 MODULE user_command INPUT. ... CALL SCREEN 101 STARTING AT lc ur ENDING AT rc lr. ... ENDMODULE. 101 101 100 100
SAP AG 2002
100 100
28
Dynamic Modifications
Dynamically Modifiable Static Attributes
Attributes Attributes
General
Object
SCREEN
SCREEN-NAME SCREEN-GROUP1 SCREEN-GROUP2 SCREEN-GROUP3 SCREEN-GROUP4 SCREEN-LENGTH SCREEN-INPUT SCREEN-OUTPUT SCREEN-REQUIRED SCREEN-INTENSIFIED SCREEN-INVISIBLE SCREEN-ACTIVE
Program
Dialog
behavior
Display
Bright Invisible
SAP AG 2002
29
PROCESS BEFORE OUTPUT. . . . MODULE modify_screen. . . . MODULE modify_screen OUTPUT. LOOP AT SCREEN. IF screen-group1 = 'SEL'. screen-input = 1. ENDIF. IF screen-name= 'FIELD1'. screen-active= 0. ENDIF. MODIFY SCREEN. ENDLOOP. ENDMODULE.
SAP AG 2002
Screen Painter
ABAP
...
30
PROCESS PROCESS BEFORE BEFORE OUTPUT. OUTPUT. MODULE MODULE set_cursor. set_cursor.
Screen Painter
ABAP
LH ? ?
MODULE set_cursor OUTPUT. sdyn_conn-carrid = 'LH'. SET CURSOR FIELDSDYN_CONN-CONNID. ... ENDMODULE.
SAP AG 2002
31
32
33
34