Post on 14-Apr-2018
transcript
7/30/2019 CR10 Module Pool Day 1
1/34
Module Pool Programming
DAY 1
7/30/2019 CR10 Module Pool Day 1
2/34
2Copyright 2010 Deloitte Development LLC. All rights reserved.
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
7/30/2019 CR10 Module Pool Day 1
3/34
3Copyright 2010 Deloitte Development LLC. All rights reserved.
Sample Screen or GUI
7/30/2019 CR10 Module Pool Day 1
4/34
4Copyright 2010 Deloitte Development LLC. All rights reserved.
Structure of Module Pool Program
7/30/2019 CR10 Module Pool Day 1
5/34
5Copyright 2010 Deloitte Development LLC. All rights reserved.
Structure of Module Pool Program
7/30/2019 CR10 Module Pool Day 1
6/34
6Copyright 2010 Deloitte Development LLC. All rights reserved.
Program Organization
SAP AG 2002
Program Organization
Program Organization
Create Program
Program SAPMZ##BC410_SOLUTION
With TOP Include
System Help
Object Navigator
Object name
SAPMZ##BC410_SOLUTION
Dictionary structures
FieldsPBO modulesPAI modulesSubroutines
ScreensGUI statusGUI titleTransactionsIncludes
MZ##BC410_SOLUTIONTOP
MZ##BC410_SOLUTIONO01
MZ##BC410_SOLUTIONI01MZ##BC410_SOLUTIONF01
MZ##BC410_SOLUTIONE01
Global declarations
Global declarations
PBO modules
PBO modules
PAI modules
PAI modules
Subroutines
Subroutines
Events
Events
7/30/2019 CR10 Module Pool Day 1
7/34
7Copyright 2010 Deloitte Development LLC. All rights reserved.
Creating a Transaction Code
Use SE93 to create a Tcode giving:1) Program name
2) 1st screen of transaction
7/30/2019 CR10 Module Pool Day 1
8/34
8Copyright 2010 Deloitte Development LLC. All rights reserved.
Using screen painter
SE41 Menu Painter SE51 Screen Painter
SE80 Object Navigator
7/30/2019 CR10 Module Pool Day 1
9/34
9Copyright 2010 Deloitte Development LLC. All rights reserved.
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.
7/30/2019 CR10 Module Pool Day 1
10/34
10Copyright 2010 Deloitte Development LLC. All rights reserved.
Events
3) PROCESS ON HELP-REQUEST: User requests for fieldhelp (Presses F1 on a field)
4) PROCESS ON VALUE-REQUEST: User request for
value request (Presses F1 on a field)
7/30/2019 CR10 Module Pool Day 1
11/34
11Copyright 2010 Deloitte Development LLC. All rights reserved.
Basic Screen Design
7/30/2019 CR10 Module Pool Day 1
12/34
12Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Attributes
Program Name of ABAP program
Screen Number 4 digit number
Screen Type Normal, Modal Dialog, Subscreen
Size Screen SizeSequence Next Screen
7/30/2019 CR10 Module Pool Day 1
13/34
13Copyright 2010 Deloitte Development LLC. All rights reserved.
Basic Screen Elements
Text fields Display elements Input/output fields Used to enter data on screen
or display data from the ABAP program.
Checkboxes
Radio buttons
Pushbuttons Elements on screen that trigger PAI
event. Function codes are associated.
Box Visual grouping of related fields
OK_CODE Function code for a screen is placed
in this field
7/30/2019 CR10 Module Pool Day 1
14/34
14Copyright 2010 Deloitte Development LLC. All rights reserved.
Identical Names
SAP AG 2002
Data Exchange: Screens - ABAP Programs
IDENTICAL NAMESIDENTICAL NAMES
Time
PBOMODULE trans_to_100
PAIMODULE trans_from_100
After PBOAfter PBO
TABLES: sdyn_conn.
CARRID CONNIDLH 0400
Program work area
TABLES: sdyn_conn.
CARRID CONNID
LH 0402
MODULE trans_to_100 OUTPUT.MOVE-CORRESPONDING
wa_spfli TO sdyn_conn.ENDMODULE.
MODULE trans_from_100 INPUT.MOVE-CORRESPONDING
sdyn_conn TO wa_spfli.ENDMODULE.
SDYN_CONN-CARRID
LH
SDYN_CONN-CONNID
0402
Before PAIBefore PAI
7/30/2019 CR10 Module Pool Day 1
15/34
15Copyright 2010 Deloitte Development LLC. All rights reserved.
Creating Screen Menu
Title Bar
Menu Bar
Standard Tool BarApplication Tool Bar
7/30/2019 CR10 Module Pool Day 1
16/34
16Copyright 2010 Deloitte Development LLC. All rights reserved.
GUI Title Set Screen TitleSET TITLEBAR ABC
GUI Status Set Screen Function CodesSET PF-STATUS XYZ [OF PROGRAM prog][EXCLUDING fcode]
Creating Screen Menu
7/30/2019 CR10 Module Pool Day 1
17/34
17Copyright 2010 Deloitte Development LLC. All rights reserved.
Processing Function Codes
SAP AG 2002
Processing the Function Code
DATA:ok_code TYPE sy-ucomm.
MODULE user_command_100 INPUT.
CASE ok_code.
WHEN 'BACK'.LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
DATA:ok_code TYPE sy-ucomm.
MODULE user_command_100 INPUT.
CASE ok_code.
WHEN 'BACK'.LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
ABAPABAPABAP
PROCESS AFTER INPUT.
...MODULE user_command_100.
PROCESS AFTER INPUT.
...MODULE user_command_100.
Screen
Painter
ScreenScreen
PainterPainter
Function key: F3
Function code: BACKFunction type: ' '
General attributesGeneral attributes
Field name Type . . .
. . .OK_CODE OK
Screen Painter
Element list
Screen PainterScreen Painter
Element listElement list
The ok_code ABAP datafield still contains the old
function code after
processing
7/30/2019 CR10 Module Pool Day 1
18/34
18Copyright 2010 Deloitte Development LLC. All rights reserved.
Exit Command
Type E function codes Identifies exit commandfunction codes
MODULE at EXIT-COMMAND Processing
for exit command function codes
7/30/2019 CR10 Module Pool Day 1
19/34
19Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Input Validations
Mandatory Fields Input Format
ABAP Dictionary Check
Checking a value list Field f values ( , )
Checking single fields
FIELD MODULE .
7/30/2019 CR10 Module Pool Day 1
20/34
20Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Input Validation
Field MODULE Chain ... Endchain
Addition to field statement and chain endchain
statement - ON REQUEST, ON INPUT
7/30/2019 CR10 Module Pool Day 1
21/34
21Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Input Validation
SAP AG 2002
Checking Groups of Fields
Ready for input again1
EMessage
1111
11
1111
11
MODULE check_input INPUT....
MESSAGE E ...... .ENDMODULE.
ScreenScreen
PainterPainter ABAPABAPPROCESS AFTER INPUT.CHAIN.
FIELD:,
,...
..MODULE check_input.
ENDCHAIN.
7/30/2019 CR10 Module Pool Day 1
22/34
22Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Input Validation
SAP AG 2002
Execution on Input
PROCESS AFTER INPUT.FIELDMODULEON INPUT..
.
.
.
ScreenScreen
PainterPainter
PROCESS AFTER INPUT.CHAIN.
FIELD: ,,
.
.
.
.MODULEON CHAIN-INPUT..ENDCHAIN.ENDCHAIN....
ScreenScreen
PainterPainter
Called whenCalled whenfield contentsfield contents
are not equalare not equal
to initial valueto initial value
7/30/2019 CR10 Module Pool Day 1
23/34
23Copyright 2010 Deloitte Development LLC. All rights reserved.
Screen Input Validation
SAP AG 2002
Execution on Change
PROCESS AFTER INPUT.FIELD MODULE ON REQUEST.
.
.
.
ScreenScreenPainterPainter
PROCESS AFTER INPUT.CHAIN.
FIELD: ,,
.
.
.
.MODULE ON CHAIN-REQUEST.
ENDCHAIN....
ScreenScreenPainterPainter
Execution whenExecution wheninput is newinput is new
7/30/2019 CR10 Module Pool Day 1
24/34
24Copyright 2010 Deloitte Development LLC. All rights reserved.
Dialog Message Categories
SAP AG 2002
Dialog Message Categories
E message
Newe
ntriesrequire
d
W message I message
Programcall
Screen 100
A messageX message
Restart
Termination Error Warning Information Success
Newe
ntriespossible
Screen 100 Screen 100 Screen 100
Screen 200S message
Screen 100 Screen 200
Screen 100
7/30/2019 CR10 Module Pool Day 1
25/34
25Copyright 2010 Deloitte Development LLC. All rights reserved.
Avoiding Field input checks
SAP AG 2002
Avoiding Field Input Checks
PROCESS AFTER INPUT.MODULE exitAT EXIT-COMMAND.
.
.
.
ScreenScreenPainterPainter
MODULE exit INPUT.CASE ok_code.WHEN 'CANCEL'.
CLEAR ok_code.LEAVE TO SCREEN 0.
WHEN 'EXIT'.LEAVE PROGRAM.
ENDCASE.ENDMODULE. " EXIT INPUT
ABAPABAP
Execution whenExecution whenfunction hasfunction has
type Etype E
7/30/2019 CR10 Module Pool Day 1
26/34
26Copyright 2010 Deloitte Development LLC. All rights reserved.
Calling Next Screen
Set screen , Leave screen. Leave to screen
Call screen
7/30/2019 CR10 Module Pool Day 1
27/34
27Copyright 2010 Deloitte Development LLC. All rights reserved.
Setting the next screen dynamically
SAP AG 2002
Setting the Next Screen Dynamically
PBO PAI
Screen Attributes
Screen number 100Next screen 200
Screen Attributes
Screen number 100Next screen 200
Screen Attributes
Screen number 300Next screen 400
PBO PAI
400
MODULE ...SET SCREEN 300.LEAVE SCREEN.ENDMODULE.
7/30/2019 CR10 Module Pool Day 1
28/34
28Copyright 2010 Deloitte Development LLC. All rights reserved.
Dialog Boxes
SAP AG 2002
Calling a Dialog Box Dynamically
101101
MODULE user_command INPUT.
...
CALL SCREEN
STARTING AT lc ur.. . .
ENDMODULE.
101
Screen type...
Modal dialog box...
Next screen 101
Screen 101
MODULE user_command INPUT.
...
CALL SCREEN
STARTING AT lc ur
ENDING AT rc lr.
...ENDMODULE.
101
100100
101101
Screen Attributes100100
7/30/2019 CR10 Module Pool Day 1
29/34
29Copyright 2010 Deloitte Development LLC. All rights reserved.
Dynamic Modifications
SAP AG 2002
Dynamically Modifiable Static Attributes
GeneralObject name
Modif. groupsSize-Dynamic
AttributesAttributes
SCREEN-LENGTH
SCREEN-INPUT
SCREEN-OUTPUT
SCREEN-REQUIREDSCREEN-INTENSIFIED
SCREEN-INVISIBLE
SCREEN-ACTIVE
SCREEN-NAME
SCREEN-GROUP1
SCREEN-GROUP2
SCREEN-GROUP3
SCREEN-GROUP4
SCREEN
ProgramDialog behavior
- Input
- Output
- Required
Display Bright
Invisible
7/30/2019 CR10 Module Pool Day 1
30/34
30Copyright 2010 Deloitte Development LLC. All rights reserved.
Modifying attributes dynamically
SAP AG 2002
Modifying Attributes Dynamically: Program
ScreenPainterPROCESS BEFORE OUTPUT.
...MODULE modify_screen.
..
.
ABAPMODULE modify_screen OUTPUT.
...LOOP AT SCREEN.
IF screen-group1 = 'SEL'.screen-input = 11.
ENDIF.IF screen-name= 'FIELD1'.
screen-active= 00.ENDIF.MODIFY SCREEN.MODIFY SCREEN.
ENDLOOP.ENDMODULE.
7/30/2019 CR10 Module Pool Day 1
31/34
31Copyright 2010 Deloitte Development LLC. All rights reserved.
Set Cursor Position
SAP AG 2002
Setting the Cursor Position Dynamically
SET CURSORFIELD [OFFSET ].
PROCESS BEFORE OUTPUT.MODULE set_cursor.
PROCESS BEFORE OUTPUT.MODULE set_cursor.
Screen
Painter
ABAPAirline
Flight number
Flight date
LH
?
?
MODULE set_cursor OUTPUT.sdyn_conn-carrid = 'LH'.SET CURSORFIELDSDYN_CONN-CONNID.
...ENDMODULE.
7/30/2019 CR10 Module Pool Day 1
32/34
32Copyright 2010 Deloitte Development LLC. All rights reserved.
Using SAP Memory
7/30/2019 CR10 Module Pool Day 1
33/34
33Copyright 2010 Deloitte Development LLC. All rights reserved.
Process on Help Request
PROCESS ON HELP-REQUEST.FIELD MODULE .
Function module used to display help text
HELP_OBJECT_SHOW
HELP_OBJECT_SHOW_FOR_FIELD
7/30/2019 CR10 Module Pool Day 1
34/34
34Copyright 2010 Deloitte Development LLC. All rights reserved.
Process on Value Request
PROCESS ON VALUE-REQUEST.FIELD MODULE .
Function modules used to display list of values -
F4IF_FIELD_VALUE_REQUEST
F4IF_INT_TABLE_VALUE_REQUEST