Skip to Content
avatar image
Former Member

Comparing the Changed Record Value with the Original Record

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.



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    May 27, 2014 at 12:03 PM

    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.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.