Wednesday, 23 June 2021

Access Salesforce custom objects from HANA Cloud via SDI

I’m going to explain how to connect in the following sections.

1. Install DP Agent and configure SAP HANA Cloud connection

2. Deploy and register the adapter for Salesforce

3. Add remote source to SAP HANA Cloud

Prerequisites

Prepare following environments in advance.

1. Salesforce

2. SAP HANA Cloud

3. An operating system which DP Agent will be installed (Linux / Windows)

We used Windows server this time.

Now, let’s get started!

1. Install DP Agent and configure SAP HANA Cloud connection

1. Create a HANA user to connect to SAP HANA Cloud from DP Agent. Open SAP HANA Cockpit and create a user with following privileges.

2. System Privilege - AGENT ADMIN, ADAPTER ADMIN

3. In order to avoid Windows environment specific issue that DP Agent could not start after Installation because of lacking a DDL file, Install x64 Visual C++ Redistributable Package to avoid DP Agent start failure if necessary.

4. Configure DP Agent after installation is completed. Go to the installation directory and run agentcli.bat in a command prompt.

cd C:\usr\sap\dataprovagent\bin

agentcli.bat --configAgent​

5. Select Option 2(Start or Stop Agent), then Option 1(Start), and start the Agent.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

6. When the agent has started, return this top menu screen back again, select Option 6(SAP HANA Connection) and then Option1(Connect to SAP HANA Cloud via JDBC).

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

7. Input following parameters about the connection to SAP HANA Cloud. (Please input information of your own environment.)

Use encrypted JDBC connection True 
Host Name 

Host name of the endpoint of SAP HANA Cloud Instance

*You can see it on SAP HANA Cockpit. 

Port Number 

Port number of the endpoint of SAP HANA Cloud Instance

*You can see it on SAP HANA Cockpit. 

Agent Admin HANA User  HANA user name which is created in step 1 
Agent Admin HANA User Password  Password of HANA user name which is created in step 1 
Use Proxy Server  false 
HANA User Name for Agent Messaging 

(When new registration) Any user name

(When using an existing account) existing user name to use

HANA User Password for Agent Messaging 

(When new registration) Any password

(When using an existing account) password for an existing user to use

Do you want to create a new SAP HANA user …  true
When you want to create an account to communicate to the agent, put true.
If you use an existing user, please set false. 

8. When you’ve completed the connection settings, Return the top screen of DPAgent Configuration Tool back and select Option7 and then Option1 (Register Agent).

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

9. Register the agent with any name. (We set ‘dpagent_172’.)

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

Here, we completed the DP agent registration and connection settings to SAP HANA Cloud.

These work in this section allow us to establish a JDBC connection from DP Agent to SAP HANA Cloud.

In the next section, we’ll register an adapter for Salesforce on our DP agent to allow SAP HANA Cloud to connect to Salesforce.

2. Deploy and register the adapter for Salesforce


Deploy and register an adapter developed by ADVANTCO.
In this evaluation test, we’ve got the trial product and license key from ADVANTCO directly.

1. Obtain the adapter for Salesforce(Jar file) from ADVANTCO and upload it to the server where the DP agent is installed.

2. Open DPAgent Configuration Tool as in step 1.3.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

3. Select Option9(Custom Adapters) and then Option2(Deploy Custom Adapter).

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

4. Input the adapter(jar file) uploaded in step2.1 as an absolute path

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

5. After successfully deployed the adapter, return back to the top screen of the DPAgent Configuration Tool. And select Option8 (Adapter Registration), and then Option2 (Register Adapter).

6. Input ’AdvantcoSFDCAdapter’ to adapter name.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

7. Open another command prompt, and run DPAgent Adapters Configuration Tool by following command.

Please note the parameter. It is NOT the same parameter as the one we used for starting the DPAgent Configuration Tool in previous steps.

cd C:\usr\sap\dataprovagent\bin
agentcli.bat --configAdapters​​

8. Select Option2(Set Adapter Preferences) and then Option28(Set AdvantcoSFDCAdapter preferences)

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

9. Enter the license key by Copy and Paste.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

10. After registering license, enter the HANA user and it’s password for monitoring SAP HANA Cloud.

If you want to use a function Real-time change data capture(CDC), This user settings is essential, but the details of this settings is left out in this blog post.

Now we completed the deployment and registration of the adapter.

3. Add remote source to SAP HANA Cloud


In this section, I will add Salesforce as a remote source to HANA Cloud and query custom object of Salesforce from HANA Cloud.

1. Open HANA Database Explorer, right click ‘Remote Source’ and click ‘Add Remote Source’.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

2. Input parameters for connection to Salesforce.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

There are wide variety of parameters, so here I will focus on the main ones.

Source Name Remote source name of Salesforce on SAP HANA Cloud
Input any name
Adapter Name AdvantcoSFDCAdapter
Source Location the DP agent name registered in step 1.8
Login Authentication Endpoint Login server URL to send an authentication request.
User Name User name of Salesforce
Password Password for the user of Salesforce
Security Token Consumer security key which Salesforce generated.
Ask your salesforce application administrator to generate it.
Read Timeout Period of time, in seconds, that adapter waits for the reply when read data from Salesforce.
Connection Timeout Period of time, in seconds, that adapter waits for the connection reply from Salesforce when making the initial connection.

3. After adding remote source, you can see the remote objects on HANA Database Explorer.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

4. Define a remote object as a virtual table since SAP HANA Cloud cannot access a remote object directly.

5. Execute a select query against the defined virtual table, and you can see what data came from Salesforce on SAP HANA Cloud.

SAP HANA Cloud, SAP HANA Tutorial and Material, SAP HANA Career, SAP HANA Studio, SAP HANA Learning, SAP HANA Guides

We’ve gotten access Salesforce custom objects from SAP HANA Cloud!

No comments:

Post a Comment