SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
Operators in ABAP Objects
The syntax for ABAP Objects contains the following operators:
-
-
-
Structure component selector,,,,
Structures are aggregated data types of the ABAP type concept
and represent a sequence of components, which can be of any data type. You can access the components of a structure using the expression struct-comp.
-
->
-
Object component selector,,,,
You can only access instance components from outside a class using the expression
obj->comp, (where obj is a reference variable
and comp is a component of the object to which the object reference in the variables points). Within a class, you can use the DS:ABEN.SELF_REFERENCE_GLOSRY>
self-reference> ME->comp to point to the class's own instance and
static components. Using the
pseudo-reference
SUPER->comp to point to an obscured method within a redefined method. In instance constructors
of subclasses, you must call the constructor of the direct superclass using SUPER->CONSTRUCTOR.
-
=>
-
Class component selector
-
You can access static components from outside a class using the expression class=>comp (where
class is a class and comp is a static component).
-
->*
-
Dereferencing operator
-
You can dereference data references using the dereferencing operator. If a data reference variable is
completely typed - that is, has no generic type - you can insert the expression dref->*
at any operand position. For all data references, you can assign the field, which a data reference indicates,
to a field symbol using ASSIGN dref->* TO <fs>. There is no dereferencing for object references.
-
->>
-
Remote call operator
-
Interfaces can help you when methods are being called remotely. You can call the instance methods of
an interface remotely using iref->>meth (where iref is an interface reference and meth is an instance method of that interface).
-
~
-
Interface component selector
-
If an interface intf is implemented in a class, the interface component comp possesses the name intf~comp within the class.
The Casting Assignment
If a static type check cannot take place when you make an assignment between two reference variables, you must use the
casting assignment
MOVE ... ?TO ... . If you are using the equivalent of this statement, the assignment operator
'=', you must change this to '?='. The'?=' expression is not an ABAP Objects operator, but simply a way of writing the casting assignment.