Skip to Content
Technical Articles
Author's profile photo Zafer Onbaş

Change log for Z-Table Maintenance (via SCDO)

Generally we don’t need table logging for custom table maintenance (SM30), but it is important and needed for some cases. All customizing tables are automatically recorded by default but if you use regular Application tables (master and transaction data), you’re about to get your hands dirty .)

Sample%20Z-Table

Sample Z-Table

Automatic table change logging

Actually this is not suitable for our case because we want to log particular tables but it’s good to know..

You can use Automatic table change logging by setting the “Log Data Changes” flag under the table “Technical Settings” in SE11 (p.s. You must activate the table again after saving it, otherwise it will not be effective).

Next, to be able to log the table changes you must activate the system profile parameter Rec/Client. The default setting is OFF (no changes are logged). BASIS Team can assist you in this.
Setting Rec/Client Parameter for Logging

However, SAP recommends this option only in systems where this is worthwhile, because all tables with “Log data changes” option will be logged, so this has a major impact on performance (Even for one client)

You can now view the changes via SCU3 (Table: DBTABLOG)

SCU3-Logs

SCU3-Logs

Logging using Change Document Objects (SCDO)

To log changes for particular tables in SM30 Maintenance, we can use change document objects and its associated functions.

Let’s do it step by step;

  • Go to SCDO and create a Change Document Object (Choose Yes for opening Namespace Pop-ups)
  • Insert the entries and choose Utilities → Generate update pgm.
  • In the opening pop-up, give function group name (it will be created if it doesn’t exist) and generate the update program for the object by clicking Activate.
  • In the Data Element → Further Characteristics Tab, set the “Change Document” flag for the objects which you want to track changes. As you recognise, many SAP standard data elements come with the selected flag.
  • You can now insert appropriate calls in the corresponding programs, for our example we will use Table Maintenance Events.
  • Under the table maintenance (SE56) go to Environment → Modification → Events.
    Give the events & subroutine names as shown in the figure and click the Editor icon to create suggested include (L<fg_name>F01).

Now, you can just copy and paste the code snippet (link is below) into the created include. It will begin to create logs in CDHDR-CDPOS tables. You can now view the changes via reports CHANGEDOCU_READ & RSSCD100.

SCDO-Logs

SCDO-Logs


Source code on GitHub: 
https://goo.gl/VrwXaC
(Fork me on GitHub if you want to contribute)

Originally published at – Change log for Z-Table Maintenance (via SCDO)

 

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Maulik Thakkar
      Maulik Thakkar

      Is there way to disable custom change document object created via this method?

      Author's profile photo Sebastian Lidzba
      Sebastian Lidzba

      Hi all.

      Great manual!

      Im working in BW and want to use this method for a transactional DSO (a DSO that allows to edit data via SM30). The moment where i stuck is to activate the change log for the fields of the table. Because the fields are infoobjects, which means the data element is generated and can't be edit.

      So my question is, if theres a trigger where I can switch on to force the system to write to the CDHDR/CDPOS tables even if no field has the change log flag set.

      Thanks for any hints.

      Best regards,
      Sebastian

      Author's profile photo Mayank Patel
      Mayank Patel

      Hi Zafar,

      Thanks for the solution it works perfectly fine... I really liked the way code is written...

      Regards

      Mayank

      Author's profile photo Mateo Cano Ceballos
      Mateo Cano Ceballos

      I have a doubt.
      To use this method, the data elements must have the "doc.modification" check...

      How is it possible to make a log for these fields that dont have the check?

      For example, I need to have a change log for the tables in a cluster and the only alternative I see is to do my logic by manipulating the events and variables "<VCL_TOTAL> "," <VCL_EXTRACT> "...

       

      ¿I'am right?

      Author's profile photo Akash Dhakulkar
      Akash Dhakulkar

      Hi Zafer,

      I tried to use the code snippet but it ran in multiple syntactical errors can u please help with the simplified code to be used?