cancel
Showing results for 
Search instead for 
Did you mean: 

How to get index when i click on blue box on a table?

Former Member
0 Kudos

Hei,

I need to select the row once i click on the box on the left most side of the row. I am able to do that if i don't have a event defined. But i need to define event. Hence i am not able to select the row by clicking that button.

So i wrote the following code once i click that box and it goes into the event i have defined.

DATA lr_element TYPE REF TO if_wd_context_element.

DATA lv_index TYPE i.

DATA l_node TYPE REF TO if_wd_context_node.

" get the index of the cell

lr_element = i_event->get_context_element('CONTEXT_ELEMENT').

lv_index = lr_element->get_index( ).

But the problem is that, lr_element, is initial and hence i get a dump.

How would i programmatically select that row when i click on the box on the far left a row? Or maybe their is a table setting which i can use to make it select everytime i click on that box eventhough i have a onSelect event defined?

Any help will be appreciated.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi,

the code which you are using is not for the functionality you want. This code helps when you have inserted any UI like buttun or linktourl in your table and if you click on that button then you get the index of the row.

For your functionality write the following code.

wd_node = wd_context->get_child_node( name = 'NODE_NAME' )." Here NODE_NAME is name of your context node which is binded to table
lr_element = wd_node->get_lead_selection( ).

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

Still i dont get any thing.

Former Member
0 Kudos

Hi,

Is this the ALV or Table UI element.

Have you tried to implement the event when checkbox is checked...

Regards,

Lekha.

former_member40425
Contributor
0 Kudos

Try using following code.

DATA lo_nd_<Node_Name>TYPE REF TO if_wd_context_node.
DATA lo_el_<Node_Name>TYPE REF TO if_wd_context_element.
DATA ls_<Node_Name>TYPE wd_this->element_<Node_Name>.
DATA lt_<Node_Name>TYPE wd_this->elements_<Node_Name>.


lo_nd_<Node_Name>= wd_context->get_child_node( name = wd_this->wdctx_<Node_Name>).
lo_el_<Node_Name>= lo_nd_<Node_Name>->get_lead_selection( ).

I hope it helps.

Regards,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

Not sure exactly if i understand.. maybe this can help

  • get access to the desired context node - single selection

wd_node = wd_context->get_child_node( name = 'LIST_FPS' ).

lr_element = wd_node->get_lead_selection( ).

OR

  • get multible selection

lo_nd_list_fps = wd_context->get_child_node( name = wd_this->wdctx_list_fps ).

lt_elements = lo_nd_list_fps->get_selected_elements( ).

are you using an ALV table?