Currency Conversion defined in CDS View of DataCatagory CUBE
It is possible to define a currency conversion for CDS views with DataCatagor CUBE(and for a CDS query as well). See also SAP Online Help: ABAP CDS - Conversion Functions for Units and Currencies . It uses the same TCUR tables as a 'normal' Bex query, see Overview of important tables used for currency translation and Simple Example.
In contrast to a Bex query, the currency conversion is not carried out in ABAP but on the Hana database. In case the conversion factor cannot be found, the query terminates with the Hana error 2620. See the following SAP note and Example11C below:
2561100 Currency Conversion in CDS Queries - Could not determine valid conversion rate for value(s)
Example11A: without parameters
The CDS view has DataCatagor CUBE and currency conversion defined for the key figure price. The target currency, exchange rate type and exchange rate date are already specified in the view itself(static, no parameters used).
+
When we run the Adhoc Query query in RSRT
the following result is displayed(with the filters Airline=AA and FilghtDate=18.05.2017)
We can see that the converted value is 3 times larger than the original value in USD. In order to check the correctness conversion factor we use the report RCURTEST
Example11B: with parameters
We now use parameters in order to make it possible for users to choose the target currency and exchnagerate date:
The adhoc query then contains variables:
Example11C: adhoc query terminates since conversion factor could ne be determined
On our test system there is no conversion rate maintained for exchange rate type I:
Hence, when we change in example 11A the rate type from M to I, the adhoc query terminates:
The error message explains the problem:
- Database returned the SQL code 2.048. Error text: column store error: search table error: [2620] executor: plan operation failed
- ...could not determine valid conversion rate for value(s) 422.94 from unit 'USD' to unit 'EUR' on date 2017
Sometimes the error details might be truncated in RSRT, go to transaction SM21 and you will see the DB error details. Then fix the exchange rate issue accordingly.
See also 2561100 Currency Conversion in CDS Queries - Could not determine valid conversion rate for value(s)