Skip to Content
avatar image
Former Member

Selection field as Drop down list

Hi experts can any one explain how can we create Drop down list in Selection screen.

and What is the F.M. used for that..?

I think using VRM we can do it. Please guide me?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 20, 2007 at 06:28 AM

    Hi,

    use this

    TYPE-POOLS: VRM.

    DATA: NAME TYPE VRM_ID,

    LIST TYPE VRM_VALUES,

    VALUE LIKE LINE OF LIST.

    data: BEGIN OF itab OCCURS 0,

    belnr type BELNR_D,

    end of itab.

    PARAMETERS: P_BELNR TYPE BELNR_D AS LISTBOX VISIBLE LENGTH 20.

    AT SELECTION-SCREEN OUTPUT.

    NAME = 'P_BELNR'.

    select belnr from bsis into table itab up to 10 rows.

    loop at itab.

    VALUE-KEY = VALUE-KEY + 1.

    VALUE-TEXT = itab-belnr.

    append value to list.

    endloop.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    ID = NAME

    VALUES = LIST.

    thanks & regards,

    Venkatesh

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 20, 2007 at 06:30 AM

    Hi Vamsi, Check out this code

    TYPE-POOLS : vrm.
    PARAMETER : p_int AS LISTBOX VISIBLE LENGTH 10.
    
    DATA : name  TYPE vrm_id,
           list  TYPE vrm_values,
           value LIKE LINE OF list.
    
    
    AT SELECTION-SCREEN OUTPUT.
      name = 'P_INT'.
    
      value-key = '1'.
      value-text = 'One'.
      APPEND value TO list.
      value-key = '2'.
      value-text = 'Two'.
      APPEND value TO list.
    
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id     = name
                values = list.
      CLEAR list.
    

    Regards

    Gopi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 06:31 AM

    Hi,

    TYPE-POOLS: vrm.

    PARAMETER: pr_spart TYPE spart AS LISTBOX VISIBLE LENGTH 7.

    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_spart.

    INITIALIZATION.

    *----Code for Drop down list....

    DATA: lit_spart_list TYPE vrm_values, "Table for list of Divisions

    lwa_spart_list TYPE vrm_value,

    lw_name TYPE vrm_id. "Name of parameter with list-box.

    *---Assign selected values to table that would be passed to FM VRM_SET_VALUES

    CLEAR : lwa_spart_list,

    lw_name.

    *---Pass required values for list-box display.

    lwa_spart_list-key = 'H'.

    lwa_spart_list-text = 'HL'.

    APPEND lwa_spart_list TO lit_spart_list.

    lwa_spart_list-key = 'S'.

    lwa_spart_list-text = 'SL'.

    APPEND lwa_spart_list TO lit_spart_list.

    lwa_spart_list-key = 'P'.

    lwa_spart_list-text = 'PP'.

    APPEND lwa_spart_list TO lit_spart_list.

    lwa_spart_list-key = 'F'.

    lwa_spart_list-text = 'FR'.

    APPEND lwa_spart_list TO lit_spart_list.

    *Name of parameter to which list is to be assigned

    lw_name = 'PR_SPART'.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    id = lw_name

    values = lit_spart_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.

    Regards,

    nagaraj

    Add comment
    10|10000 characters needed characters exceeded