Skip to Content
Technical Articles
Author's profile photo Antonio Maradiaga

Replicate SAP Ariba operational data to SAP BW/4HANA 2.0

In this blog post I will cover how we can move operational reporting data available in the SAP Ariba APIs to SAP BW/4HANA 2.0. To achieve this, we will use the trial version of the Integration Suite available in SAP BTP. We will build an integration flow in SAP Cloud Integration, transform the data using a Groovy script and send the data to BW/4HANA using the REST data load functionality.

In a previous blog post, I covered how to use SAP Cloud Integration to replicate SAP Ariba analytical data. This blog post is a continuation of it but will focus just on what is required to get it working with SAP BW/4HANA 2.0. Special thanks to my friends Mostafa EL BARBARY and Mohamed EZZAT for their collaboration setting up the SAP BW/4HANA piece.

There are blog posts in SAP Community, e.g. SAP Cloud Platform Integration (CPI) to push data into SAP BW/4HANA and PI REST Adapter: Connect to BW/4HANA using X-CSRF-Token, that cover the details of the how the REST based interface in SAP BW/4HANA 2.0 can be used to push data. I will briefly touch on the objects in SAP BW/4HANA, to get the full details please refer to the blog posts previously mentioned.

Update 1: If you are interested in knowing how to configure step by step a connection from SAP Cloud Integration to the SAP Ariba API, including sample code and sample integration flow, please check out this blog post: https://blogs.sap.com/2021/03/22/step-by-step-how-to-configure-sap-cloud-integration-to-communicate-with-sap-ariba-by-using-the-http-adapter/

To complete the steps explained in this blog post, there are some prerequisites that we will need to complete first:

  • Check the prerequisites listed in the previous blog post.
  • Access to SAP BW/4HANA 2.0. I guess that if you are reading this, it is because your company uses SAP BW/4HANA and have access to an instance 😃

In this instance we will “combine” the integration flow developed in previous blog posts and the SAP BW/4HANA Integration With Rest Based Data Load integration package available in the SAP API Business Hub. There are some differences in this integration with what is available in the integration package:

  1. We will not be using message mapping to map data to the BW structure. As the groovy script will be responsible of doing the transformation.
  2. The integration flow here can send data to multiple DSOs (Data Store Objects) in BW. The integration package only allows sending data to one DSO.
  3. We will be posting a JSON message (yes, JSON not XML) to BW.

Now that we have access to the different systems, and we know the main differences between the integration flows, we will proceed to explain how to get SAP Cloud Integration talking with SAP Ariba and SAP BW/4HANA.

  1. Set up the Data Store Object in SAP BW/4HANA 2.0
  2. Deploy security material in SAP Cloud Integration – SAP BW/4HANA credentials
  3. Update the integration flow components
    1. Modify Process Ariba response script
  4. Deploy the integration flow
Integration%20flow
Fig. 1 – Integration flow to SAP BW/4HANA

Step 1 – Set up the Data Store Object in SAP BW/4HANA 2.0

In this blog post, we will be sending project information that is available in the SAP Ariba Operational Reporting API. The project information is available via the ProjectInfoDimSystemView, which exposes the ProjectInfoDim document type. The Data Store Object (DSO) in SAP BW/4HANA has the definition below.

Fig. 2 – Data Store Object definition

Step 2 – Deploy security material in SAP Cloud Integration

⚡ Go to your SAP Cloud Integration instance and create/deploy a security material (Monitor > Manage Security > Security Material). This will be used by the integration flow to communicate with SAP BW/4HANA.

Fig. 3 – Security material

Step 3 – Update the integration flow components

⚡ Remove the modify content and Set Authorization components. Add a General Splitter and copy the components available in the SAP BW/4HANA Integration With Rest Based Data Load integration package to communicate with SAP BW/4HANA.

The integration flow should look like the integration flow in Fig. 1. Below, the details on what each of the new components are doing:

  • Ariba setup: Headers (updatedDateFrom, updatedDateTo, dateInterval, apiKey) are set from the externalised parameters.

  • Modify the Process Ariba response script: In the previous blog posts, we were using a Javascript script. Here, we are replacing it for a Groovy script and instead of outputting JSON lines, the script will be outputting the DSOs that the script processes. See OperationalReportingBW.groovy.

    DSO
    Z_ARB01
    Z_ARB02

  • Setup for BW: Sets the message headers Accept and Content-Type to application/json. This is to inform BW that it will receive a JSON payload. Also, we set the ${property.payload} as the Message Body. This is the payload that was produced by the processAribaResponse method.

  • Split by DSOs: The expression type is Line Break and its purpose is to process each DSO separately. In the Process Ariba Response script, we define the DSOs that we are processing. This is so we can then set as a body the actual DSO specific payload transformed in the script.

  • Handle DSO: It calls the exchangeDSOPropertyAndBody method and it will use the contents of the body, e.g. Z_ARB01 – our DSO name, and set the DSO-specific payload as the body, which is stored as a property of the exchange.

  • HTTP connections to TokenService and BW4System: Configure the connections to the SAP BW/4HANA instance. It is likely that the SAP BW/4HANA system is on-premise and SAP Cloud Connector can be used to connect to it. To find out more on how to connect from SAP Cloud Integration to an on-premise system, check this out – cpi-open-connectors.

Externalised parameters

The externalised parameters in the figure below have been exposed to make the integration flow more flexible. This enables using the same integration flow to extract different view templates from the Operational Reporting API. All that is required to handle a new view template, is specifying a transformation for the document type in the Groovy script.

