Wednesday, March 16, 2022

Drop Down lists in the selection parameters

PROGRAM ztest.

 TYPE-POOLS: vrm.

 DATA: name TYPE vrm_id,

       list TYPE vrm_values,

       value LIKE LINE OF list.

 

PARAMETERS: ps_parm(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

  name = 'PS_PARM'.

  value-key = '1'.

  value-text = 'Line 1'.

  APPEND value TO list.

  value-key = '2'.

  value-text = 'Line 2'.

  APPEND value TO list.

  CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING id     = name

              values = list.

             

START-OF-SELECTION.

  WRITE: / 'Parameter:', ps_parm.

report test1.

type-pools: vrm.

data: it_val type vrm_values,

      w_line like line of it_val.

parameters p_bukrs like t001-bukrs as listbox

           visible length 25 obligatory.

 

initialization.

  select bukrs butxt from t001 into (w_line-key, w_line-text).

    append w_line to it_val.

    check p_bukrs is initial.

    p_bukrs = w_line-key.

  endselect.

 

at selection-screen output.

  call function 'VRM_SET_VALUES'

       exporting

            id     = 'P_BUKRS'

            values = it_val.

 

end-of-selection.

  write: / 'Company Code:', p_bukrs.