Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Selection Screens →  Create Selection Screens →  SELECTION-SCREEN →  SELECTION-SCREEN - screen_elements →  SELECTION-SCREEN - TABBED BLOCK 

Subscreens on Selection Screens

The example shows how to include subsceens in selection screens.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_sel_screen_with_subscreen.

TABLES sscrfields.

<span class="blue">* SUBSCREEN 1</span>

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: p1(10) TYPE c,
            p2(10) TYPE c,
            p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 100.

<span class="blue">* SUBSCREEN 2</span>

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
PARAMETERS: q1(10) TYPE c,
            q2(10) TYPE c,
            q3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 200.

<span class="blue">* SUBSCREEN 3</span>

SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-030.
PARAMETERS: r1(10) TYPE c,
            r2(10) TYPE c,
            r3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF SCREEN 300.

<span class="blue">* STANDARD SELECTION SCREEN</span>

SELECTION-SCREEN: FUNCTION KEY 1,
                  FUNCTION KEY 2.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR 10 LINES,
                  END OF BLOCK sub.

INITIALIZATION.
  sscrfields-functxt_01 = '@0D@'.
  sscrfields-functxt_02 = '@0E@'.
  sub-prog = sy-repid.
  sub-dynnr = 100.

AT SELECTION-SCREEN.
  CASE sy-dynnr.
    WHEN 100.
      IF sscrfields-ucomm = 'FC01'.
        sub-dynnr = 300.
      ELSEIF sscrfields-ucomm = 'FC02'.
        sub-dynnr = 200.
      ENDIF.
    WHEN 200.
      IF sscrfields-ucomm = 'FC01'.
        sub-dynnr = 100.
      ELSEIF sscrfields-ucomm = 'FC02'.
        sub-dynnr = 300.
      ENDIF.
    WHEN 300.
      IF sscrfields-ucomm = 'FC01'.
        sub-dynnr = 200.
      ELSEIF sscrfields-ucomm = 'FC02'.
        sub-dynnr = 100.
      ENDIF.
  ENDCASE.

START-OF-SELECTION.
  WRITE: / 'P1:', p1,'Q1:', q1, 'R1:', r1,
         / 'P2:', p2,'Q2:', q2, 'R2:', r2,
         / 'P3:', p3,'Q3:', q3, 'R3:', r3.

Description

Displaying subscreens in subscreen areas on selection screens is a special case of tabstrips being used on selection screens. Defining a subscreen area is similar to defining a tabstrip area without a tab title. Before the selection screen is sent, you must assign a subscreen to the subscreen area sub. To do this, you use the components prog and dynnr of the identically named structure sub which is generated automatically by the statement above. The component prog must be assigned the program name of the subscreen, and the component dynnr must be assigned the screen number of the subscreen.

This program defines three subscreen selection screens, 100, 200, and 300. On the standard selection screen, a subscreen area sub is created. In addition, two pushbuttons are enabled in the application toolbar.

At the INITIALIZATION event, the system assigns the subscreen selection screen 100 to the subscreen area. At the AT SELECTION-SCREEN event, the system evaluates the function keys and assigns them to one of the other subscreens accordingly.