Blog Layout

Use case 2: Update currency exchange

flabouch • Feb 21, 2021

Depending on your business location, your customer location, your operating concern currency and your company code currency, you might need to maintain couple of exchange rate in your system. Most of our client have to maintain an average of 5 different currencies in their system, and in most case they do it manually.

There are already some literature explaining how to make the process easier, this blog on the SAP website for example.

Most likely if you are still reading this blog it's because you didn't find yet something answering your need, either because you do not have a exchange rate feed provider (expensive sometime for what they do), or your SAP is not reaching internet, or any other good reason.

For this use case, I will explain how to perform the action on a daily basis based on the official Brazilian exchange rate, provided by the Brazilian government:

1. First we need to get the feed. You can use any of your favourite programmatic language to call the following wsdl (I use python of course): , https://www3.bcb.gov.br/sgspub/JSP/sgsgeral/FachadaWSSGS.wsdl

2. Once the rate extracted, you can insert into SAP with the following BAPI: BAPI_EXCHANGERATE_CREATE

This BAPI will take in argument the information about the exchange rate you would like to modify, the format will look like this:

CURR_VAL = { 'RATE_TYPE':'x', 'FROM_CURR':'USD', 'TO_CURRNCY':'BRL', 'VALID_FROM': , 'EXCH_RATE': , 'FROM_FACTOR':'1', 'TO_FACTOR':'1' }

Rate_type will depend on your setup, but most likely 'M'.

should be the date of the day if you are running the script on daily basis.

the exchange rate received from the Brazilian web-service.

To validate the update, you need to commit the transaction by calling: BAPI_TRANSACTION_COMMIT

This can be done for any currency, as soon as you have identify the feed and the way to get the value of the exchange rate.

For a company doing the exercise everyday for one currency, we have estimated that it require 10 min of someone with a medium risk of error, which represent 200 min per month saved with this simple use case.

If you have any question, or willing to get the full code, please contact us.

SII Spain Integration thru API
14 Jul, 2023
SII in Spain: What is it, why does your company need to comply, and how to do it?
Integrating VIES VAT Validation with your ERP
By flabouch 19 May, 2022
How to integrate and automate VIES VAT number validation of EU commission with your ERP.
SAP Idoc parser python library
By flabouch 12 May, 2022
SAP Idoc parser in Python
Share by: