Wednesday 18 August 2021

Near real time Data Replication from Salesforce to SAP HANA using the Advantco Salesforce adapter for SDI

Introduction

Salesforce provides APIs that enable external applications to receive events in near real time mode. In this blog, we provide a detailed configuration steps for two of these options: Platform Event and Change Data Capture (CDC). Platform Event is an excellent option when data from multiple objects are required as in the case of combining data from Opportunity with details from the Account object. Change Data Capture (CDC) provides a quick and configurable option to publish data of a specific object like Account or Contact.

The solution we describe here is based on SAP Smart Data Integration (SDI) tools which provide features to support data replication from external resources to SAP HANA. The two most important components in this context are the Data Provisioning Server, which is a native SAP HANA process, and the Data Provisioning Agent, which is a container running outside the HANA environment. The Advantco Salesforce adapter is deployed on the Data Provisioning Agent host and can be configured from the HANA environment duration the creation of a remote source. The remote source is the connection from SAP HANA to the Salesforce instance.

Preparations on Salesforce side.

Enable Change Data Capture (CDC) for the Account object.

Enabling Change Data Capture is a very easy and quick process.

In Salesforce, go to Setup -> Change Data Capture to activate CDC for the Account object.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Create and configure Platform Event for the Opportunity object.

In Salesforce, define a Platform Event object to hold the data that will be send when an Opportunity is updated. This event object can hold data from any objects, in this case, data from Opportunity and Account.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Once the Platform Event object is defined, we write an APEX trigger code to retrieve the data from the Opportunity and Account.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

The Salesforce configurations are ready. Next step is to configure the SAP SDI part.

Near real time data replication with Salesforce Platform Event or and Change Data Capture (CDC).


Installing the Advantco Salesforce Adapter on the Data Provisioning Agent host.

For a detailed installation and configuration instructions, please see this excellent blog from our NTT DATA colleague.


Creating Remote Source to Salesforce.

Once the Salesforce adapter is deployed and registered to the SAP HANA server, it is now available to be used to create a Remote Source to Salesforce.

There are multiple ways to create a Remote Source, we use the Web-based Development Workbench user interface option.

Provide the Salesforce endpoint, the user credentials and in case of near real time replication, select the Streaming option.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Once the Remote source is configured and tested, one would see the Salesforce objects, Platform events and Event Channels.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Creating replication task to replicate Salesforce Change Data Capture events into HANA tables.

To capture Change Data Capture events into a HANA real table, we define a task and select the remote source created in the step above. In this example, the replication task replicate events from the Salesforce Account object using the standard Event channel.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

The Change Event objects are categorized under the Streaming CDC Source objects.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

The system will automatically create the HANA table structure for the Account Change Event object.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Once the replication is saved and started, the task can be monitored with the standard monitoring tool in HANA.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

The virtual and real table were created automatically when the replication task was saved.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

A query of the real table displays the events of the different accounts. The fields in Salesforce that was modified will have the updated information.

Creating replication task to replicate Salesforce Platform Event events into HANA tables.

To capture Platform events into a HANA real table, we use the same Streaming remote source as we used for CDC replication. We select the Platform Event object from the available Salesforce objects.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

The system will create the table structure based on the Platform Event object structure that was created in Salesforce.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Save and activate the replication to start receiving Platform event from the Opportunity object into the HANA real table.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

Each Platform event is replication in near real time into the HANA real table.

SAP HANA, SAP HANA smart data integration, BW SAP HANA Data Warehousing, SAP HANA Exam Prep, SAP HANA Career, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Certification

No comments:

Post a Comment