ABAP Keyword Documentation → ABAP − Reference → SAP GUI User Dialogs → Selection Screens → Create Selection Screens → SELECTION-SCREEN → SELECTION-SCREEN - screen_elements → SELECTION-SCREEN - TABBED BLOCK
Tabstrip Controls on Selection Screens
The example demonstrates how tabstrips can be included 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.
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 DATA(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 places a tabstrip control area with three tab pages on the standard selection screen. A subscreen dynpro 300 (from the same program) is assigned statically to the third tab page.
The input/output fields of dynpro 300, p1
to q3
,
are created by applying the parameters from the ABAP program and are associated with the modification
group "MOD". The pushbutton has the function code TOGGLE. The screen flow logic for dynpro 300 is as follows:
PROCESS BEFORE OUTPUT.
MODULE init_0100.
PROCESS AFTER INPUT.
MODULE user_command_0100.
Both dialog modules are defined in the ABAP program.
The standard selection screen appears when the program is executed. At the event INITIALIZATION
,
the tab title texts are determined, the subscreen selection screen 100 is assigned initially to the tabstrip area, and the first tab title is enabled.
User actions on the selection screen are processed in the AT SELECTION-SCREEN
event block. In particular, it is here that the subscreens are assigned and tab titles activated when
the user chooses one of the first two tab titles. This is not necessary for the third tab title, since
the dynamic assignment (screen 300) is always placed in the structure mytab
when the user chooses it.
Before the subscreen screen is displayed, the PBO module init_0100
is executed.
User actions on the subscreen screen trigger the PAI module. This includes when the user chooses a tab title. After that, the AT SELECTION-SCREEN
event is triggered.
Messages in the status line show where an action has been processed.