Change Data Capture for SAP S/4HANA

Prev Next

Overview

Syniti Replicate provides an incremental replication from SAP S/4HANA systems, this replication option is called Mirroring, and allows our users to create a transactional replication using the CDC capabilities from SAP. Ensure that you have completed the Prerequisites steps before proceeding to configure Refresh replication for an SAP S/4HANA system.

SAP Environment Compatibility S/4HANA

Transport is compatible with SAP installations of S/4HANA 1909 and higher.

User Authorization for Mirroring (CDC)

The following Authorization Objects must be assigned to the user performing the generation steps.

Authorization Object

Authorization Field

Authorization Value

S_TCODE

TCD

/BS4/GENERATOR

/BS4/SDRMP

PROGRAM

/BS4/GENERATOR

ACTVT

16 (Execute)

S_DEVELOP

DEVCLASS

<Customer’s Package>

OBJTYPE

TABL

OBJNAME

SDR

P_GRP

ACTVT

02

S_TRANSPRT

TTYPE

ACTVT

03

The following Authorization Objects must be assigned to the user using the Consumption APIs Read Capabilities.

Authorization Object

Authorization Field

Authorization Value

S_RFC

RFC_NAME

/BS4/SDRM_READ_TABLE

/BS4/SRTT_GET_TABLE_SIZE_RFC

/BS4/SDRM_RFC_API

RFC_TYPE

FUNC or FUGR

ACTVT

16

/BS4/SDRMF

RFC_NAME

/BS4/SDRM_READ_TABLE

ACTVT

16 (Execute)

S_TABU_NAM

TABLE

<Name of Tables in scope>

ACTVT

03 (Display)

S_TABU_DIS

DICBERCLS

<Authorization Group of Tables in scope>

ACTVT

03 (Display)

The following Authorization Objects must be assigned to the user using the Consumption APIs Update Capabilities.

Authorization Object

Authorization Field

Authorization Value

S_RFC

RFC_NAME

/BS4/SDRM_UPDATE_MASTER_TABLE

/BS4/SDRM_UPDATE_LOG_TABLE

/BS4/SDRM_DELETE_MASTER_TABLE

/BS4/SDRM_DELETE_LOG_TABLE

/BS4/SDRM_RFC_API

RFC_TYPE

FUNC or FUGR

ACTVT

16

/BS4/SDRMF

RFC_NAME

/BS4/SDRM_UPDATE_MASTER_TABLE

/BS4/SDRM_UPDATE_LOG_TABLE

/BS4/SDRM_DELETE_MASTER_TABLE

/BS4/SDRM_DELETE_LOG_TABLE

ACTVT

16 (Execute)

S_TABU_NAM

TABLE

<Name of Tables in scope>

ACTVT

02 (Display)

S_TABU_DIS

DICBERCLS

<Authorization Group of Tables in scope>

ACTVT

02 (Display)

Note

Refer to Executing the Consumption APIs in SAP S/4HANA for more information on how different components of Consumption APIs are used.

Setup SAP S/4HANA for Mirroring

Download and Install Syniti Replicate

Refer to Installing Syniti Replicate for more information on the Syniti Replicate installation process.

Install Mirroring Transport for S/4HANA

Install the provided transport in the SAP Application Server. The transport files are listed below. To install them, please contact the Customer Basis team.

Transport Contents S/4HANA (Mirroring)

Object Name

Type

Description

/BS4/SDRM

/BS4/SDRM_API

/BS4/SDRM_CONSTANTS

/BS4/SDRM_EXCEPTIONS

Package

Packages that contain all objects related to Syniti Replicate – Mirroring.

/BS4/ERROR_LOG

/BS4/GEN_DB_OBJS

/BS4/GEN_TR_OBJS

/BS4/MASTER_LOG

/BS4/TGT_OBJECTS

Table

Syniti Replicate – Mirroring delivered tables. These tables contain the names of the generated ABAP and HANA objects as well as mappings between standard tables and mirroring target tables. The Master Log table contain the header entry for all mirroring actions and the Error Log table store the messages raised when errors occur when populating target tables.

