ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Screens → Statements in the Screen Flow Logic → MODULE → Module Call - Examples
Screens, Simple Module Call
The example shows how to call a module.
Other versions: 7.31 | 7.40 | 7.54
Source Code
PROGRAM demo_dynpro_module.
TABLES demo_conn.
DATA: ok_code TYPE sy-ucomm,
save_ok LIKE ok_code,
wa_spfli TYPE spfli.
CALL SCREEN 100.
MODULE init_screen_100 OUTPUT.
MOVE-CORRESPONDING wa_spfli TO demo_conn.
ENDMODULE.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
SET TITLEBAR '100'.
ENDMODULE.
MODULE clear_ok_code INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.
MODULE get_data INPUT.
MOVE-CORRESPONDING demo_conn TO wa_spfli.
CLEAR demo_conn.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE sy-dynnr.
WHEN 0100.
CASE save_ok.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
PERFORM read_data.
WHEN 'CLEAR'.
CLEAR wa_spfli.
ENDCASE.
...
ENDCASE.
ENDMODULE.
FORM read_data.
SELECT SINGLE
cityfrom airpfrom cityto airpto fltime deptime arrtime
INTO CORRESPONDING FIELDS OF wa_spfli
FROM spfli
WHERE carrid = wa_spfli-carrid AND connid = wa_spfli-connid.
ENDFORM.
Description
The static next screen number of screen 100 is 100. Its layout is taken from the fields of the structure DEMO_CONN from the ABAP Dictionary. The screen flow logic is as follows:
MODULE init_screen_100.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE clear_ok_code.
MODULE get_data.
MODULE user_command_0100.
In the GUI status STATUS_100, the icon Cancel (F12) has been activated with the function code CANCEL, and the function keys F5 and Shift+F2 have been assigned the function codes DISPLAY and CLEAR. The functions of the program are similar to those in the example in Processing Input and Output Fields. In this case, however, the processing logic is distributed among several dialog modules and a subroutine is used to read the data from the database.