Entering content frameSimple 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>, which 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:

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 SDYN_CONN.

DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE OK_CODE,
      WA_SPFLI TYPE SPFLI.

CALL SCREEN 100.

MODULE INIT_SCREEN_100 OUTPUT.
  MOVE-CORRESPONDING WA_SPFLI TO SDYN_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 SDYN_CONN TO WA_SPFLI.
  CLEAR SDYN_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 for screen 100 is 100. It uses components of the structure SDYN_CONN, Structure link copied 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