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 

Tabstrips on Selection Screens

The example shows how to include tabstrips in selection screens.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_sel_screen_with_tabstrip.

DATA flag(1) TYPE c.

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

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
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.
PARAMETERS: q1(10) TYPE c OBLIGATORY,
            q2(10) TYPE c OBLIGATORY,
            q3(10) TYPE c OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 200.

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

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 10 LINES,
                  TAB (20) button1 USER-COMMAND push1,
                  TAB (20) button2 USER-COMMAND push2,
                  TAB (20) button3 USER-COMMAND push3
                                  DEFAULT SCREEN 300,
                  END OF BLOCK mytab.

DATA screen_wa TYPE screen.

INITIALIZATION.
  button1 = text-010.
  button2 = text-020.
  button3 = text-030.
  mytab-prog = sy-repid.
  mytab-dynnr = 100.
  mytab-activetab = 'BUTTON1'.

AT SELECTION-SCREEN.
  CASE sy-dynnr.
    WHEN 1000.
      CASE sy-ucomm.
        WHEN 'PUSH1'.
          mytab-dynnr = 100.
          mytab-activetab = 'BUTTON1'.
        WHEN 'PUSH2'.
          mytab-dynnr = 200.
          mytab-activetab = 'BUTTON2'.
      ENDCASE.
    WHEN 100.
      MESSAGE s888(sabapdemos) WITH text-040 sy-dynnr.
    WHEN 200.
      MESSAGE s888(sabapdemos) WITH text-040 sy-dynnr.
  ENDCASE.

MODULE init_0100 OUTPUT.
  LOOP AT SCREEN INTO screen_wa.
    IF screen_wa-group1 = 'MOD'.
      CASE flag.
        WHEN 'X'.
          screen_wa-input = '1'.
        WHEN ' '.
          screen_wa-input = '0'.
      ENDCASE.
      MODIFY SCREEN FROM screen_wa.
    ENDIF.
  ENDLOOP.
ENDMODULE.

MODULE user_command_0100 INPUT.
  MESSAGE s888(sabapdemos) WITH text-050 sy-dynnr.
  CASE sy-ucomm.
    WHEN 'TOGGLE'.
      IF flag = ' '.
        flag = 'X'.
      ELSEIF flag = 'X'.
        flag = ' '.
      ENDIF.
  ENDCASE.
ENDMODULE.

START-OF-SELECTION.
  WRITE: / 'P1:', p1,'Q1:', q1,
         / 'P2:', p2,'Q2:', q2,
         / 'P3:', p3,'Q3:', q3.

Description

This program defines two selection screens, 100 and 200, as subscreens and defines a tabstrip area with three tab titles on the standard selection screen 1000. Only the third tab title is statically assigned a subscreen dynpro 300 of the same program.

The input and output fields of screen 300, p1 to q3, have been created by adopting the parameters from the ABAP program and have been assigned to the modification group "MOD". The pushbutton has the function code TOGGLE. The flow logic of dynpro 300 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE init_0100.
PROCESS AFTER INPUT.
  MODULE user_command_0100.

The two dialog modules are defined in the ABAP program.

When the program is executed, the system displays the standard selection screen. At the event INITIALIZATION, the tab title texts have been determined, the subscreen selection screen 100 has been assigned initially to the tabstrip area, and the first tab title has been enabled.

User actions on the selection screen are evaluated in the event block AT SELECTION-SCREEN. In particular, if the user chooses the first two tab titles, the system dynamically assigns the corresponding subscreens and enables the tab titles. This is not necessary for the third tab title, since when it is chosen the static assignment of dynpro 300 is automatically placed in the structure mytab.

Before displaying the subscreen dynpro, the system executes the PBO module init_0100, and any user action on the subscreen dynpro trigger the execution of the PAI module. This is also the case if a tab title is chosen. Afterwards, AT SELECTION-SCREEN is triggered.

Messages in the status bar indicate where actions are performed and processed.