Utilizing CDHDR and CDPOS SAP Tables for Change Logs

In this post we will discuss the purpose of CDHDR and CDPOS SAP Tables and how to utilize them. Standard SAP and a Custom SAP Program will be provided as examples. We will additionally discuss some information that deals with the overall usage of the 2 tables.

Overview

  • Purpose
  • Differentiate CDHDR and CDPOS SAP Tables
  • How to use CDHDR and CDPOS SAP Tables
  • Additional Info
  • Summary

Purpose

There will be times wherein you need to double check your changes. In some cases, the log is not readily available, so you need to rely on something else.

One good example would be a custom program that performs changes and does not store the change logs. It may show the logs after execution, but it is possible that the logs are not available after exiting the transaction.

This may be a problem for consultants especially if there is a need to review or backtrack the changes done.

CDHDR and CDPOS are SAP Tables that you can check for those change logs.

Differentiate CDHDR and CDPOS SAP Tables

First, you need to understand the difference between those 2 SAP Tables. CDHDR is will contain “Header” details while CDPOS will contain “line item” details.

  • CDHDR – Header Details
  • CDPOS – Line Item Details

Let us focus on a standard example:

Typically, an SAP Document will have 2 main parts: Header (orange box) and Line Item (green box). That is the usual structure for all related SAP documents.

Below is a screenshot from FB03 that will help us view posted accounting documents.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

If we show the details per section, it will look something like this:

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

Let us go through each of them.

Header Details

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

If we consider the simple FB01 or Financial Accounting Document posting below, the header details would contain the Document Number, Company Code, Fiscal Year, Document Type, Document Header Text, Document Date, Posting Date, Period, etc. These are general information that covers whole posted document.

Line Items

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

If we focus on the line items of the document, you will see several line items that clearly itemize the transaction posting. Notice that there is a breakdown of the amount per line (overall showing a balanced debit and credit).

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

You will see the following information per line item: Posting Key, G/L Account, Text, Amount, Tax Code, Account Assignments (i.e cost center, WBS element, etc.), other supplementary info, etc.

Overall:

  • If I want to view the header details of the financial accounting document, I will refer to SAP Table BKPF “Accounting Document Header”.
  • If I want to view the line item details of the financial accounting document, I will refer to SAP Table BSEG “ Accounting Document Segment / Line Items”.

Viewing Accounting Document Header Details of our Document:

Utilizing CDHDR and CDPOS SAP Tables for Change Logs BKPF

Result:

Utilizing CDHDR and CDPOS SAP Tables for Change Logs BKPF

Viewing Accounting Document Segment Details of our Document:

Utilizing CDHDR and CDPOS SAP Tables for Change Logs BSEG

Result:

Utilizing CDHDR and CDPOS SAP Tables for Change Logs BSEG

How are these 2 tables linked? It is the financial accounting document number, company code, and fiscal year that establishes the linkage.

If we specify the same information for the 2 tables, you should see the table details of that document (both header and line item).

Utilizing CDHDR and CDPOS SAP Tables for Change Logs BKPF BSEG

Okay but why am I explaining those 2 tables and not CDHDR and CDPOS?

I want you to associate that type of logic / approach for CDHDR and CDPOS. It follows the same concept as BKPF and BSEG. The only difference is that CDHDR and CDPOS focus on the “changes” done.

  • BKPF + BSEG = Accounting Document Details
  • CDHDR + CDPOS = Change Document Details / Changes done to SAP Documents

Now that it is clear enough, I will move on to how to use those 2 tables.

How to use CDHDR and CDPOS SAP Tables

For this portion, we will discuss a standard SAP example and a custom SAP program example.

It is good to note that when a document has been changed in SAP, a change document number is created. Keep this in mind as we go through the examples.

Standard SAP

1. Go to Transaction Code SE16N.

To view any table in SAP, you can go to transaction code SE16 or SE16N. Below is a screenshot of SE16N where I have entered the CDHDR table.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

2. Narrow down or filter your search results by filling in the parameters for Table CDHDR

We start with table CDHDR because we need to note the “change document number” of the document we are analyzing. The “change document number” will be our linkage / basis of search for Table CDPOS.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

Click on the Execute Button to proceed. For now, you can review the CDHDR results.

Notice the object value is a concatenation of the SAP Accounting Document details (Client + Company Code + Document Number + Fiscal Year) we are concerned with. That is one way to determine the change document number.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

You can also refer to the Object Change field to see what kind of change was done.

3. Copy all concerned “change document numbers” from CDHDR table and open a separate window for SE16N CDPOS search.

You need to copy the “change document numbers” (red box) so you can paste them as part of the selection criteria in Table CDPOS. We open a separate table so that we still have the CDHDR table view.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

4. Narrow down or filter your search results by filling in the parameters for Table CDPOS.

