ALV Grid refresh sonrası imleci hücreye geri yükleme
ALv gridde refresh sonrasında ilk satır ve sütuna imlecin gitmesi kullanıcılar oldukça yorar.
Özellikle uzun listelerde kullanıcıların geliştiriciler sövmesi muhtemeldir.
Aşağıdaki kodlar etkin hücrenin satır ve sütun bilgilerini kaydedip , refresh sonrası aynı hücreye imleci getiri.
types: begin of ty_last_Cell ,
SCR_ROW_NO Type LVC_S_ROID ,
SCR_ROW_INFO Type LVC_S_ROW ,
SCR_COL_INFO Type LVC_S_COL,
cur_ROW_ID Type LVC_S_ROW,
cur_COL_ID Type LVC_S_COL,
cur_ROW_NO Type LVC_S_ROID,
end of ty_last_Cell .
data: gs_last_cell type ty_last_Cell .
method handle_data_changed."ALV GRID methodu
CLEAR gs_last_cell.
ref_grid_master->get_scroll_info_via_id(
importing
es_row_no = gs_last_cell-SCR_row_no
es_row_info = gs_last_cell-SCR_row_info
es_col_info = gs_last_cell-SCR_col_info
).
ref_grid_master->get_current_cell(
importing
* e_row = e_row
* e_value = e_value
* e_col = e_col
es_row_id = gs_last_cell-cur_row_id
es_col_id = gs_last_cell-cur_col_id
es_row_no = gs_last_cell-cur_row_no
).
end method.
form cl_refresh_alv using prm_grid type ref to cl_gui_alv_grid
prm_soft type char01.
data : stable type lvc_s_stbl.
*
stable-row = `X`.
stable-col = `X`.
*
call method prm_grid->refresh_table_display
exporting
i_soft_refresh = prm_soft
is_stable = stable
EXCEPTIONS
finished = 1
OTHERS = 2 .
prm_grid->set_scroll_info_via_id(
is_row_info = gs_last_cell-SCR_row_info
is_col_info = gs_last_cell-SCR_col_info
is_row_no = gs_last_cell-SCR_row_no
).
prm_grid->set_current_cell_via_id( is_row_id = gs_last_cell-CUR_row_id
is_column_id = gs_last_cell-CUR_col_id
is_row_no = gs_last_cell-CUR_row_no ).
endform. " CL_REFRESH_ALV