2011年3月30日 星期三

[Code] SubScreen

Defines the selection screen as tabbed views as subscreen
* ----------------
* SELECTION-SCREEN
* ----------------
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
  <put parameters or select-options in here>
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
  <put parameters or select-options in here>
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 6 LINES,
                  TAB (20) text-t02 USER-COMMAND push1
                                   DEFAULT SCREEN 100,
                  TAB (20) text-t03 USER-COMMAND push2
                                   DEFAULT SCREEN 200,
                  END OF BLOCK mytab.

* --------------
* INITIALIZATION
* --------------
INITIALIZATION.
  IMPORT gv_flag FROM MEMORY ID 'ZPROGRAM'.
  IF gv_flag = '2'.
    mytab-dynnr = 200.
    mytab-activetab = 'PUSH2'.
  ELSE.
    gv_flag = '1'.
    mytab-dynnr = 100.
    mytab-activetab = 'PUSH1'.
  ENDIF.

* -------------------
* AT SELECTION-SCREEN
* -------------------
AT SELECTION-SCREEN.
  IF sscrfields-ucomm = 'PUSH1'.
    gv_flag = '1'.
  ELSEIF sscrfields-ucomm = 'PUSH2'.
    gv_flag = '2'.
  ENDIF.
  EXPORT gv_flag TO MEMORY ID 'ZPROGRAM'.