initialization.
data btab type table of sy-ucomm.append'ONLI' to btab.
call function 'RS_SET_SELSCREEN_STATUS'
exporting
p_status = sy-pfkey
tables
p_exclude = btab.
2.添加按钮(Tool Bar)
tables: sscrfields.
selection-screen begin of line.
selection-screen function key 1.
selection-screen function key 2.
selection-screen end of line.
initialization.
sscrfields-functxt_01 = icon_execute_object.
sscrfields-functxt_02 = icon_graphics.
3. 添加按钮(Screen)
selection-screen:
begin of line,
pushbutton 2(10) but01 user-command cli1,
end of line.
完整代码(可执行)
tables: sscrfields.
selection-screen begin of line.
selection-screen comment 1(5) text-001for field p1. "starting from 12
parameters : p1 type matnr. " this will take 10
selection-screen comment 50(10) lv_icon. "starting from 12
selection-screen function key 1.
selection-screen function key 2.
selection-screen end of line.
selection-screen skip 1.
selection-screen:
begin of line,
pushbutton 2(10) but01 user-command cli1,
end of line.
initialization.
sscrfields-functxt_01 = icon_execute_object.
sscrfields-functxt_02 = icon_graphics.
data btab type table of sy-ucomm.append'ONLI' to btab.
call function 'RS_SET_SELSCREEN_STATUS'
exporting
p_status = sy-pfkey
tables
p_exclude = btab.if lv_icon =''.
lv_icon = icon_led_yellow.
endif.
but01 ='测试按钮'.
at selection-screen.if sy-ucomm ='FC01'.
lv_icon = icon_led_green.
elseif sy-ucomm ='FC02'.
lv_icon = icon_led_red.
elseif sy-ucomm ='CLI1'.
lv_icon = icon_message_warning.
endif.