ABAP Generate Change Pointer in Code

ABAP Generate Change Pointer can be done directly by ABAP code. The following post will explains how to customize a change pointer and present a Sample ABAP Code to generate a Change Pointer in ABAP.

For more information about SAP change Pointer, check this post SAP Change Pointer Overview

ABAP Generate Change Pointer Customizing

For customizing, check this post about Creating SAP Change Documents for Custom Table/Fields.
It explains how to enable Change Document for none SAP standard tables and fields. The most common case is to trigger change on customized field on SAP Material or Customer Master Data.

If you want to know more SAP Change pointer / Document customizing and how to Trigger IDOC immediately Purchase Order changed, the previous link will give the whole picture how to set up the customizing needed.

To sum up, First Check the SAP Change Pointer SCDO for Display Change Document Objects if you want to adjust or create a change object for a custom field or table.

Then Add the the new Change Document objects for the Message in the SAP Tcode BD52.

Generate Change Pointer BAPI / Function

In order to generate Change pointer direclty from ABAP Code, you can use the standard function module CHANGE_POINTERS_CREATE. 

You have to pass the following information to CHANGE_POINTERS_CREATE BAPI,

  • The Change document header: CHANGE_DOCUMENT_HEADER ( Type CDHDR )
  • The Change document Items: CHANGE_DOCUMENT_POSITION ( Type Table of CDPOS )

Change Document Header

The Structure CHANGE_DOCUMENT_HEADER contains the header data for the change pointer.
The main fields to be filled in the change pointer header are:

  • OBJECTCLAS: Object class … ex. ‘MATERIAL’
  • OBJECTID: Object value … ex. MATNR or KUNNR
  • USERNAME: User name of the person responsible in change document
  • UDATE Creation date of the change document
  • UTIME Time changed
  • TCODE Transaction in which a change was made
  • CHANGE_IND Application object change type (U, I, E, D)
  • LANGU Language Key of the change
Check also   Demystifying ABAP Code Page in SAP ( Tables and BAPI )

Change Document Items

The Change doucment Items contains the details of the change. It stores the old and the new value on the field level.
When generating Change pointer in ABAP Code, the following fields on the CDPOS structure must be filled

  • OBJECTCLAS: Object class … ex. ‘MATERIAL’
  • OBJECTID:       Object value … ex. MATNR or KUNNR
  • TABNAME:       Table Name
  • TABKEY:          Changed table record key
  • FNAME:            Field Name
  • CHNGIND:        Change type (U, I, E, D)
  • TEXT_CASE:    Flag: X=Text change
  • VALUE_NEW:   New contents of changed field
  • VALUE_OLD:    Old contents of changed field

Generate Change Pointer Sample ABAP Code

 

In the following ABAP Sample code, a SAP change Pointer is created if a the value of MARC Customized field ZZFIELD is updated.

The TABKEY should be MANDT+MATNR+WERKS for SAP Material Plant Level Data.

For Customer Sales Data, the TABKET will be MANDT+KUNNR+VKORG+VTWEG for example

 

 

Check also   Important SAP GRC Tcodes and Tables (Governance Risk and Compliance)

If you want to dive deeper into the change pointer, check this link Change Pointer (Master Data Distribution) 

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

Leave a Reply

Your email address will not be published. Required fields are marked *