Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Changed GRID data

Former Member
0 Likes
445

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

2 REPLIES 2
Read only

former_member745780
Active Participant
0 Likes
388

Hello

check this

Thanks

Read only

Former Member
0 Likes
388

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