Mentor SAP

Instance Constructor

 

There are two types of methods in ABAP Objects. ABAP Objects can be called implicitly or explicitly with the CALL METHOD syntax. Constructors are the first type of method.

 

The instance constructor is a special instance method in a class and is always named CONSTRUCTOR. The constructor is automatically called at runtime with the CREATE OBJECT statement.

 

When you define constructors, always consider the following points:

 

Note: There is no destructor in ABAP Objects; that is, there is no instance method that is automatically called from the memory immediately before the object is deleted.

 

The corresponding comments in the SAP Library and the menu paths outside the ABAP Workbench are only contained in internal system calls.

 

 

Example

After the instantiation of a class, a constructor is necessary when some of the following conditions occur: