Skip to Content

How to Populate a listbox based on another listbox selection. Please help!

Hi Experts,

I have a requirement where I have two listboxs(dropdown list) in a selection screen. I have to populate the second listbox based on the selected item from the first listbox. How to do this?

I have created a listbox in a selection screen using

Parameters: p_soldto as listbox visible length 30 user-command chg,

p_shipto as listbox visible length 30.

Then I have tried to look at the value of item selected from first listbox in AT SELECTION-SCREEN OUTPUT, But I am not getting any value of p_soldto.

I think I am doing something wrong. I think I have to use some event handling like on selection of an item from listbox. But I don't see any such event handing in ABAP.

Please give me some code example.

Please help!

Thanks

Gopal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Sep 02, 2006 at 05:14 AM

    HI,

    Check this program, it is using a list box and filling values into it at initilization event.

    <b>REPORT ztest2.
    
    TYPE-POOLS : vrm.
    tables: bkpf.
    
    DATA : values TYPE vrm_values.
    DATA : wa LIKE LINE OF values.
    
    PARAMETERS : list_box(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
    
    PARAMETERS: dd type bkpf-BSTAT user-command abc.
    
    select-options: a for bkpf-bukrs MODIF ID buk.
    
    select-options: b for bkpf-belnr MODIF ID SEL.
    
    
    at selection-screen output.
      If list_box = 2.
        loop at screen.
    
          if screen-group1 = 'SEL'.
            screen-input = 0.
            modify screen.
          endif.
    
        endloop.
    
      endif.
    
    
    INITIALIZATION.
    
      wa-key = '1'.
      wa-text = 'Orange'.
      APPEND wa TO values.
    
      wa-key = '2'.
      wa-text = 'Red'.
      APPEND wa TO values.
    
      wa-key = '3'.
      wa-text = 'Blue'.
      APPEND wa TO values.
    
      wa-key = '4'.
      wa-text = 'Gray'.
      APPEND wa TO values.
    
    
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id              = 'LIST_BOX'
                values          = values
           EXCEPTIONS
                id_illegal_name = 1
                OTHERS          = 2.</b>

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2006 at 06:23 AM

    hi Gopal,

    I found that this thread matches to your requirement ...

    have a look at this

    dynamic-listbox

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2006 at 09:39 AM

    Hi Gopal,

    You can refer SAP Help which discusses the similar scenario with an example.

    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm

    <b>Award points if found useful.</b>

    Regards,

    SP.

    Add a comment
    10|10000 characters needed characters exceeded

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.