cancel
Showing results for 
Search instead for 
Did you mean: 

Exact Meaning of ?= in a better way

Former Member
0 Kudos

Hi Experts,

Wht dis ?= means?????

I know it is used for Type Casting..but i need clear xplaination to use it.

Whts its use...when it is used..

Thks.

Accepted Solutions (0)

Answers (1)

Answers (1)

S-H
Active Participant
0 Kudos

Hi,

This is for casting between reference variables in abap objects..

Help from sap documentation

This statement is the equivalent of:

o2 ?= o1.

The fields o1 and o2 must be reference variables (with the type REF TO), otherwise the system triggers the runtime error MOVE_CAST_REF_ONLY. Use casting whenever a static type check between two assigned reference variables is not possible during the syntax check. If a normal type check is possible, you can use the normal MOVE statement or the assignment operator (=).

Static type checks are possible when you assign reference variables to each other and the type of the target variable has the same number of components or fewer than the starting variable. Conversely, static type checks are not possible if the type of the target variable can have more components than the starting variable.

In casting, the system checks at runtime whether the object reference in the starting variable points to an object to which the object reference in the target variable can also point. It assigns the variable if possible, otherwise, it triggers the catchable runtime error MOVE_CAST_ERROR.

Also refer the thread

Best regards,

Suresh

Message was edited by:

Suresh Honnappanavar