ABAP如何自定义下拉列表 .
1. 在选择屏幕上添加下拉列表控件, 代码如下: PARAMETERS: auart LIKE vapma-auart AS LISTBOX VISIBLE LENGTH 6 DEFAULT 'ZESC' OBLIGATORY. 2. 手工添加下拉列表数据, 代码如下: *&---------------------------------------------------------------------* *& Form fill_data_to_auart *&---------------------------------------------------------------------* * to fill data for combo auart. *----------------------------------------------------------------------* FORM fill_data_to_auart . TYPE-POOLS: vrm . "存放combobox内容的type pool DATA: name TYPE vrm_id, " list box的名称 list TYPE vrm_values, " list box的值 value LIKE LINE OF list . " list box的结构 REFRESH list . DEFINE fill_list. value-key = &1. "个就是变量P_LIST的值 value-text = &2. "这个是text append value to list. END-OF-DEFINITION. fill_list 'ZESC' 'ZESC'. fill_list 'ZESE' 'ZESE'. fill_list 'ZEDN' 'ZEDN'. fill_list 'ZEEN' 'ZEEN'. fill_list 'ZPBB' 'ZPBB'. fill_list 'ZPBE' 'ZPBE'. fill_list 'ZPDN' 'ZPDN'. fill_list 'ZPEN' 'ZPEN'. fill_list 'ZOCS' 'ZOCS'. fill_list 'ZASC' 'ZASC'. fill_list 'ZASE' 'ZASE'. fill_list 'ZADN' 'ZADN'. fill_list 'ZAEN' 'ZAEN'. "---〉调用函数显示listbox里面的值 CALL FUNCTION 'VRM_SET_VALUES' EXPORTING id = 'AUART' " PARAMETERS's Name values = list. ENDFORM. " fill_data_to_auart 3. 在 AT SELECTION-SCREEN OUTPUT. 事件中填充数据,代码如下: PERFORM fill_data_to_auart. 以上代码,ECC6环境下通过。