cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing the Changed Record Value with the Original Record

former_member197475
Active Contributor
0 Kudos

Hi Experts,

I have created a form, in which did an option to Create, Copy and Delete records of a table. Of-course every thing is working fine.

At the same time, I have a Change scenario also, where an user should able to change the data of a record and on Save, it should update the table.

I can get the record at run time using GET_LEAD_SELECTION, but the thing is, I have 5 fields in table where all are key fields in table. So I can't able to compare the selected record with changed values with those of the record is ZTABLE.

How can I compare the changed data with the original one to get updated in ZTABLE(Note: All fields are key fields in my Ztable).

Please help me experts.

BR,

RAM.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi RAM,

As all the fields are made as key in ZTABLE. You can update the data to table as new record and delete the existing old record.

You can achieve your requirement as below


  • On button click of CHANGE, store the existing table data into a global table  at view / component controller
  • Now, user made the changes to 2 lines i.e. the key fields are changed , hence its a new record
  • On save, compare the existing temporary global table's records with records of screen table
  • Now, you can ignore the identical records and delete the old record from ZTABLE and update the new record from screen

     i.e. 2nd record from global table will be deleted from ZTABLE and 2nd line of screen will be inserted

Hope this helps you.

Regards,

Rama

former_member197475
Active Contributor
0 Kudos

Hi Rama,

Thanks for your information.

I just followed the same idea of yours but with little bit modified.

On clicking of Change button, I got the record and kept in separately(lt_old). Now if an user changes the value in the selected record(lt_new), am just inserting the record(lt_new) to the Ztable and at the same time removing the old record(lt_old) from Ztable.

BR,

RAM.

Answers (0)