/BS4/TID_RANGE

Structure

Syniti Replicate – Mirroring delivered Structures.

/BS4/TID_RANGE_TT

Table Type

Syniti Replicate – Mirroring delivered Table Types.

/BS4/SDRM_RFC_API

Function Group

Syniti Replicate – Mirroring Consumption API Function Group. Refer to Executing the Consumption APIs in SAP S/4HANA for more information

/BS4/SDRM_READ_TABLE

/BS4/SDRM_UPDATE_LOG_TABLE

/BS4/SDRM_UPDATE_MASTER_TABLE

/BS4/SDRM_DELETE_LOG_TABLE

/BS4/SDRM_DELETE_MASTER_TABLE

/BS4/SRTT_TABLE_SIZE_RFC

Function Module

Syniti Replicate – Mirroring Consumption API Function Modules. Refer to Executing the Consumption APIs in SAP S/4HANA for more information

/BS4/GENERATOR

Program

Syniti Replicate – Mirroring – ABAP and HANA DB objects generation program.

/BS4/GENERATOR

Transaction

Syniti Replicate – Mirroring – Generator

/BS4/GENERATOR

/BS4/MESSAGE_PROVIDER

/BS4/SPECIFICATION

Interface

Syniti Replicate – Mirroring – OO Interfaces

/BS4/DATA_CLASS

/BS4/DATA_TYPE

/BS4/DDL_TYPE

/BS4/DELIVERY_CLASS

/BS4/MESSAGE_SEVERITY

/BS4/RANGE_OPTION

/BS4/RANGE_SIGN

/BS4/SIZE_CATEGORY

/BS4/TABLES

/BS4/TABLE_CLASS

/BS4/VIEW_ACTION

Class

Syniti Replicate – Mirroring – Constants Enumeration Classes

/BS4/CX_GENERATION_ERROR

/BS4/CX_SDRM

/BS4/CX_SPECIFICATION_ERROR

Class

Syniti Replicate – Mirroring – Exception Classes

/BS4/DB_SPECIFICATION

/BS4/DDL_GENERATOR

/BS4/DDL_SPEC

/BS4/DROP_TRIGGER_DELETE_SPEC

/BS4/DROP_TRIGGER_INSERT_SPEC

/BS4/DROP_TRIGGER_UPDATE_SPEC

/BS4/LOG_TABLE_SPEC

/BS4/MASTER_SEQUENCE_SPEC

/BS4/MESSAGE_LOGGER

/BS4/SEQUENCE_SPEC

/BS4/TABLE_GENERATOR

/BS4/TABLE_SPECIFICATION

/BS4/TRIGGER_DELETE_SPEC

/BS4/TRIGGER_INSERT_SPEC

/BS4/TRIGGER_SPEC

/BS4/TRIGGER_UPDATE_SPEC

Class

Syniti Replicate – Mirroring – Classes

/BS4/SDRM_API

/BS4/SDRM_GENERATION

/BS4/SDRM_SPEC

Message Class

Syniti Replicate – Mirroring – Message Classes

/BS4/SDRMF

/BS4/SDRMP

Authorization Object

Syniti Replicate – Mirroring – Authorization Objects

Executing the Generation Program

The Syniti Replicate Mirroring solution uses a mix of Transportable Objects (Transparent Tables) and Data Base Objects (Sequences and Triggers) to implement the change data capture solution. The Transparent Tables can be separated into the following four groups:

  • Control Tables:
    The Control tables are provided with the installation packaged and are used to keep up an inventory of what Log Transparent Tables (/BS4/GEN_TR_OBJS) and Database Objects (/BS4/GEN_DB_OBJS) were generated, as well as the mapping between Standard SAP Tables in scope for Mirroring and their corresponding Log Tables (/BS4/TGT_OBJECTS).

  • Master Log Tables:
    The Master Log Table (/BS4/MASTER_LOG) is also provided with the installation package and is used to track all Mirroring activities.

  • Error Log Tables:
    The Error Log Table (/BS4/ERROR_LOG) is also provided with the installation package and is populated with any error message raised during the execution of Triggers during the Mirroring activities.

  • Log Tables:
    Log Tables are not provided with the installation package and must be generated in the source system's development environment. Log tables are Transportable Objects and need to be placed in Transport Requests and promoted through the landscape to the desired production environment.

