Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • 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

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

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 16, 2016 at 11:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2016 at 02:41 PM

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

    Add comment
    10|10000 characters needed characters exceeded