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

Why doesn't this calculation work?

former_member195355
Participant
0 Likes
899

Hiya,

I have some code that is doing a basic division calculation but it is always returning a value of zero:

I can't seem to understand why this should be the case?

It should be a simple case of just 20,000 / 10,000 = 2

Not 20,000 / 10,000 = 0?

Can anyone smarter than me figure out what is happening?

Many thanks!

4 REPLIES 4
Read only

former_member183073
Active Participant
0 Likes
865

i think it is happening because of the decimal places.

For lv_total you have two decimal places and menge you have 3 decimal places. i am not sure about the reason but can you try putting one of them in proper format(i think putting lv_total into 3 decimal variable would be better)

Read only

Former Member
0 Likes
865

Can you show us the data statements for the three variables?

Read only

former_member195355
Participant
0 Likes
865

Thanks for your help guys but I think it's a setting in the class that is causing the problem:

Changing it means it is now working.

Has anyone else encountered this?

Why do SAP not set this be default?!

Very frustrating!

Read only

0 Likes
865

k, got it