cancel
Showing results for 
Search instead for 
Did you mean: 

set lead selection on link to action in a table column

Former Member
0 Kudos

Hi Experts,

I have a table with 1 column of Link to action type.

I have to read the data of a particular link to action selected on that table.

Eg:-

R1 C1 Link1

R2 C2 Link2

R3 C3 Link3

R4 C4 Link4

On Click on Link 1 i have to read the row 1 value R1 & C1, on which lead selection comes by default. But when i click on Link4, it again read R1 & R4 because lead selection is still the first line.

If i select row1 and then click on the link to actio n(Link4) it then read R4 & C4.

I think i have to set the lead selection again for link4 but donno how to do it. I can set the lead selection if i know user is clicking no which line but it is unsure.

Can anyone please let me know?

Regards,

Nik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Please check this code.

DATA LO_ND_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_NODETYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_NODE TYPE WD_THIS->ELEMENT_NODE.

DATA LT_NODE TYPE STANDARD TABLE OF WD_THIS->ELEMENT_NODE

DATA WA_NODETYPE WD_THIS->ELEMENT_NODE.

navigate from <CONTEXT> to <NODE> via lead selection

LO_ND_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_NODE).

get element via lead selection

LO_EL_NODE = LO_ND_NODE->GET_ELEMENT( ).

LO_EL_NODE= WDEVENT->GET_CONTEXT_ELEMENT( NAME = 'CONTEXT_ELEMENT' ). "here u get reference for the element, after that set the lead selection and get element data

IF LO_ND_NODE IS NOT INITIAL.

CALL METHOD LO_ND_NODE->SET_LEAD_SELECTION

EXPORTING

ELEMENT = LO_EL_NODE.

ENDIF.

@TODO handle not set lead selection

IF LO_EL_NODE IS NOT INITIAL.

LO_EL_NODE->GET_STATIC_ATTRIBUTES(

IMPORTING

STATIC_ATTRIBUTES = LS_NODE ).

ENDIF.

"in ls_node you have the row u click without lead selection

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

If your requirement is just to read the details of the complete row in which the link to action is clicked,

you can get the corresponding context element in the event handler of the action for Link to Action.

method ONACTIONREAD .
  DATA ele TYPE REF TO IF_WD_CONTEXT_ELEMENT.
  ele = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
endmethod.

In the above code, ele will have the reference to the context element corresponding to the link to action which was clicked.

If you have to also set lead selection, i guess first you have to disable initialize lead selection for the context node which is mapped to the table. And then lead select elements programmatically. For the first time you can set the lead selection to the first element in WDDOINIT of the view. And whenever link to action is clicked, you can get the index of the element ele and set lead selection.

Hope this helps!

Regads,

Srilatha