Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Introduction

Starting with the Help:

As suggested by online help we could use SAP Cloud Connector directly to access OData service with SAP HCI adapters.

When I first signed up with the SAP HCI Trial programme, I tried to use this approach but failed miserably. Whilst the online help isn’t particularly descriptive, I couldn’t find any blog or descriptive instruction on how to get this working end to end. Unfortunately it was much later in my trial of the solution that I learned that this approach will not work with trial participants. This is a shame, but hopefully the HCI trial team can look at working something else out, as they were very helpful in solving various other issues we had during the trial.

As I found it very hard to build an integration without any detailed step by step blogs or documentation on SCN, I thought that it would be best to share an example, we will be using SAP HCI to fetch data from SuccessFactors and follow by updating a custom table in SAP On-Premise.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

SuccessFactors
In SuccessFactors, we will use the Currency Conversion data and it’s API. You can either update these currency conversion data manually in SuccessFactors or you could use SAP HCI to leverage on free online exchange rate data

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

On-Premise SAP System

Create a custom Z table. (Or you can use standard SAP tables if you wish)

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Create a gateway service using the custom table above.

An example from my Gateway service builder

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Go to the Gateway Client and create EDMX file.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Save your EDMX file. We will need this file when configuring the OData adapter in Eclipse. (NB you have to save the file as you can’t directly pull the metadata from the on Premise connection using the Model Operation area in HCI. I don’t know why, but this is the solution!)

SAP HCI Tenant
Get tenant ID (Account Name) of your SAP HCI tenant from Eclipse. You will need the tenant ID as the account name when configuring SAP Cloud Connector

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

SAP Cloud Connector Configuration
Install SAP Cloud Connector on your on-premise system & start the Cloud Connector

Login to the SAP Cloud Connector once the Cloud Connector is running (Default URL – https://localhost:8443 )

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Establish connection to your SAP HCI tenant by adding new account.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Configure on-premise SAP system and map it to a virtual host and port. If you would like to use Certificate based Authentication, select HTTPS and the corresponding port. (NB this is the point where the trial landscape doesn’t work!

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Once the system has been mapped, define the permitted resources that you wish to grant access to.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

SAP HCI Configuration
Now, in the Eclipse, we would build an iFlow to fetch the currency conversion rates from SuccessFactors, map the data to a different format and finally, updates a custom table in the SAP system by using OData adapter.

Here is the iFlow will look like:

PictUsing SAP HCI OData Adapter with SAP HANA Cloud Connectorure20

Configure the SuccessFactors Adapter as a Receiver Channel

PictUsing SAP HCI OData Adapter with SAP HANA Cloud Connectorure20

Open the Operation Modeler wizard, specify the SuccessFactors address, Company ID, Username and Password which you are connecting to. Select “CurrencyConversion” from the entity list.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Select the Operation and Fields of the Entity

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Once the operation modelling is finished, an XSD is generated in src.main.resources.wsdl automatically.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Before we configure the receiver channel for SAP, we need to import the EDMX file which we generated earlier

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Now, moving on to the receiver channel for SAP, configure the OData communication channel as below

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Using the Operation Modeler, select “Local EDMX File”. Click on the “Browse” button to select the edmx file to proceed.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Select “CurrencySet” from the entity list.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Select the “PUT” Operation and Fields of the Entity we are updating.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Once the operation modelling is finished, an XSD is generated in src.main.resources.wsdl automatically.
Ensure “On-Premise” is selected as the Proxy Type in order to use SAP Cloud Connector.
Authentication type as defined in the SAP Cloud Connector. In this example, it will be Basic Authentication.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Deploy User Credentials Artifacts
In order for the adapter to authenticate, we need to deploy “User Credentials” arctifacts. The name of the artifacts will have to be the same Credential Name referenced in both communication channels. In this example, we named the arctifacts “sap_odata” and “sf_odata”

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Message mapping
In this step, we need to map the incoming message to the message type required by SAP. The Mapping step can be added to the integration flow canvas from the Palette. In the Message Mapping Overview tab, add the .XSD files generated earlier and define the mapping as below:

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Split Incoming Payload
Here we need to split the incoming payload to individual messages for each currency code.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Add Splitter to the integration flow canvas by selecting from the Palette. Configure a “General” splitter with the following properties:

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Deploy
Set Timer Start Event to “Run Once”. This should allow the iFlow the run immediately once deployed.

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Now, deploy the Integration Project. In the message monitoring view, you should be able to see the status of the iFlow.

Here is the results after a successful run:

In the SAP system, the custom Z Table is updated with Currency code, timestamp and exchange rates. (Image: Below left)

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

If you have activated the ICF recording in SAP system,you will first find a “GET” request with “x-csrf-token: fetch” in the header to obtain the X-CSRF-Token, then follow by “PUT” request to update the data in SAP system. (Image: Above right)

Here is the audit log from SAP Cloud Connector showing my user accessing the ICF service

Using SAP HCI OData Adapter with SAP HANA Cloud Connector

Potential Bug

The iFlow seems pretty simple and straight forward. But during this exercise, there was an error that kept giving me grief whenever it tries to update SAP system via the OData adapter. Fortunately the HCI trial team pointed out to me that the header in the message after fetching data from SuccessFactors is the caused of it. The “SystemQueryOption” with the value of “$select=lastModifiedDateTime” in the message header was flows all the way through to the OData channel for SAP system. To resolve the error, she suggested to have a “Content Modifier” with the same header parameter and the value is set to blank string

Using SAP HCI OData Adapter with SAP HANA Cloud Connector