Thursday 27 July 2017

Currency Conversion in SAP HANA


                   Most of the amounts in any given fact table are expressed in one specific currency. For example, in SAP ERP tables, there is a mandatory and explicit link between any monetary amount field and its currency. Converting currencies is a necessary function for many reporting scenarios, and SAP HANA offers the possibility to do this as part of the modeling of the analytic and calculation views.
In general, to convert an amount to a different currency, you must specify the following:
v  Source currency
v  Target currency, either fixed or with the use of a variable
v  Date you want to use as the exchange rate between the two currencies
Additionally, you must of course have the necessary tables in the system to store the exchange rates. For an SAP ERP system, this requires the following tables to be replicated to SAP HANA:
TCURR: Exchange Rates
TCURV: Exchange Rate Types
TCURF: Conversion Factors
TCURN: Quotations
TCURX: Currency Decimal Settings

The tables must be in the schema you specified as Schema for Conversion during the creation of the view. If you need to change the schema for conversion later, you can do so by changing the view property Default Schema. The best place to do currency conversion in SAP HANA is in the analytic views and Calculation vews, where it can be done using the graphical interface.

As an example, we will provide the Net Value measure with a simple conversion from its document currency to INR (Indian Rupee), so that aggregation works easily across all reporting levels, and all reports have an apples-to-apples view of Net Value.

EXAMPLE:

1.Create a Calculation view as a cube. Here I named it as "CV_DYNAMIC_CURRENCY_CONVERSION".
2. Drag and Drop the required table in a separate Projection node. Here I use “VBAK” and “VBAP” tables.
3. And Join them by using logical join node.
4.And join the join node to the “Aggregation” node. Then select the required fields.
5. For a currency conversion, you have to create the “Calculated Column”. Here I name it as “Target Currency”.
 6. Drag and drop the required field which you want to convert in an “Expression Editor”. Here I            use “Net_Value”.
7. Then Click Semantics in calculated column, a pop-up window will appear here select the
Semantic type: Amount with Currency Code
Below these two check boxes are available: Enable for conversion and Enable for decimal shifts.
8. And Specify the Following Things:
Specify the Schema for Currency Conversion: This schema should contain the Standard Currency Tables.

Specify the Client for Currency Conversion: Assign a default client to an calculation view and filter data at runtime based on the default client value.
 

For more details:http://kabilsapworld.blogspot.in/2017/07/what-is-client-in-sap-hana.html
Specify the Target Currency: This can be done in three ways:
v  As a fixed target currency, for example, "USD"
v  As an attribute of the view, for example, "T001 .WAERS" for company code currency.
v  As an input parameter, so the user gets a prompt where the target currency can be chosen dynamically (see later in this section for how to create such a parameter).
Specify the Source Currency: This can be done in two ways:
v  As a fixed source currency, for example, "EUR".
v  As an attribute of the view, for example, "VBAP.WAERK" for a sales document currency.
Specify the Exchange Type: In general, there can be many types of exchange rates, for example, "mean daily rate," "bank buying rate,” and so on. If you don't specify anything here, the system will use the exchange rate type "M" — mean daily value.
Specify the Date: This can be done in three ways:
v  As a fixed date, for example, "12/31/2016".
v  As an attribute of the view, for example, "VBAK.ERDAT" for the sales document creation date.
v  As a variable, so the user gets a prompt where the date can be chosen dynamically, or the value is specified at runtime using a procedure that runs in the background.

Select the check box of Generate Result Currency Column for generating a new column in the result.
Set the Upon Conversion Failure option to tell the system how to respond to requests where no exchange rate can be found. There are three choices:
v  Fail
v  Set to NULL
v  Ignore
9. Finally, click OK. The currency conversion for the measure has now been defined.
10. Result: Data Preview








7 comments:

  1. good work dude its very useful for us

    ReplyDelete
  2. Thanks!!!Very Helpful Post, I am facing an issue when trying to connect it to a composite provider, it is asking to connect the new currency calculated column to the generated Currency Column and i dont see it in the HANA view, Can you please help

    ReplyDelete
  3. "nice article. thank you for the information. you can look for Exchanging Foreign Currency in India
    Exchanging Foreign Currency in India
    "

    ReplyDelete
  4. On this page, you'll see my profile, please read this information. convert currency

    ReplyDelete
  5. Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing... cambio cupo en dolares

    ReplyDelete
  6. Your blogs further more each else volume is so entertaining further serviceable It appoints me befall retreat encore. I will instantly grab your rss feed to stay informed of any updates. cupo en dolares

    ReplyDelete
  7. gaming, or various intellectual pursuits Gacha99

    ReplyDelete