Skip to Content
author's profile photo Former Member
Former Member

Populate value into dropdownlist

Is it possible to populate value of a dropdownlist?

I will want what is inside my dropdownlist to have values according to this SQL statement.

-


Select distinct PROGRAM_ID from ZPROGRAM_TABLE

-


How am I suppose to do this? Any codes example?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2008 at 08:33 AM

    HI

    This is correct like based on the import parameter, we can write the query and finally export the value.

    Ex:-

    select roledes into e_roledesc from zse_role where rolecd = i_rolecd.

    endselect.

    reward if help.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2008 at 11:31 AM

    check this it might give u some clue.

    PARAMETERS P_PLANT TYPE STR AS LISTBOX VISIBLE LENGTH 10.

    TYPE-POOLS: VRM.

    DATA: T_PLANT type vrm_values.

    INITIALIZATION.

    APPEND '1000' TO T_PLANT.

    APPEND '3200' TO T_PLANT.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    id = 'P_PLANT'

    values = T_PLANT.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      str is for type string.

      its not necessary to give this type u can give ur own type also..its just a parameter definition...the thing to be noted is addition - as listbox.

      p_plant is the parameter for which u want a listbox.

      and declare any variable of type vrm_values (here it is t_plant),

      this (t_plant) will hold all those values which u want to display in the dropdown.

      Edited by: Kamini Rawat on Jan 28, 2008 5:48 AM

  • Posted on Jan 25, 2008 at 05:00 AM

    Use the below code.

    TYPE-POOLS : VRM.

    DATA : VAL TYPE VRM_VALUES.

    DATA : DROPDOWN LIKE LINE OF VAL.

    DROPDOWN-TEXT = 'Ticket Booking'.

    APPEND DROPDOWN TO VAL.

    DROPDOWN-TEXT = 'Electricity Bill Payment'.

    APPEND DROPDOWN TO VAL.

    DROPDOWN-TEXT = 'Telephone Bill Payment'.

    APPEND DROPDOWN TO VAL.

    DROPDOWN-TEXT = 'E-Shop'.

    APPEND DROPDOWN TO VAL.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    ID = 'CREDITUSAGE' /////// Your list box name.....

    VALUES = VAL

    EXCEPTIONS

    ID_ILLEGAL_NAME = 1

    OTHERS = 2.

    Thanks

    Anand D

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 06:23 AM

    Try This code.

    data: it_itab type standard table of vrm_value,

    wa_itab type vrm_value.

    DATA : K TYPE I VALUE 1.

    select DISTINCT PROGRAM_ID from ZPROGRAM_TABLE

    into table itab.

    loop at itab.

    clear wa_itab.

    wa_itab-key = K .

    wa_itab-text = itab-ename.

    append wa_itab to it_itab.

    K = K + 1.

    endloop.

    call function 'VRM_SET_VALUES'

    exporting

    id = 'L1' "Here use your input box name in which you need dropdown

    values = it_itab

    exceptions

    id_illegal_name = 1

    others = 2.

    • hERE L1 IS NAME OF THE LISTBOX

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I got an error when I put this codes:

      -


      data: itab type standard table of ZPROGRAM_TABLE WITH HEADER LINE,

      wa_itab type ZPROGRAM_TABLE.

      DATA : K TYPE I VALUE 1.

      START-OF-SELECTION.

      CALL SCREEN 1000.

      ----


      • MODULE STATUS_1000 OUTPUT

      ----


      *

      ----


      MODULE STATUS_1000 OUTPUT.

      SET PF-STATUS 'SCREEN_1000'.

      SET TITLEBAR 'TITLE_1000'.

      select DISTINCT PROGRAM_ID from ZPROGRAM_TABLE

      into table itab.

      loop at itab.

      clear wa_itab.

      wa_itab-PROGRAM_ID = K .

      wa_itab-PROGRAM_CODE = itab-PROGRAM_CODE.

      append wa_itab to itab.

      K = K + 1.

      endloop.

      call function 'VRM_SET_VALUES'

      exporting

      id = 'ZDROPDOWNLIST' "Here use your input box name in which you need dropdown

      values = itab

      exceptions

      id_illegal_name = 1

      others = 2.

      ENDMODULE. "STATUS_1000 OUTPUT

      -


      Here is the link of how the error look like:

      http://img529.imageshack.us/img529/9650/screenee6.png

      Can someone tell me how to solve it and where is the error?

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.