‎2008 Aug 21 2:13 PM
Hi ,
in Editable ALV Grid some rows i changed , and is i save that i need that records should be save in one another database table , so how we can get taht changed records in to one internal table.
Please give me solution with one example .
THANKS
‎2008 Aug 21 2:17 PM
‎2008 Aug 21 2:18 PM
in the user command form you have code for it. Before that you take the Backup of the internal table before calling the ALV function module.
You can do some thing like this..
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.
LOOP AT itab
read table it_backup = itab.
if sy-subrc ne 0.
append itab to it_update.
endif.
ENDLOOP.
"use it_update and update the data to database.
"it_update will have only changed records.
clear it_backup.
it_backup = itab.
rs_selfield-refresh = 'X'.
BREAK-POINT.
ENDFORM. "USER_COMMAND