Application Development 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: 

move decimal place and round off

AJeB
Participant
0 Kudos
474

how to achieve this result in abap is there a mathematical abap syntax i need to use or is there a function module for this?

expected result = 2455

data(a) = (4.33 * 14400 ) / 254 . " the result is 245.48

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos
381

Your ABAP code calculates 245, not 245.48

But I understand what you mean, no need to show the calculation, you want to multiply 245.48 by 10 to get 2454.8 and round it to 2455.

You can use the ROUND function which does exactly what you ask. Any issue with it?

8 REPLIES 8

Sandra_Rossi
Active Contributor
0 Kudos
381

You have a syntax error anyway.

If you have numbers with decimals, you must define them as text literals:

data(a) = ( '4.33' / 14400 ) / 254.

the result is not 254.48, it's 0, and expected result is not 2455, it's 0.00000118

Please clarify

AJeB
Participant
381

sorry inside the column is *

Sandra_Rossi
Active Contributor
0 Kudos
381

Thanks, there's still a syntax error.

Sandra_Rossi
Active Contributor
0 Kudos
381

and I don't understand your question because the expected result is 245.48, not 2455...

Sandra_Rossi
Active Contributor
0 Kudos
382

Your ABAP code calculates 245, not 245.48

But I understand what you mean, no need to show the calculation, you want to multiply 245.48 by 10 to get 2454.8 and round it to 2455.

You can use the ROUND function which does exactly what you ask. Any issue with it?

0 Kudos
381

for the round it is working.
and for the calculation i made a mistake it is 144000 not 14400 thats why i get 245.48

0 Kudos
381

but is it possible to move the decimal point to the right ?

is there an abap syntax for that?

381

multiply by 10...