cancel
Showing results for 
Search instead for 
Did you mean: 

How to update DBTABLOG?

Former Member
0 Kudos
1,805

Does anyone know how to use a Z*-program to write entries to the database log table DBTABLOG?

The reason I'm asking is we have a batch job to update table T001b. Due to the Sabine-Oxlay requirements, I need to add entries to DBTABLOG each time that batch job updates the table T001b so that auditors can use transaction s_alr_87003642 (go to utilities -> change logs) to see who made changes to table T001b.

Basically, I need to minic how DBTABLOG entries are created when s_alr_87003642 is called to update T001B.

I found out that each T001b line change thru s_alr_87003642 results in 3 new lines in DBTABLOG. The first line has LOGKEY = VB, the third line has LOGKEY = VE.

I can use debug to see how DBTABLOG-logdata(has LRAW data type) is created in the first line and the third line. But debug will not stop at anywhere the second line's DBTABLOG-logdata is created!

So I have trouble to create DBTABLOG-logdata and DBTABLOG-logid for the second line.

If anyone ever wrote directly to DBTABLOG, please tell me how to load information into DBTABLOG fields of LOGDATA and LOGID.

Thanks,

Ruthy

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

If your requirement is to simply have a log of the changes to T000b, then isn't the standard logging being done by SAP and report-able via SCU3 enough?

Also - has anyone actually experienced performance/locking problems referred to when enabling rec/client?

Former Member
0 Kudos

Christian, Andreas, and Ajay;

Thank you very much for reminding me to check SCU3 and ST05 (trace).

In trace list, when I put the cursor on the line which executes the insert to table DBTABLOG, then click “ABAP display”, it took me to “UPDATE T001B“. It just won’t show how DBTABLOG entries was added! This only happened when I click on object DBTABLOG. If I click on any other objects, it will show me the real codings!

May be the codings to update DBTABLOG are inside “UPDATE” command (controlled by log change flag and rec/client parameter), therefore, we cannot see it in any ABAP programs?? Please advise.

Ruthy

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Ruthy,

looks quite easy to test your theory:

If update statement includes logic for dbtablog, then just make a little report with a single update inside. Then new entries in dbtablog / SCU3 should be visible. (And afterwards change back.)

My guess: it will work - if not, we can think about a different test.

Regards,

Christian

Former Member
0 Kudos

Yes, Christian, your suggestion did work. Thanks.

And that confirms that DBTABLOG update is happened inside SAP commands “INSERT”, “UPDATE”, and “DELETE”.

I think LOGDATA contains “before change” non-key data. But I have trouble to figure out LOGID field, for example, LOGID value "373029atcgpa130306". I know the first 6 digits are date and time in microseconds (eg. 373029), followed by host name (eg. atcgpa13). But I could not figure out where the 306 was from. I believe 306 is some kind of system parameter.

Does anyone happen to know where is the last 4 digit from??

Thanks,

Ruthy

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Ruthy,

easiest way: compare the DB entry with a display in SCU3. If the last digits don't appear, they aren't important user information.

You can also have a look inside this report to see how SAP selects the log.

Regards,

Christian

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Ruthy,

like Ajah I always thought of this log as given functionality.

If we are wrong: make a change in a transaction and run a SQL-trace. Search for update of the log tables, jump to the source code and place a break-point.

Make a second change (maybe including update debugging) and wait for the break-point to stop the execution. Now you can see in the calling history, which functions were used by SAP.

Regards,

Christian

andreas_mann3
Active Contributor
0 Kudos

Hi Rutthy,

can't you use transaction <b>SCU3</b> to analyse

changes in T001B

regards Andreas

Former Member
0 Kudos

Hi,

Won't DBTABLOG entries be written by the system when you update T001B (in a Z program)?

My understanding was that such entries would be written as long as table's technical setting is to log changes, and rec/client parameter is set in the profile parameters. A simple update/delete/insert shall trigger the log recording based on these, is what I understood of it.

cheers,