Search The SAP Consultant

Sunday, November 20, 2005

Automatic table history

Some times it’s critical to monitor the changes made to the important tables on the SAP database. SAP provides a way to automate this function. Today I will take you through the steps that we have to perform in order to activate this functionality. After we have carried out the following steps we would be able to monitor the changes using the transaction code SCU3

Step one:

Activate the ‘Log data changes’ option on the technical setting of the selected table. By default this option would be activated for tables such as T000 (Client), T001 (Company code) by SAP.

Now you may ask me if the automatic table recording has already been activated for tables I mentioned above, why system gives the following error message when try to view the change documents using SCU3

Yes we have to do one more step to activate the automatic table history functionality on a given client.

Step two:

Maintain the client number, for which we want to activate the automatic table history, against the parameter ‘rec/client’ on the application server profile.

Bingo now we are ready to go. Now we can use transactions SCU3 to view the change documents.

Ok now let me explain how exactly this works. Every time when you perform an ‘Insert’, ‘Delete’, or ‘Update’ statement on an ‘Automatic table history’ activated table, it will maintain a log on the change document table ‘DBTABPRT’. Check the following screen shot to see the structure of the table ‘DBTABPRT’

Details such as Table name, Date of change, Time of change, Host name, Person who has changed, Transaction code that has been used to change, ABAP Program name, Type of the operation (whether is it insert , delete or update) and the data change will be recorded on the table DBTABPRT. Later when we use transaction code SCU3, it will fetch the data from this table and display the change documents.

But it’s not possible to activate the automatic table history to a table where the length of the primary keys is more than 86 bytes and the length of non primary keys is more than 500 bytes.

As well as consider the fact that activating the ‘Automatic table history’ may slow down the database operations since all the tables with the above option activated need to access the table DBTABPRT to update the change documents and which may lead to table locks. So it’s advisable to activate the 'automatic table history' only on the tables which are really crucial.

Please send me your comments about this post.

No comments: