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

Capturing changed data when we press enter in ALV OOPS

Former Member
0 Likes
4,279

Hi Folks,

            I have built an editable ALV using object oriented approach. when i change data and press SAVE button directly, i can capture the changes by using the method CALL METHOD g_grid->refresh_table_display..

          But after changing the data, if i press enter and then press SAVE button, changed data is not captured into my internal table.

           Could any body suggest whats the problem.

             Thanks,

               Shyam.

Moderator Message: There are many discussions on this topic, please search. Thread locked.    

Message was edited by: Suhas Saha

3 REPLIES 3
Read only

Former Member
0 Likes
1,006

Hi.

Please try comparing your code with the code given in the below wiki link and see if there are any discrepancies.

http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editing+and+saving+the+edited+values+in+Database(O...)

Read only

Kiran_Valluru
Active Contributor
0 Likes
1,006

Hi,

use method check_changed_data of CL_GUI_ALV_GRID.

like,

take one more itab if required to compare.

data itab_old type standart table of <table>

itab_old[] = itab[].

lr_grid->set_table_for_first_display( .......... ).

when SAVE.

lr_grid->check_changed_data( ).

if itab_old[] <> itab[]

Update Database.

endif.

Hope this helps u.,

Thanks & Regards,

Kiran.         

Read only

kranthi_kiran5
Explorer
0 Likes
1,006

To make the ALV column as editable in runtime we need to set the field EDIT  as part of

field catalog generation.

  • Whenever the user modifies ALV cell values in runtime and to reflect to change in data

         base table we need to handle the event  HANDLE_DATA_CHANGED of the class

         CL_GUI_ALU_GRID this event is triggered enter key in the modified cell.

  • By default DATA_CHANGED is not triggered it must be registered explicitly by calling

         the method REGISTER_EDIT_EVENT of a class CL_GUI_ALV_GRID.

  • As part of event  DATA_CHANGED  we need to import the parameters ER_DATA_CHANGED  it is a parameter which is the object of the class CL_GUI_CHANGE_DATA_PROTOCOL.
  • As part of the above class we need to use instance attribute MT_MOD_CELLS (OR)

         MT_GOODS_CELLS  which are of type  LVC_T_MODI. It is table type associated  with the              structure LVC_S_MODI.

  • These attributes contains a information related to be modified cell the information include

        row id, field name, and value.

this is some sample which includes all the functionality PFA