[英]How to select full row in ALV grid?
I need to return to a specific line in ALV in the code with cl_gui_alv_grid
.我需要使用cl_gui_alv_grid
返回代码中 ALV 中的特定行。 I use set_current_cell_via_id
, it works, but only a cell is selected.我使用set_current_cell_via_id
,它可以工作,但只选择了一个单元格。 How to programatically select the full row?如何以编程方式 select 整行?
Thanks谢谢
Full code:完整代码:
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
DATA gt_t005t TYPE TABLE OF t005t.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
IF gr_alvgrid IS NOT BOUND.
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = cl_gui_container=>screen0.
SELECT * FROM t005t INTO TABLE gt_t005t WHERE spras = 'E'.
gr_alvgrid->set_table_for_first_display(
EXPORTING i_structure_name = 'T005T'
is_layout = VALUE #( sel_mode = 'D' )
CHANGING it_outtab = gt_t005t ).
ENDIF.
DATA sroid TYPE lvc_s_roid.
DATA irow TYPE i VALUE 2.
SROID-ROW_ID = iRow.
CALL METHOD gr_alvgrid->set_current_cell_via_id
EXPORTING
IS_ROW_NO = SROID.
Use the method SET_SELECTED_ROWS
to achieve this result:使用方法SET_SELECTED_ROWS
来实现这个结果:
Full code:完整代码:
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
DATA gt_t005t TYPE TABLE OF t005t.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
IF gr_alvgrid IS NOT BOUND.
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = cl_gui_container=>screen0.
SELECT * FROM t005t INTO TABLE gt_t005t WHERE spras = 'E'.
gr_alvgrid->set_table_for_first_display(
EXPORTING i_structure_name = 'T005T'
is_layout = VALUE #( sel_mode = 'D' )
CHANGING it_outtab = gt_t005t ).
ENDIF.
gr_alvgrid->set_selected_rows( it_row_no = VALUE lvc_t_roid( ( row_id = 2 ) ) ).
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.