ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Screens → Statements in the Screen Flow Logic → Subscreens, Tabstrips, and Splitter Controls → Subscreens, Tabstrips, and Splitter Controls - Examples
Dynpros, Subscreens
The 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-screen number of dynpro 100 is 100. Four pushbuttons with functions 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
fields of all four subscreen dynpros have the name field
. The function codes of the pushbuttons on the subscreen dynpros 110 and 130 are OK1 and OK2. The screen flow logic of dynpro 100 is:
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 the 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 the subscreen dynpros 120 and 140 is:
PROCESS BEFORE OUTPUT.
MODULE fill_0120|0150.
PROCESS AFTER INPUT.
When executing the program, the user sees a screen that displays the subscreens 110 and 130. The user can use the pushbuttons of the main dynpro to switch between two subscreen dynpros for each subscreen area and the pushbuttons on the subscreen dynpros 110 and 130 to pass data to the subscreen dynpros 120 and 140.
Since on all subscreen dynpros the same field name field
is used, the ABAP
field with the same name is transported several times at each event PBO and PAI of the main dynpro.
In the ABAP program, the values must therefore be stored intermediately in the auxiliary fields field1
and field2
.
The function code of the pushbuttons of the subscreen dynpros differs, so that the usual handling in an ABAP field is sufficient. If the function codes had the same names, too, than several auxiliary fields would have to be used here as well.