Importance of the operator ?=
by Raghavan
?= is called Casting Operator. It is used to instruct ABAP to skip type checking
at compile time and do the check at runtime.
For example, the following code would issue a syntax check because at compile
time it is not possible to verify if oref1 actually points to an object
of the class cl_myclass.
DATA: aref1 TYPE REF TO object,
bref2 TYPE REF TO
cl_someclass.
...
bref2 = aref1.
So instead we use the casting operator like so.
aref1 ?= bref1 or
MOVE aref1 ?to bref2.
This shifts the verification to the runtime.
|