MODULE mod [ AT {EXIT-COMMAND|CURSOR-SELECTION} ]
[ ON {CHAIN-INPUT|CHAIN-REQUEST} ]
[ SWITCH switch ].
1. ... AT EXIT-COMMAND
2. ... AT CURSOR-SELECTION
3. ... ON {CHAIN-INPUT|CHAIN-REQUEST}
4. ... SWITCH switch
The statement MODULE of the dynpro flow logic calls the dialog module mod of the ABAP program. You can use MODULE either as a keyword or as an addition of statement FIELD. When using it as an addition, the call of the dialog module depends on conditions for the screen fields.
As a keyword, the statement calls the dialog module mod of the respective ABAP program. At the event PAI, you can use the additions AT and ON to specify conditions for the call of the dialog module.
At the event PBO, you can call any dialog module defined in the ABAP program with the addition OUTPUT. At the events PAI, POH and POV, you can call any dialog module defined with the addition INPUT or without any addition. If the dialog module mod does not exist in the ABAP program, an untreatable exception is triggered. After processing a dialog module in the ABAP program, processing of the dynpro flow logic is resumed after the position of the call, unless the screen processing is completed within the dialog module.
You can use MODULE as a keyword only at the events PBO and PAI. At the events POH and POV, you can use MODULE only as an addition to the FIELD statement.
Do not mix up the MODULE statement of the dynpro flow
logic with the identically called statement MODULE for defining dialog modules in the ABAP program.
... AT EXIT-COMMAND
Addition AT EXIT-COMMAND at the event PAI causes module mod to be called exactly if:
The dialog module is called before the automatic input checks defined in the system or in the ABAP Dictionary and independent of its position in the event block. The only screen field transported to the ABAP program is the OK field. If the function that triggered the PAI event does not fulfill any of the above prerequisites, the MODULE statement is not executed.
If several MODULE statements have the AT EXIT COMMAND addition, only the first one is executed. If no MODULE statement has the addition AT EXIT COMMAND, a normal PAI processing is executed: The predefined input checks are executed and then the PAI event block is processed sequentially. Provided the screen processing is not terminated in the dialog module mod, after the return from the dialog module, the complete PAI processing is executed. You must not use the addition AT EXIT COMMAND in connection with the statement FIELD.
The function type of a function is determined in the
Screen Painter or
Menu Painter. Usually those functions
of the user interface are defined with function type "E" that are assigned to the icons Back,
Exit and Cancel in the
standard toolbar of the GUI status. Therefore, the called dialog module should terminate the screen processing and allow security checks, if required.
... AT CURSOR-SELECTION
The AT CURSOR-SELECTION addition at the event PAI causes the module mod to be called only if
The call occurs within the usual PAI processing, meaning that the automatic input checks defined in the system or in the ABAP Dictionary are executed and the MODULE statement is called according to its position in the event block. You can use the addition in connection with the FIELD statement.
If the PAI event is triggered under the above circumstances, the function code is not passed to sy-ucomm and the OK field. They keep their previous values.
The function type and function code of a function are determined in the Screen Painter or in the Menu
Painter. We recommend to assign function code "CS" in the Menu Painter to function key F2 in order to
simultaneously assign the double-click function of the mouse to it. This allows you to assign dialog modules to the selection of input or output fields.
... ON {CHAIN-INPUT|CHAIN-REQUEST}
These conditions make sense only within chains using the
CHAIN and ENDCHAIN statements. They check the
individual conditions ON INPUT or ON REQUEST for all
screen fields that are specified so
far within the current chain after FIELD.
The dialog module is called if at least on of the screen fields fulfills the respective condition.
...SWITCH switch
If the addition SWITCH is specified, the dialog module mod is called only if the switch specified by switch has the state on.
With switch, a switch defined in the Repository must be specified directly. If the specified switch does not exist, the dialog module will not be called.
You cannot specify the addition together with the statement
FIELD. There, the switch assigned to the screen field in the Screen Painter applies.
Typical structure of a simple dynpro flow logic. At PBO, a dialog module status_0100 is called to set the GUI status, at PAI, a dialog module leave_100 is called to handle functions with function type "E" and a dialog module user_command_0100 to handle the other user actions.
The relevant ABAP program must implement the dialog modules and may have a structure like the one below. Because dialog module have no local data, we recommend to handle the actual processing within procedures that you call depending on the function code.