ALV选择屏幕选项卡
运行效果:
代码:
*&--------------------------------------------------------------------* *& REPORT ZQMRTEST *&--------------------------------------------------------------------* *& *&--------------------------------------------------------------------* REPORT ZQMRTEST. TABLES: MARA,QALS,AFPO. DATA: BEGIN OF GT_DATA OCCURS 0, PRUEFLOS LIKE QALS-PRUEFLOS, MSG TYPE STRING, END OF GT_DATA. *-->ALV TYPE-POOLS SLIS. DATA: GS_LAYOUT TYPE SLIS_LAYOUT_ALV, GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV. SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. PARAMETERS: P_WERKS LIKE MARC-WERKS DEFAULT '2000' OBLIGATORY, P_TYPE LIKE QALS-HERKUNFT DEFAULT '89' OBLIGATORY, P_MATNR LIKE MARC-MATNR, P_MENGE LIKE QALS-LOSMENGE, P_KDAUF LIKE AFPO-KDAUF, P_KDPOS LIKE AFPO-KDPOS. SELECTION-SCREEN END OF SCREEN 100. SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. PARAMETERS: P_WERKS2 LIKE MARC-WERKS DEFAULT '2000' OBLIGATORY, P_TYPE2 LIKE QALS-HERKUNFT DEFAULT '89' OBLIGATORY, P_MATNR2 LIKE MARC-MATNR, P_MENGE2 LIKE QALS-LOSMENGE. SELECTION-SCREEN END OF SCREEN 200. "定义一个TAB空间, 取名为MYTAB, 控件高10行, 共分为二个页签. SELECTION-SCREEN: BEGIN OF TABBED BLOCK MYTAB FOR 10 LINES, TAB (25) BUTTON1 USER-COMMAND PUSH1, TAB (25) BUTTON2 USER-COMMAND PUSH2, END OF BLOCK MYTAB. ************************************************************************ * INITIALIZATION ************************************************************************ "为TAB控件分配初始化值 INITIALIZATION. BUTTON1 = TEXT-010. BUTTON2 = TEXT-020. MYTAB-PROG = SY-REPID. MYTAB-DYNNR = 100. ************************************************************************ * AT SELECTION SCREEN ************************************************************************ "为控件页签单击事件, 选择不同页签显示不同子屏幕. AT SELECTION-SCREEN. CASE SY-UCOMM. WHEN 'PUSH1'. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'BUTTON1'. WHEN 'PUSH2'. MYTAB-DYNNR = 200. MYTAB-ACTIVETAB = 'BUTTON2'. ENDCASE. "处理各个屏幕的触发 ************************************************************************ * AT SELECTION SCREEN OUTPUT ************************************************************************ AT SELECTION-SCREEN OUTPUT. ************************************************************************ * REPORT FORMAT ************************************************************************ TOP-OF-PAGE. END-OF-PAGE. ************************************************************************ * MAIN PROCESS ************************************************************************ START-OF-SELECTION. END-OF-SELECTION.