Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Dynpros →  Statements in the Screen Flow Logic →  Subscreens, Tabstrips, and Splitter Controls →  Subscreens, Tabstrips, and Splitter Controls - Examples 

Dynpros, Subscreens

This example demonstrates how to include subscreens.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_dynpro_subscreens.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

DATA: number1(4) TYPE n VALUE '0110',
      number2(4) TYPE n VALUE '0130',
      field(10) TYPE c, field1(10) TYPE c, field2(10) TYPE c.

CALL SCREEN 100.

MODULE status_100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE fill_0110 OUTPUT.
  field = 'Eingabe 1'(001).
ENDMODULE.

MODULE fill_0120 OUTPUT.
  field = field1.
ENDMODULE.

MODULE fill_0130 OUTPUT.
  field = 'Eingabe 2'(002).
ENDMODULE.

MODULE fill_0140 OUTPUT.
  field = field2.
ENDMODULE.

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE save_ok INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
ENDMODULE.

MODULE user_command_0110 INPUT.
  IF save_ok = 'OK1'.
    number1 = '0120'.
    field1 = field.
    CLEAR field.
  ENDIF.
ENDMODULE.

MODULE user_command_0130 INPUT.
  IF save_ok = 'OK2'.
    number2 = '0140'.
    field2 = field.
    CLEAR field.
  ENDIF.
ENDMODULE.

MODULE user_command_100 INPUT.
  CASE save_ok.
    WHEN 'SUB1'.
      number1 = '0110'.
    WHEN 'SUB2'.
      number1 = '0120'.
      CLEAR field1.
    WHEN 'SUB3'.
      number2 = '0130'.
    WHEN 'SUB4'.
      number2 = '0140'.
      CLEAR field2.
  ENDCASE.
ENDMODULE.

Description

The static next dynpro number of dynpro 100 is 100. Four pushbuttons with function codes "SUB1" to "SUB4" and two identically sized subscreen areas area1 and area2 have been created. In the same ABAP program, four subscreen dynpros 110 to 140 are defined. The input/output field of all four subscreen dynpro has the name field. The function codes of the pushbuttons on the subscreen dynpros 110 and 130 are OK1 and OK2. The screen flow logic for dynpro 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE status_100.
  CALL SUBSCREEN: area1 INCLUDING sy-repid number1,
                  area2 INCLUDING sy-repid number2.
PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  MODULE save_ok.
  CALL SUBSCREEN: area1,
                  area2.
  MODULE user_command_100.

The screen flow logic of subscreen dynpros 110 and 130 is:

PROCESS BEFORE OUTPUT.
  MODULE fill_0110|0130.
PROCESS AFTER INPUT.
  MODULE user_command_0110|0130.

The screen flow logic of subscreen dynpros 120 and 140 is:

PROCESS BEFORE OUTPUT.
  MODULE fill_0120|0150.
PROCESS AFTER INPUT.

When the program is executed, a screen appears on which subscreens 110 and 130 are displayed. The pushbuttons on the main dynpro allow the user to choose between two subscreen dynpros for each screen area. The pushbuttons on the subscreen dynpros 110 and 130 allow data to be passed to the subscreen dynpros 120 and 140.

Since all subscreen dynpros use the same field name field, the ABAP field with the same name is transported several times at each PBO and PAI of the main dynpro. In the ABAP program, the values must therefore be cached in the helper fields field1 and field2.

The function code of the pushbuttons of the subscreen dynpros is different and regular handling in an ABAP field is enough. If the function codes had the same names, it would be necessary to use multiple auxiliary fields here as well.