首页 > 代码库 > ABAP 选择屏幕创建标签页

ABAP 选择屏幕创建标签页

*&---------------------------------------------------------------------*
*& Report  ZTEST_TAB
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZTEST_TAB.
TABLES MARA.
                                                             "定义子屏幕 100
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS: S_FG1 FOR MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECT-OPTIONS: S_FG2 FOR MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECT-OPTIONS: S_RAW FOR MARA-MATNR.
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_FG1.
   ELSEIF MYTAB-DYNNR = 200.
*    PERFORM GET_FG2.
   ELSEIF MYTAB-DYNNR = 300.
*    PERFORM GET_MATNR.
   ENDIF. 

 

ABAP 选择屏幕创建标签页