Skip to Content
Technical Articles

Getting started with the new Cloud Service: SAP Customer Order Sourcing

Moderation note: 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:

  1. Open your global account in the Cockpit.
  2. Navigate to Global Accounts and your Subaccount named trial.
  3. In the navigation area of the trial subaccount, choose Subscriptions.
  4. Click on SAP Customer Order Sourcing (Trial) to open its overview page.
  5. Choose Subscribe.
  6. 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.

  1. Navigate to your trial Subaccount and Choose Security > Trust Configuration:
  2. Choose SAP ID Service from the list
  3. 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.
  4. Choose Assign Role Collection and assign the role collection StrategyBuilder_ReadWrite to the given user.
You need help?
watch this animation in a new window

Access Strategy Builder:

  1. Navigate to Subscriptions>SAP Customer Order Sourcing (Trial) and click on Go to Application.
  2. Login with your email and password
  3. Choose the Strategy-Builder App

You are close to creating your first sourcing strategy!

  1. Choose to create a strategy.
  2. 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”.
  3. Choose Create to finish the creation of your first strategy.
  4. 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.
  1. Go back to your cloud Cockpit > Cloud Foundry Trial > Trial > Spaces > Your Space > Services > Service Marketplace
  2. Choose SAP Customer Order Sourcing (Trial) and navigate to the Service Overview.
  3. On the left side bar navigate to Instances > New Instance ( )
  4. In the Create Instance window click next 3 times.
  5. On the last page insert an instance name and click finish.
You need help?
watch this animation in a new window

Create credentials for your service

  1. Click on your created Service Instance.
  2. From the left sidebar choose Service Keys > Create Service Key ().
  3. In the Popup window insert a name for your Credentials and click “save”.
  4. Now you should be able to see your key in json format.
You need help?
watch this animation in a new window

 

You can now use your credentials to upload Master data into SAP Customer Order Sourcing via REST API:

  1. 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.
  2. Choose Configure Environments () and select Create New Environment.
  3. At Starting URL choose https://cpfs-dtrt-trial.cfapps.eu10.hana.ondemand.com/v1.
  4. Insert a name like “SAP Customer Order Sourcing Trial API”
  5. Go back to your recently created Service Key in you trial space of SAP Cloud Platform.
  6. Copy and paste your clientid into the field Client Id.
  7. Copy and paste your clientsecret into the field Secret.
  8. Copy and paste your identityzone into the field identityzone.
  9. Choose Save this environment for future sessions radio button. And save your environment.

Step 3: Upload master data

Step 3.1: Upload sources
    1. On the left side choose Sources
    2. Open POST /sources and choose try out.
    3. 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 }
}]
    1. Click execute.
    2. Make sure you get the HTTP response 201.
You need help?
watch this animation in a new window

 

Step 3.2: Upload Availability Raw data
    1. On the left side choose Availability Raw Data.
    2. Open POST/availabilityRawData and choose try out.
    3. 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" }
}]
    1. Click execute.
    2. 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

  1. Go back to Strategy Builder App and choose the Strategy my-webshop-strategy-de.
  2. Drag and drop the Objective Products from Several Sources onto the canvas for modeling your strategy, under the shopping cart.
  3. Drag and drop the Sources Munich Distribution Center (DC) and Store Stuttgart (Store) into the first box.
  4. Drag and drop the Rule Shortest Distance to Destination into the second box.
  5. 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:

  1. Consider the sources in Munich and Stuttgart.
  2. 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.

Optional Read: How does the rule “Shortest Distance to Destination” work and which other sourcing rules are supported

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

  1. Open SAP Customer Order Sourcing on SAP API Business Hub in a new window.
  2. On the left-hand side choose Sourcing.
  3. 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…

  1. Subscribe to SAP Customer Order Sourcing.
  2. Create Service Instance and credentials to access the API.
  3. Mange Role Collection to access the Strategy Builder.
  4. Upload your master data using SAP API Business Hub.
  5. How to model a sourcing strategy for a simplified business scenario.
  6. 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?

 

7 Comments
You must be Logged on to comment or reply to a post.