cancel
Showing results for 
Search instead for 
Did you mean: 

Catching of Index value using WDEVENT->get_data

former_member187692
Participant
0 Kudos

Hi,

      My question is can If I get the index value using WDEVENT ( suppose for radiobutton group by index ) and can I pass the value of this index to some other code inside a "on action button".

In other words I want the data fetch based on the index value of radiobutton(the code is in "on action radiobutton"). Both these codes are in different methods. Can i pass these indexes values to other.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Krishna,

Yes, you can pass the index of selected radio button to any method in the view.

Please let me know, the requirement in detail, so that I can suggest you further.

Regards,

Rama

former_member187692
Participant
0 Kudos

Hi Rama,

               The req is the same as what I have shared with you previously. 2 radiobuttons and 2 select-options and ALV grid displayed in another view. Based on the index of radio button selected the corresponding data is fetched.

           I know it can be done based on select-options selected but I am more interested in index of radiobuttons which is selected and how it is passed to another methods.

PS:- AND ALSO TO OTHER VIEW'S METHODS.

Regards,

Krishna.

ramakrishnappa
Active Contributor
0 Kudos

Hi Krishna,

You can achieve your requirement as below

Approach1:


  • Create an attribute GV_INDEX of type I, in view
  • Write the below code in your on select event of radio button

METHOD onactionradio_select .

" Collect the index of radio button into view attribute GV_INDEX

  wdevent->get_data(

  EXPORTING name = 'INDEX' IMPORTING value = wd_this->gv_index ).

ENDMETHOD.

Now, you can user it in any method as WD_THIS->GV_INDEX

Approach2:

As suggested by Mr. Kiran,


data lr_node type ref to if_wd_context_node.

lr_node = WD_CONTEXT->GET_CHILD_NODE( NAME = `RADIOBUTTON` ).

lv_index = lr_node->GET_LEAD_SELECTION_INDEX( ).

the lead index of the node "RADIOBUTTON" should have the currently selected radio button's index

Hope this helps you.

Regards,

Rama

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You can get the index using get_lead_selection_index( ) method of context node or using wdevent as below


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( ).


lr_node = WD_CONTEXT->GET_CHILD_NODE( NAME = `RADIOBUTTON` ). 

lv_index = lr_node->GET_LEAD_SELECTION_INDEX( ).

Hope this helps u,

Regards,

Kiran