ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Dynpros → Statements in the Screen Flow Logic → MODULE → Module Call - Examples
Screens, Unconditional Module Call
The example illustrates how you can exit a screen without the automatic input checks.
Other versions: 7.31 | 7.40 | 7.54
Source Code
PROGRAM demo_dynpro_at_exit_command .
DATA: ok_code TYPE sy-ucomm,
save_ok LIKE ok_code,
input1(20) TYPE c, input2(20) TYPE c.
CALL SCREEN 100.
MODULE init_screen_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
ENDMODULE.
MODULE cancel INPUT.
MESSAGE i888(sabapdemos) WITH text-001 ok_code input1 input2.
IF ok_code = 'CANCEL'.
CLEAR ok_code.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.
MODULE back INPUT.
MESSAGE i888(sabapdemos) WITH text-002 ok_code input1 input2.
IF ok_code = 'BACK' OR ok_code = 'EXIT'.
CLEAR: ok_code, input1, input2.
LEAVE TO SCREEN 100.
ENDIF.
ENDMODULE.
MODULE execute1 INPUT.
MESSAGE i888(sabapdemos) WITH text-003 ok_code input1 input2.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.
MODULE execute2 INPUT.
MESSAGE i888(sabapdemos) WITH text-004 ok_code input1 input2.
IF save_ok = 'EXECUTE'.
MESSAGE s888(sabapdemos) WITH text-005.
ENDIF.
ENDMODULE.
Description
The static Next-Screen-Number of screen 100 is 100. The input fields have the screen fields input1
and input2
assigned to them. The input fields are specified as obligatory
fields in their attributes. The function codes of the pushbuttons are EXECUTE and CANCEL, in which CANCEL has the function type E. In GUI status STATUS_100, the symbols Back
(F3) and Cancel
(F12) are activated using the function codes BACK and CANCEL. Both have
the function type E. In addition, the function code EXECUTE is assigned
to the function key F8. EXECUTE does not have the function type E. The screen flow logic is:
MODULE init_screen_0100.
PROCESS AFTER INPUT.
MODULE execute1.
MODULE cancel AT EXIT-COMMAND.
MODULE back AT EXIT-COMMAND.
MODULE execute2.
The program demonstrates via information reports and status messages which modules are called after user actions and which data is transported.
- When "Execute" is selected without input to the mandatory fields, the automatic input check demands that the mandatory fields are populated.
- When "Execute" is selected with populated mandatory fields, all screen fields are transported and the modules
execute1
andexecute2
are called consecutively.
- When "Cancel" is selected with or without input to the mandatory fields, the OK field is transported and the module
cancel
is called. The program is exited there.
- When you select "Back" with or without input to the mandatory fields, the OK field is transported
and the module
cancel
is called. However, the program is not exited there, because the function code is BACK. Instead, the automatic input check is carried out. If the mandatory fields are populated, the modulesexecute1
andexecute2
are called consecutively.
The module back
is never called. Two module calls with AT
EXIT-COMMAND do not make sense in the screen flow logic. In above example, the function code
BACK was to be handled in module cancel
as well. Then, the position of the statement MODULE
with AT EXIT-COMMAND
is irrelevant.