SAP Knowledge Base Article - Public

3169818 - Error message "Element contains invalid formula" while adding a Currency Conversion in a Custom CDS View

Symptom

You are trying to implement a currency conversion directly in a Custom CDS View. However, when publishing the Custom CDS View, the following error occurs: "Element contains invalid formula. APS_CCV_CHECK/007".

"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."

Environment

SAP S/4HANA Cloud, Public Edition

Cause

There is something wrong with the formula. 

Resolution

Below is a template for Currency Conversion in calculation:

currency_conversion( amount => amount, source_currency => currency, round => 'X', target_currency => cast('USD' as abap.cuky), exchange_rate_date => exc_date, error_handling => 'SET_TO_NULL' )

Example:

currency_conversion(amount => I_SalesContract.TotalNetAmount, source_currency => I_SalesContract.TransactionCurrency, target_currency => cast('USD' as abap.cuky), exchange_rate_date => I_SalesContract.CreationDate, error_handling => 'SET_TO_NULL', round => 'X', decimal_shift => 'X', exchange_rate_type => 'M', decimal_shift_back => 'X')
 
 
For details of the parameters, please see the introduction in "See Also".
 
When publishing, maybe you will encounter an error "missing CUKY-reference annotation Semantics.amount.currencyCode", you can set like below.
 

See Also

ABAP CDS - Conversion Functions for Units and Currencies

SAP Help Portal | Currency Conversion

Keywords

Currency Conversion, calculation, Semantics.amount.currencyCode, conversion, custom cds view, cds view, formula , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem

Product

SAP S/4HANA Cloud Public Edition all versions ; SAP S/4HANA Cloud all versions

Attachments

Pasted image.jpg
Pasted image.jpg