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 Z table from ABAP

Former Member
0 Likes
3,917

Hello,

what I'm trying to do is to log all the changes made in a user table (Z...). For the changes made through SM30 it's easy since I can use the standard logging feature in SE11 and then see these changes through transaction SCU3 for example.

My problem is that most of the changes are made through ABAP programs, i.e. through insert, modify and so on, and in these cases the modifications are not logged. So I would like to know if it's possible to log the changes in a standard way (maybe with a function module) so then I can see the report of modifications through SCU3.

I would like to keep track of all my changes, not only the ones made with the table maintenance but also the ones made through ABAP coding

Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,208

Hi,

You would need to use change document object (transaction SHDO) to do this. For help on this, refer to http://help.sap.com/saphelp_nw04/Helpdata/EN/2a/fa018f493111d182b70000e829fbfe/frameset.htm.

Regards,

SS

7 REPLIES 7
Read only

ThomasZloch
Active Contributor
0 Likes
2,208

Hmm, as far as I know, SE11 table logging also tracks changes done via ABAP programs. Doublecheck via SE16 on DBTABLOG and give your table name there.

Thomas

Read only

Former Member
0 Likes
2,208

Here is what SAP says as a F1 help on the logging flag in technical setting of a table..

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

Former Member
0 Likes
2,209

Hi,

You would need to use change document object (transaction SHDO) to do this. For help on this, refer to http://help.sap.com/saphelp_nw04/Helpdata/EN/2a/fa018f493111d182b70000e829fbfe/frameset.htm.

Regards,

SS

Read only

Former Member
0 Likes
2,208

Hi

U should create a custom object (trx SCDO) for your Z-TABLE in order to manage the change document, but then u need to change all program updating that table and call the fm to update the change document table (CDHDR and CDPOS).

Max

Read only

0 Likes
2,208

Max it is not necessary, we need to have these conditions satisfied for change logging custom tables:

Change log flag set to ON in technical settings

rec/client is set to ON in system parameters

SAP says that the table will be logged for both user changes through SM31 or application program changes through UPDATE, INSERT etc statements. Read my post, which I copied from SAP application help.

Read only

0 Likes
2,208

Thank you very much to everybody for your answers. Vishnu as you said, it should be enough with the standard feature for logging changes in sap. But maybe I will have a look at change documents, because I want to track some more user information than the username and the date.

Thanks everybody for your support

Read only

Former Member
0 Likes
2,208

Hi Javier,

Use change documents inorder to capture changes. Please check the below link for change document log.

http://sample-code-abap.blogspot.com/2008/02/applying-change-document-technique-on.html

Thanks,

Vinay