Implementing Currency Conversion

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Describe how to implement currency conversion

Currency Conversion in SAP HANA Cloud

Most organizations operate in multiple currencies but will usually want to report in a single currency. Once we load data to SAP HANA Cloud database the individual transactions are often stored in mixed currencies. SAP HANA Cloud calculation views can convert currencies during run-time.

Even if the reporting tool is able to convert currencies, you should always consider implementing currency conversion in the calculation view to ensure high-performance, as the conversion in SAP HANA Cloud is processed completely in-memory. Also, by defining the conversion rules in the calculation view you ensure consistency across reports that use the same calculation view as you define the rules only once and not in each report.

Currency Conversion

The key elements provided by SAP HANA Cloud are:

  • A set of tables to store master data about currencies, exchange rate types, and the exchange rate values.

  • A semantic typeAmount with Currency which you set for the measure you want to convert.

  • Calculation view settings to define, for each measure, how the conversion should be processed (which rate and conversion dates should be applied, where to find the source and target currency).

Standard SAP Currency Conversion Tables

Table NameDescription
TCURCCurrency codes
TCURRExchange rates
TCURVExchange rate types for currency translation
TCURFConversion factors
TCURNQuotations
TCURXDecimal places in currencies

These tables exist in most SAP systems (in particular, SAP Business Suite and SAP S/4HANA).

To enable currency conversion in SAP HANA Cloud, these tables must be available in the SAP HANA Cloud database. The tables are not provided by SAP HANA Cloud by default and you must provide them and update them yourself using any of the data provisioning tools.

Implementing Conversion in Calculation Views

To setup currency conversion in a calculation view, you need to follow some basic steps:

Assuming you have made the currency tables (TCUR*) available in the SAP HANA Cloud database, you can proceed.

Setting the Semantic Type

When a measure contains an money amount, and if you want to enable conversion, you need to change its semantic type to Amount with Currency Code.

In the Columns tab of the semantic node, select a measure and using the drop-down Semantics choose the semantic type Amount with Currency Code.

Note

The semantic type Amount with Currency Code can be used even if conversion is not required. You would do this to provide currency information to the front end tool so that it can display the amount alongside the currency.

In this case, you only have to set the Display Currency property to identify the currency in which the amounts are expressed. Do not set the Conversion flag.

Defining Currency Conversion Settings

After assigning the semantic type Amount with Currency Code, you then must enable conversion and define the main parameters used for conversion.

Key Settings for Currency Conversion

Key Settings for Currency Conversion

SettingDescriptionOptions
ClientThe client (MANDT) to use to filter the TCUR* tables contentSession Client / Fixed Client Number / Column / Input parameter
Source CurrencyThe currency in which the amounts to convert are expressedFixed / Column
Target CurrencyThe currency in which the amounts must be convertedFixed / Column / Input Parameter
Exchange TypeThe type of rate used to convert amounts. Example: Spot rate, average rate...Fixed / Column / Input Parameter
Conversion DateThe date used to match an amount and the corresponding conversion rateFixed / Column / Input Parameter
Exchange Rate(optional) A column from the source data that contains the exchange rate to be used 
Data TypeThe data type of the converted measure (overrides the data type of the converted column)Example: Decimal (15,2)
GenerateIf selected, this option creates a column that indicates for each converted amount the (target) currency in which it is expressed.The result currency column is never exposed to client tools. It is only available to other calculation views, where it can be used in additional calculations.
Upon FailureSpecifies the behavior if the conversion cannot be executed (for example, if the rateFail (a query on the view generates an error), NULL (the column is not populated), Ignore (keeps the source amount without converting it)
AccuracyDefines how the conversion must be performedIntermediate rounding / Retain all possible digits

It is important to carefully define how the exceptions must be handled when converting data. In addition, to reduce the risk of conversion failure, make sure that the currency conversion tables TCUR* in your SAP HANA system are updated on a regular basis, in particular in a side-by-side scenario where they should always be in sync with the data imported from the remote SAP system.

Decimal Shift and Rounding

By default, the precision of all values is two digits in SAP ERP tables.

As some currencies require accuracy in value, decimal shift moves the decimal points according to the settings in the TCURX currency table. If you want to round the result value after currency conversion to the number of digits of the target currency, select the Rounding checkbox.

Decimal shift back is necessary if the results of the calculation views are interpreted in ABAP. The ABAP layer, by default, always executes the decimal shift. In such cases, decimal shift back helps avoid wrong numbers due to a double shift.

Reusing Currency Conversion Settings between Columns

It is possible to reuse the currency conversion settings for other measures in the same node of a Calculation View. This reduces manual definition and allows for more consistency, by avoiding mistakes. The settings can be applied to several measures at the same time.

The currency conversion settings can be reused in two different ways:

  • Reference

    The settings defined in a measure are applied as is in the other measures that you select, and cannot be modified in the other measures.

    In other words, the settings will always remain consistent and only the source measure for currency conversion setting can be changed, thus impacting the ones that reference it.

  • Copy

    The setting defined in a measure is just copied to the other measures, but they are not bound to each other. The currency conversion settings of the other measures can be freely modified.

Using an Input Parameter for the Currency

The input parameter can also be described as a prompt, in that it asks the user what currency to use.

If you want to define the currency at runtime, when the view is executed, you can create an input parameter.

VARCHAR (5) is the way that the currency code is defined in the TCUR* tables, so to be consistent, we recommend that you define the input parameter with the same data type.

Save progress to your learning plan by logging in or creating an account