How to create parameter as listbox in ABAP/4

You can create parameter as listbox by applying statement ’PARAMETER ... AS LISTBOX ...’.

Example

TYPE-POOLS: vrm.

DATA: it_list TYPE VRM_VALUES,
      list_value TYPE VRM_VALUE.

PARAMETERS: p_list(20) TYPE C AS LISTBOX VISIBLE LENGTH 15.

AT SELECTION-SCREEN OUTPUT.
  list_value-key = ’AAAA’.
  list_value-text = ’AAAA Show Text’.
  append list_value to it_list.
  list_value-key = ’AAAB’.
  list_value-text = ’AAAB Show Text’.
  append list_value to it_list.
  list_value-key = ’AAAC’.
  list_value-text = ’AAAC Show Text’.
  append list_value to it_list.
  list_value-key = ’AAAD’.
  list_value-text = ’AAAD Show Text’.
  append list_value to it_list. 

CALL FUNCTION ’VRM_SET_VALUES’
    EXPORTING
      ID                    = ’P_LIST’
      VALUES                = it_list
    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.

START-OF-SELECTION.
  WRITE:/ ’P_LIST parameter have value: ’, p_list.

The output is:
 img57

Technorati Tags: ,

Post new comment