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

Logging changes in a Custom Table

sharadendu_agrawal
Active Participant
0 Likes
3,511

Hi All,

We have two custom tables. Now the requirement is to log the changes of the first table in the second table.

In the second table if any value in the first table is changed then both the old and the new values should be stored as two different entries. The second table has fields for all the entries in the first table with the names like field1_old, field1_new, field2_old, field2_new.

So we need to log both the old and the new entries.

Plz help me.

Regards,

Sharadendu

5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
1,811

What you would like to make already exist with table CDHDR & CDPOS ..

Just activate the "Log data changes" in the Technical setting of your first table.

Fred

Read only

Former Member
0 Likes
1,811

SAP has defines a table by itself if you set the parameter to LOG CHANGES for any Customized table.

Goto SE11 & open the table. click GOTO->Technical Settings & at the end, tick the check box LOG DATA CHANGES

Log data changes

The logging flag defines whether changes to the data records of a table should be logged. If logging is activated, every change (with UPDATE, DELETE) to an existing data record by a user or an application program is recorded in a log table in the database.

Note: Activating logging slows down accesses that change the table. First of all, a record must be written in the log table for each change. Secondly, many users access this log table in parallel. This could cause lock situations even though the users are working with different application tables.

Dependencies

Logging only takes place if parameter rec/client in the system profile is set correctly. Setting the flag on its own does not cause the table changes to be logged.

The existing logs can be displayed with Transaction Table history (SCU3).

Read only

0 Likes
1,811

>

> Logging only takes place if parameter rec/client in the system profile is set correctly. Setting the flag on its own does not cause the table changes to be logged.

>

Hi how do you set the rec/client in the system profile?

Thanks

Read only

0 Likes
1,811

setting syetem profile parameters is something which you can ask to basis people of your organization .

Read only

Former Member
0 Likes
1,811

Hi,

How changes are happening? through ABAP code or direct custom entry?

If abap code then before updating new data. Retrieve old data from Table 1 and then update second table.

Reward if useful!