SAP Function ROUND - Rounding to spec. no. of dec. place (round up, round down, comm. rounding)

Parameter Reference Type Length Default Optional Text
DECIMALS 0 0 X Number decimal places, to which rounding is to be carried out
INPUT 0 value to be rounded
SIGN 0 SPACE X Flag for rounding up, rounding down, commercial roundoff

Parameter Reference Type Length Text
OUTPUT 0 rounded value

Exception Text
INPUT_INVALID value to be rounded is not a number
OVERFLOW Field overflow
TYPE_INVALID Output value is not a number


Functionality
This function module rounds the value INPUT to ANDEC decimal places.The parameter SIGN determines whether rounding is down ('-'), up ('+')or commercial ('X').
If SIGN = SPACE, there is no rounding (OUTPUT = INPUT).
Example
The value VALUE is to be rounded up to the nearest hundred.
DATA: VALUE TYPE F,
ROUND_VALUE TYPE F.
...
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 2-
INPUT = VALUE
SIGN = '+'
IMPORTING
OUTPUT = ROUND_VALUE
EXCEPTIONS
INPUT_INVALD = 01
OVERFLOW = 02
TYPE_INVALID = 03.
Note
  • The result of floating point rounding calculations can be incorrect in
  • certain cases because of rounding errors.
    • If INPUT is a field of type P, internal calculatons similarly use
    • packed numbers. This is expensive, but more accurate. If thecalculation accuracy is very important, INPUT should thus be a field oftype P.
      Negative values are also allowed here:
      For positive values count to the right from the decimal point, fornegative values, to the left.
      E.g.: 1234,1234 rounded to -2 decimal places equals 1200
      1234,1234 rounded to 2 decimal places equals 1234,12
      SPACE,,: no rounding (input = output)
      '+',,: round up
      '-',,: round down
      'X',,: commercial rounding

1574292Enhancement of rounding function for condition adjustment
1093485Long parsing times on Oracle
1112104Weighted round robin procedure
1075310IC: Rounding amounts during interest calculation 3
495779Rounding of base quantity does not occur commercially
613453"Error During Quantity Conversion"/XU058 generated in error
529729MD62 forecast value in demand management rounded up
521579MD70 Forecast value rounded up in demand management
486551Rundung bei der Bewertung von Lohn- u. Gehaltbestandteilen