Uploaded by karthiwhat24

SAP OOPS study

advertisement
SAP OOPS:
Class Component Selector =>
A static component comp of a class can be accessed using the name
class=>comp
In this case, no instance of the class needs to be created. The characters => are the class component
selector. The name class of a class must be on the left of the class component selector. The name comp
of the component must be on the right of the class component selector.
The class component selector can also be used to access the data types and constants of an interface.
intf=>type, intf=>const
The name intf of an interface must be on the left of the class component sector. The name type of a
data type defined using TYPES or the name const of a constant defined using CONSTANTS must be on
the right of the object component selector.
Note
It is also possible to access the static components of a class using the object component selector if an
instance of the class was created.
Object Component Selector ->
A component comp of an object is accessed using the following name:
ref->comp
In this case, the character -> is the object component selector. A reference variable ref must be specified
on the left of the object component selector as follows:
Name of a reference variable (can itself be a composite).
Functional method call or method chaining with reference variable as a result.
Single or chained table expression whose result is a reference variable.
Constructor expression with the instance operator NEW or the casting operator CAST.
The name comp of the component must be on the right of the object component selector. The object
component selector dereferences the reference variable ref and makes the components of the
referenced object accessible.
If ref is an object reference variable, the components comp of the object (attributes and methods) to
which the object reference variable points are addressed using the object component selector.
If ref is a data reference variable that is typed as a structure, the components comp of the structure to
which the data reference variable points are addressed using the object component selector.
If an attempt is made to access a data object (an instance attribute or structure component) using a
reference variable that contains the null reference, a non-handleable exception is raised. Dereferencing
of a data reference in the statement ASSIGN is an exception to this. If an attempt is made to access an
instance method using a reference variable that contains the null reference, a handleable exception of
the class CX_SY_REF_IS_INITIAL is raised.
Download