Skip to Content
0

How download Table Change History (SAP standard table logging) for different SAP tables in ABAP

Nov 16, 2016 at 10:20 AM

153

avatar image
Former Member

Hi all, I am new at ABAP development and have a Problem. For a project I have to create a program that downloads the change history (SAP standard table logging) for three different SAP tables. I tried to select the data for these from the CDHDR and CDPOS tables but I get a really bad performance, because of the size of these two tables.

I also tried the SCU3 transaction, which shows the Change History for the tables in a really fast way as an ALV grid.

Does anybody know a better (faster) way to get the Change History for these three and can recommend something?

I would be very thankful!

Regards,

Kadir

10 |10000 characters needed characters left characters exceeded

If you're looking for a fast way, and SCU3 is fast enough for you, why are you looking for other methods? PS: example of program proposed by Raymond here http://scn.sap.com/thread/486920

0

Can you clarify

  • Transaction SCU3 refer to Logging Changes to Table Data (table DBTABLOG)
  • Tables CDHDR/CDPOS refer to Change documents

Which one do you actually want to extract, those are different logs.

Regards,
Raymond

0
Former Member
Raymond Giuseppi

Hi Raymond,

at first let me thank you for your help and sorry if my question is not clear enough. Actually I just need the outcome of the SCU3 with the old and new changed values. The idea is to create a report, which downloads three different sheets with the change history for each table.

For the beginning it would be enough if I could just save the data in an internal table, because the download is not a problem. Perhaps I had a wrong approach till now.

It seems like I have to use the DBTABLOG, am I right? But unfortunately I can’t see some of the columns like Change Type (Old value/New value) etc. how can I get them or see the tables which includes them?

Kind regards,

Kadir

0

Look at my old answer in the link mentioned by Sandra, this table has no fixed structure, you have to navigate into the raw data thru offset and pointers to regenerate table structure. Look at the recent answers added, my sample code dates from the early part of the century, Some FM became since obsolete, Unicode and newer Abap versions provided us many new statements and utilitty classes.

But if SCU3 is okay for you, as it can output data in an ALV grid you could use it, wrap it in a custom report using cl_salv_bs_runtime_info so you can get the generated internal table back in you wrapper program.

Regards,
Raymond

1
Former Member
Raymond Giuseppi

Dear Raymond,

thank you very much! I could solve my problem with “cl_salv_bs_runtime_info“, it was a really helpful hint!

Thanks and regards,

Kadir

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Raymond Giuseppi
Nov 16, 2016 at 11:08 AM
2

Both log tables only carry objectclas and objectid to identify records , so if you only use TABNAME in criteria to access the cluster table CDPOS don't expect any good performance, only key fields of CDCLS are actual database keys. You need at least to provide some OBJECTCLAS criteria for mass download.

Hint: You can find link between table name and object in transaction SCDO or in a program from table TCDOB.

Regards,
Raymond

Share
10 |10000 characters needed characters left characters exceeded
Nic Teunckens Nov 16, 2016 at 02:41 PM
0

You could also have a look at FM "CHANGEDOCUMENT_READ_RANGES" which allows for reading multiple records from the ChangeHistory Tables ... Again, you will need "OBJECTCLASS" and "OBJECTIDS", but these can be provided as Ranges via the FunctionModule.

I've used this FM before, but truthfully only to download a handful of Records. So I can't make any claims on its Performance ...

Share
10 |10000 characters needed characters left characters exceeded