cancel
Showing results for 
Search instead for 
Did you mean: 

TABLE + BUTTON : NO LEADSELECTION + No Select column

Former Member
0 Kudos

I just have a button on each line for DETAILS

I'd like to identify the row on which the button was pressed so that I can read an internal table to get the corresponding record!

so far i'm there...


  DATA:
            L_INDEX TYPE I.


  DATA:
    NODE_OBJECT_LIST                    TYPE REF TO IF_WD_CONTEXT_NODE,
    ELEM_OBJECT_LIST                    TYPE REF TO IF_WD_CONTEXT_ELEMENT,

    LWT_SELECTION               TYPE WD_THIS->ELEMENT_SELECTION.
* navigate from <CONTEXT> to <OBJECT_LIST> via lead selection


 ELEM_OBJECT_LIST = wdevent->get_context_element('CONTEXT_ELEMENT').


Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Stephan, I misunderstand your need

You have a button on EACH row of the table. When the button is pressed, you need to get the line of the table in which your button is. In this case, you can add a new import parameter to the method of the button action, with TYPE REF TO IF_WD_CONTEXT_ELEMENT. Let's call it "element". In your method, you just call the same get_index of the element:


  lv_index = element->get_index( ).

Hope it helps!

Andre

Former Member
0 Kudos

Stephan,

Suppose you have a NODE called DETAILS in your view VIEW. In the button action, add the following code to get the index of the selected element:


  DATA: node_details TYPE REF TO if_wd_context_node,
        elem_details TYPE REF TO if_wd_context_element,
        lv_index     TYPE i.

  node_details = wd_context->get_child_node( name = 'DETAILS' ).

  IF ( node_details IS INITIAL ).
    EXIT.
  ENDIF.

  elem_details = node_details->get_element(  ).

  IF ( elem_details IS INITIAL ).
    EXIT.
  ENDIF.

  lv_index = elem_details->get_index( ).

Regards,

Andre