sapdev logo background
sapdev logo sapdev logo
Comments

SAP CLASS COMPONENT SELECTOR documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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 to the left of the class component selector. The name comp of the component must be to 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 to 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 to 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.

Example
Declares a class factory and accesses its static attribute
oref .
CLASS factory DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CLASS-DATA oref TYPE REF TO factory.
CLASS-METHODS class_constructor.
METHODS do_something.
ENDCLASS.

...

factory=>oref->do_something( ).

...

CLASS factory IMPLEMENTATION.
METHOD class_constructor.
CREATE OBJECT oref.
ENDMETHOD.
METHOD do_something.
...
ENDMETHOD.
ENDCLASS.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CLASS_COMPONENT_GLOSRY
CLASS_COMPONENT_SELECT_GLOSRY




comments powered by Disqus