Dropdown box on Selection-Screen

Problem: you want to put a list drop down box on a Selection-Screen.

Solution: it is simple. Below is a code which will allow you to do exactly that.

TYPE-POOLS:
  vrm.
 
PARAMETERS: p_month TYPE i AS LISTBOX VISIBLE LENGTH 3.
 
DATA:
  lv_parameter TYPE vrm_id,
  ls_values TYPE vrm_value,
  lt_values TYPE vrm_values.
 
lv_parameter = 'P_MONTH'. "name of the drop down box parameter
DO 12 TIMES.
  ls_values-key = sy-index.
  ls_values-text = sy-index.
  APPEND ls_values TO lt_values.
ENDLOOP.
SORT lt_values BY key ASCENDING.
 
CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    id     = lv_parameter
    values = lt_values.
TYPE-POOLS:
  vrm.

PARAMETERS: p_month TYPE i AS LISTBOX VISIBLE LENGTH 3.

DATA:
  lv_parameter TYPE vrm_id,
  ls_values TYPE vrm_value,
  lt_values TYPE vrm_values.

lv_parameter = 'P_MONTH'. "name of the drop down box parameter
DO 12 TIMES.
  ls_values-key = sy-index.
  ls_values-text = sy-index.
  APPEND ls_values TO lt_values.
ENDLOOP.
SORT lt_values BY key ASCENDING.

CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    id     = lv_parameter
    values = lt_values.

Komentowanie jest zakończone.