How ABAP customizes dropdown lists.

1. Add a drop-down list control on the selection screen, the code is as follows:

  PARAMETERS: auart LIKE vapma-auart AS LISTBOX   VISIBLE LENGTH 6 

    DEFAULT 'ZESC' OBLIGATORY.

2. Manually add drop-down list data, the code is as follows:

  *&---------------------------------------------------------------------*
*&      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 OFlist . " The structure of the list box

  REFRESH list .

  DEFINE fill_list.
    value -key = & 1 .   " This is the value of the variable P_LIST 
    value-text = & 2 . " This is 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 ' REAR '  REAR ' . _
  fill_list ' ZAEN '  ' ZAEN ' .

  " ---> Call the function to display the value in the listbox 
  CALL  FUNCTION  ' VRM_SET_VALUES ' 
    EXPORTING 
      id      = ' AUART '   " PARAMETERS's Name 
      values ​​= list.
 ENDFORM .                     " fill_data_to_auart

 

3. Fill data in the AT  SELECTION-SCREEN  OUTPUT . event, the code is as follows:

    PERFORM fill_data_to_auart.

 

The above code is passed in ECC6 environment.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325310398&siteId=291194637