Skip to Content
avatar image
Former Member

Capturing the Row number of a table

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 ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 31, 2008 at 08:51 AM

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

    Add comment
    10|10000 characters needed characters exceeded