Changes to standard business objects in SAP are logged in Change Documents. We can extend this concept to custom database tables also by creating a change document object in transaction SCDO and adding the tables under it.
You can create a change document object for a business object. This change document object contains the tables in which the data of the business object is stored.
You can create a change document object for a business object. This change document object contains the tables in which the data of the business object is stored.
Click on Insert Entries and Utilities -->Generate Update Pgm in the consecutive steps.
Now a update function module will get generated which we can use in our program to update the CDHDR and CDPOS tables for the corresponding object id .
Logging only takes place if the fields whose contents were changed refer to a data element that was flagged as relevant for the change document.
Now a update function module will get generated which we can use in our program to update the CDHDR and CDPOS tables for the corresponding object id .
Logging only takes place if the fields whose contents were changed refer to a data element that was flagged as relevant for the change document.
The changes made are logged in two tables namely CDHDR and CDPOS .
Change Document Header table (CDHDR) : The database table CDHDR stores the header data of any changes logged in the system. For example, object class, object ID, change document number, the user ID of the user who made changes, the date and time at which the change was made, the transaction code through which change was made, etc.
Change Document Item table (CDPOS) : The database table CDPOS stores the actual changes that have been made, i.e., the table name, field name, table key for the entry that has been changed, old value, new value, change flag etc.
Additional Info :
Reports to display change documents as an ALV report are RSSCD100 , RSSCD200 .
Change Document Header table (CDHDR) : The database table CDHDR stores the header data of any changes logged in the system. For example, object class, object ID, change document number, the user ID of the user who made changes, the date and time at which the change was made, the transaction code through which change was made, etc.
Change Document Item table (CDPOS) : The database table CDPOS stores the actual changes that have been made, i.e., the table name, field name, table key for the entry that has been changed, old value, new value, change flag etc.
Additional Info :
Reports to display change documents as an ALV report are RSSCD100 , RSSCD200 .