cancel
Showing results for 
Search instead for 
Did you mean: 

Populating a dropdown list based on the selected item from another. Help!

gopalkrishna_baliga
Participant
0 Kudos

Hi Experts,

I have a two dropdowns in webdynpro for ABAP.

Plant:

Ship to Party:

The 'Ship to Party' dropdown should be populated based on the selected item from 'Plant' dropdown list. In other words, 'Ship to party' should list values for the selected plant.

Kindly provide some example to acheive this using wendynpro ABAP. Any sample code will be really appreciated.

Thanks

Gopal

Message was edited by:

gopalkrishna baliga

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gopa.

You can achieve this in several ways.

One way would be to create a context structure like:

- node plant (0..n)

--- plant type werks

--- node ship_to (0...n / singleton)

-


kunnr type kunnr

Now you can create a supply method for the node ship_to. In this supply method

you have a reference to the parent element (plant). Read the selected plant from

that element and select your corresponding ship to parties. Now you can bind this internal table to the ship_to node using the reference node:

node->bind_table( ship_to_table ).

The supply method of the ship_to node is going to be called each time the lead

selection of the parent node (plant) changes, which is when a user select

something in the plant drop down list.

Then create a supply method for the plant node where you just select all plants

and bind them to the reference node.

Hope this helps.

Cheers,

Sascha

former_member758419
Active Participant
0 Kudos

Hi,

Try using Dropdownbyindex. Declare a context node for Plant[PLANT] and have attribute of type string inside it to hold the different plants. Have a supply function[showships()] for it to populate the plants. Declare a subnode for the context node PLANT by name Ship_to_party and have a attribute inside it to hold the different parties. Have a supply function[showparties()] for Ship_to_party subnode where u check for the selected ship and then populate the required party lists.

example:

method showships.

data:

itab_plant type if_componentcontroller=>elements_plant,

stru_plant like line of itab_plant.

select planttext from planttable into table itab_plant.

node->bind_table( new_items = itab_plant ).

endmethod.

Hope this helps,

Sachi