SAP ABAP 动态地将 alv 行附加到另一个 table?

SAP ABAP Append alv row to an other table dynamically?

如何获取行事件的选择?

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

有人可以帮助我吗?我想在单击要动态附加到 alv_table_2 的行时?

像下面这样创建一个本地 class 来处理 ALV 网格的 double-click 行事件。

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.

在您的左 ALV 初始化后,在代码中的某处注册您的事件处理程序。

 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.