*---------------------------------------------------------------------*
* FORM. USER_COMMAND *
*---------------------------------------------------------------------*
FORM. user_command USING i_ucomm TYPE syucomm
is_selfield TYPE slis_selfield. "#EC CALLED
CASE i_ucomm.
WHEN '&NTE'.
is_selfield-refresh = 'X'. " REFESH ALV
SET USER-COMMAND '&OPT'. " Optimize columns width
ENDCASE.
ENDFORM. " USER_COMMAND
使用方法刷新
call method grid (name of grid )->refresh_table_display
exporting
IS_STABLE = (THIS IS FOR DATA REFRESHING)
I_SOFT_REFRESH = (THIS IS FOR ICON REFRESHING).
*-------------------------------调用以上方法时可传参数以实现刷新后位置保持不变。
DATA: ls_stable TYPE lvc_s_stbl.
ls_stable-row = 'X'.
ls_stable-col = 'X'.
CALL METHOD g_grid->refresh_table_display
EXPORTING
is_stable = ls_stable.