Monitoring Changes in Custom Tables
The following document explains an alternative of monitoring changes made to custom tables. Activating monitoring of database changes through SE11 sometimes creates an overhead on database. The following document gives a workaround of monitoring user logs /changes at record level in custom table itself.
1. Creation of Control Structure
Create a control structure in transaction SE11. The control structure has fields which will indicate information on record creation and change.
Include the control structure in the custom table for you want to monitor changes
2. Creation of Table Maintenance View
Create a table maintenance view through transaction SE11 for the custom table.
Include all the table fields in the maintenance view. Set the field property of control fields to “R” . The control fields are then “Read Only” during data maintenance and cannot be changed by end users.
Create table maintenance generator through utilities
Generate table maintenance dialog after giving information of authorization group , Function group and maintenance screen number
3. Adding Events to Table Maintenance
Thorough modification use BEFORE SAVE event “01” and give a subroutine name
Create a new include where we will add code for populating values of control field.The incude can be reused in main program of other table maintenance function groups wherever monitering is required.
4. Populating Control Fields with runtime values
Whenever end users add/remove entries through table maintenance. There are 3 user commands associated with the buttons.
<ACTION> = ‘N’ –New Entry
<ACTION> = ‘D’ –Delete Entry
<ACTION> = ‘U’ –Update Record
For Action = ‘U’ Populate Only Last Change Date, Time for Last change, User who last changed record with system values of date time & user name
For Action = ‘N’ Populate Creation Date, Last Creation data, Creation Time, Last record change time, User who 1st Created record & User who last changed record
If we want to record changes made to record values then another field with name old value can be added in control structure and then populated during run time by retrieving actual value from database using available primary key fields .