# Rounding-off Currency fields.

Hi,

Can someone tell me how to round-off value of currency field.

If fraction <= 0.49 it should be rounded-off to 0.00

If fraction >= 0.50 it should be rounded-off to 1.00

10|10000 characters needed characters exceeded

### Related questions

Posted on Oct 14, 2005 at 04:06 PM

Try this...

```
report zrich_0002 .

data: curr1 type p decimals 2 value '.49',
dec type p decimals 2 .

dec = frac( curr1 ).
if dec <= '.49'.
curr1 = floor( curr1 ).
else.
curr1 = ceil( curr1 ).
endif.

check sy-subrc  = 0.

```

Regards,

Rich Heilman

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 14, 2005 at 08:05 PM

Hi, you have the Function Module ROUND too,

here a litle example ( the paremeter sign = 'X' set how the number will be rounded )

DATA l_input TYPE p DECIMALS 5.

break-point.

l_input = '0.499'.

CALL FUNCTION 'ROUND'

EXPORTING

decimals = 0

input = l_input

sign = 'X'

IMPORTING

output = l_input

EXCEPTIONS

input_invalid = 1

overflow = 2

type_invalid = 3

OTHERS = 4.

l_input = '0.500'.

CALL FUNCTION 'ROUND'

EXPORTING

decimals = 0

input = l_input

sign = 'X'

IMPORTING

output = l_input

EXCEPTIONS

input_invalid = 1

overflow = 2

type_invalid = 3

OTHERS = 4.

Saludos

Daniel

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 14, 2005 at 04:06 PM

parameter p(4) type P decimals 2.

data wa(4) type P decimals 0.

data wa1(4) type P decimals 2.

wa = p .

wa1 = wa .

write wa1.

Cheers.

10|10000 characters needed characters exceeded
• Posted on Oct 14, 2005 at 04:07 PM

Just move it to a integer field.