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
Table of Contents
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.
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 Structure CHANGE_DOCUMENT_HEADER contains the header data for the change pointer.
The main fields to be filled in the change pointer header are:
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
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
DATA: ls_cdhdr TYPE cdhdr. DATA: lt_cdpos TYPE TABLE OF cdpos. FIELD-SYMBOLS: <fs_cdpos> LIKE LINE OF lt_cdpos. ls_cdhdr-mandant = sy-mandt. ls_cdhdr-objectclas = 'ZMATERIAL'. ls_cdhdr-objectid = p_matnr. ls_cdhdr-username = sy-uname. ls_cdhdr-udate = sy-datum. ls_cdhdr-utime = sy-uzeit. ls_cdhdr-tcode = sy-tcode. ls_cdhdr-change_ind = 'U' . ls_cdhdr-langu = sy-langu. ls_cdhdr-version = '000'. " Change Pointer Triggered when a value of ZZFIELD on " SAP Material Plant Data (extension ZZFIELD ) APPEND INITIAL LINE TO lt_cdpos ASSIGNING <fs_cdpos>. <fs_cdpos>-mandant = sy-mandt. <fs_cdpos>-objectclas = 'ZMATERIAL'. <fs_cdpos>-objectid = p_matnr. <fs_cdpos>-tabname = 'MARC'. " tabkey : MANDT + MATNR + WERKS CONCATENATE sy-mandt p_matnr p_werks INTO <fs_cdpos>-tabkey . <fs_cdpos>-fname = 'ZZFIELD'. <fs_cdpos>-chngind = 'U' . " Update Modification <fs_cdpos>-text_case = 1 . <fs_cdpos>-value_new = p_new_stock. " New Value <fs_cdpos>-value_old = p_old_stock. " Old Value " SAP Generate Change Pointer BAPI in ABAP CALL FUNCTION 'CHANGE_POINTERS_CREATE' EXPORTING change_document_header = ls_cdhdr TABLES change_document_position = lt_cdpos EXCEPTIONS duplicate_pointer_id = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
If you want to dive deeper into the change pointer, check this link?Change Pointer (Master Data Distribution)?
SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…
SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…
Dunning is the business practice of informing a customer of past due payment. Dunning letters…
SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…
What are the main SAP Payment Terms Tables ? What are the related Tables in…
Work center consists of master data related to routing of products. It contains data related…