Here you will paste the “change document numbers” you have copied from CDHDR. This should establish the linkage and show you the line item details of the change documents.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs

Click on the Execute Button to proceed.

5. Proceed with your analysis or extract.

Now that you have the line items of the change document, notice that there are “before” (Old Value) and “after” (New Value) details of the changes. This should give you a good overview of the changes done.

You will also notice the field is logged for the specific change.

Custom Program in SAP

The steps remain the same. For custom SAP programs that work on massive document changes, you need to be aware on what that program is changing.

Is it a financial accounting document? Is it a material document? Is it a contract document? Etc. This should help you narrow down the results of CDHDR and CDPOS.

Scenario:

For this example, let us say that there is a custom program that performs massive changes to contract documents following a certain logic / criterion. The logic is not important for this discussion. The important thing is we know that it performs changes to a contract document.

After executing the custom program, change logs and results of the program run will be seen on screen but the exact same log will disappear once you exit from the transaction or worse… your internet has disrupted your connection to SAP.

At this point, you are unsure of the changes because you did not get a chance to review those logs. In some cases, there could be issues with the changes – it did not update accurately. Now you need to find a way to track down all of those changes and revert them.

What to do?

One good example is to utilize CDHDR and CDPOS by narrowing the changes to your SAP User ID, a specific date and time, etc.

Below is a screenshot where I have narrowed down the results (changes done by a custom SAP program) in CDHDR and CDPOS. Notice that the same concept applies with the standard SAP example.

  • Going to CDHDR and narrowing down via User ID and Transaction SE38 (used to run the custom program)
Utilizing CDHDR and CDPOS SAP Tables for Change Logs
  • Viewing the Results of CDHDR and taking note of the change document numbers (highlighted in orange):
Utilizing CDHDR and CDPOS SAP Tables for Change Logs
  • Copy pasting the change document numbers in Table CDPOS:
Utilizing CDHDR and CDPOS SAP Tables for Change Logs
  • Viewing the results of CDPOS:
Utilizing CDHDR and CDPOS SAP Tables for Change Logs

Additional Info

There is a “changed on” field found in SAP Table BKPF. Isn’t that enough? Why go through CDHDR and CDPOS?

Yes, there is a “changed on” field in Table BKPF but you need to consider the depth of information you are looking for.

We can clearly see the SAP User ID that changed the document details, but we don’t know what changed exactly. For that purpose, we need to go to CDHDR and / or CDPOS.

Utilizing CDHDR and CDPOS SAP Tables for Change Logs. BKPF CHANGED ON.

Example: The “changed on” field could be useful if you want to narrow down documents changed on a specific date range but it will not show the before and after changes.

Note: for standard SAP programs, usually there are available change logs that you can view in the concerned transaction code and there are also available reports that show change logs for multiple documents.

If there are change logs available for standard SAP transactions and even available reports to show changes for multiple documents, why should we use CDHDR and CDPOS?

For those who are not aware, below are some images showing available change logs in SAP:

Viewing change logs in FB03: Environment > Document Changes > All Changes

Utilizing CDHDR and CDPOS SAP Tables for Change Logs. Standard SAP Change Logs
Utilizing CDHDR and CDPOS SAP Tables for Change Logs

Viewing change logs via standard SAP Report: S_ALR_87012293

Utilizing CDHDR and CDPOS SAP Tables for Change Logs S_ALR_87012293
Utilizing CDHDR and CDPOS SAP Tables for Change Logs S_ALR_87012293

Earlier I mentioned that these 2 tables would be especially useful for instances or scenarios where there is no available change log view or report that you can refer to. This is evident with some custom programs that have been developed in the SAP environment.

There could also be cases where you want to get a quick snapshot / insight of all visible changes that were done by a certain SAP User ID for a specific date range. In that case, you can utilize the 2 tables for your query.

Summary

  • Purpose – CDHDR and CDPOS are SAP Tables that you can check for needed document change logs.
  • Differentiate CDHDR and CDPOS SAP Tables – CDHDR is for change document header details while CDPOS is for change document line item details.
  • How to use CDHDR and CDPOS SAP Tables – Go to transaction code SE16 or SE16N to narrow down the results for Table CDHDR first. Copy the change document numbers from Table CDHDR and paste them into the Table CDPOS selection criteria. This should give you the change logs needed.
  • Additional Info
    • There is a “changed by” field found in SAP Table BKPF. Isn’t that enough? Why go through CDHDR and CDPOS? The changed by field in Table BKPF does not provide that actual changes done to the document.
    • If there are change logs available for standard SAP transactions and even available reports to show changes for multiple documents, why should we use CDHDR and CDPOS? This is utilized or beneficial for instances where change logs or reports are not readily available.

I hope this helps. Good luck! 😊

✨Fun Fact: I used the name “Micah Davis” in the accounting document posting. It refers to the real name of Masego (the musician).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.