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

Round Up

Former Member
0 Likes
620

Hi all,

I need to rund up, for examplo 19,464323 round up with 2 decimals = 19,47

Can you help me ?

Thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
529

Hi,

You can use the Function Module 'MURC_ROUND_FLOAT_TO_PACKED'.

Or you can also use the following code to round up:

DATA: num1 TYPE f, num2 TYPE p DECIMALS 3.

num1 = '1.666666'.

num2 = num1.

WRITE num2.

Reward points if helpfull,

Regards,

Kashyap Ivaturi

Read only

former_member194669
Active Contributor
0 Likes
529

no =  19,464323
WRITE no DECIMALS 2 to v_no.

v_no contains 19,47.

a®

Read only

mnicolai_77
Active Participant
0 Likes
529

hi,

the best way for rounding a variable is the following example:

>data: a(8) type p DECIMALS 5 VALUE '123.45678'.

>data: b(8) type p DECIMALS 2.

>START-OF-SELECTION.

>write:/ a.

>write:/ b.

>move a to b.

>write:/ b.

bye.

Marco

Read only

Former Member
0 Likes
529

Hi !

If i use for example

a type f

b type p decimals 2.

a = 19,64332333

move a to b or write a to b, the result is 19,64 i need roud up to 19,65

thanks