1、SELECTION-SCREEN:FUNCATION KEY
步骤一:声明应用sscrfields table
TABLES sscrfields.
步骤二:在INITIALIZATION事件中添加文本描述
INITIALIZATION .
sscrfields-functxt_01 = '配置表1'.
sscrfields-functxt_02 = '配置表2'.
sscrfields-functxt_03 = '配置表3'.
步骤三:在AT SELECTION-SCREEN中判断SY-UCOMM和SSCRFIELDS-UCOMM中做判断
CASE sscrfields-ucomm. "SY-UCOMM
WHEN 'FC01'.
WHEN 'FC02'.
WHEN 'FC03'.
WHEN 'FC04'.
WHEN 'FC05'.
ENDCASE.
2、SELECTION-SCREEN:PUSHBUTTON
SELECTION-SCREEN:PUSHBUTTON 1(5) TEXT-002 USER-COMMAND cli1.
3、屏幕按钮控制某个字段的显示和隐藏
效果1:按钮控制一个字段的显示和隐藏
"选择屏幕字段
SELECTION-SCREEN:BEGIN OF BLOCK block01 WITH FRAME TITLE TEXT-001.
PARAMETERS p_matnr TYPE matnr .
SELECTION-SCREEN:END OF BLOCK block01.
"按钮
SELECTION-SCREEN:PUSHBUTTON 1(5) TEXT-002 USER-COMMAND cli1.
AT SELECTION-SCREEN OUTPUT .
"字段的显示和隐藏 active的值0为显示,1为隐藏
LOOP AT SCREEN .
IF screen-name CP '*P_MATNR*'.
screen-active = lv_button.
ENDIF.
MODIFY SCREEN .
ENDLOOP.
AT SELECTION-SCREEN .
"sscrfields中返回按钮的UCOMM
"实现功能:点击按钮的时候控制按钮的显示和输出
IF sscrfields-ucomm = 'CLI1'.
IF lv_button = '1'.
lv_button = '0'.
ELSE .
lv_button = '1'.
ENDIF.