Refresh ALV classic style grid after edit without pressing ENTER - based on REUSE function
See the following two examples to refresh ALV classic style grid after edit without pressing ENTER.
Example 1 - automatically gets the user's input and refreshes the internal
table, when he is leaving the changed field (it won't work for the last
field, if the user doesn't leave it, if necessary combine it with example 2):
DATA:
ls_grid_settings TYPE lvc_s_glay.
...
* synchronize internal table after leaving an edited cell
ls_grid_settings-edt_cll_cb = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_grid_settings = ls_grid_settings
it_fieldcat = lt_fcat
TABLES
t_outtab = lt_popup.
ls_grid_settings TYPE lvc_s_glay.
...
* synchronize internal table after leaving an edited cell
ls_grid_settings-edt_cll_cb = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_grid_settings = ls_grid_settings
it_fieldcat = lt_fcat
TABLES
t_outtab = lt_popup.
Example 2 - automatically gets the user's input and refreshes the internal
table, when he is leaving the grid:
DATA:
lv_repid LIKE sy-repid.
...
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fcat
TABLES
t_outtab = lt_popup.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA:
lo_grid TYPE REF TO cl_gui_alv_grid.
IF lo_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
ENDIF.
IF NOT lo_grid IS INITIAL.
CALL METHOD lo_grid->check_changed_data.
ENDIF.
ENDFORM.
lv_repid LIKE sy-repid.
...
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fcat
TABLES
t_outtab = lt_popup.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA:
lo_grid TYPE REF TO cl_gui_alv_grid.
IF lo_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
ENDIF.
IF NOT lo_grid IS INITIAL.
CALL METHOD lo_grid->check_changed_data.
ENDIF.
ENDFORM.
Full list of examples in my infodepot
If you have a question, have found an error or just want to contact me, please use this form.
If you have a question, have found an error or just want to contact me, please use this form.
Copyright (C) 2010 http://www.kerum.pl/infodepot/
Disclaimer: I am not affiliated or related to any division or subsidiary of SAP AG.
Trademarks or registered trademarks of any products or companies referred to on this site belong to those companies.
Anyone using the given solutions, is doing it under his/her own responsibility and at own risk.