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
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
Add a comment