Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Subtraction not working in CDS View

Former Member
0 Likes
5,552

Hi,

I'm doing simple subtraction but not giving the expected result, below is the snippet and output.

I also try using CAST but it also didn't work. Need yours suggestion on this.

Regards,

Binay Biswakarma

2 REPLIES 2
Read only

thomasgauweiler
Employee
Employee
2,542

Are you sure that "open.menge" is not a null value?

On the ABAP side, null values are mapped to INITIAL values which is 0 for numeric types.

But in SQL the difference 1500 - NULL results in NULL.

Regards, Thomas

Read only

Mujeeb
Participant
0 Likes
2,535

Hello Binay, 

Quick solution to this problem is to use COALESC(menge,0). this function will result the 0 value in case of initial SQL value and your substractions will work as expected.

Regards

Mujeeb