Get Example source ABAP code based on a different SAP table
ABAP_ARITHEXP > - Lossless Calculations The example demonstrates lossless calculations> and the exceptions raised when roundings occur.
ABAP_SOURCE_CODE DEMO CL_DEMO_COMPUTE_EXACT
ABAP_DESCRIPTION The lossless operator EXACT> > is used to perform the following calculations and to assign 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 affect 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 of the affect the structure has on an arithmetic expression: 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 )>.