In the dynpro technology, to include a screen "A" into a screen "B", the screen "A" must be defined as a subscreen and the screen "B" must define a "subscreen area" to contain the screen "A". The flow logic of the screen "B" must contain the statement CALL SUBSCREEN <subscreen_area> INCLUDING ...
, which refers to the subscreen number to include either statically or via a global variable.
As with a normal screen, a selection screen can also be defined as a subscreen by defining it as a "standalone selection screen" (wrapping its elements inside the ABAP statements SELECTION-SCREEN BEGIN OF SCREEN <any-screen-number>
and SELECTION-SCREEN END OF SCREEN <any-screen-number>
), and adding the words "AS SUBSCREEN" after BEGIN OF SCREEN <any-screen-number>
). For example:
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1001.
If you have to include an existing selection screen, which is not yet defined as a subscreen, there are two main possibilities:
- If it was already defined as a "standalone screen" (with
SELECTION-SCREEN BEGIN OF SCREEN ...
), and it's to be used only as a subscreen, you may simply add AS SUBSCREEN
as said above.
- If it has to be used both as a subscreen and as a normal screen, then the most simple solution is to wrap its elements inside a block (ABAP statements
SELECTION-SCREEN BEGIN OF BLOCK <block ID>
and SELECTION-SCREEN END OF BLOCK <block ID>
), and define another selection screen which includes this block (ABAP statement SELECTION-SCREEN INCLUDE BLOCKS <block ID>
).
Below are two examples for the case 2.
Example 1, with the default selection screen (1000 cf footnote)
REPORT zprg1.
PARAMETERS test AS CHECKBOX. " screen 1000 cf footnote
REPORT zprg1.
SELECTION-SCREEN BEGIN OF BLOCK b1000.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1000.
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
SELECTION-SCREEN INCLUDE BLOCKS b1000.
SELECTION-SCREEN END OF SCREEN 1002.
Example 2 with a Standalone selection screen (1002, included using CALL SUBSCREEN subarea INCLUDING 'ZPRG1' '1002'.
)
REPORT zprg1.
SELECTION-SCREEN BEGIN OF SCREEN 1002.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1002.
REPORT zprg1.
SELECTION-SCREEN BEGIN OF SCREEN 1002.
SELECTION-SCREEN BEGIN OF BLOCK b1002.
PARAMETERS test AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1002.
SELECTION-SCREEN END OF SCREEN 1002.
SELECTION-SCREEN BEGIN OF SCREEN 1003 AS SUBSCREEN.
SELECTION-SCREEN INCLUDE BLOCKS b1002.
SELECTION-SCREEN END OF SCREEN 1003.
Footnote:
(1) The selection screen parameters which are not placed inside SELECTION-SCREEN BEGIN OF SCREEN ... END OF SCREEN ...
are implicitly part of the "default selection screen" (1000
). Note that using SELECTION-SCREEN BEGIN OF SCREEN 1000...
leads to a syntax error.