Symptom
Error "Data type CURR is not supported at this position, see long text" occurs, when checking/publishing a custom CDS view in app Custom CDS Views.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
1. Create a custom CDS view in app Custom CDS Views.
2. Add a calculation like sample codes below. (Type of AmountInCompanyCodeCurrency is CURR.)
case when I_OperationalAcctgDocItem.FinancialAccountType = 'S'
then
AmountInCompanyCodeCurrency
else
0
end
3. Check/Publish the custom CDS view.
4. Error message "Data type CURR is not supported at this position, see long text" shows up.
Cause
An element of data type CURR has a CUKY-reference and requires a decimal shift before using it in expressions.
In CASE expressions either all THEN- and ELSE-branches need to be of type CURR or none of them.
Resolution
There are two options to resolve this issue:
1. Apply one of the following functions to shift the values of CURR-elements:
CURR_TO_DECFLOAT_AMOUNT
GET_NUMERIC_VALUE
2. In CASE expressions use typed literals, e.g. abap.curr'0.00', instead of plain numeric values.
Sample codes:
case when I_OperationalAcctgDocItem.FinancialAccountType = 'S'
then
AmountInCompanyCodeCurrency
else
cast( 0 as ABAP.CURR( xx, x ) )
end
Keywords
Data type CURR, calculation, custom CDS view, case, cast , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem