Entering content frame

Simple Module Calls Locate the document in its SAP Library structure

To call a module, use the flow logic statement

MODULE mod.

The system starts the module mod of the ABAP program. A module must have been defined for the same event block in which the call occurs.

If you only use simple modules in the screen flow logic, the data transport between the ABAP program and the screen is as follows:

        In the PAI event, all of the data from the screen is transported to the ABAP program (as long as there are program fields with the same names as the screen fields) after the automatic input checks and before the first PAI module is called. This includes the contents of the system fields (for example, sy-ucomm, which contains the current function code).

        At the end of the last PBO module, and before the screen is displayed, all of the data is transported from the ABAP program to any identically-named fields in the screen.

This graphic is explained in the accompanying text

Data is transported between the screen and the ABAP program at the beginning and end of each dialog step on the application server. Do not confuse this with the data transport between a screen on the application server and the SAPgui on the presentation server.

Example

Simple module call

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.

The statically-defined next screen number for screen 100 is 100. It uses components of the structure DEMO_CONN , Structure linkcopied from the ABAP Dictionary, and looks like this:

This graphic is explained in the accompanying text

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.
  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 symbol This graphic is explained in the accompanying text (F12) is active with the function code CANCEL, and the functions DISPLAY and CLEAR are assigned to the function keys F5 and shift+F2 respectively.

The program has a similar function to the example program in the section Processing Input/Output Fields.

 

 

Leaving content frame