abap中利用select-screen来产生下拉列表框

 需要用到数据字典中的类型组:vrm和系统函数'VRM_SET_VALUES'

 代码如下:

REPORT  zrr_createdrplist .

PARAMETER:p AS LISTBOX VISIBLE LENGTH 22,

          name(20) TYPE c.

AT SELECTION-SCREEN OUTPUT.

  PERFORM setlist. 

FORM setlist .

type-pools vrm."include the type group vrm

  DATA: itab TYPE STANDARD TABLE OF vrm_value,"define a internal table

"which work area is vrm_value

       init,"avoid the data is laoded everytime

       line type vrm_value.

  line-key = 1.

  line-text = 'zrr'.

  APPEND line TO itab.

  line-key = 2.

  line-text = 'ycc'.

  APPEND line TO itab.

  line-key = 3.

  line-text = 'ww'.

  APPEND line TO itab.

  IF init IS INITIAL.

    CALL FUNCTION 'VRM_SET_VALUES'

      EXPORTING

        id = 'p'

        values = itab.

*     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.

  ENDIF.

ENDFORM.                    " setlist

你可能感兴趣的:(职场,abap,休闲,下拉列表框)