1.方法一
FORM USER_COMMAND USING IW_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
IS_SELFIELD-COL_STABLE = 'X'. "列保持
IS_SELFIELD-ROW_STABLE = 'X'. "行保持
IS_SELFIELD-REFRESH = 'X'. "是否刷新
ENDFORM.
1.方法二
FORM FRM_WHEN_CHANGED .
DATA: IS_STABLE TYPE LVC_S_STBL.
IS_STABLE-ROW = 'X'. "保持行
IS_STABLE-COL = 'X'. "保持列
CALL METHOD GV_GRID->REFRESH_TABLE_DISPLAY( EXPORTING IS_STABLE = IS_STABLE ). "刷新
ENDFORM.
【ABAP系列】SAP ABAP 刷新SCREEN的方法 - 走看看
1:
* 显示ALV
CALL METHOD gr_alvgrid->set_table_for_first_display
* 刷新ALV
CALL METHOD gr_alvgrid->refresh_table_display
有2个参数,一个是行,一个是列.如果设置了相应的值,
那么对应的行,或者列,在刷新的时候,将会保持稳定,就是滚动条保持不动.
有些时候需要再调用 CL_GUI_CFW=>FLUSH方法,才能看到刷新后的结果。
2:
设置 selfield-refresh = 'X'
用的太多,不赘述。
---------------------
cl_gui_cfw=>flush._闫艺宸的博客-优快云博客
CL_GUI_CFW=>FLUSH把更新后的数据同步到SAP GUI
用法一:
REFRESH_TABLE_DISPLAY虽然刷新的界面,但是SAP GUI并不是实时更 新,而是将更新的结果放在缓存中,手动调用CL_GUI_CFW=>FLUSH才能触发SAP GUI更新界面,看到刷新的结果。
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
用法二:
在OO的ALV方法中,使程序重新走PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = ‘REFRESH’
CALL METHOD cl_gui_cfw=>flush.
用法三:
FORM frm_refresh_dlysk_display USING pv_p_refresh.
IF g_grid_dlysk IS INITIAL.
EXIT.
ENDIF.
Refresh grid
CALL METHOD g_grid_dlysk->refresh_table_display
EXPORTING
i_soft_refresh = pv_p_refresh.
CALL METHOD cl_gui_cfw=>flush.
ENDFORM. " FRM_REFRESH_DLYSK_DISPLAY
————————————————
版权声明:本文为优快云博主「闫艺宸」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/weixin_42921800/article/details/98776432
用法一:
REFRESH_TABLE_DISPLAY虽然刷新的界面,但是SAP GUI并不是实时更新,而是将更新的结果放在缓存中,手动调用CL_GUI_CFW=>FLUSH才能触发SAP GUI更新界面,看到刷新的结果。
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
用法二:
例如下面让用户选择文件夹的代码:
CALL METHOD cl_gui_frontend_services=>directory_browse
CHANGING selected_folder = folder.
CALL METHOD cl_gui_cfw=>flush.
why should we call the flush method?
here is some notes about this mehtod, from About cl_gui_cfw=>flush_xyfchris的博客-优快云博客
"In OO approach, calling a Control-method does not imply that the method is automatically executed at runtime. Initially, the system buffers methods in a queue, referred to as the Automation Queue, when they are called in the ABAP program. The execution sequence of the methods therefore remains unchanged. However, the methods are only executed if they are transferred to the frontend via Remote Function Call (RFC) using method FLUSH. This means that the Automation Queue is used to reduce the number of RFC calls required."
用法三:
在OO的ALV方法中,使程序重新走PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH'.
CALL METHOD cl_gui_cfw=>flush.