Introduction
The below blog provides an overview of setting up a simple CPI integration to post data to a SAP BW/4HANA on-premise instance. I have included an explanation of how to achieve this in both postman and SAP Cloud Integration. I have also included references to helpful blogs you can refer to for additional details.
Set up in BW
Create DSO in BW
Ensure 'Write Interface Enabled' attribute is set.
Add fields to DSO
Download URL's shown on DSO
Using DSO in Postman
For Info can query DSO structure
Or see an example json payload
Post data in postman:
Step 1: Fetch CSRF token
Add header for x-csrf-token = fetch, set Authorization to basic Auth
Response header will contain the csrf token
Step 2: Send Data to BW
Add header x-csrf-token and set value returned by call in Step 1 (found in the response header)
Set body to message to post to BW (xml in this example)
Response back
Example JSON POST
Data Post example in CPI
The process below mirrors the process done previously in postman to post data to BW
Against the Integration flow set HTTP session
- Start Timer - Schedule set to Run Once
- Set Csrf token header
3. Make http call to get csrf token returned (note that in this example an on-premise BW is being called so virtual host/port have been set in cloud connector)
Make sure Headers are both passed to the call and returned
4. Handle Cookies - The initial csrf call returns an header called 'set-cookie', unfortunately the call to post the data requires an header called 'cookie'. The groovy script converts the format and name. More details can be found in https://help.sap.com/docs/SUPPORT_CONTENT/sci/3361897820.html?locale=en-US
import com.sap.gateway.ip.core.customdev.util.Message;
def Message processData(Message message) {
def headers = message.getHeaders();
def cookies = headers.get("set-cookie");
message.setHeader("cookie", String.join("; ", cookies));
return message;
}
5. Set content type and payload of data post
6. HTTP call to post data to BW
Referenced Blogs:
Integrating with BW
Example CPI to BW
Issues with x-csrf not working see below:
https://help.sap.com/docs/SUPPORT_CONTENT/sci/3361897820.html?locale=en-US
Introduction
The below blog provides an overview of setting up a simple CPI integration to post data to a SAP BW/4HANA on-premise instance. I have included an explanation of how to achieve this in both postman and SAP Cloud Integration. I have also included references to helpful blogs you can refer to for additional details.
Set up in BW
Create DSO in BW
Ensure 'Write Interface Enabled' attribute is set.
Add fields to DSO
Download URL's shown on DSO
Using DSO in Postman
For Info can query DSO structure
Or see an example json payload
Post data in postman:
Step 1: Fetch CSRF token
Add header for x-csrf-token = fetch, set Authorization to basic Auth
Response header will contain the csrf token
Step 2: Send Data to BW
Add header x-csrf-token and set value returned by call in Step 1 (found in the response header)
Set body to message to post to BW (xml in this example)
Response back
Example JSON POST
Data Post example in CPI
The process below mirrors the process done previously in postman to post data to BW
Against the Integration flow set HTTP session
- Start Timer - Schedule set to Run Once
- Set Csrf token header
3. Make http call to get csrf token returned (note that in this example an on-premise BW is being called so virtual host/port have been set in cloud connector)
Make sure Headers are both passed to the call and returned
4. Handle Cookies - The initial csrf call returns an header called 'set-cookie', unfortunately the call to post the data requires an header called 'cookie'. The groovy script converts the format and name. More details can be found in https://help.sap.com/docs/SUPPORT_CONTENT/sci/3361897820.html?locale=en-US
import com.sap.gateway.ip.core.customdev.util.Message;
def Message processData(Message message) {
def headers = message.getHeaders();
def cookies = headers.get("set-cookie");
message.setHeader("cookie", String.join("; ", cookies));
return message;
}
5. Set content type and payload of data post
6. HTTP call to post data to BW
Referenced Blogs:
Integrating with BW
Example CPI to BW
Issues with x-csrf not working see below:
https://help.sap.com/docs/SUPPORT_CONTENT/sci/3361897820.html?locale=en-US
Source: https://community.sap.com/t5/technology-blog-posts-by-members/cpi-integration-with-bw-4hana/ba-p/14170026 Date: 2025-08-02T08:11:44.000Z
No comments:
Post a Comment