Fig. 4 – Integration flow externalised parameters

Step 4 – Deploy integration flow

Now that all steps are completed, we deploy the integration flow and check the DSO loads and records created in SAP BW/4HANA 2.0.

Fig. 5 – DSO Load

 

Fig. 6 – Table contents in SAP BW/4HANA

As we can see, we have replicated the SAP Ariba data to SAP BW/4HANA 2.0. We can now use this dataset to create a report/dashboard in reporting tools that connect to SAP BW/4HANA, e.g. SAP Analytics Cloud.

Next steps?

  • In the SAP Ariba Operational Reporting view template you can define multiple filters. How can the integration flow be updated to handle create and updated dates?
  • How can we make a call to SAP BW/4HANA only when there is data available?
  • What can we do to store the payload sent to SAP BW/4HANA in a DataStore for future reference?

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mostafa EL BARBARY
      Mostafa EL BARBARY

      very good one , keep it up , thanks for sharing and help 😉

      Author's profile photo Frank Riesner
      Frank Riesner

      Dear Antonio, very interesting blog post. I thought it is best practice to leverage SAP DataServices to bring the data to SAP BW/4HANA, but was not aware of this option. I have two questions please:

      When you refer to "SAP Cloud Integration Suite"  - is it the same as the "SAP Cloud Platform Integration (CPI)"?

      It would be helpful to understand the modeling parameters of the target ADSO in BW/4HANA. I assume it is write interface-enabled?

      Thanks!

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      Hi Frank Riesner , you are right.... SAP Cloud Integration might not be the best tool for the job, especially if handling huge volumes of data, but it is what some customers have in place and what they can use to build such integrations, instead of adopting a new product. The case exposed here will be good if there is no need to move huge volumes of data.

      > SAP Cloud Integration Suite

      Integration Suite is the name of the subscription you can find in your SAP BTP trial account. That being said, SAP Cloud Integration (formerly known as SAP Cloud Platform Integration - CPI) is part of the SAP Cloud Integration Suite.

      > Write interface-enabled

      Correct.

      Author's profile photo Mauricio Cubillos
      Mauricio Cubillos

      Antonio,

      does this apply to CX too??

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      @Mauricio Cubillos, Unfortunately I'm not familiar with the CX APIs.

      Author's profile photo Jonathan Ma
      Jonathan Ma

      Thank you for the blog. Would you be able to share the screenshot of the Ariba API setups? I found them extremely confusing to do. Much appreciated.

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      HI Jonathan Ma

      Check out this blog post, https://blogs.sap.com/2020/10/18/replicate-sap-ariba-analytical-data-to-big-query-using-sap-cloud-platform-integration/, where I specify the details on how to configure the Ariba component in SAP Cloud Integration (scripts, security material). It also includes screenshots.

      Regards,

      .A

      Author's profile photo Jonathan Ma
      Jonathan Ma

      Thanks Antonio

      I am aware of the other blog you mentioned. What I am looking for is exactly what values you put in all those Ariba steps in the iflow. from Ariba setup to Request Token. This Ariba API is rather hard to use and the standard documentation is very poor put together. I would like to know what parameter you put in like filter and template name, etc when calling the Ariba API.

      Sorry that I am new and this Ariba API seems to be very hard to use. I am pretty sure I am not the only one feeling this way. The more screenshot you provide the more helpful it would be.

       

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      Hi Jonathan Ma I understand your frustration. I will include the details in a new blog post and share them with you when its available. Stay tuned!

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      If you are interested in knowing how to configure a connection from SAP Cloud Integration to the SAP Ariba API, please check out this blog post: https://blogs.sap.com/2021/03/22/step-by-step-how-to-configure-sap-cloud-integration-to-communicate-with-sap-ariba-by-using-the-http-adapter/.

      CC: Jonathan Ma

      Author's profile photo Sreedhar polakampalli
      Sreedhar polakampalli

      Hi Maradiaga,

      We have using the BW 7.4, we need to connect the Ariba CPI system, could you please let me know can we go through this process or any other process we have to extract the data/create Data source in the BW 7.4 system.

       

      Regards,

      Sreedhar

      Author's profile photo Former Member
      Former Member

      Does it work also for BW on HANA 7.5 or only with BW4HANA 2.0 ?

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      Former Member , I'm not a BW expert but my understanding is that this is only possible with BW/4HANA 2.0 - https://api.sap.com/package/SAPBW4HANAIntegrationWithRestBasedDataLoad/overview

      Author's profile photo SEBASTIAN Rodriguez
      SEBASTIAN Rodriguez

      Hello Antonio,

      Thank you very much for this great Blog and others that I could see on this subject of your authorship!!

      I have a question if you know, would it be feasible to use the Ariba Cloud Integration Gateway (CIG) to perform this integration with the BW/4? Or is it required to use our own CPIS tenant for this type of integration?

      Thanks in advance,
      Best regards!

      Sebastián.

      Author's profile photo Antonio Maradiaga
      Antonio Maradiaga
      Blog Post Author

      SEBASTIAN Rodriguez, thanks for your kind words.

      Although CIG uses SAP Cloud Integration under the hood.... it is not possible to use CIG to achieve this scenario. You will need to develop/deploy this on your own SAP Cloud Integration tenant.

       

      Author's profile photo SEBASTIAN Rodriguez
      SEBASTIAN Rodriguez

      Thank you very much Antonio for you quick answer!!

      Best Regards,

      Sebastián.