Cloud Integration, SAP S/4HANA Cloud

MRM – BYOR Implementation with S/4 HANA Cloud

Background

SAP have provided a Standard Solution to Upload and Maintain Currency Exchange Rates. The Solution is provided as a Service on the SAP CPI Platform. Once activated, a repository is created which stores the Currency Exchange rates. The service also provides an Upload and Download Endpoint along with Client-ID and Secret to access the repository.

Introduction

This Blog Post highlights the setup required to Subscribe to the SAP MRM BYOR service. This will enable the system to Cater for Daily Exchange Rates. The Post Covers the below:

  • Service Subscription and setup on SAP CPI Subaccount
  • Upload\Download Rates using the MRM Repository via POSTMAN
  • S/4 HANA Cloud setup to Download Rates
  • S/4 HANA Cloud Scheduling and APPS

HOW TO IMPLEMENT THIS IN SAP CPI

Log into the SCP CPI Subaccount. In the Subscriptions Menu, Find the SAP Market Rate Management Service and Subscribe to it.

Step 1 – In the CPI Subaccount, Select the Entitlement menu from the Left Hand Side. Then Select Configure Entitlement. Add a new MRM – Bring your Own Rates plan as shown below:

Search for MRM – Bring Your Own Rates and Select the default plan. Then Click on the Add Service Plan to activate.

Step 2 – Create a Cloud Foundry Space named Market Rate Management. Assign Users to the created Space.

Step 3 – Create Service Instance for Market Rate Management. Create a new instance and populate the Wizard with values shown below. Ensure you enter the name of the SPACE created in previous step. Add the ServiceInstanceName for instance parameters and then Create the instance.

Step 4 – Create Service Key for the newly created Instance. Select the instance using the arrow and then Click on Create under Service Keys. Add a name for the Service Key and then Create.

View the Service Key which will display the Key Data needed to Communicate for the MRM Service. Extract the below fields from the Service Key which will be used to Communicate with the Service:

  • DownloadURL
  • UploadURL
  • URL
  • ClientID
  • ClientSecret

Test the Upload/Download Service via POSTMAN tool

a) Generate Access Token for Authorisation

URL – https://XXXXX-XXXXXX.authentication.eu10.hana.ondemand.com/oauth/token
Method – POST
Authentication – No Auth

The Service requires the below information to be provided in the body of the call:

client_id: [clientid from Service Key]
client_secret: [clientsecret from Service Key]
grant_type: client_credentials
response_type: token
Content-Type: application/x-www-form-urlencoded

Upon Successful completion of the call an Access Token will be provided in the response as shown below:

b) Upload Market Rates using the Service

URL – https://XXXX-mrm-byod-market-data-upload.cfapps.eu10.hana.ondemand.com/uploadMarketData
Method – POST
Authentication – Bearer Token (Use Generated Access Token from Step a)

The Upload call requires the body data to be sent in JSON format with fields shown below:

[
{
“providerCode”: “Y001”,
“marketDataSource”: “BYOR”,
“marketDataCategory”: “01”,
“key1”: “EUR”,
“key2”: “USD”,
“marketDataProperty”: “CLOSE”,
“effectiveDate”: “2020-10-07”,
“effectiveTime”: “00:00:00”,
“marketDataValue”: “1.73”,
“securityCurrency”: “”,
“fromFactor”: 1,
“toFactor”: 1,
“priceQuotation”: “”,
“additionalKey”: “”
}
]

Upon Successful execution of the Upload call, you will receive a Status 201 Created response as shown in the above screenshot.

c) Download Rates from the Service

URL – https://XXXX-mrm-mrm-byod-market-data-download.cfapps.eu10.hana.ondemand.com/downloadMarketData
Method – POST
Authentication – Bearer Token (Use Generated Access Token from Step a)

The Download call requires the body data to be sent in JSON format with fields shown below:

[
{
“marketDataSource”: “BYOR”,
“marketDataCategory”: “01”,
“marketDataKey”: “EUR~USD”,
“marketDataProperty”: “CLOSE”,
“fromDate”: “2020-10-07”,
“fromTime”: “00:00:00”,
“toDate”: “2020-10-07”,
“toTime”: “00:00:00”
}
]

Upon Successful execution you will receive a Status 200 OK response.

The Exchange Rate data downloaded will be in the body of response the message.

You should be able to download the rate that was uploaded in Step b.

d) – Launch the SAP Market Rates Management Tile from SAP BTP.

Log into SAP BTP CPI Subaccount. In the Subaccount Select Subscriptions and Select Go To Application for SAP Market Rates Management Tile.

Select the Manage Market Rate Tile.

You will be able to view all uploaded Exchange Rates.

SAP S/4HANA Setup to use MRM Service

Step 1 – Create Communication System

A new Communication System will be created for the Market Rate Management to allow Communication from the S/4 HANA system.

In Communication Management, open the Communication Systems App. Choose New and
add a New Communication System MRM_EXCHANGE_RATE. Click on Create.

Add Description in the General Tab.

Add the Host Name in the Technical Area. This will be the URL provided in the Market Rate Management Service Instance Generated from the BTP Subaccount.

Create a new Outbound User for the Communication System. The Username will be the Client ID and Password is the Client Secret Generated from the MRM instance.

Save the Communication System.

Step 2 – Create Communication Arrangement

Create a new Communication Arrangement to Communicate with the MRM Service.

Goto the Communication Arrangement APP and Click on the new.

Use SAP_COM_0203 Scenario and create a new Arrangement.

Assign the MRM_EXCHANGE_RATE Communication system created in the previous step to the newly created Communication Arrangement.

In the Additional Properties leave the OAuth Scope Blank. Add the Download URL from the MRM Service to the Universal Resource Indicator.

Ensure the User created against the Communication system is selected. Add the URL from the Service to the Service URL Field.

Click on the Check Connection Link. This should give you a successful Ping status as shown below. Save the Communication Arrangement.

Step 3 – Create Currency Pairs for Download

The Download Service in SAP S/4HANA system will only extract the Currency Pairs that you need. The Assign Currency Notation Datafeed APP is used to Configure the Exchange Rates tgata re required.

Launch the Assign Currency Notation Datafeed App in S/4HANA. Select Y001 as the Data Provider.

Add the Currency Pairs that you need to extract from the MRM Service. Example of EUR to GBP is shown below.

Step 4 – Run the Job to Download Rates from the MRM Service

Once the Currency Pairs have been added then Launch the Request Current Market Data APP.
Tick the Currency Checkbox and add Y001 as the Datafeed Name. Execute

Exchange Rate data from the MRM Service will be loaded and displayed as shown below:

Please Note: A Scheduled job to run on a regular basis can be setup using the APP Schedule Treasury Back Office Jobs.