No Database Object is provided with the installation package. All Database Objects must be generated directly in each environment of the source system.

To generate both Log Tables and Database Objects, report /BS4/GENERATOR (transaction code /BS4/GENERATOR) is available.

Master Log Table Database Objects - Sequence

As explained in the previous section, the Master Log Tables is provided with the installation packaged and does not need to be generated using /BS4/GENERATOR. However, the Database Objects associated with it must be created. In this case, only a Sequence will be created in the database as no Triggers are required for Master Log Table.

To execute this step, all that is required is to select the Master Table radio button under Generation Control in the selection screen and execute the report as shown in Image A.

Transaction SE80

A screenshot of a computer  Description automatically generated

Object Navigator Execution

Image A: Master Log Table Database Objects Generation

After the report is executed, Sequence /BS4/MASTER_LOG_SEQ will be created, and the execution log will be displayed. In the following example, the Master Log Table Sequence had previously been created, therefore in the execution log the message states that a new one cannot be created. When the program is executed in an environment where the Master Log Table Sequence does not exist, a successful message would be displayed.

Log Table Transportable Objects – Transparent Table

The Transportable Objects need to be created for the tables in scope for Mirroring/CDC.

To execute this step using /BS4/GENERATOR, the Log Table radio button must be selected under Generation Control section, and the Transportable Objects radio button must be selected under Transportable or Database Objects section. On the main section, the following fields must be entered:

  • Transport Request: Transport Request to be used to promote the Log Tables to other environments;

  • Package: Development Package in which the Log Table should be created;

  • Prefix: Used to construct the name of the Log Table - SDR<TABLE_NAME>;

  • Table Name: Name of the table for which a Log Table should be created.

Image B: Log Tables Transportable Objects Generation shows an example of how create Log Table ZSDRLFA1 for table LFA1 in package ZSDRGEN.

A screenshot of a computer  Description automatically generated

Image B - Log Tables Transportable Objects Generation

During the execution of the report for the creation of Log Tables Transportable Objects, the Package assignment and Transport Request assignment must be confirmed.

A screenshot of a computer  Description automatically generated

Log Tables Transportable Objects Generation - Package Assignment

A screenshot of a computer  Description automatically generated

Log Tables Transportable Objects Generation - Transport Request Assignment

Once the report is executed, Table SDR<TABLE_NAME> will be created and the execution log will be displayed.

A screenshot of a computer  Description automatically generated

Image C: Log Tables Transportable Objects Generation Log

Log Table Database Objects – Triggers & Sequence

The Database Objects need to be created for the tables in scope for Mirroring/CDC.

To execute this step using /BS4/GENERATOR, the Log Table radio button must be selected under Generation Control section, and the Database Objects radio button must be selected under Transportable or Database Objects section. On the main section, the following fields must be provided:

  • Prefix: Used to construct the name of the Log Table Sequence and Triggers- SDR<TABLE_NAME>_[SEQ, _INS, _UPD, DEL];

  • Table Name: Name of the table for which a Log Table should be created.

Image C: Log Tables Database Objects Generation shows an example of how create Sequence ZSDRLFA1_SEQ and Triggers ZSDRLFA1_INS, ZSDRLFA1_UPD, ZSDRLFA1_DEL for table LFA1.

A screenshot of a computer  Description automatically generated

Log Tables Database Objects Generation

Once the report is executed, the following objects will be created, and the execution log will be displayed.

  • Sequence: SDR<TABLE_NAME>_SEQ

  • Triggers:

    • SDR<TABLE_NAME>_INS

    • SDR<TABLE_NAME>_UPD

    • SDR<TABLE_NAME>_DEL

