Mentor SAP

Static Constructor

The static constructor is a special static method and is always named CLASS_CONSTRUCTOR. The static constructor is executed only once per program.

 

The static constructor is called by the system automatically before the class is first accessed and before the first execution of the following actions:

 

When you define static constructors, always consider the following points:

 

 

Self-Reference

In some cases, you must also have a self-reference available. In ABAP Objects, self-references are always predefined, but they are only useful and syntactically available in certain contexts.

 

You can address an object itself by using the predefined reference variable ME within its instance methods. You are not required to use me-> as a prefix in such cases, but you can use it to improve readability.

 

However, you must use the prefix me-> when distinguishing between local data objects and instance attributes with the same name.

 

An important use of self reference is when you call a foreign method and a client object is required to export a reference to itself, you can then use ME as an actual parameter with EXPORTING or CHANGING.