Используйте ФМ ROUND - Rounding to spec. no. of dec. place (round up, round down, comm. rounding)
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).
Code:
*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 the calculation accuracy is very important, INPUT should thus be a field of type P.
Parameters
OUTPUT
DECIMALS
Negative values are also allowed here:
For positive values count to the right from the decimal point, for negative 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
INPUT
SIGN
SPACE : no rounding (input = output)
'+' : round up
'-' : round down
'X' : commercial rounding
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.