ABAP - Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Processing of Internal Data →  Obsolete Assignments → 

MOVE

Quick Reference

Obsolete Syntax

MOVE {[EXACT] source  TO destination}
   | {        source ?TO destination}.


Variants:

1. MOVE [EXACT] source TO destination.

2. MOVE source ?TO destination.

Effect

Obsolete form of the assignment of data objects and reference variables source to target variables destination. If EXACT is specified, only data objects can be specified for source. If EXACT is not specified, the following can be specified for source alongside data objects:

The following cannot be specified with MOVE:

Notes

Variant 1

MOVE [EXACT] source TO destination.


Effect

Without the addition EXACT, this statement works in the same way as

destination = source.

If the addition EXACT is specified, the statement works like

destination = EXACT #( source ).

In this way, the addition EXACT produces a lossless assignment in accordance with the rules that apply when using the lossless operator EXACT. This can raise exceptions if values are lost or if they are invalid. If an exception is raised when the operator EXACT is used, the statement is not executed and the value of the target field remains unchanged. In assignments made without the operator EXACT, the target field contains an undefined value when an exception raised by the conversion is handled.

Note

When MOVE is used for enumerated objects, additionEXACT and the lossless operator EXACT have the special effect that they can enable assignments, which would otherwise have not been possible.

Example

It is not possible to have the two commented out assignments of a number to the enumerated variable num. The assignment is possible using EXACT, because in this case the assignment follows the same rules as the lossless operator displayed underneath.

TYPES:
  BEGIN OF ENUM number,
    n0, n1, n2,
  END OF ENUM number.

DATA num TYPE number.

"num = 1.
"MOVE 1 TO num.
MOVE EXACT 1 TO num.

num = EXACT number( 1 ).

Variant 2

MOVE source ?TO destination.


Effect

This statement works in the same way as

destination ?= source.

source and destination must have reference types. The addition ?TO makes down casts possible, whereas in TO only up casts can be used.

Programming Guideline

Assignments with the assignment operators = and ?= only