1 效果图如下:
选择屏幕3个子屏幕。
2 代码实现如下:
REPORT ZTEST32.
TABLES bkpf.
"定义子屏幕 100
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
PARAMETERS:p_bukrs1 type bkpf-bukrs default '6000' .
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS:p_bukrs2 type bkpf-bukrs default '1000' .
SELECTION-SCREEN END OF SCREEN 200.
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
PARAMETERS:p_bukrs3 type bkpf-bukrs default '2000' .
SELECTION-SCREEN END OF SCREEN 300.
"定义一个TAB空间, 取名为MYTAB, 控件高2行, 共分为三个页签.
"三个页签的功能代码分别为push1, push2, push3.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK MYTAB FOR 2 LINES,
TAB (25) BUTTON1 USER-COMMAND PUSH1,
TAB (25) BUTTON2 USER-COMMAND PUSH2,
TAB (25) BUTTON3 USER-COMMAND PUSH3,
END OF BLOCK MYTAB.
"为TAB控件分配初始化值
INITIALIZATION.
BUTTON1 = TEXT-010.
BUTTON2 = TEXT-020.
BUTTON3 = TEXT-030.
MYTAB-PROG = SY-REPID.
MYTAB-DYNNR = 100.
"为控件页签单击事件, 选择不同页签显示不同子屏幕.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PUSH1'.
MYTAB-DYNNR = 100.
MYTAB-ACTIVETAB = 'BUTTON1'.
WHEN 'PUSH2'.
MYTAB-DYNNR = 200.
MYTAB-ACTIVETAB = 'BUTTON2'.
WHEN 'PUSH3'.
MYTAB-DYNNR = 300.
MYTAB-ACTIVETAB = 'BUTTON3'.
ENDCASE.
"处理各个屏幕的触发
START-OF-SELECTION.
IF MYTAB-DYNNR = 100.
* PERFORM GET_DATA1.
ELSEIF MYTAB-DYNNR = 200.
* PERFORM GET_DATA2.
ELSEIF MYTAB-DYNNR = 300.
* PERFORM GET_DATA3.
ENDIF.