Categories: ABAP Tutorials

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

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 )

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

Related Post

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)

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.

INCLUDE FF05LCDT.
 
SELECT SINGLE * FROM BKPF WHERE BUKRS = p_companycode
                            AND BELNR = p_invoicedocnumber
                            AND GJAHR = p_fiscalyear.
CHECK SY-SUBRC = 0.
" Old data 
*BKPF = BKPF.
 
" New data
BKPF-zzfield = p_link.
MODIFY BKPF.
 
UPD_BKDF  = 'X'.
INCLUDE FF05LCDC.

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)
  2. Assign tables to CDO (SCDO)
  3. Generate CDO Update Program (SCDO)
  4. Generate Update Program and *WRITE_DOCUMENT Function

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

Share
Published by
John

Recent Posts

The Most Important SAP ISU Tables

SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…

December 22, 2020

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…

November 18, 2020

The Main SAP Dunning Transaction Codes

Dunning is the business practice of informing a customer of past due payment. Dunning letters…

November 28, 2019

SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)

SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…

August 1, 2019

The Most Important SAP Payment Terms Tables (ZTERM, Text…)

What are the main SAP Payment Terms Tables ? What are the related Tables in…

October 21, 2018

The most Important SAP Work Center Tables in SAP PP

Work center consists of master data related to routing of products. It contains data related…

October 21, 2018