Ansicht
Dokumentation

ABENCOMPUTE_EXACT_ABEXA - COMPUTE EXACT ABEXA

ABENCOMPUTE_EXACT_ABEXA - COMPUTE EXACT ABEXA

CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- Lossless Calculations

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

Source Code

Execute

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 ).






CL_GUI_FRONTEND_SERVICES - Frontend Services   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 1721 Date: 20240418 Time: 072811     sap01-206 ( 34 ms )