What does it do? 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>:
A non-generic data type dtype>, apart from reference types>.
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.
Latest notes: NON_V5_HINTS The lossless operator EXACT> replaces the identically named addition of the obsolete statements MOVE>> and COMPUTE>>. ABAP_HINT_END
ABAP_EXAMPLE_VX5 Lossless assignment. Here, the exception CX_SY_CONVERSION_ERROR> is raised, because the argument contains an invalid value. ABEXA 00897 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 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. ABEXA 00898 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 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 >. ABEXA 00899 ABAP_EXAMPLE_END