cancel
Showing results for 
Search instead for 
Did you mean: 

How to read selected index of Dropdown by Index in ALV table

Former Member
0 Kudos

Hello All,

I have a ALV table in that 1 column is a Dropdown by index to hold different dropdown values for each row of ALV table to achieve this I created a seperate attribute in the same context as VALUESET of type WDR_CONTEXT_ATTR_VALUE_LIST. As part of my requirment Type and Text of the VALUESET is same

        ls_value_custom-text   = 'TEST'.
        ls_value_custom-value = 'TEST'.

My requirment is I need to get the selected index of the Dropdown( ex: From ALV table 3rd row I open the dropdown and selected 5th Dropdown value)

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Venkat,

You can get selected index by method "get_lead_selection_index" of class if_wd_context_node.

DATA ls_selected_index TYPE i.


CALL METHOD lo_nd_ddbi->get_lead_selection_index
     RECEIVING
       index = ls_selected_index.

Method "get_static_attributes" use to get selected item

  

   DATA lo_nd_ddbi TYPE REF TO if_wd_context_node.
   DATA lo_el_ddbi TYPE REF TO if_wd_context_element.
   DATA ls_ddbi TYPE wd_this->element_ddbi.

   lo_nd_ddbi = wd_context->get_child_node( name = wd_this->wdctx_ddbi ).
   lo_el_ddbi = lo_nd_ddbi->get_element).

   lo_el_ddbi->get_static_attributes(
     IMPORTING
       static_attributes = ls_ddbi ).

Regards,

Mukesh

former_member211591
Contributor
0 Kudos

Hi,

get the reerence to the node (which you have created to realize the VALUESET). The lead selection index of this node is the selected line number of your dropdown selection.

(node->get_lead_selection_index( ).)

Regards

ismail

Former Member
0 Kudos

Hello Ismail,

Thank you for your response....

Part of my post is missing above so I am putting the same below again

Hello All,


Can any body help me how to Read selected index of a Dropdown By Index in ALV table

I have a ALV table in that 1 column is a Dropdown By Index to show different dropdown values in each row of ALV table. to achieve this I created separate attribute in same context node as VALUESET of type WDR_CONTEXT_ATTR_VALUE_LIST. As part of my requirement I have same Value and Text values for VALUESET

    ls_value_custom-text   = 'TEST'.

    ls_value_custom-value = 'TEST'.

Values are populated and I am getting different values for dropdown on each row of ALV table

My requirement is to Get the Selected index of the dropdown( Ex: From ALV 3rd row I open the dropdown and sleeted 5th value)

I am using event ON_CELL_ACTION to capture change.

r_param->value->* is returning Value of the Dropdown, my issue is I need to get the index of the selected Value

My  r_param->index is returning 3 (3rd row of ALV where I opened the Dropdown)

Thanks,

Venkat.

Former Member
0 Kudos

Hello Ismail,

When I try the below statement it is returning the ALV table lead index. my attribute VALUESET is there in the same context node

node->get_lead_selection_index( ).

Former Member
0 Kudos

Hello,

1. On change of drop-down read the value which is set.

2. If you are not changing value of drop-down.

     a. Get the Lead selected row. using Lead_selection_index method..

     b. Read the row on which u are working using without lead selection by..

DATA lr_el_element TYPE REF TO if_wd_context_element.

   DATA lv_index TYPE i.


   lr_el_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

    lv_index = lr_el_element->get_index( ).

Former Member
0 Kudos

Hi,

If the drop-down value is not changed, then you can use get_lead_selection_index() method to retrieve the index.

If the drop down value is changed, first get the selected element, then use get_index() method to retrieve the index of selected element.

Please try and let me know.

Best Regards,

Abirami