cancel
Showing results for 
Search instead for 
Did you mean: 

Currency Conversion directly in a CDS View

PSchmierer
Participant
0 Kudos
4,707

Hello together,

how can we implement a currency conversion directly in a CDS View in S4HC if the CDS View is exposed as API?

The CDS View cannot be published using the function currency_conversion() in a calculated field in the app "Custom CDS View".

currency_conversion(
    amount => I_BillingDocumentItem.NetAmount,
    source_currency => I_BillingDocumentItem.TransactionCurrency,
    target_currency => cast( 'USD' as ABAP.CUKY( 5 ) ),
    exchange_rate_date => I_BillingDocumentItem.CreationDate,
    exchange_rate_type => 'M',
    error_handling => 'FAIL_ON_ERROR',
    round => 'true',
    decimal_shift => 'true',
    decimal_shift_back => 'true'
  )

However displaying the data preview of the CDS View is showing the correct values. Publishing the CDS View is not allowed. As the following error mesage is displayed: 

Element contains a not supported formula.
APS_CCV_CHECK/008

We are also not able to derive the correct Exchange Rate from CDS View I_ExchangeRate as it is only containing one date (ExchangeRateEffectiveDate). So we are missing the DateTo as ExchangeRateEffectiveDate can be interpreted as DateFrom.

Best regards

Philipp

View Entire Topic
vinoogan
Explorer
0 Kudos

Hi

S4HANA Cloud 2111 i am unable to find function currency_conversion() in the Add Calcualtion of the custom CDS view type, I have Unbilled Revenue Till Period from I_JournalEntryItemCube, which i would like to convert to Global and Functional Currency

Thanks

Vinoo

PSchmierer
Participant
0 Kudos

Hi Vinoo,

the funktion might not be available in the suggested list of available functions, but you can use it.

For that, see my initial post.

Best regards

Philipp