SAP Knowledge Base Article - Public

3345843 - Custom CDS View is showing incorrect values for currency amount - SAP S/4HANA Cloud

Symptom

When previewing the Custom CDS View and the amount shown for a specific column is incorrect because it's shown with decimals or with a different ratio.

For example: In the Purchase Order app, the price of Item XX should be 4000 TWD. However, when viewing it in the Custom CDS View, the amount is 40 instead of 4000.

Environment

SAP S/4HANA Cloud

Reproducing the Issue

  1. Go to Custom CDS Views app.
  2. Open the Custom CDS View.
  3. Click on "Preview".

Cause

For historical reasons, SAP stores most of the amounts with two decimals in the database, independent of the actual number of decimals maintained for the currency.

As Custom CDS Views are supposed to be used in other tools, the values shown in the Data Preview are the raw line item data.

Resolution

When using the Custom CDS View in standard consumption channels, for example OData and Custom Analytical Queries, an output conversion is applied that shifts the decimals according to the currency and the report is shown as expected with the correct amount. This means that when using the Custom CDS View, the conversion will take place and the amount will be as expected.

It's possible to have a report using this Custom CDS View, by creating a Custom Analytical Query or expose it as External API. 

See Also

SAP Help Portal | How to Create Custom Queries

SAP Help Portal | External API: Exposing a Custom CDS View as OData API

Keywords

preview, Custom CDS View, amount, incorrect, decimals, ratio, price, currency , 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