12.6. 按钮、单选复选框、下拉框的FunCode
如果复选框与单选按钮没有设置Function Code,则它们就会像普通的输入框一样,即使状态发生了改变,也不会触发PAI事件
对话屏幕中的按钮、复选框、单选按钮、下拉框的Function Code都是通过屏幕元素 attributes来设置的;选择屏幕中的FunCode则通过USER-COMMAND选项来设置
12.6.1. 选择屏幕中的按钮
SELECTION-SCREEN:) but1 USER-COMMAND cli1.
INITIALIZATION.
but1 = 'Button 1'."可直接设置按钮上的标签文本
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'CLI1'.
ENDCASE.
12.6.2. 选择屏幕中的单选/复选按钮:点击时显示、隐藏其他屏幕元素
更多请参考动态修改屏幕章节
.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE t.
PARAMETERS: p3 TYPE c LENGTH 10 MODIF ID bl2,
p4 TYPE c LENGTH 10 MODIF ID bl2.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME .
PARAMETERS: p5 TYPE c LENGTH 10 MODIF ID bl3,
p6 TYPE c LENGTH 10 MODIF ID bl3.
SELECTION-SCREEN END OF BLOCK b3.
INITIALIZATION.
t = '----ALL----'.
"单先与复选框、下拉列表项点击触发PAI后,接下来还会触发屏幕的PBO(回车也是这样),但如果点击的是执行按钮,则不会接着触发屏幕的PBO,除非没有输出或在Basic List列表页面上点击返回按钮时,才会触发PBO
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF show_all = 'X' AND screen-group1 = 'BL2'.
screen-active = '1'."显示
MODIFY SCREEN.
ELSEIF screen-group1 = 'BL2'.
screen-active = '0'."隐藏
MODIFY SCREEN.
ENDIF.
IF show = 'X' AND screen-group1 = 'BL3'.
screen-active = '1'.
MODIFY SCREEN.
ELSEIF screen-group1 = 'BL3'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.