MOVE
Short Reference
Syntax
MOVE source {TO|?TO} destination.
destination {=|?=} source.
Effect
Both these statements assign the content of the operand source
to the data object destination. The variants with the
addition TO or the assignment operator
= are valid for all assignments between operands that are not reference variables, and for
assignments between reference variables for which the static type of source is more specific than or the same as the static type of destination
(narrowing cast).
Variants with the addition ?TO or the assignment operator ?=
(casting operator) must be used
if the source and destination
are reference variables and the static type of source is more general than the static type of destination
(down cast). For assignments between
operands that are not reference variables, use of the question mark ? is not permitted.
The data object destination can be any data object that can be listed at a
write position, and the data object source can be a data object, a
predefined function> or a
functional method (as of release 6.10). The data type of the data object destination must either be
compatible with the data type of
source, or it must be possible to convert the content of source into the data type of destination according to one of the
conversion rules.
Notes
-
If source and/or destination
are field symbols, then, as in all ABAP commands, the system works with the content of the data objects
to which the field symbols point. The actual pointer content of a field symbol can only be changed using
the statement ASSIGN or the
addition ASSIGNING when processing internal tables (value
semantics). If source and
destination are reference variables, the reference contained in
source is assigned to destination (reference semantics).
-
Strings and internal tables are addressed internally using references. When assignments are made between
strings and between internal tables (as of release 6.10 and if the line type itself does not contain
any table types), for performance reasons, only the internal administrative information is transferred. After the assignment, the actual string or the actual
table body of the source as well as the target object are addressed
(sharing). Sharing is valid until the object
is accessed to be changed. At this point, the sharing is canceled and a copy of the content is made. The sharing is displayed in the memory consumption display of the ABAP Debugger and in the
Memory Inspector tool (as of release 6.20).
For internal tables of which the line type itself is, or contains, an internal table, no sharing takes place. Sharing can, however, take place for the corresponding sub tables.
-
If an internal table with a header line is specified as an operand of an assignment, in nearly all
operand positions, the header line is addressed and not the
table body. To address the table body of a table with a header line, [] must be appended to the name.
-
Obsolete Form: MOVE PERCENTAGE
Catchable Exceptions
CX_SY_CONVERSION_NO_NUMBER
-
Cause: Operand cannot be interpreted as number
Runtime Error: CONVT_NO_NUMBER (catchable)
CX_SY_CONVERSION_OVERFLOW
-
Cause: Overflow with arithmetic operation (type P, with specified length)
Runtime Error: BCD_FIELD_OVERFLOW (catchable)
-
Cause: Operand too large or (intermediate) result too large
Runtime Error: CONVT_OVERFLOW (catchable)
CX_SY_MOVE_CAST_ERROR
-
Cause: Source or target variable are not reference variables
Runtime Error: MOVE_CAST_REF_ONLY
Non-Catchable Exceptions
-
Cause: Source field (type P) does not contain correct BCD format.
Runtime Error: BCD_BADDATA
-
Cause: Assignment for deep structures not permitted if these overlap.
Runtime Error: MOVE_COMPLEX_OVERLAP
-
Cause: Type conflict with the assignment between object references.
Runtime Error: MOVE_INTERFACE_NOT_SUPPORTED,
Runtime Error: MOVE_IREF_NOT_CONVERTIBLE,
Runtime Error: MOVE_IREF_TO_OREF,
Runtime Error: MOVE_OREF_NOT_CONVERTIBLE
-
Cause: Type conflict with the assignment between data references.
Runtime Error: MOVE_DREF_NOT_COMPATIBLE
-
Cause: Assignment between the types involved not supported.
Runtime Error: MOVE_NOT_SUPPORTED
-
Cause: Constants and literals must not be overwritten.
Runtime Error: MOVE_TO_LIT_NOTALLOWED
-
Cause: constants and literals must not be overwritten.
Runtime Error: MOVE_TO_LIT_NOTALLOWED_NODATA
-
Cause: During a loop in an internal table, an attempt was made
to overwrite a reference variable that is linked with the internal table by REFERENCE INTO.
Runtime Error: MOVE_TO_LOOP_REF