cancel
Showing results for 
Search instead for 
Did you mean: 

Events and Event Handlers

Former Member
0 Kudos

Hi,

I need to get the index of a specific line in a table. Selection mode is set to none. The first column contains a menu with two menuActionItems. When I choose an actionitem my event handler is called with parameter WDEVENT TYPE CL_WD_CUSTOM_EVENT. As I understand you have to use this parameter to get the index from the table line.

I have tryed with the following code in my event handler method:

DATA:

node_lines TYPE REF TO if_wd_context_node,

elem_lines TYPE REF TO if_wd_context_element,

l_index TYPE i.

elem_lines = wdevent->get_context_element( name = 'LINES' ).

l_index = elem_lines->get_index( ).

This does not work. The elem_lines is initial after I try to get it.

Hope that someone can guide me in the right direction.

Thanks,

Morten

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Hi Morten,

Try this



  data: lr_element type ref to if_wd_context_element,
          lv_index type i.
 
  lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ). " use CONTEXT_ELEMENT instead of LINES  
  lv_index = lr_element->get_index( ).

I hope it helps.

Regards

Arjun

Edited by: Arjun on Mar 4, 2009 1:38 PM

Answers (2)

Answers (2)

vivekananthan_sellavel
Active Participant
0 Kudos

data: index type i,

msg type string.

index = wd_event->get_context_element->get_index->get_index( ).

msg = index.

l_message_manager->report_success( msg ).

vivekananthan_sellavel
Active Participant
0 Kudos

hi ;

this will work

DATA: mod_cell TYPE salv_wd_t_table_mod_cell,

wa_mod_cell TYPE LINE OF salv_wd_t_table_mod_cell,

msg TYPE string.

mod_cell = r_param->t_modified_cells.

wd_comp_controller->set_material_dtl( ).

LOOP AT mod_cell INTO wa_mod_cell.

msg = wa_mod_cell-index .

msg = mod_cell-index .

  • l_message_manager->report_success( msg ).

Or else try this.

wd_event is return parameter

data: index type i.

index = wd_event->get_context_elementget_index->get_index( ).