Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

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

7 REPLIES 7

raymond_giuseppi
Active Contributor

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

Sandra_Rossi
Active Contributor
0 Kudos

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

raymond_giuseppi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

NTeunckens
Active Contributor
0 Kudos

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 ...

raymond_giuseppi
Active Contributor

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

Former Member
0 Kudos

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