cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing the Row number of a table

Former Member
0 Kudos

I have a table having 10 rows. In one of the column of the table, i am using the LINKTOACTION. If i click on that , i need to call a view based on the rownumber of the table. So my question is how to capture the row number of the table in which i clicked on LINKTOACTION ?

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Manjunath,

If you are working with events in a table the system does automatically pass on the WDEVENT of type CL_WD_CUSTOM_EVENT to the event handler method. In this case WDEVENT consists of 2 values in the PARAMETERS table : ID & CONTEXT_ELEMENT. First get the reference of this context element & then you can call the get_index method on the context element reference and get your row number. Put the code below into the event triggered by your LinkToAction & then you can get your row number.

Regards,

Uday

DATA: lr_element TYPE REF TO if_wd_context_element,
      lv_column_name type string,
      lv_row_number type i value 0.
 
  lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
 
  lv_column_name = wdevent->get_string( name = 'ID' ).
 
  lv_row_number = lr_element->get_index( ).

Former Member
0 Kudos

Can i directly se the above code or we need to change the values in the Hard codings ?

uday_gubbala2
Active Contributor
0 Kudos

You can directly use the same coding Manju.

Regards,

Uday

Answers (0)