SELECTION-SCREEN BEGIN OF TABBED BLOCK tblock FOR n LINES.
...
[SELECTION-SCREEN TAB (len) tab USER-COMMAND fcode
[DEFAULT [PROGRAM prog] SCREEN dynnr].]
...
SELECTION-SCREEN END OF BLOCK tblock.
1. ... USER-COMMAND fcode
2. ... DEFAULT [PROGRAM prog] SCREEN dynnr
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.
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 of a maximum of two characters, which must not exceed 79. If the width of all the tab titles is greater than the width of the area, the system automatically sets up a scroll bar so that you can access all the tab pages.
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.
If no SELECTION-SCREEN statement with the TAB addition 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 subscreendynpro on the selection screen. The subscreen dynpro is assigned dynamically (see below).
... USER-COMMAND fcode
Each tab title must be assigned a function code fcode
with the USER-COMMAND addition. The function codes
fcode must be specified directly and can contain a maximum of 20 characters. When the user
chooses a tab, the corresponding function code can be determined from the system field
sy-ucomm after the event AT SELECTION-SCREEN.
If a function code used in the GUI status of the selection screen is specified for fcode,
selection screen processing is influenced accordingly.
... DEFAULT [PROGRAM prog] SCREEN dynnr
Each tab title must be assigned a subscreen screen 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, an untreatable exception occurs.
Dynamic assignment
For each tabstrip area, a global structure with the same name is created in the current program. This structure has 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 has no effect. 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 pure subscreen area, that is, a tabstrip area without a tab title, dynamic assignment 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_SUBSCR).
Static assignment
If the addition DEFAULT is specified, the tab title is assigned the subscreen screen for the number dynnr of the program prog. You must specify the screen number and program 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, you can specify
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.
If an assigned subscreen screen 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 screen is a selection screen, user actions on the
subscreen lead to the event
AT SELECTION-SCREEN. These actions include selecting 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.
Definition of a tabstrip control mytab on the standard selection screen and inclusion of the selection screens 100 und 200, which are defined as subscreen screens, in an executable program. The assignment of the subscreen screens to the tab titles takes place dynamically. For an example of a static assignment with the addition DEFAULT, see SELECTION-SCREEN - AS SUBSCREEN.
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 sy-ucomm.
WHEN 'PUSH1'.
mytab-dynnr = 100.
WHEN 'PUSH2'.
mytab-dynnr = 200.
WHEN OTHERS.
...
ENDCASE.
...
ENDCASE.