手工写页签
效果图:
大致代码如下:
SELECTION-SCREEN BEGIN OF SCREEN 0100 AS SUBSCREEN .
PARAMETERS:
p_dwms TYPE zssdwmc AS LISTBOX VISIBLE LENGTH 30,
p_dwm TYPE zssdwdm NO-DISPLAY ."MATCHCODE OBJECT zmm00sh_zssdw. "单位码
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.
CASE sy-dynnr.
WHEN 1000.
CASE sy-ucomm.
WHEN 'BUT1'. " 'BUT1'
mytab-dynnr = 0100.
WHEN 'BUT2' " 'BUT2'
mytab-dynnr = 0300.
WHEN OTHERS.
ENDCASE.
ENDCASE.
"文件路径
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_file CHANGING p_file.
AT SELECTION-SCREEN OUTPUT.
*----------------------------------------------------------------------*
* 事件处理
*----------------------------------------------------------------------*
START-OF-SELECTION.
CASE mytab-dynnr.
WHEN 0100.
PERFORM frm_weihu_db.
WHEN 0300. "300屏幕的操作
PERFORM frm_down_up.
ENDCASE.
FORM frm_down_up .
DATA: l_mm TYPE string .
"ABAP memory是为了能控制返回时返回到哪个页签
l_mm = '0300'.
EXPORT l_mm TO MEMORY ID 'M1'.
FORM frm_init .
DATA: l_mm TYPE string .
text1 = ‘合理供货期维护’.
"合理供货期维护
text2 = ‘批量导入’.
"批量导入
IMPORT l_mm FROM MEMORY ID 'M1' .
"读取内存,获取当前处理页签
v_dynnr = l_mm.
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
代码仅仅做个简单的参考,具体细节自己拷过去改改就行