7 Additional Functionality for Views
7.5 Using Currency and Unit of Measure
You can define a measure as an amount or quantity in the analytical space, and perform currency conversion.
Measures used in analytic views and calculation views can be defined as amount or weight in the analytical space using currency and unit of measure. You can also perform currency conversion and unit of measure conversion.
For example, you need to generate a sales report for a region in a particular currency, and you have sales data in database tables in a different currency. You can create an analytic view by selecting the table column containing the sales data in this other currency as a measure, and perform currency conversion. Once you activate the view, you can use it to generate reports.
Similarly, if you need to convert the unit of a measure from cubic meters to barrels to perform some volume calculation and generate reports, you can convert quantity with unit of measure.
To simplify the process of currency conversion, the system provides a list of currencies, and exchange rates based on the tables imported for currency. Currency conversion is performed based on source currency, target currency, exchange rate, and date of conversion. You can also select currency from the attribute data used in the view.
To simplify the process of conversion, system provides the following:
● For currency conversion - a list of currencies, and exchange rates based on the tables imported for currency.
● For quantity unit conversion - a list of quanity units based on the tables imported for units.
Currency conversion is performed based on the source currency, target currency, exchange rate, and date of conversion. You can also select currency from the attribute data used in the view. Similarly, quantity unit conversion is performed based on the source unit and target unit.
You can also select the target currency or unit of measure at query runtime using input parameters. If you use this approach then, you have to first create an input parameter with the desired currency/unit specified, and use the same input parameter as target in the conversion dialog.
Note
Currency conversion is enabled for analytic views and base measures of calculation views.
100 P U B L I C
© 2013 SAP AG or an SAP affiliate company. All rights reserved.
SAP HANA Modeling Guide Additional Functionality for Views
Prerequisites
● You have imported tables T006, T006D, and T006A for Unit of Measure.
● You have imported TCURC, TCURF, TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX for currency.
Procedure
1. Select a measure.
2. In the Properties pane, select Semantic Type.
3. If you want to associate the measure with a currency, perform the following substeps:
a. In the Semantic Type dropdown list, select the value Amount with Currency Code.
b. In the Currency Dialog, select the required Type as follows:
Type Purpose
Fixed To select currency from the currency table TCURC.
Column To select currency from one of the attributes used in the
view.
c. Select the required value, and choose OK.
d. If you want to convert the value to another currency, choose Enable for Conversion.
a. To select the source currency, choose Currency.
b. Select the target currency.
Note
For currency conversion, in addition to the types Fixed and Column, you can select Input Parameter to provide target currency at runtime. If you select an input parameter for specifying target currency and deselect Enable for Conversion checkbox, the target currency field gets clear because input parameters can be used only for currency conversion.
c. To specify exchange rate type, in the Exchange Rate Types dialog, select the Type as follows:
Type Purpose
Fixed To select exchange rate from the currency table
TCURW.
Input Parameter To provide exchange rate input at runtime as input
parameter.
d. To specify the date for currency conversion, in the Conversion Date dialog, select the Type as follows:
Type Purpose
Fixed To select conversion date from the calendar.
Attribute To select conversion date from one of the attributes
used in the view.
Input Parameter To provide conversion date input at runtime as input
parameter.
SAP HANA Modeling Guide Additional Functionality for Views
P U B L I C
© 2013 SAP AG or an SAP affiliate company. All rights reserved. 101
e. To specify the schema where currency tables are located for conversion, in the Schema for currency conversion, select the required schema.
f. To specify the client for which the conversion rates to be looked for, in the Client for currency conversion, select the required option.
e. From the dropdown list, select the required value that is used populate data if the conversion fails:
Option Result
Fail In data preview, the system displays an error for
conversion failure.
Set to NULL In data preview, the value for the corresponding records
is set to NULL.
Ignore In data preview, you view the unconverted value for the
corresponding records.
4. If you want to associate a measure with a unit of measure other than currency, perform the following substeps:
a. Select the value Quantity with Unit of Measure in the Semantic Type drop-down list.
b. In the Quantity Units dialog , select the required Type as follows:
Type Purpose
Fixed To select a unit of measure from the unit tables T006
and T006A.
Column To select a unit of measure from one of the attributes
used in the view.
c. Select the required value, and choose OK.
d. If you want to convert the value to another unit, choose Enable for Conversion.
a. To select the source currency, choose Unit.
b. Select the target currency.
Note
For unit conversion, in addition to the types Fixed and Column, you can select Input Parameter to provide target unit at runtime. If you select an input parameter for specifying target unit and deselect Enable for Conversion checkbox, the target unit field gets clear because input parameters can be used only for unit conversion.
c. To specify the schema where unit tables are located for conversion, in the Schema for unit conversion, select the required schema.
d. To specify the client for which the unit conversion factors to be looked for, in the Client for unit conversion, select the required option.
e. From the dropdown list, select the required value that is used populate data if the conversion fails:
Option Result
Fail In data preview, the system displays an error for
conversion failure.
Set to NULL In data preview, the value for the corresponding
records is set to NULL.
102 P U B L I C
© 2013 SAP AG or an SAP affiliate company. All rights reserved.
SAP HANA Modeling Guide Additional Functionality for Views
Option Result
Ignore In data preview, you view the unconverted value for
the corresponding records.
5. Choose OK.
Note
You can associate Currency or Unit of Measure with a calculated measure, and perform currency conversion for a calculated measure by editing it.
Related Information
Creating Input Parameters [page 95]
You use input parameters to define internal parameterization of the view. Input parameters used in the views enables you to obtain a desired functionality when the view is executed.