cancel
Showing results for 
Search instead for 
Did you mean: 

two dropdown by index lists connected

Former Member
0 Kudos

hello,

I have 2 tables connected

(for id_jud from table ytb_jud_iv i have n id_loc from table ytb_loc_iv)

In my component i want to insert two dropdown by index lists , one for the values from ytb_jud_iv and one for ytb_loc_iv

The question is how can i connect this two  for this result:

when i select a value from dropdown1 in dropdown2 appears the value corresponding the value for dropdown2.

Please help!

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Follow these steps :

1. Fill data into first drop down box using supply function..

2. Goto events in drop down box property and give action name to populate data into second drop down box ...

3.  Write the following code in action method to retrieve data based on first drop down..

     DATA lo_nd_list_1 TYPE REF TO if_wd_context_node.

     DATA lo_el_list_1 TYPE REF TO if_wd_context_element.

     DATA ls_list_1 TYPE wd_this->element_list_1.

     DATA lv_ebeln TYPE wd_this->element_list_1-ebeln.

*   navigate from <CONTEXT> to <LIST_1> via lead selection

     lo_nd_list_1 = wd_context->get_child_node( name = wd_this->wdctx_list_1 ).

*   get element via lead selection

     lo_el_list_1 = lo_nd_list_1->get_element( ).

*   get single attribute

     lo_el_list_1->get_attribute(

       EXPORTING

         name =  `EBELN`

       IMPORTING

         value = lv_ebeln ).

   DATA lo_nd_list_2 TYPE REF TO if_wd_context_node.

   DATA lt_list_2 TYPE wd_this->elements_list_2.

* navigate from <CONTEXT> to <LIST_2> via lead selection

   lo_nd_list_2 = wd_context->get_child_node( name = wd_this->wdctx_list_2 ).

select ekorg

   up to 5 rows

   from ekko

   into table lt_list_2

   where ebeln = lv_ebeln.

   lo_nd_list_2->bind_table( new_items = lt_list_2 set_initial_elements = abap_true ).

Hope this will be helpful..

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Tony,

check this it might helps..

http://scn.sap.com/thread/1938061

Cheers,

Kris.

former_member197425
Active Participant
0 Kudos

Hi,

For this requirement create two nodes of 0:N cardinality for

1.Table ytb_jud_iv  --> Node should contain field to displayed in drop down i think it is "id_jud"

2.Table ytb_loc_iv  --> Node should contain field to displayed in drop down i think it is "id_loc"

So for first drop down by index selection i.e id_jud ,make use of "ON SELECT" event of the drop down and fill the Node of second drop down by index for id_loc...

So by making use of ON SELECT event of first drop down fill the node of second drop down ...

Thanks,

Nandi

chengalarayulu
Active Contributor
0 Kudos

Tony,

DDBI has onSelect event, just populate values for second dropdown(LOC_TV) with comparision in onSelect of JUD_TV dropdown...

Regards,

CR

manigandan_d2
Explorer
0 Kudos

please provide more information......