cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect formatting of Decimals in CDS View

Mowkax
Associate
Associate
0 Kudos
152

Hello SAP Community,

We are having a Node.js CAP application connected to HANA Cloud DB.

There is a view that fetches some information from the table, it is exposed as an OData service as per the standard CAP functionality.
We've noticed that after the CDS npm package version was upgraded to version 8 - view attributes with type "Decimal" are now returned as Strings and formatted as in the screenshot below:

CDS Version 6.8.4:

Mowkax_2-1744801479743.jpeg

CDS Version 8.5.0:

Mowkax_4-1744801939363.png

Calling the view directly in the database returns correct results( DECIMAL value).
No changes were done to the view, and no transformations are applied to the returned value, only version of the cds package had changed.

Has anybody else encountered similar issues? Perhaps this is a side effect of some changes in cds package/ CAP framework?
Any assistance would be appreciated 🙂

Best regards,
Alex

 




View Entire Topic
martinstenzig
Contributor

Long story, there are some other blog posts about it. Short version: Use Double instead of Decimals.

Mowkax
Associate
Associate
0 Kudos

Hello Martin,

Could you please share some of these blog posts?
And thanks for the answer.

cwedler
Product and Topic Expert
Product and Topic Expert
0 Kudos

Using Double in a business context? Probably fine for weight, etc, but probably not for amount…