Key Points related to Module Pool Programming:
1. Module pool can be considered as follows:
Collection of screens + Flow logic (Code behind the screen) + Code within main ABAP program.
2. Screen is an interface through which user can interact with SAP.
3. Module pool program is classified as Type M and these can’t be executed directly. (Executed by Transaction codes)
4. For Module pool programming the screen design is done through Graphical Screen Painter (SE51) and GUI design is done from Menu Painter (SE41).
5. In Module Pool screen can be Normal Screen (has min, max, close option), Sub screen (Screen within a screen), Modal Dialog Box (only close option).
6. Screen Numbers:
1000 – Selection Screen
>= 9000 – Custom Screen
9000-9500 – SAP Partners
>9500 – Customer Screen
7. Screen painter.
Screen painter = screen attributes + screen layout + field attributes + flow logic.
8. Menu Painter.
Menu painter = menu bar + standard tool bar + title bar.
9. Function codes are assigned to screen attributes to make them interactive.
10. Flow Logic.
Dynpro processor controls the flow logic on screen. By default the flow logic has two specific events which are specific only for module pool programming
PBO and PAI. Apart from these it can have POV and POH.
11. PBO.
Process Before Output is triggered before the screen gets displayed.
It has one module which sets the status bar and title bar.
Module Status_ Output.
Set PF_Status ‘XXXXXX’.
Set Title Bar ‘XXXX’.
End module.
12. PAI.
Process After Input is triggered after the user does some interaction.
It has one module.
Module User Command_ Input.
Inside this the system field SY-UCOMM holds the function code from interactive screens element and according the value different coding options are provided inside CASE –END CASE.
13. POV.
Process On Value request (F4 help).
Field Module on input.
14. POH.
Process On Help request (F1 Help)
Field Module on request.
15. Steps For Programming:
- create the main program
- create top include
- create first screen
- Define attributes
- Define graphical user interface
- Assign field attributes via field list
- Define flow logic using dialog flow logic syntax
- create follow up screens
(Same steps as first screen)
16. PBO module statements are followed by OUTPUT and PAI module statements are followed by INPUT.
17. Field names must be identical to screen field names for values to pass between the dialog processor and ABAP/4 processor at runtime.
18. Message statements can be used in PAI.
19. Field statement keeps a single field open after an error or warning message is issued.
20. To keep multiple fields open for i/p after error/warning we use
Chain- - -End Chain.
21. All fields of current screen are stored in screen table. Use Modify Screen statement to modify attributes.
22. For table control there must be a loop statement in both PBO and PAI. It is because loop statement causes screen fields to be copied back and forth between ABAP program and the Screen Field.
At the time of PBO, the transport of the table control fields from the ABAP program to the screen takes place after every loop run in the flow logic. The remaining screen fields are filled, as usual, at the end of PBO processing.
At PAI time, first all the screen fields that do not belong to any table control and not listed in any FIELD statement are transported to identically-named fields of the ABAP program. The contents of the table control fields are transported, row by row at the beginning of the corresponding loop run, into the identically-names fields of the ABAP program. The fields that are listed in the FIELD statements are transported, as usual, directly from the corresponding FIELD statement.
Within the loops, two system fields are of importance.
sy-stepl contains the current line of the table control counted from the uppermost displayed line
sy-loopc contains the current number of table control rows on the screen
23. To call sub screen we use CALL SUBSCREEN statement in the PBO of main screen and also in PAI.
In PBO:
Call Subscreen including sy-repid .
In PAI:
Call Subscreen .
24. For search help on a screen we can use a predefined search help on the search tab of dictionary attribute of the field.
25. For select options, create sub-screen area in your screen layout where you want to create the select options. In the top include of your module pool program declare a selection screen as a sub-screen
e.g.
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
Select-options s_matnr for mara-matnr.
SELECTION-SCREEN END OF SCREEN.
In the PBO and PAI of the main screen where the select options needs to be created do a
call subscreen of the above screen (100).
CALL SUBCREEN sub_area INCLUDING.
This call subscreen statement is necessary for transport of values between screen and
program. All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc. and not in PAI. These selection screen validations etc. should be done in the top include only.
e.g.
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
Select-options s_matnr for mara-matnr.
SELECTION-SCREEN END OF SCREEN.
In the PBO and PAI of the main screen where the select options needs to be created do a
call subscreen of the above screen (100).
CALL SUBCREEN sub_area INCLUDING.
This call subscreen statement is necessary for transport of values between screen and
program. All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc. and not in PAI. These selection screen validations etc. should be done in the top include only.
Code Snippet :
Link : http://www.scribd.com/doc/140550815/Module-Pool-Programming
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletenice
ReplyDeleteHi ,
ReplyDeleteI have a small doubt in MPP.
Can we call a mail screen from sub screen in MPP ?
Thanks
Swami