cancel
Showing results for 
Search instead for 
Did you mean: 

Row index when a hyperlink in a particular row is clicked

Former Member
0 Kudos

Hi Experts,

I have a table with 10 columns & 5 rows. I have hyperlink in each row that means I have total 5 hyperlinks.

Now when I click one particular hyperlink in any row I want the index of that particular row(or the row reference) where hyperlink is being clicked.

Please suggest how to get the row index.

Thanking you.

Regards,

Anindita

Accepted Solutions (1)

Accepted Solutions (1)

FLSaito
Participant
0 Kudos

HI,

Creat a event to handle the event ON_CLICK of SALV_WD_TABLE component then you can use the parameter

R_PARAM->INDEX of the method created to get the index of the selected link element.

example:


* navigate from <CONTEXT> to <ND_ALV_RESULT> via lead selection
  lo_nd_nd_alv_result = wd_context->get_child_node( name = wd_this->wdctx_nd_alv_result ).
* alternative access via index
  lo_el_nd_alv_result = lo_nd_nd_alv_result->get_element( index = r_param->index ).
* get all declared attributes
  lo_el_nd_alv_result->get_static_attributes( IMPORTING static_attributes = ls_nd_alv_result ).

Regards,

Fabio Saito

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

when the link to action is clicked,

you can get the corresponding context element in the event handler of the action for Link to Action.


method ONACTIONREAD .
  DATA ele TYPE REF TO IF_WD_CONTEXT_ELEMENT.
  DATA index TYPE i.
  ele = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
  i = ele->get_index( ).
endmethod.

In the above code, ele will have the reference to the context element corresponding to the link to action which was clicked.

and you get the index of that element using get_index( ) method.

Hope this helps!

Regards,

Srilatha

Former Member
0 Kudos

use the method of get_Index from if_wd_content_element.

DATA: lo_el_node TYPE REF TO if_wd_context_element.
  DATA: lv_index TYPE i.
  lo_el_node = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
  lv_index= lo_el_node->get_index( ).