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: 

keyword.

Former Member
0 Kudos

Hi all good morning.

is there any keyword to roundup the value to nearest one.

ex: 123.46 output must be 123.00.

if its 123.67 then value must be 124.00

Regards.

Prajwal.k

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Prjawal ,

Use CEIL.

Regards,

Atish

8 REPLIES 8

Former Member
0 Kudos

Hi Prjawal ,

Use CEIL.

Regards,

Atish

Former Member
0 Kudos

Hi Prajwal,

Check below SAP help

Function func Return value

abs Absolute value of the argument arg

sign Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.

ceil Smallest integer number that is not smaller than the value of the argument arg.

floor Largest integer number that is not larger than the value of the argument arg.

trunc Value of the integer part of the argument arg

frac Value of the decimal places of the argument arg

Regards,

Atish

Former Member
0 Kudos

HI,

ROUND function is u can use that

<b>example</b>

data:num TYPE p value '5789.7'.

WRITE num NO-GROUPING ROUND 0 DECIMALS 2.

rgds,

bharat.

Former Member
0 Kudos

hi,

use <b>ceil or floor or round.</b>

regards,

paras

Former Member
0 Kudos

Hi,

Try this..

data: v_amount type netpr value '123.46'.

data: v_mod type i.

v_amount = v_amount * 100.

v_mod = v_amount mod 100.

v_amount = v_amount / 100.

if v_mod > 50.

  • Use the ceil function to round it up.

v_amount = ceil( v_amount ).

write: / v_amount.

else.

  • Use the floor function to round it down.

v_amount = floor( v_amount ).

write: / v_amount.

endif.

Thanks

Naren

Former Member
0 Kudos

Hi,

Try this code -

DATA P TYPE P.

P = abs( 10 / 3 ).

write:/ p.

If value is 10, it will return P = 3 and value = 11, it will return P = 4.

Hope this helps.

ashish

Former Member
0 Kudos

Hi

Copy Paste and Execute

DATA n TYPE p DECIMALS 2.

DATA m TYPE p DECIMALS 2 VALUE '-5.55'.

n = abs( m ). WRITE: 'ABS: ', n.

n = sign( m ). WRITE: / 'SIGN: ', n.

n = ceil( m ). WRITE: / 'CEIL: ', n.

n = floor( m ). WRITE: / 'FLOOR:', n.

n = trunc( m ). WRITE: / 'TRUNC:', n.

n = frac( m ). WRITE: / 'FRAC: ', n.

Check the value for CEIL now.

Hope it helps.

Praveen

Former Member
0 Kudos

Thanks to all.

Regards.

Prajwal.k