Sap Change Documents for Custom Table and Fields

This post will explain how to Create Sap Change Documents for Custom Table or Field step by step.



Change Documents Overview

Let’s first have a look on the result, we expect for this change tracking
For example, change in FI Document ( tcode FB03 to display a document and SAP Table BKPF )
To Display Changes on Document, Environment > Document Changes

Sap Change Document for Custom Table schema

All the changes are displayed as following with old value and new value for each modified field.
( Change Document tracking manage change on field level )

Sap Change Document for Custom Table

In order to compare new value and old value, go to All Changes

Sap Change Document for Custom Table All changes

Check also   SAP License Table and Tcodes

Technical Overview for Change Documents

Change Documents Objects and Tables
Technically, the changes on Document are saved in these both tables
CDHDR : Change document header
CDPOS : Change document items

The object class assigned to Business Objects can be customized in tcode SCDO (Display Change Document Objects)

SCDO- Change Documents Object

Sap Change Documents for Custom Fields
The Update function module for FI document is BELEG_WRITE_DOCUMENT

Let take for example for zzField on BKPF, object class assigned to FI document should be BELEG
Sample code following can be modified to adjust your requirement.
Or you can call directly the FM BELEG_WRITE_DOCUMENT, don’t forget to run commit work because this function module must run in UPDATE MODE in order to not disturb the main business process.

Sap Change Documents for Custom Table

In order to manage change document ( history ) on customize table, a change document object have to be create.

  1. Create Change document Object (SCDO)Create Change document Object
  2. Assign tables to CDO (SCDO)Assign tables to CDO
  3. Generate CDO Update Program (SCDO)Generate CDO Update Program
  4. Generate Update Program and *WRITE_DOCUMENT Function
    Generate Update Program and *WRITE_DOCUMENT Function

For me information, check the sap help documentation on Create a Change Document Object.

Sab125

Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ...Sab