Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  Selection Screens →  Create Selection Screens →  SELECTION-SCREEN →  SELECTION-SCREEN - BEGIN OF →  SELECTION-SCREEN - AS SUBSCREEN 

Selection Screens in Tabstrips

This example demonstrates how selection screens can be included in tabstrips.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_sel_screen_in_tabstrip.

SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN NO INTERVALS.
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 1100.

SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN NO INTERVALS.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
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 1200.

CONTROLS mytabstrip TYPE TABSTRIP.

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

DATA: number(4) TYPE n VALUE '1100'.

START-OF-SELECTION.
  mytabstrip-activetab = 'BUTTON1'.
  CALL SCREEN 100.

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

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BUTTON1'.
      mytabstrip-activetab = save_ok.
      number = 1100.
    WHEN 'BUTTON2'.
      mytabstrip-activetab = save_ok.
      number = 1200.
  ENDCASE.
ENDMODULE.

AT SELECTION-SCREEN.
  MESSAGE s888(sabapdemos) WITH text-030 sy-dynnr.

Description

The two selection screens 1100 and 1200 are defined as subscreens. The static next screen number of screen 100 is 100. A tab strip area called mytabstrip is created with two tab titles, BUTTON1 and BUTTON2, plus a function code with the same name (without typing). All tabs are assigned a shared subscreen area area. The screen flow logic for dynpro 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  CALL SUBSCREEN area INCLUDING sy-repid number.
PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  CALL SUBSCREEN area.
  MODULE user_command_0100.

From a programming point of view, this program is almost identical to the executable example for Selection Screens as Subscreens and shows similar behavior. The only difference is that the pushbuttons have been replaced with tab titles, and the control mytabstrip has been declared and filled. Scrolling between the tab pages is programmed in the ABAP program. Whenever a tab title is chosen, the function code of the OK field is assigned to the component activetab of the structure mytabstrip. At the same time, the variable number is filled with the dynpro number of the subscreen selection screen which is to be displayed in the subscreen area area of the tabstrip.