cancel
Showing results for 
Search instead for 
Did you mean: 

How to select drop down based on country selected in one field

Former Member
0 Kudos

Dear Experts,

I am facing a problem,

I have a table in webdynpro, where there are two columns namely Country and its Subtype.

here both the fields are drop down by key type.

when i am selecting Country field from drop down. I am getting its subtype correctly populated in other column.

But when i am selecting the country in next row, It is removing the subtype text of 1st row and giving its code.

Also Now In Column Subtype, It is Showing the dropdown related to the current selected country.

Kindly help.

Regards

Sushil

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member193460
Contributor
0 Kudos

Hi Sushil,

     i had a similar requirement in my previous project and as stated by Rama, we need to use dropdownbyIndex to implement the second dropdown.

In dropdown by index,we can use context to dynamically load the data depending on your first dropdown list selection.

Regards,

Tashi

ramakrishnappa
Active Contributor
0 Kudos

Hi Sushil,

You need to go for DropDownByIndex for column "Subtype", to hold different set of values based on the value of country value per row.

DropDownByKey ui element holds only one set of value at any given point of time per attribute in whole context. So you cannot use it in your case.

Please refer the below document which suits your requirement.

Hope this helps you.


Regards,

Rama

harsha_jalakam
Active Contributor
0 Kudos

Hi Sushil,

I guess the value for subtype is depending on the country value, which is fetch from the static value( Usually lead selected value). To avoid this we can either set the current row as lead selected row before populating subtype value or with the following code which will give the element value for the row which is selected rather than the lead selected row and then pass the value for fetching country type.

data: lr_element type ref to if_wd_context_element.
lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ). " Wdevent is the paramter in the                                                                                                              "event handler


Regards,

Harsha

amy_king
Active Contributor
0 Kudos

Hi Sushil,

I've seen this happen when the key value you set for a dropdown is not actually defined as part of its value set, so the framework isn't able to select a corresponding text for the key. When you set value ABC as the selected Subtype, make sure that key is defined in its value set.

Can you share with us your code for the Country column's onSelect event?

Cheers,

Amy