Moderation note: The tutorial, described in this blog post doesn’t work anymore. Please visit
https://developers.sap.com/tutorials/cos-getting-started-trial.html for more information and an updated Getting Started Tutorial.
Introduction
Target audience
- You want to make attractive and reliable promises to your web-shop and in-store customers?
- You need reliable real-time product availability information across all channels and scenarios such as ship to home, buy online pick-up in store, deliver from store, etc.?
- You need a solution to create your own sourcing strategies meeting your business needs?
Then look no further. This blog post is exactly for you!
What is SAP Customer Order Sourcing?
SAP Customer Order Sourcing is a public cloud service based on SAP Cloud Platform and offers
- Calculation of (omnichannel) product availability
- across DC’s, vendors, 3rd party warehouses and even stores
- You can use APIs to upload availability raw data. Based on this data and on temporary reservations, the system calculates which products are available to sell and in what quantity across all source types such as stores or distribution centers.
- Management of sources and source lists
- You can use APIs to upload, retrieve, and delete sources and their master data, and group sources in source lists. Sources and source lists are used for modeling sourcing strategies. You can also create source lists in the Strategy Builder app.
- Creation and maintenance of sourcing strategies
- Calculation of optimal sourcing results
- You can use APIs to calculate a sourcing result for one or multiple products with specific identifiers. When it calculates the sourcing result, the system runs through the assigned sourcing strategy.
- Management of temporary reservations
- You can use APIs to create, retrieve, update, and delete temporary reservations used to reserve products for a customer who is in the checkout process to buy the products. These reservations prevent the same product from being promised to different customers.
Read more about SAP Customer Order Sourcing from this interesting blog post by ingo.woesner
What you will learn in this blog post (no coding required)
- You will be introduced to SAP Cloud Platform Cockpit and Subscribe to SAP Customer Order Sourcing (Trial).
- You will use SAP API Business Hub to upload master data 1 via REST API of SAP Customer Order Sourcing Service
- You will model your first sourcing strategy via the Strategy Builder App of SAP Customer Order Sourcing Service.
- You will create a sourcing request to test your sourcing strategy.
1 What are the required master data for SAP Customer Order Sourcing?
SAP Customer Order Sourcing needs to know which and how many of a product are available (we call it availability raw data) in which locations (we call it sources).
These data are used for further calculations concerning:
- Available products to sell
- Sourcing result for products
- Reservation of products for a certain period of time
|
Getting started
Business Scenario
For a better understanding of SAP Customer Order Sourcing, let's have a look at the following, very simplified Business Scenario:
You are the owner of an E-Commerce (or web shop owner) Business in the Fashion Industry with these characteristics (which is the required master data for the service):
- sources: you have one Store in Stuttgart and one Distribution Center (DC) in Munich
- availability raw data: You only have one product available with the following quantity:
Product/Source |
Number of Available Products in … |
DC in Munich
|
Store in Stuttgart
|
Red_T-shirt |
11
|
4
|
As a Business Owner you want to reduce delivery cost of each order and therefore decide for the following Sourcing Strategy:
"The products in the shopping cart should be delivered from the source with the shortest distance to the customer."
For instance:
- A Customer located near Stuttgart, ordering a Red_T-shirt, should be supplied from the Store in Stuttgart.
- A Customer located near Munich, ordering a Red_T-shirt, should be supplied from the DC in Munich.
|
Let’s start to implement your first Sourcing Strategy for your business.
Prerequisite
The first thing you need is an SAP Cloud Platform Trial Account. If you don't know how to setup a trial account, follow these steps. |
Step 1: Subscribe to SAP Customer Order Sourcing Application
Now you can activate SAP Customer Order Sourcing service for your trial account:
- Open your global account in the Cockpit.
- Navigate to Global Accounts and your Subaccount named trial.
- In the navigation area of the trial subaccount, choose Subscriptions.
- Click on SAP Customer Order Sourcing (Trial) to open its overview page.
- Choose Subscribe.
- The Go to Application link becomes available once the subscription is activated. Later in this post, you can use this link to access the Strategy Builder.
Note: Before you can access the Strategy Builder, you need to assign read and write permissions to your user, so that you can design a new strategy.
- Navigate to your trial Subaccount and Choose Security > Trust Configuration:
- Choose SAP ID Service from the list
- In the E-Mail Address enter the Email Address of your trial account (or of whom you want to give access) and choose Show Assignments.
- Choose Assign Role Collection and assign the role collection StrategyBuilder_ReadWrite to the given user.
Access Strategy Builder:
- Navigate to Subscriptions>SAP Customer Order Sourcing (Trial) and click on Go to Application.
- Login with your email and password
- Choose the Strategy-Builder App
You are close to creating your first sourcing strategy!
- Choose to create a strategy.
- Insert a Strategy ID with the id “my-webshop-strategy-de” (you will need it later) and a display name, for example, “My sourcing Strategy for web shop in Germany”.
- Choose Create to finish the creation of your first strategy.
- Choose the newly created strategy from the Sourcing Strategies list, to build a specific strategy.
Congratulations on your first achievement !
Later in Step 4, you will be able to model your desired Sourcing Strategy. However, you first need to upload some master data to customer order sourcing.
But why don’t you play around with the Strategy Builder a bit: Drag building blocks (start with an objective) from the left sidebar and drop them into the canvas on the right side.
Hint: Did you notice this button in the top right corner?
Give it a try, I think you will like it and it can help a lot. |
|
Step 2: Create a Service Instance
To upload the required master data via API (Step 3), you first need to create a Service Instance and a credentials:
Short Hint: If you have a recently created trial account follow the steps further below. Otherwise, please first add the entitlement for SAP Customer Order Sourcing by navigation to cockpit > Cloud Foundry Trial > Trial > Entitlement > Configure Entitlements > Add Service Plans > and add SAP Customer Order Sourcing Trial to your subaccount. |
- Go back to your cloud Cockpit > Cloud Foundry Trial > Trial > Spaces > Your Space > Services > Service Marketplace
- Choose SAP Customer Order Sourcing (Trial) and navigate to the Service Overview.
- On the left side bar navigate to Instances > New Instance ( )
- In the Create Instance window click next 3 times.
- On the last page insert an instance name and click finish.
Create credentials for your service
- Click on your created Service Instance.
- From the left sidebar choose Service Keys > Create Service Key ().
- In the Popup window insert a name for your Credentials and click “save”.
- Now you should be able to see your key in json format.
You can now use your credentials to upload Master data into SAP Customer Order Sourcing via REST API:
- Open a new window, navigate to SAP Customer Order Sourcing on SAP API Business Hub and login with your email address. From here we will upload some master data.
- Choose Configure Environments () and select Create New Environment.
- At Starting URL choose https://cpfs-dtrt-trial.cfapps.eu10.hana.ondemand.com/v1.
- Insert a name like “SAP Customer Order Sourcing Trial API”
- Go back to your recently created Service Key in you trial space of SAP Cloud Platform.
- Copy and paste your clientid into the field Client Id.
- Copy and paste your clientsecret into the field Secret.
- Copy and paste your identityzone into the field identityzone.
- Choose Save this environment for future sessions radio button. And save your environment.
|
Step 3: Upload master data
Step 3.1: Upload sources
- On the left side choose Sources
- Open POST /sources and choose try out.
- Copy the following sources data and paste it into the body:
[{ "sourceId": "munich_dc",
"sourceName": "Munich Distribution Center",
"sourceType": "DC",
"sourceCoordinates": { "latitude": 48.136781, "longitude": 11.577352 }
},
{ "sourceId": "stuttgart_store",
"sourceName": "Stuttgart Store",
"sourceType": "STORE",
"sourceCoordinates": { "latitude": 48.774247, "longitude": 9.181072 }
}]
- Click execute.
- Make sure you get the HTTP response 201.
Step 3.2: Upload Availability Raw data
- On the left side choose Availability Raw Data.
- Open POST/availabilityRawData and choose try out.
- Copy the following availability raw data and paste it into the body:
[{ "productId": "Red_T-shirt",
"unit": "C62",
"calculatedAt": "2019-09-24T21:54:30Z",
"items": [ { "availableFrom": "2019-09-24T00:00:00Z","quantity": 4 } ],
"source": { "sourceId": "stuttgart_store", "sourceType": "STORE" }
},
{ "productId": "Red_T-shirt",
"unit": "C62",
"calculatedAt": "2019-09-24T21:54:30Z",
"items": [ { "availableFrom": "2019-09-24T00:00:00Z", "quantity": 11 } ],
"source": { "sourceId": "munich_dc", "sourceType": "DC" }
}]
- Click execute.
- make sure you get the HTTP response 201.
Congratulation on your second achievement !
You just posted the required master data for your sourcing strategy.
Hint: Have a look at other API Methods and their description to understand what each endpoint does.
|
|
Step 4: Model your strategy
- Go back to Strategy Builder App and choose the Strategy my-webshop-strategy-de.
- Drag and drop the Objective Products from Several Sources onto the canvas for modeling your strategy, under the shopping cart.
- Drag and drop the Sources Munich Distribution Center (DC) and Store Stuttgart (Store) into the first box.
- Drag and drop the Rule Shortest Distance to Destination into the second box.
- Save your strategy.
Hint: The box where the building block is supposed to go is highlighted when you drag them onto the canvas.
The modelled strategy says:
For a sourcing request with this Strategy:
- Consider the sources in Munich and Stuttgart.
- Source Products according to the rule Shortest Distance to Destination
In other words:
The products in the shopping cart should be delivered from the source with shortest distance to the customer.
Now let’s test our strategy
Scenario: A Customer Located close to Stuttgart orders a Red_T-shirt.
Desired Sourcing Result: Red_T-shirt should be sourced from Stuttgart since it is closer to the customer than Munich.
let's check if this is the case
- Open SAP Customer Order Sourcing on SAP API Business Hub in a new window.
- On the left-hand side choose Sourcing.
- Post the following sourcing request:
{
"strategyId": "my-webshop-strategy-de",
"items": [ { "productId": "Red_T-shirt", "quantity": 1 } ],
"destinationCoordinates": { "latitude": 49.004417,"longitude": 8.400847 }
}
In the sourcing result you see that the Red_T-shirt should be sourced from stuttgart_store.
Congratulation !
You just setup a sourcing strategy for your business which will save you some shipping costs! |
|
An optional task for you:
Create a sourcing request for this scenario to test your strategy:
Scenario: A Customer Located in Ingolstadt (latitude: 48.764472, longitude: 11.426090) orders 1 Red_T-shirt
Let us know in comments, how your sourcing request and your response looks like. Good Luck! |
Summary
In this post I have shown you, how to…
- Subscribe to SAP Customer Order Sourcing.
- Create Service Instance and credentials to access the API.
- Mange Role Collection to access the Strategy Builder.
- Upload your master data using SAP API Business Hub.
- How to model a sourcing strategy for a simplified business scenario.
- Make a sourcing request to test your Strategy.
Of course, SAP Customer Order Sourcing has more capabilities like:
- Create sources and source lists
- Calculate product availability
- Manage temporary product reservations
- Different sourcing rules
We will post further How-To's to demonstrate other capabilities of SAP Customer Order Sourcing. |
You want to learn more?