SAP Integration Suite – Products, Pricing and Stock – S/4HANA Cloud and Salesforce integration
Compared to my previous post on the workflow and the Integration capabilities of the SAP Cloud Platform Integration, I am going to focus this time solely on the SAP Cloud Platform Integration and the existing Integration Flows available in the SAP Business Hub API.
Disclaimer: This is just an example on how to leverage technologies of the SAP Cloud Platform, as always I will be using a fake company made up for the purpose of my demonstration and all that I will state here, has to be considered as the concerns of this fake company. These conceptual choices are not a judgement of Salesforce and their products. They are solely made for the sake of my integration scenario between two systems, Salesforce and S/4HANA Cloud.
Now that this is set, let’s imagine that this fake company uses both Salesforce and S/4HANA cloud, with Salesforce mainly used by their sales on the road and with their back office system being S/4HANA. When the sales will create and opportunity, he will want to see in Salesforce the products that are in his S/4HANA system, to have the exact pricing of his products, and also the inventory available of this products. This company wants to integrate these two systems and the have made the choice to use the SAP Cloud Platform Integration. Once again, all this could be done directly in S/4HANA Cloud, and SAP has also its own great CRM solution, such as SAP CRM and the Customer Experience (CX), but this is for the purpose of my integration demo and to demonstrate the strength of using the SAP Cloud Platform Integration and SAP API Business Hub, where we can find APIs and integration flows that enables us to integrate our customers landscapes in just a few clicks and configurations.
First let’s see the SAP API Business Hub and look for S/4HANA Cloud and Salesforce integration packages.
I will click on the first occurrence. This is an integration package maintained and developed by Advantco.
[13th April 2021 Edit : There is now a Integration flow directly available from SAP to connect Salesforce and S/4HANA that can be found on the SAP API Business Hub. You can review it by clicking here. Thank you Mohammed Fawwaz for bringing this up to me.]
In the details, you will find a documentation helping you with installing the Advantco adaptor and setting up your S/4HANA cloud and Salesforce systems. I will not go thru these details here as the documentation is very well done and very straightforward.
From our SAP Cloud Platform Integration, we can look for the same integration flow in the discover menu.
Copy the package locally.
Now all we need to do is setup the packages and deploy them. For that we will need to use Credential Names (for S/4HANA and Salesforce) and also a Security token (for Salesforce).
The Credential Names and Security Token can be created in the security material of the SAP Cloud Platform Integration.
Go into the monitoring. Then go down in the list and click on Manage Security Material.
You can add them here.
Save you credentials, note their names, and don’t forget to deploy them.
Now that this is done, we can go and configure our integration flows.
For the purpose of our demonstration, first we need to copy all our products from S/4HANA to Salesforce. Let’s choose the “Replicate Products to Salesforce” integration flow.
Click on Configure.
Choose a recurrence for your Integration flow, you can run it once, everyday at a specific recurrence or weekly and monthly.
Then we need to configure the receivers for S/4HANA and Salesforce.
Enter the hostname and the credentials to your S4/HANA instance that you just created earlier in the Security Material.
Do you the same for your Salesforce instance, with your credential name and security token.
On the last tab, we can configure a few more parameters that will be used by the integration flow. Here we can only set the logging parameters of our integration flow.
You can now deploy it.
You can also just save your configuration, and deploy the integration flow directly from the main window.
Once the integration flow is deployed, if everything is setup correctly you will see it complete.
Verify from the operations view
Click on your integration flow, and then Monitor Message Processing. If anything goes wrong, the integration flow will maybe not show started, you can change the level of log configuration to trace to understand the issue.
In our case, the integration flow completed successfully.
Our products are copied from S/4HANA Cloud. To verify this, let’s go into Salesforce.
The material number on the right is the SAP Material Number, all these products have been added from S/4HANA Cloud.
To perform the same demonstration as shown in the video – We will do the same configurations for two other integration flows, “Receive Sales Pricing from S4HANA Cloud” and “Receive Availability Information from SAP S4HANA Cloud”. One to get the prices coming from S/4HANA of the products we just copied and the second one to update stock levels when an opportunity is won and to show the inventory in Salesforce.
First, for “Receive Sales Pricing from S4HANA Cloud”, in the same way, we need to define a recurrence, set up the receivers for both S/4HANA Cloud and Salesforce – Actually in this integration flow, you will have to set up two Salesforce instance. One for retrieving the Pricebook entry and one for updating the Pricebook entry.
You will need also to configure a few more parameters that will be used by the “Receive Sales Pricing from S4HANA Cloud” integration flow. Like the ConditionType, Distribution Channel, the SalesOrganization of our desired S4/HANA pricing and the name of the PricebookName in Salesforce.
Once this is saved and deployed, this will enable us to get the exact pricing coming for S/4HANA to Salesforce. Here in Salesforce, we see a new Pricebook, Standard Price Book, with a price of 230€ for our product 177.
As you can see this corresponds to the pricing of our S/4HANA system.
For the last integration flow, “Receive Availability Information from SAP S4HANA Cloud”, you will only need the S/4HANA Cloud receiver, as this integration flow will only expose an API endpoint to query for a specific Material Number the available stock quantity. The calling of this Endpoint is done on the Salesforce side.
For that, when an opportunity is created and updated to “Closed won” in Salesforce, I wrote Apex code to get the stock inventory information from S/4HANA and write it back to our products in Salesforce. I will not go into the details of the Apex code that I had to write here, but you can have a look at the video to see the full demonstration with the demo on the Salesforce part on the opportunity side.
Just to show you, this is the stock level of our product 177 on S/4HANA Cloud.
And this is what we have on the Salesforce side.
Have a look at the video if you wish to see the whole demonstration.
One thing to keep in mind is how easy it is to performs these tasks as the integration flows are the most complex and time consuming elements at hand here and we have them already available in the SAP API Business Hub. Once the package is copied to our own SAP Cloud Platform Integration, the rest is just configuration and setup.
I hope the post was useful. All the best and see you soon.