It is possible to execute /BS4/GENERATOR to drop the created triggers for a table. To perform this action, radio button Log Table must be selected under Generation Control section, and radio button Database Objects must be selected under Transportable or Database Objects section as well as the check box Drop Triggers Only. On the main section, the following fields must be provided:

  • Prefix: Used to construct the name of the Log Table Triggers- SDR<TABLE_NAME>_[INS, UPD, DEL];

  • Table Name: Name of the table for which a Log Table should be created.

Image D: Log Tabes Database Objects Generation - Drop Triggers shows an example of how create Sequence ZSDRLFA1_SEQ and Triggers ZSDRLFA1_INS, ZSDRLFA1_UPD, ZSDRLFA1_DEL for table LFA1.

A screenshot of a computer  Description automatically generated

Image D: Log Tables Database Objects Generation - Drop Triggers

Once the report is executed, the Triggers will be dropped, and the execution log will be displayed.

A screenshot of a computer  Description automatically generated

Log Tables Database Objects Generation - Drop Triggers Log

Steps for Replicating CDC Enabled Tables

Extracting data from SAP S/4HANA Systems using Syniti Replicate requires software to be installed on the application server running Syniti Replicate.

Configure the Enable Transactional Replication Wizard

Note

Skip this section if you are setting up a Refresh replication. Continue here if you are setting up a Mirroring replication from SAP S/4HANA.

This section assumes you have selected the Source Connection wizard option to launch the Enable Transactional Replication wizard. To open the wizard from the Management Center, right-click a connection in the Metadata Explorer, and then select Transactional Setup > Enable.

A screenshot of a computer  Description automatically generated

In the Enable Transactional Replication wizard:

  1. Select the Triggers option.

    A screenshot of a computer  Description automatically generated

  2. On the Triggers Based Log Setting page, complete the required fields using the following table:

    Field

    Description

    User and Password

    These fields are automatically filled from the connection string properties.

    Tablespace

    Before selecting the Master Table, make sure to assign the proper tablespace name for ECC systems: /BS4/

    Master Table

    Once selected the Tablespace name, you will be able to select or create a new Mater Table.

    Retention Time

    The amount of time in hours that a transaction is kept in the log tables. The default value is 72 hours. When the amount of time a transaction resides in the log exceeds the retention time, the transaction is permanently removed from the log tables.

    Tuning the retention time provides control over the size of the log tables. It is also possible to instruct Syniti Replicate to remove all the processed transactions at the end of each mirroring interval. Tuning the retention time provides control over the size of the log tables.

    Delete Block Size

    Based on the retention time, Syniti Replicate deletes items from the log. This field specifies the maximum number of records to delete from the Syniti log tables with a single SQL statement. The default value is 10,000 records. You do not typically need to edit this value.

    Lower-case Trigger Identifiers

    Check this option if your database installation uses lower-case trigger identifiers. Always inactive for SAP ECC sources.

    Trigger Order

    Always inactive for SAP ECC sources.

    Uncommitted Transactions Recovery Option

    This section can be used to indicate how uncommitted transactions should be handled during replication.

    • None: No gap conditions handled. Uncommitted transactions may cause data to be skipped in replication.

    • Wait: Set a number of mirroring intervals to hold all replications on the connection to wait when a gap is found due to an uncommitted transaction. All replications in the connection will hold and wait for the number of cycles specified to see if the gap is filled. If after the number of cycles, a transaction is still not committed, it will be skipped.

    • Continue and Process when Committed: Instead of pausing all replications in case of a gap, replication proceeds with all currently committed transactions. During the next mirroring cycle, the trigger log table is checked for earlier transactions that now have been committed, and any identified transactions are processed.

    • Skip Uncommitted Transactions Older Than: If wait or continue are selected, this property sets a limit on the amount of time to wait for uncommitted transactions. For instance, a value of 15 minutes means that, no matter which option you choose, transactions opened and not committed for more than 15 minutes will be skipped.

A screenshot of a computer  Description automatically generated

Define Replications

Refer to the Define the Replication section for more information to define Mirroring Replications.

Syniti SAP RFC .NET Data Provider Connection Properties

