sapdev logo background
sapdev logo sapdev logo
Comments

SAP COMPUTE EXACT ABEXA documentation, setup help and example usage



Return to SAP documentation index


ARTIClE

Lossless Calculations
The example demonstrates lossless calculations and the exceptions raised when roundings occur.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The lossless operator EXACT
makes the following calculations and assigns the result to a data object with the type decfloat34 :
result = number / sy-index
result = number * ( 1 / sy-index )
If rounding is not needed, the result result is produced. If roundings are needed, the associated exception
CX_SY_CONVERSION_ROUNDING is caught and its attribute VALUE is displayed. The results of lossless calculations are flagged in the display.
This example demonstrates how the structure of an arithmetic expression can influence the result of a lossless calculation. For example, the division of the number number by itself is always a lossless calculation; multiplying number by 1 / number , however, raises an exception when a rounding occurs in the division.
The following two expressions are further examples where the structure of an arithmetic expression is an influence:
result = number * 1 / sy-index
result = 1 / sy-index * number
The first expression has an effect like number / sy-index and the second like number * ( 1 / sy-index ) (again).
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




COMPOUND_INTERFACE_GLOSRY
COMPUTE_EXPRESSIONS




comments powered by Disqus