cancel
Showing results for 
Search instead for 
Did you mean: 

Button in a table UI element:Get line number

Former Member
0 Kudos

Hi Experts,

I am enhancing a webdynpro component where i have added a button ui element to call a pop up where user can attach files to lines item.

I want to retrieve the line number on which user has clicked the "button".

For example if the lead selection is on first row and user clicks button on 2nd row how can i retrieve which line item number user has clicked on?

Thanks

Bhanu

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

You can get context element, and from context element you can get index (http://help.sap.com/saphelp_nw73/helpdata/en/32/bf5b4150b38147e10000000a1550b0/content.htm IF_WD_CONTEXT_ELEMENT-GET_INDEX).


WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).

If the element is located in a Table, the context element is the element from the row in which the action was triggered (vertical coordinate).

Former Member
0 Kudos

Hi Maksim,

Thanks for reply.

In on action of the button i tried retrieving the index of the record.

But lo_el_receipts is initial in case no lead selection is done and user clicks on attachment button.

DATA LO_ND_RECEIPTS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_RECEIPTS TYPE REF TO IF_WD_CONTEXT_ELEMENT

LO_ND_RECEIPTS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_RECEIPTS ).

LO_EL_RECEIPTS = LO_ND_RECEIPTS->GET_ELEMENT( ).

CALL METHOD LO_EL_RECEIPTS->GET_INDEX

RECEIVING

MY_INDEX = index .

Could you please advice

former_member182372
Active Contributor
0 Kudos

 LO_ND_RECEIPTS->GET_ELEMENT( ).

return lead selected element.

Why don't you try approach I suggested? Retrieve context element from the event object?


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

Answers (0)