Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  Selection Screens →  Create Selection Screens →  SELECTION-SCREEN →  SELECTION-SCREEN - screen_elements 

SELECTION-SCREEN - TABBED BLOCK

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


SELECTION-SCREEN BEGIN OF TABBED BLOCK tblock FOR n LINES [NO INTERVALS]. 
...
[SELECTION-SCREEN TAB (len) tab USER-COMMAND fcode
                  [DEFAULT [PROGRAM prog] SCREEN dynnr]
                  [MODIF ID modid]
                  [ldb_additions].]
...
SELECTION-SCREEN END OF BLOCK tblock.

Extras

1. ... NO INTERVALS

2. ... USER-COMMAND fcode

3. ... DEFAULT [PROGRAM prog] SCREEN dynnr

Effect

The first and last statements define a tabstrip area with the name tblock on the current selection screen. The name tblock must be specified directly and can contain a maximum of 16 characters. The number of lines in the tabstrip area is determined by a number n, which must be specified directly and can contain a maximum of three characters but must not exceed 197. The current selection screen cannot be defined as a subscreen dynpro using AS SUBSCREEN.

Within the statements defining a tabstrip area, there can only be SELECTION-SCREEN statements with a TAB addition, and these can only be used in this location. These statements define tab titles with the name tab and a length of len. The names tab must be specified directly and can contain a maximum of 8 characters. The lengths len must be specified directly as positive numbers with no more than two figures and a value of no more than 79. If the width of all the tab titles is greater than the width of this area, a scroll bar is configured automatically so that all pages can be accessed.

The system automatically creates a type c global variable of the same name and with a length of 83 for each tab title. The content of the variables is displayed as the label for the tab title on the selection screen. The addition MODIF ID assigns the tab title to the modification group modid. The ldb_additions can only be used in the selection include of a logical database.

If no SELECTION-SCREEN statement with the addition TAB is included within the statements for the definition of a tab area, a tab area is defined without a tab title. This special case acts as the definition of a subscreen area for the integration of a single subscreen dynpro on the selection screen. The subscreen dynpro is assigned dynamically (see below).

Addition 1

... NO INTERVALS

Effect

The tabstrip area is created small enough that a subscreen dynpro created using the addition NO INTERVALS of AS SUBSCREEN can fit in it.


Note

The addition NO INTERVALS of TABBED BLOCK has no influence on the selection criteria of selection screens, which are integrated as subscreen dynpros in the tab area.

Addition 2

... USER-COMMAND fcode

Effect

Each tab title must be assigned a function code fcode using the addition USER-COMMAND. The function codes fcode must be specified directly and can contain a maximum of 20 characters. When the user selects a tab, the associated function code can be taken from the component ucomm of the structure sscrfields after the event AT SELECTION-SCREEN. For this purpose, this component must be declared as an interface work area with reference to the structure SSCRFIELDS using the statement TABLES.


Notes

  • If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.
  • It is not recommended that the system field sy-ucomm instead of sscrfields-ucomm is evaluated, since this does not guarantee that sy-ucomm is always given the correct value in selection screen processing.

Addition 3

... DEFAULT [PROGRAM prog] SCREEN dynnr

Effect

Each tab title must be assigned a subscreen dynpro whose screen is displayed as a tab page when the tab title is selected. If this assignment is not made or has errors when the selection screen is sent, a non-handleable exception is raised.

Dynamic Assignment

For each tabstrip area, a global structure with the same name is created in the current program. This structure has the following three components: prog of type c with length 40, dynnr of type c and length 4, and activetab of type c with length 132. If the addition DEFAULT is not specified, the name of the ABAP program in which the required subscreen dynpro is defined, the number of the subscreen dynpro, and the function code of the tab title must be assigned to these components before the selection screen is sent. An assignment to the component activetab at the event AT SELECTION-SCREEN is ignored. Instead, this is automatically overwritten with the function code of the selected tab title before the event AT SELECTION-SCREENOUTPUT of the current selection screen.

For a subscreen-only area, that is, a tabstrip area without a tab title, dynamic assignments must be used. Before the selection screen is sent, the program name must be assigned to the component prog and the dynpro number of the subscreen dynpro must be assigned to the component dynnr (for an example, see the program DEMO_SEL_SCREEN_WITH_SUBSCREEN).

Static Assignment

If the addition DEFAULT is specified, the tab title is assigned the subscreen dynpro for the number dynnr of the program prog. The dynpro number and program must be specified directly. If the addition PROGRAM is not specified, the subscreen dynpro is searched for in the current program. A subscreen dynpro that is assigned statically with DEFAULT can also be overwritten dynamically.

If the DEFAULT addition is specified, it is possible to dictate that the screen element for a tab page is displayed when the selection screen is sent by assigning the name of the tab title to the component activetab. The other components are filled with the values specified for DEFAULT when the selection screen is sent. The first page is displayed as standard.


Note

If an assigned subscreen dynpro is not a selection screen, the dialog modules that are accessed during its flow logic must be defined in the current program. If an assigned subscreen dynpro is a selection screen, user actions on the subscreen produce the event AT SELECTION-SCREEN. This includes when the user chooses a tab title. The event AT SELECTION-SCREEN is executed first for the subscreen included in the selection screen and then for the selection screen itself.


Example

Defines a tabstrip control mytab on the standard selection screen and includes the selection screens 100 and 200, which are defined as subscreen dynpros, in an executable program. The subscreen dynpros are assigned to the tab titles dynamically. For an example of a static assignment with the addition DEFAULT, refer to SELECTION-SCREEN - AS SUBSCREEN.

TABLES sscrfields. 

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. 
PARAMETERS: p1 TYPE c LENGTH 10, 
            p2 TYPE c LENGTH 10, 
            p3 TYPE c LENGTH 10. 
SELECTION-SCREEN END OF SCREEN 100. 

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. 
PARAMETERS: q1 TYPE c LENGTH 10, 
            q2 TYPE c LENGTH 10, 
            q3 TYPE c LENGTH 10. 
SELECTION-SCREEN END OF SCREEN 200. 

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

INITIALIZATION. 
  button1 = 'Selection Screen 1'. 
  button2 = 'Selection Screen 2'. 
  mytab-prog = sy-repid. 
  mytab-dynnr = 100. 
  mytab-activetab = 'PUSH1'. 

AT SELECTION-SCREEN. 
  CASE sy-dynnr. 
    WHEN 1000. 
      CASE sscrfields-ucomm. 
        WHEN 'PUSH1'. 
          mytab-dynnr = 100. 
        WHEN 'PUSH2'. 
          mytab-dynnr = 200. 
        WHEN OTHERS. 
        ... 
      ENDCASE. 
      ... 
  ENDCASE. 

Continue

Tabstrip Controls on Selection Screens

Subscreens on Selection Screens