2

This is the picture

How can I get the selection of the row event?

if (alv_table_1_row) is selected or if button is pressed 
append to alv_table_2

Can somebody help me? I want at the click of the row to be appended into alv_table_2 dynamically?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
User2333
  • 51
  • 2
  • 12
  • @Brian Tompsett - 汤莱恩 Thanks stack wouldn't allow me to post the pic – User2333 Aug 14 '17 at 10:33
  • @vwegert I have tried using ok_code to append the row but system gives me dump.I dont know how to get the selection event – User2333 Aug 14 '17 at 11:56
  • Show us the code, then we might be able to help. No code, you might just get guesswork. Simple as that. – vwegert Aug 14 '17 at 11:57

1 Answers1

1

Create a local class like below to handle double-click row event of ALV grid.

class lcl_alv_event_receiver definition.

  public section.

  methods:  handle_double_click.
    for event double_click of cl_gui_alv_grid
        importing e_row e_column.

endclass.  

class lcl_alv_event_receiver implementation.

    method handle_double_click.
        " Your event handler code here like below
        " read table alv_table_1 index e_row-index into ls_row.
        " append ls_row to alv_table_2.
        " alv_table_2_grid->refresh_table_display( ).
    endmethod.

endclass.

Register your event handler somewhere in your code after your left ALV is initialized.

 data:  lo_alv_event_receiver  type ref to lcl_event_receiver.
    create object lo_alv_event_receiver.

    set handler lo_alv_event_receiver->handle_double_click for alv_table_1_grid.
User2333
  • 51
  • 2
  • 12
Haojie
  • 5,665
  • 1
  • 15
  • 14