Ansicht
Dokumentation

ABENCONSTRUCTOR_EXPRESSION_EXACT - CONSTRUCTOR EXPRESSION EXACT

ABENCONSTRUCTOR_EXPRESSION_EXACT - CONSTRUCTOR EXPRESSION EXACT

Vendor Master (General Section)   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

EXACT, Lossless Operator

... EXACT type( $[let_exp$] dobj ) ...

Effect

A constructor expression with the lossless operator EXACT performs either a lossless assignment or a lossless calculation, depending on the specified argument dobj, and creates a result with the data type type. The following can be specified for type:

  • The # character for a data type that is determined in accordance with the following hierarchy:
  • If the data type required in an operand position is unique and known completely, the operand type is used. The operand type can also be generic, and the current type is used at runtime.

  • If the data type cannot be derived from the context, the calculation type decfloat34 is used in lossless calculations and the data type of the argument is used in lossless assignments.

The parentheses must contain exactly one unnamed argument dobj that can be converted to the data type type. dobj is a general expression position. The content of the result is determined as follows:

  • If the argument dobj is specified as an arithmetic expression, the expression is calculated in accordance with the rules for a lossless assignment and the result with the calculation type decfloat34 is converted to the data type type.
  • In all other cases, the content of the result is determined by an assignment of the argument in accordance with the associated conversion rules, during which a check is performed in accordance with the rules of lossless assignments.

In the case of a value loss, the corresponding exception is raised in both cases. If the argument is compatible with the data type type in a lossless assignment, EXACT does not perform any checks and a syntax check warning occurs. For enumerated types, additional special rules apply.

An optional LET expression let_exp can be specified before the argument to define local helper fields.

Note

The lossless operator EXACT replaces the identically named addition of the obsolete statements MOVE and COMPUTE.

Lossless assignment. Here, the exception CX_SY_CONVERSION_ERROR is raised, because the argument contains an invalid value.

Example

Lossless assignment with generic types. The first method call produces a successful assignment and the second raises the exception CX_SY_CONVERSION_EXACT_NOT_SUP. If the assignment is replaced with p2 = EXACT #( + p1 ), a lossless calculation is produced and no exception is raised.

Lossless calculation. Here, the exception CX_SY_CONVERSION_ROUNDING is raised, because the calculation is not lossless. The rounded result is assigned to the inline declared variable rounded_result.

Exceptions

Catchable Exceptions

CX_SY_CONVERSION_EXACT_NOT_SUP

  • Cause: Invalid combination of types or lengths.
    Runtime Error: CONVT_NOT_SUPPORTED





ROGBILLS - Synchronize billing plans   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 4974 Date: 20240425 Time: 191140     sap01-206 ( 69 ms )