Introduction:
This blog explains each step in detail on how to integrate S4Hana cloud and on premise systems using SAP Cloud Platform Integration
Business Case:
Migrating on premise SAP ECC to S4Hana cloud. All the existing interfaces from SAP ECC to third party and other business applications connected through ESB-Microsoft Integration services (MSIS). To minimize the development effort and migration process, existing interfaces from MSIS to other third party and business systems kept AS IS, however, a new data cache layer introduced in between S4Hana cloud and MSIS.S4Hana cloud and data cache layer integrated using SAP Cloud Platform Integration by making
API calls
In this blog, we are going to discuss about extracting customer information from S4Hana cloud by calling API_BUSINESS_PARTNER API and push the data to on premise system by calling an API
Below is the high level as-is and to-be architecture
Highlighted part in the new architecture screen shot represents the on premise landscape
Systems Involved:
- SAP S/4 Hana Cloud – 1805
- SAP Cloud Platform Integration Tenant, Lite Edition, Version: 2.40.12
- SAP Cloud Connector 2.11.0.3
- Eclipse Neon.3 Release (4.6.3)
- Application program Interface (APIs)
This document does not cover the communication arrangements configured in S4Hana cloud for the ODATA API calls, custom CDS views created to handle the response message from on premise system, deploying user credentials Artifacts and eclipse configurations.
This blog intended for the starters and intermediate level SAP CPI consultants
Below Integration Flow deployed in SAP CPI tenant. Please refer above business case section for more details.
Let us discuss each step in detail.
For the testing purpose synchronous soap adapter configured on sender side however, this will be replaced with timer event to trigger the interface depends on the business requirement. This could be everyday or once in a month etc.
Please find below screen shot of soap adapter configuration. Make sure the required roles assigned to s-user to call this service and end-point URL retrieved from the web UI immediately after deploying IFLOW
Step1: Configuring Write Variables
This will store the values in variables and can access across the IFLOW's locally and globally. In this case, I am storing values locally for this IFLOW. Once IFLOW deployed in CPI tenant below variable will automatically assign the deployed date and time. You can see the details of this variable in WEB UI
Step2: Configuring Content Modifier
Content modifier used to store the additional data during message processing.
LastSuccessfullRun value in the above step is accessing in the properties of content modifier
Step3: Configuring Request-Reply
Request-Reply step used for synchronous communication. Receiver ODATA adapter query multiple entities in S4Hana cloud to fetch customer info to build the final desired structure that the on premise API is expecting.
Receiver ODATA Adapter configurations:
Query Options:
To get data from multiple entities in a single ODATA call, we can either manually enter the sub-levels. In this case It is 3, where we can see all the relevant entities and fields to create query (highlighted in blue color in the above screen shot shows the expansion).We can also still use the content enricher however this require multiple ODATA calls to specific entity to enrich the data. Phone number, fax number and BPcustomernumber are the fields which belongs to different entities
Filter Options in the query:
Records from S4Hana cloud will fetch based on the LastSuccessfullRun property value from the content modifier. Below filter have to create manually as the wizard process cannot provide the exact format.
$filter=CreationDate ge datetime'${property.LastRun}' or LastChangeDate ge datetime'${property.LastRun}' and Customer ne 'null'
using this filter,ODATA API call will not fetch the duplicate records which were already read by the query until unless new records created/changed.
X-CSRF Token:
We are not using cross-site request forgery token validation and we are not maintaining anywhere in IFLOW while integrating with S4Hana cloud. However, there are couple of blogs in scn configuring the x-csrf token in content modifier and setting cookies etc. This is only required when you are making ODATA calls using
http adapter but in this case we are using native ODATA adapter to make ODATA API calls.(This was my observation).
Below is the error screen shot of x-csrf token validation in SAP CPI when I am trying to post timesheet data to S4Hana cloud using http adapter. However, the same data posted successfully using receiver ODATA adapter.
While testing from Postman test tool, certainly we need x-csrf token in the message header before you post/query data
Step4: Mapping between S4Hanacloud and On-premise API
After creating above ODATA query, XSD and EDMX file will create automatically and down load the WSDL from the webservice(on premise application exposed to soap service) and place it in the integration package.
Complete the mapping between the source and target structures
For the comfort of the readers,this blog is split into
3 parts.From Step 5 and calling the on-premise system please refer below
Part-2 link and for monitoring please refer below
Part-3 link
https://blogs.sap.com/?p=679582&preview=true&preview_id=679582 Part-2
https://blogs.sap.com/?p=679603&preview=true&preview_id=679603 Part-3
Happy Learning !!!