SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → User Dialogs → Screens → 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.
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:
The program demonstrates via information reports and status messages which modules are called after user actions and which data is transported.
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.