cancel
Showing results for 
Search instead for 
Did you mean: 

Button at row repeater - How to identify what line button was clicked.

furlan
Participant
0 Kudos

Hi,

I`m developing a WD application using ROW_REPEATER to show a list of items. For each item, I have a button to access another view to show the detail about the line where button was clicked.

My application is very similar with example showed in this link: http://help.sap.com/saphelp_nw70/helpdata/en/44/93d3bc2e8c60d6e10000000a114a6b/frameset.htm

How can I pass the ID of the line where button were clicked to detail view?

Many thanks!

Flávio Furlan

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi,

You can proceed as explained in here. In the onAction event of the Button place the following coding:

method ONACTIONONBUTTONCLICK .
  data: lr_element type ref to if_wd_context_element,
          lv_index type i.
 
  lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
  lv_index = lr_element->get_index( ).

Now lv_index will contain the table row number in which the Button was clicked upon.

Regards,

Rohit

furlan
Participant
0 Kudos

Hi Rohit,

Thanks for your suggestion, but lv_index is always 1.

I`m still having this problem.

Regards,

Flávio

uday_gubbala2
Active Contributor
0 Kudos

Hi Flavio,

I tried recreating your scenario. I am displaying the information from SFLIGHT using a RowRepeater & I have a button beside each row of data. when I click up on the button am succesfully able to retrieve the buttons information using the same approach as suggested by Rohit.

METHOD onactionfetch_bookings .
  DATA: lr_element TYPE REF TO if_wd_context_element,
        lv_index TYPE i.

  lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
  lv_index = lr_element->get_index( ).
ENDMETHOD.

Regards,

Uday

furlan
Participant
0 Kudos

Hi Rohit and Uday,

You are correct. Solution provided by Rohit solved my problem.

I found the problem. When I was implementing Rohit's solution, I was replacing 'CONTEXT_ELEMENT' by own context name 'POST'.

lr_element = wdevent->get_context_element( name = 'POST' ).

instead

lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

Thanks for your help!

See you!

Flávio

Former Member
0 Kudos

I made the same initial mistake, it seems like CONTEXT_ELEMENT is indeed a default value.

Note that this approach also works when using Button controls as Cell Editors inside Table Rows.

Answers (0)