效果圖:
ide
demo代碼spa
須要特別注意的是abap memory的應用blog
文本版:事件
*&---------------------------------------------------------------------*
*& Report ZLM_SCREEN3
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zlm_screen3.
TABLES:mara.
SELECTION-SCREEN BEGIN OF SCREEN 0100 AS SUBSCREEN .
PARAMETERS:
p_dwms TYPE char1 AS LISTBOX VISIBLE LENGTH 30,
p_dwm TYPE string NO-DISPLAY.
SELECT-OPTIONS:
s_matnr FOR mara-matnr .
SELECTION-SCREEN END OF SCREEN 0100.
SELECTION-SCREEN BEGIN OF SCREEN 0300 AS SUBSCREEN.
PARAMETERS: rb_down RADIOBUTTON GROUP rad1, "下載模版
rb_up RADIOBUTTON GROUP rad1, "導入數據
p_file LIKE rlgrap-filename. "文件路徑
SELECTION-SCREEN END OF SCREEN 0300.
SELECTION-SCREEN BEGIN OF TABBED BLOCK mytab FOR 4 LINES."子屏幕的行數
SELECTION-SCREEN TAB (6) text1 USER-COMMAND but1.
SELECTION-SCREEN TAB (10) text2 USER-COMMAND but2.
SELECTION-SCREEN END OF BLOCK mytab.
*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION . "給標籤賦值
PERFORM frm_init.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN.
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sy-dynnr.
WHEN 1000.
CASE sy-ucomm.
WHEN 'BUT1'. " 'BUT1'
mytab-dynnr = 0100.
WHEN 'BUT2'. " 'BUT2'
mytab-dynnr = 0300.
WHEN OTHERS.
ENDCASE.
ENDCASE.
*----------------------------------------------------------------------*
* 事件處理
*----------------------------------------------------------------------*
START-OF-SELECTION.
CASE mytab-dynnr.
WHEN 0100.
MESSAGE '1' TYPE 'I'.
WHEN 0300. "300屏幕的操做
DATA: lv_subscreen TYPE string .
"ABAP memory是爲了能控制返回時返回到哪一個頁籤
lv_subscreen = '0300'.
EXPORT lv_subscreen TO MEMORY ID 'M1'.
MESSAGE '2' TYPE 'I'.
ENDCASE.
FORM frm_init .
DATA: lv_subscreen TYPE string .
text1 = '頁籤一'.
text2 = '頁籤二'.
IMPORT lv_subscreen FROM MEMORY ID 'M1' . "讀取內存,獲取當前處理頁籤
DATA(v_dynnr) = lv_subscreen.
mytab-prog = sy-repid.
IF v_dynnr = space.
mytab-dynnr = 0100.
mytab-activetab = 'BUT1'. " 'BUT1'
ELSE.
mytab-dynnr = v_dynnr.
IF v_dynnr = 0300 .
mytab-activetab = 'BUT2'. "'BUT2'
ENDIF.
ENDIF.
ENDFORM. " FRM_INIT
圖片