The table below defines the available Syniti SAP RFC .NET driver connection properties along with recommended values to be used for properties.

Required Parameters

Description

AppServerHost

IP Address or host name of application server

System ID

Unique identifier assigned to each individual SAP system

Client

SAP client number

System Number

Unique identifier for an SAP instance

User

User ID authenticating to the SAP System

Password

Password

Optional Parameters

Description

System Language

Select your system language

Read Table

Function allowing direct access to database tables.

For ECC: /BOA/SDRM_READ_TABLE

For S/4: /BS4/SDRM_READ_TABLE

Stream Read Table

Function for efficient data retrieval. By default: /BS4/STREAM_READ_TABLE

Logon Group

Logon Group when connection is loading balanced/SAP Message Server

SNC Mode

Secure Network Communications mode enhances security for SAP connections. Set in True to use SNC

SNC Partner Name

Identification of the secure network partner

SNC Library Path

Directory containing secure network communications libraries

SNC QOP

Quality of Protection specifies the level of security using SNC

SNC SSO

Secure store and forward enhances security for message transmission

SAP Router

Secure communication tool for connecting SAP systems

Message Server Host

Server responsible for managing communication between SAP instances

Message Server Service

Service of the SAP system (message server). This can be the numeric description of the service port of the message server or the alphanumeric equivalent (for example, sapmsXXX, where XXX is the system ID of the SAP system).

Gateway Host

Entry point for communication between SAP systems and external applications

Gateway Service

The service that facilitates communication between SAP systems and external applications

Destination Server

Name of the destination defined in SM59 in SAP, for example: NCO_SERVER

Program ID

Unique identifier for a program running in the SAP system, for example: SKPStreamServer

Connection Count

SAP connection count refers to the total number of active connections to an SAP system

Max Pool Size

Maximum number of connections allowed in the pool

Fetch Block Size

Read Block Size. Specifies the amount of data retrieved in each fetch operation

Fetch Queue Size

Specifies the number of data blocks kept in memory during fetch

Extended Properties

Additional properties not listed in the grid.

Remove Components Used in a Triggers-Based Replication

In this scenario, follow these steps:

  1. Disable the Mirroring replication

  2. Delete the replication from the Replication Monitor. The following message will be displayed:

  3. Click Yes. A Confirmation dialog box is displayed to remove your Triggers from your source database.

  4. Click Yes.

  5. If you are removing a group of replications, select Yes All.

Uninstall Transactional Components

Select and right-click the source connection and select Transactional Setup > Disable.

This wizard offers two options to disable the Transactional setup:

  • Disable Transaction Replication: Choose this option to disable transactional replication from this connection and leave all settings on the database unchanged.

  • Complete Uninstall: The database’s transactional setup will be uninstalled. If other connections are using the same server as source for transactional replication, they will no longer work correctly.

Uninstall components on SAP

Remove the Database Object on SAP

  1. Go to transaction SE80, select /BOA/GENERATOR program and execute it.

  2. On Generator Control, select Log Table.

  3. On Transportable or Database object section, select Database Object and select the Drop Triggers Only checkbox.

  4. Complete the information with you Transport Request, Package, Prefix used when you enable Mirroring, and enter the table name.

  5. Once you execute this action, a confirmation page will be displayed.

Remove Custom Tables for Mirroring

Syniti Replicate creates a Zxxx table in SAP for Mirroring activities, and it must be removed manually by following these steps:

  1. Go to Transaction SE14, and remove the temporal table created for replications, in this example we enable mirroring replication for table AUSP. The custom table created for Mirroring is called ZSDRAUSP

    ABAP Dictionary utility interface showing object name and dictionary objects options.

  2. To remove a custom table in SAP you have to make sure it is empty. Select the option processing Type - Direct, check the option “Delete Data” and click on “Activate and Adjust Database” button.

    ABAP Dictionary interface for managing database tables and operations like deletion.

  3. Go back to transaction SE80, select the Package used for Mirroring, in this example we used “Z001”, select the table and Delete it.