复选框、单选按钮、下拉列表的定义
1、定义复选框
REPORT ztest_sum. TABLES:mara,syst. PARAMETER p_box AS CHECKBOX USER-COMMAND comm1. "comm1是事件代码,控制语句at selection-screen.或者 start-of-selection过程捕获该单击事件 AT SELECTION-SCREEN. IF sy-ucomm = 'COMM1'. MESSAGE i001(00) WITH '单击复选框'. ENDIF.
2、定义单选按钮,同样可以加user-command comm1事件代码
REPORT ztest_sum. TABLES:mara,syst. PARAMETER: p_rad1 radiobutton group g1 user-command comm1, p_rad2 radiobutton group g1. AT SELECTION-SCREEN. IF sy-ucomm = 'COMM1'. MESSAGE i001(00) WITH '单击复选框'. ENDIF.
3.创建下拉列表
REPORT ztest_sum. TABLES:mara,syst. PARAMETER:p_lang(20) AS LISTBOX VISIBLE LENGTH 22. "顶一个下拉列表对象 AT SELECTION-SCREEN. IF sy-ucomm = 'COMM1'. MESSAGE i001(00) WITH '单击复选框'. ENDIF. PERFORM setlist. *&---------------------------------------------------------------------* *& Form setlist *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM setlist . TYPE-POOLS vrm. "引用字典对象TYPE-POOLS vrm用于保存列表对象 DATA values TYPE vrm_values WITH HEADER LINE. *对内表加载值,key为关键字也是列表回执的值,text为描述 values-key = 'CHINESE'. values-text = '中国人'. APPEND values. values-key = 'American'. values-text = '美国人'. APPEND values. values-key = 'english'. values-text = '英国人'. APPEND values. values-key = 'korean'. values-text = '韩国人'. APPEND values. CALL FUNCTION 'VRM_SET_VALUES' EXPORTING id = 'P_LANG' values = values[] * EXCEPTIONS * ID_ILLEGAL_NAME = 1 * OTHERS = 2 . IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. "setlist