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.
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.