Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
5,126
Hello there.

 

SAP Market Rates Management offers you, in addition to getting market rates directly from leading providers like Thomson Reuters, the ability to bring in your own market data from your own sources. In this case, you need to implement your own mechanism to upload rates to the service.

This may appear to be a daunting task at first. So here, we attempt to break this task down for you, and provide examples and sample implementations which will hopefully be able to guide you through developing your own Upload implementation. Remember, your Upload implementation can be done in any system or technology of your choice, as long as you can perform the steps listed here.

We expect you have already finished your service setup. If not, please feel free to check out our 'Getting Started' blog here.

Here, we take up the example of fetching latest market rates from the European Central Bank (ECB) via their APIs, and then posting them to the SAP Market Rates Management Upload service. The steps essentially would remain the same for your own market data provider as well.

A sample application covering the following steps is available for your reference here.

So let's get started.

 

Step 1: Fetch market rates from your market data provider - ECB in this case - via their APIs.


 

We receive the data from ECB in the following format.
























Key Freq Currency Currency_Denom Exr_Type Exr_Suffix Time_Period Obs_Value
EXR.D.USD.EUR.SP00.A D USD EUR SP00 A 2019-02-28 1.1393


This is what the fields are called, and this is what a sample record looks like.

We fetch this data using ECB's APIs in our Upload implementation.

 

Step 2: Parse rates from the market data provider and convert them into the Market Rates Management Upload CSV or JSON format.


 

The fields needed for Market Rates Management Upload are the following.

Provider Code - The market data provider from whom you are fetching your data, for example, Thomson Reuters, or the European Central Bank as in this case.

Market Data Source - The direct source from which your data provider gets their market data, for example, NYSE.

Market Data Category - The identifier for the type of market data. For example, 01 for exchange rates, 03 for interest rates, and so on.

Key 1 - Placeholder1 for a key you can assign to a market data type. For example, the <From> currency type when you are using the exchange rates data type, or <Reference Interest Rates> when you are using the interest rates data type.

Key 2 - Placeholder2 for a key you can assign to a market data type. It is usually the <To> currency type for when you are using a currency exchange transaction. When you are making a call for interest rates, this field is empty.

Market Data Property - The specific kind of market data that you are requesting. For example, <CLOSE> for End of Day rates.

Effective Date - The effective date on which the market data value is valid.

Effective Time - The effective time from which the market data value is valid.

Market Data Value - The actual value of the market data.

You can find out more details about the fields to be used in our Help documentation section 'Uploading Rates' here.

We take the data received from Step 1, and map it to the Upload fields mentioned here.

For the ECB example, the sample record above can be mapped to the Market Rates Management fields as follows.


























Provider Code Market Data Source Market Data Category Key 1 Key 2 Market Data Property Effective Date Effective Time Market Data Value
ECB ECB 01 EUR USD CLOSE 2019-02-28 16:00:00 1.1393


Based on these descriptions, you need to map the data from your market data provider to this format supported by the service.

 

Step 3: Upload the parsed rates to the MRM service.


 

Once you have converted the rates you have received from your market data provider into the Market Rates Management Upload format, all that remains to be done is for you to post these rates to the Upload endpoint of the service.

From your service setup on the SAP Cloud Platform, you should already have the following values from your generated service key - uploadUrlclientidclientsecret, and url.

The first thing we now need to do is to generate an access token for us to access the service with our credentials. For this, we need to send a request to the url from the service key with the following details.
POST:{'url' from your service key}/oauth/token

Headers:
Content-Type: application/x-www-form-urlencoded

Body:
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

Here, you can replace the urlclientid and clientsecret with the values from your service key.

Once executed, this request would return to you an access_token in the response body. We then take this access token and provide it to authenticate our call to the Upload endpoint.

This is how a call to the Upload endpoint would then look like -
POST:{'uploadUrl' from your service key}

Headers:
Authorization: Bearer {generated access token}
Content-Type: text/csv or application/json

Body:
{prepared market data set from Step 2}

Here, you'd need to replace the uploadUrl with the actual value from your service key. Also, add the generated access token, and of course, the market data itself.

And that's it. Once you execute this request, you should receive a '201 Created' HTTP status back from the Market Rates Management service. This tells you that the rates were successfully posted to to the service. You can also then execute a request to the Download endpoint to verify that your uploaded data is now available.

 

We hope this blog has helped you understand the Market Rates Management Upload process a little better, and that it'd now be a little easier for you to get started and build your own implementation.

 

Again, please feel free to check out our sample implementation for these steps here.

Please visit our Help documentation page for the Bring Your Own Rates data option here for a lot of more insights. Here, you shall also find a Postman collection available for download, where you'd be able to plug in your service credentials and try out the Upload and Download processes on your own.

For more information about the Thomson Reuters data option, please refer to our Help documentation here.

Thank you!
14 Comments