ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Assignments → Lossless Assignments
Lossless Assignments - Rules
A lossless assignment checks the assigned content, before its conversion to an incompatible target object, to see whether the assignment is possible without data loss. This means:
- the value is checked to see whether it is a valid value for the data type of the source
- whether a conversion to the target field can result in a loss of values
whether the value is valid for the target field after conversion
If the source contains a valid value and no values are lost, the conversion is performed in accordance with the associated conversion rules. Otherwise no assignment is made. If it is statically detectable that one of the prerequisites is not met, a syntax error occurs. If this violation is not identified until the program is executed, a handleable exception is raised. The exception class of this exception is generally a subclass of CX_SY_CONVERSION_ERROR.
The following sections outline which rules are used by the operator
EXACT when checking the content of its argument with respect to the data types involved:
If an exception is raised as a result of an invalid or inappropriate value, the VALUE attribute of the exception object is assigned this value in character form; this value is generally also included in the exception text.
No checks are made for:
- compatible data types
- Reference Variables
EXACTare not useful. This is because nothing is converted and the content is either assignable or not assignable, as specified by the assignment rules for reference variables.
A syntax check warning is produced if it is determined (statically) that no checks are performed for the combination of argument and target type, so making
Other versions: 7.31 | 7.40 | 7.54
Since lossless checks are only performed for conversions to incompatible data types, it is best to only
use the operator
EXACT to fill data objects that should only be given valid
objects. Other types of assignments that require a start value to be specified in the declaration using
VALUE can generate invalid values that are then not recognized when a lossless assignment is made to a compatible target field.
See Lossless Assignment.
Checking Elementary Data Objects