Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Listbox default value.

Hello,

i have generated a dropdown list using the VRM_SET_VALUES FM, but i can"t set the default value to this list.

here is a sample of my code :

SELECT  pos value
  FROM zfee_scr_param
  INTO TABLE list
  WHERE fieldname = 'CDL'.
  SORT list BY key.
  name = 'ADRSTREET-ZZ_CONTR_LOC'.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = list.

Thank you,

Tom.

Tags:
Former Member
replied

hi Tom,

as i understand your combo field is not on selection-screen but you can do the same on screen element as well. just create a PBO module and fill your internal table and listbox there.

example:

IN PBO MODULE

CLEAR : items,items[], item.

combo_id = 'GT_MAIN-REASON'.

item-key = '1'.

item-text = 'TOURISTIC'.

APPEND item TO items. CLEAR item.

item-key = '2'.

item-text = 'BUSINESS'.

APPEND item TO items. CLEAR item.

item-key = '3'.

item-text = 'EDUCATION'.

APPEND item TO items. CLEAR item.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = combo_id

values = items[]

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

READ TABLE items WITH KEY key = gt_main-reason.

gt_main-reason_tx = items-text.

    • this fills your listbox on the screen (change the names accordingly)

IF gt_main-reason IS INITIAL.

gt_main-reason = '1'.

ENDIF.

    • this part looks if the field is empty and gives the initial value 'TOURISTIC' (key value is 1 for TOURISTIC)

no need to take points back

regards,

Murat Kaya

Edited by: Murat Kaya on Jan 14, 2009 3:37 PM

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question