PARAMETERS p_carri2 LIKE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20
USER-COMMAND lst 有一个下拉框 AS LISTBOX VISIBLE 属性 下面针对这个下拉框属性做一个简单的示例介绍。
------------------定义下拉框---------------------------*
DATA: g_vrm_id TYPE vrm_id VALUE 'P_SUB', "绑定到一定的字段上
lt_vrm_values TYPE vrm_values,"值列 表
ls_vrm_values LIKE LINE OF lt_vrm_values.
*DATA: c2 TYPE c LENGTH 2.
*------------------定义下拉框---------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001. "定义显示框
PARAMETERS: p_sub LIKE zmtnumber-zzsub1
AS LISTBOX VISIBLE LENGTH 10
DEFAULT '语文' USER-COMMAND zzsub. "定义下拉列表框
SELECTION-SCREEN END OF BLOCK bk1.
AT SELECTION-SCREEN OUTPUT. "屏幕元素事件
PERFORM getdata USING g_vrm_id. "将参数传入程序块中
FORM getdata USING g_vrm_id.
REFRESH lt_vrm_values . "给下拉列表赋值
ls_vrm_values-key = '01'.
ls_vrm_values-text = '语文'.
APPEND ls_vrm_values TO lt_vrm_values.
CLEAR ls_vrm_values.
ls_vrm_values-key = '02'.
ls_vrm_values-text = '数学'.
APPEND ls_vrm_values TO lt_vrm_values.
CLEAR ls_vrm_values.
ls_vrm_values-key = '03'.
ls_vrm_values-text = '英语'.
APPEND ls_vrm_values TO lt_vrm_values.
CLEAR ls_vrm_values.
CALL FUNCTION 'VRM_SET_VALUES' "调用函数
EXPORTING
id = g_vrm_id
values = lt_vrm_values
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.