cancel
Showing results for 
Search instead for 
Did you mean: 

Index of the row where the cursor is clicked

Former Member
0 Kudos

Hi all,

I need to set some values in table control for the fields where i clicked the cursor. Actually i am using the below code but its not working...

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

lv_sel_index = lo_el_zdcapsc->get_index( ).

lo_nd_zdcapsc->set_attribute(

EXPORTING

index = lv_sel_index

name = `ZPLANTID`

value = lv_plant ).

For example I placed the cursor in 3 row at the plant column in my table control. So only 3 row plant value has to be set.

Can anybody tell me how to read the index when a cursor is placed at a particular row.

Regards

Sireesha.

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi Sireesha,

You are doing right, just remove following line from your code when you are setting attribute.

index = lv_sel_index

You will get desired functionality.

Regards,

Rohit

Former Member
0 Kudos

Hi Rohit,

Thanks for prompt reply..

I am getting the value for the below code...So its null in lo_el_zdcapsc . How can i read the row where a cursor is placed ( without leadselection)

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

Please suggest me on this....

Regards

Sireesha.

former_member40425
Contributor
0 Kudos

If you are using any UI which has an action associated (example: linktoaction) with UI, then write the code in the onAction of that UI which you are using (without the line which I have told you). if you do not want to use UI which does not have action associated with that then you have to use lead selection only.

Regards,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

u can use get_index method to get the index of the particular row selected


data: lr_element type ref to if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node.
lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
 
* get all declared attributes
  lr_element->get_static_attributes(
    IMPORTING
      static_attributes = ls_cn_node ).
  
 data lv type I.
 lv = lr_element->GET_INDEX( ).

u have got the table row values in a strucure , now u can set it to new value

regards,

amit