我在屏幕上的容器中有一个 ALV 0100
。它是通过 class 创建的CL_SALV_TABLE
。
go_alv_dms->get_selections( )->get_selected_rows( )
问题是按下屏幕上的按钮(屏幕截图上的 2)后,我无法通过选定的行。
如果按钮位于 ALV 状态栏(屏幕截图上的 1)中,我可以毫无问题地访问选定的行。似乎按下 ALV 外部的按钮会清除它的选择。
显示 ALV 时的寄存器选择:
...
lo_selections = go_alv_dms->get_selections( ).
lo_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
lo_events = go_alv_dms->get_event( ).
CREATE OBJECT go_handler.
SET HANDLER go_handler->on_user_command2 FOR lo_events.
...
PAI的屏幕按键逻辑:
go_handler->on_user_command2( gv_ok_0100 ).
方法on_user_command2
:
case gv_ok_0100.
when 'OK'.
...
lt_rows = go_alv_dms->get_selections( )->get_selected_rows( ).
...
ENDCASE.