Module Pool Programming Notes
Module Pool Programming Notes
http://www.sapabapwebdynprotutorials.com/search/label/D
ialog%20Programming
PURPOSE:
Note: A module pool program can be created either with or without TOP
include program.
TOP include program can be used for declaring global variables, subroutine
definitions and module definitions.
A TOP include program must end with ‘TOP’.
A Module pool program cannot be executed directly; it needs to be
associated with a transaction code.
PAI (Process after Input): This event functionality is similar to ‘At selection-
screen’ event in case of selection-screen. This event is triggered in the
following cases:
a) When the user presses enter key in the input field
b) When the user selects/deselects a checkbox or when the user
selects a radio button
c) When the user selects a value in the dropdown list box
d) When the user scrolls in the table control
e) When the user clicks on the pushbutton
This event can be handled to provide an action whenever a user
performs an action in/on a screen element in the runtime
Note: By Default, The first tab will be active in the Tabstrip control. We can
use the property ‘ACTIVETAB’ of tabstrip control to activate a specific tab
button in tabstrip control. Each Tab should be associated with a subscreen.
Since Subscreen cannot be placed on top of normal screen, we need to
place subscreen area in each tab and then in the runtime, the subscreen
will sit on TOP OF subscreen area. We can use same/different subscreen
area’s FOR each tab. The no. of calls to ‘CALL SUBSCREEN’ statement
depends on the no. of subscreen areas.
TABLE CONTROL:
It is used for displaying the data in the form of rows and columns.
In order to avoid this error in the design time, initially provide loop and
endloop in both PBO and PAI events.
Note: Whenever a screen/subscreen layout contains table control, it should
be declared explicitly by using ‘controls’ keyword. The data type for table
control is ‘tableview’. If it not declared, it leads to runtime error ‘control
not found’.
Controls <table control name> type tableview using screen <screen no>.
Validation messages:
1. If mandatory field value is not entered message will be provided by
SAP fill in all the required fields
2. If invalid country key / language key / units of measurement … is
entered message will be provided by SAP Invalid values (entry
doesn’t exist in …..)
3. If invalid date is entered message will be provided by SAP invalid
date
Flowlogic section:
Eg: field lfa1-land1 values (‘AF’,’AR’,’IN’)
Field mara-mtart values (‘COUP’,’FGTR’,’ROH’)
Note: If any of the screen field fails the flow logic validations, the other
fields on the screen will be disabled and doesn’t allow the user to input the
values in the other fields.
This can be avoided by grouping the logically related fields using chain-
endchain statement.
Eg:-
Flowlogic section:
Chain.
Field lfa1-lifnr.
Field lfa1-land1 values (‘AF’,’AR’,’IN’).
Endchain.
chain.
field mara-matnr.
field mara-mtart values ('COUP','FGTR','ROH').
endchain.
3. Module pool validations: These validations are used for performing field
specific validations. In this, the validation messages must be provided by
developer itself.
Syntax:
Flowlogic section:
Field <field name> module <module name>.
Note: Define the module with validation logic and validation message in any
of the include programs.
At Exit-command module
Note: If a screen field fails any of the above validations, the user cannot exit
the transaction unless the validation is correct or in some cases user may
require to forcefully exit the transactions. For forceful exit, we need to
consider a button whose functionality should be similar to that of cancel
button. For this, we need to set an additional property for the button i.e
FCTTYPE to ‘E’ (function type to exit command) along with the function
code. Apart from this additional property, there should be corresponding
‘at exit-command’ module in the PAI event. As part of this module
definition, we need to implement the logic to exit the transaction
forcefully. This ‘at exit-command’ module is executed only when the user
clicks on the button whose function type is set to ‘E’.
PAI event: