Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 14, 2009 at 12:42 PM

    Hi Tom,

    on initialization event, just give the key value (be sure to give the key value) to the listbox parameter.

    example:

    ***

    TYPE-POOLS : vrm.

    DATA: combo_id TYPE vrm_id,

    items TYPE vrm_values WITH HEADER LINE,

    item TYPE LINE OF vrm_values.

    ***

    selection-secreen begin of block b1.

    PARAMETERS: pp1(20) AS LISTBOX VISIBLE LENGTH 30.

    selection-screen end of block b1.

    ***

    • for your example

    loop at list.

    item-key = list-pos.

    item-text = list-value.

    APPEND item TO items. CLEAR item.

    endloop.

    *

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    id = 'PP1'

    values = items[]

    EXCEPTIONS

    id_illegal_name = 1

    OTHERS = 2.

    ***

    on initialization.

    pp1 = <your default value>.

    it gets the initial value..

    regards,

    Murat Kaya

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      thx for your fast answer. i checked it in the debugger and made a screen:

      http://www5.pic-upload.de/23.08.10/8132e7iepx1l.jpg

      I also tried to change it to add '1' to... in the filling form for the listbox. it does not work. seems that abap does not match my G_0300-ddlifnr = 1. (or = '1') to my first entry. Dont know why 😔

      g_dd_lb_value_key TYPE i. --> so imho it has to work without the ''....

      Maybe i have to try another key for my table, but i need one which i can increase in a loop, cause of not knowing how many values i'll have in my listbox.

      kind regards!

  • avatar image
    Former Member
    Jan 14, 2009 at 12:23 PM
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks pravin,

      is there no way to have a default value while working with VRM_SET_VALUES ?

      if i am not wrong, the parameters that most of you are telling me to use, is only for selectionscreens but i am dinamicaly filling a dropdown inside a report dynpro

  • avatar image
    Former Member
    Jan 14, 2009 at 12:26 PM
    PARAMETERS p_carrid TYPE spfli-carrid 
                        AS LISTBOX VISIBLE LENGTH 20 
                        USER-COMMAND onli 
                        *DEFAULT 'LH' *.

    regards,

    Jinson

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2009 at 12:30 PM

    hI,

    try liek this

    for example.

    PARAMETER: pr_spart TYPE spart AS LISTBOX VISIBLE LENGTH 7 default 'HL'.

    'HL' is one of the value that is there in the list box.

    Regards,

    Nagaraj

    Add comment
    10|10000 characters needed characters exceeded