Saturday 7 September 2024

Currency conversion in SAP Datasphere

Currency conversion is a fundamental capability across most SAP products, playing a vital role in enabling accurate financial reporting and analysis across different currencies. Whether you're working within the traditional BW environment or leveraging the modern features of SAP Analytics Cloud, there are various techniques available to handle currency conversion effectively.

In this blog, I’ll take you through a comprehensive, step-by-step guide to modeling currency conversion in SAP Datasphere, helping you unlock the full potential of this essential feature.

Disclaimer: All the data created are for demo purposes, the approach is used to demo the functionality of the currency conversion in SAP Datasphere, not intended for production design or usage.

Step overview:


1. Create SAP currency tables/views

2. Create a task chain to trigger data loading for SAP currency exchange rate/currency code/decimals, etc

3. Create a transaction data table and view on top of it

4. Create a currency conversion column to perform currency conversion

Detailed steps:


1. Create SAP currency tables/views

From Data Builder, create SAP currency tables/views, we can load data from S4 source system(connection needs to be set up beforehand)

Currency conversion in SAP Datasphere

The below screenshot shows the source of currency tables/views, multiple data flows also be created when currency conversion views are added to the space, you can also choose to get the source manually.

Currency conversion in SAP Datasphere

2. Create a task chain to combine all the data flows to trigger data loading for SAP currency exchange rate/currency code/decimals, etc 

Running the task chain to load all the currency related data from S4

Currency conversion in SAP Datasphere

3. Create a transaction data table and view on top of it

When creating a transaction data table, we will need to assign 'Currency code' semantic type to the Currency column

In this demo, we are going to convert transaction currency to

1. Global currency

2. Currency from Input Parameter

Currency conversion in SAP Datasphere

Let's first take a look at the transaction data we created:

Currency conversion in SAP Datasphere

Exchange rate we loaded from S4 source system, in order to derive the correct date, we will need to use 99999999 minus the 'Date as of which the Exchange rate is Effective' 

Currency conversion in SAP Datasphere

4. Create a currency conversion column to perform currency conversion

◉ Convert to GlobalCurrency

In the view build, select add a 'Currency Conversion Column', a new column will be generated automatically, configure the 'Source Amoutn Column', 'Source Currency', and 'Target Currency', in this case, it's 'GCCurrency', we will use the CURRENT_DATE() as a reference date to perform the conversion,

Note: you can also create your own formula to use different date as reference date

Currency conversion in SAP Datasphere

Error handling configuration is also available to cater for failed conversion

Currency conversion in SAP Datasphere

◉ Convert to Target Currency based on Input Parameter

In this case, we need to create Input Parameter from the downstream target, so that it will appear when we create currency conversion column in the calcuation node

Input parameter created in downstream target:

Currency conversion in SAP Datasphere

We go back to calculation node of currency conversion column, we can select Input parameter as a new option

Currency conversion in SAP Datasphere

Save and deploy the view

Final output


Now if we preview the final output, it will prompt us to choose the target currency

Currency conversion in SAP Datasphere

The value help populate all the currency code nicely

Currency conversion in SAP Datasphere

We choose JPY in this case, you can see the conversion performed nicely with result in both global currency(USD) and JPY: 

Currency conversion in SAP Datasphere

Conclusion

The currency conversion modeling in SAP Datasphere is very straightforward, it can support multiple currency codes easily.

No comments:

Post a Comment