cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown options in webdynpro

Former Member
0 Kudos

Hi guys..

I have requirement like add two drop down elements in a table. And second drop down list of values dependent on first drop down element.

example: if i take ekpo table i will make PO number and item number fields as dropdown elements. And Once PO number selected from first dropdown list

second dropdown list should consist  item numbers of selected PO. After selecting both the values remaining fields will get displayed based on input.

Can anyone suggest please the way of doing it.

thanks in advance...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

First you need to read the row in which you want to change the DD value. this can be done using following code.

DATA lv_index type i.
   lr_element
= wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
   lv_index
= lr_element->get_index( ).


  READ TABLE itab INTO wa INDEX lv_index.

...


now read the value of 1st dd, and change the value in 2nd DD and modify the itab.

Former Member
0 Kudos

Hi Chandra,

Thanks for your answer. here my doubt is, in which method i have to place this code

former_member193460
Contributor
0 Kudos

if its table ui element, use the onselect event for the first dropdown to populate the second dropdown.

if its alv, you can see on my prev comment

Former Member
0 Kudos

on action of 1st drop down.

Former Member
0 Kudos

Hi Uma,

For normal table.

1) You can write code in OnSelect event of that dropdown column as shown below.

For more information, you can refer the below document

Dropdown column in table

For ALV Table,

1) For the particular column, you need to enable the cell action as shown below.

LOOP   AT   lt_columns ASSIGNING <fs_column>.

CASE <fs_column>-id.

   WHEN '<your column>'.

CALL METHOD lv_value->if_salv_wd_column_settings~get_column

            EXPORTING

              id    = <coumn name>
            RECEIVING

              value = lo_system_select_hdr.




          DATA lo_dropdown TYPE REF TO cl_salv_wd_uie_dropdown_by_key.

          CREATE OBJECT lo_dropdown

            EXPORTING

              selected_key_fieldname = <fs_column>-id.

          lo_dropdown->set_state( cl_wd_abstract_input_field=>e_state-required ).

          lo_dropdown->set_read_only_fieldname( value = 'READONLY' ).

          lo_dropdown->set_selected_key_fieldname( <fs_column>-id ).

          <fs_column>-r_column->set_cell_editor( lo_dropdown ).

          lv_value->if_salv_wd_table_settings~set_cell_action_event_enabled( abap_true ).

ENDLOOP.

and you can write the code in onselect event

Hope this helps you.

Thanks

KH

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Uma,

Please refer the below document which clearly explains the steps involved in achieving similar requirement.

Hope this helps you to achieve your requirement.

Regards,

Rama

former_member193460
Contributor
0 Kudos

Hi Umadevi,

     The first dropdown you have to use dropdown by key and the second which is decided dynamically is done through dropdown by index.

I had similar requirement, but i implemented in alv.

Thanks & Regards,

Tashi

former_member193460
Contributor
0 Kudos

Sorry Uma, The dynamic dropdown (second dropdown) in my example is dependent on one of the fields not the first dropdown. But since every record can have a different list, this is still relevant to your question.

probabaly you need to play around in the wddomodify method, when the first dropdown changes, you populate the context node of the second dropdown list.

Cheers again,

Tashi