Class Builder

The ABAP classes, exception classes and interfaces are created using the Class Builder. The Class Builder is called through the SE24 Transaction.

  • Name:  Provide a corresponding class name.
  • Class type: There are four different types of ABAP classes.
    • Usual ABAP classes
    • Exception classes
    • Persistent classes
    • Test classes
  • Final check option:  Enabling this option ensures that no other classes can inherit this class.
  • Accessibility of the class: The accessibility of the class is controlled through options such as private, public, protected
  • Inheritance option

Once all the above details are filled up, the save button can be clicked.

Inheritance:

The Inheritance is achieved through two ways. One way is through the creation dialog box while creating the class. The class to be inherited is given in the input filed for Inherited class. The other way is through properties tab. The Inherited class is entered in the respective field.

Figure 1 Inheritance

Interfaces:

The interfaces is used to accomplish a unified approach to access the class type. The interface can be defined in three different ways as shown in below figure

Figure 2 Interfaces

With the Abstract type of interface, the methods cannot be implemented. The Final option ensures that it cannot be inherited. The components cannot be accessed during the runtime.

Friends:

It serves for the foreign classes which can access the private and protected components of the class. The class can be entered in the friends tab.

Attribute:

The attributes for the class can be defined in the following ways.

Figure 3 Attribute definition

Method definition:

The method can be defined in the following ways.

Figure 4 Method definition

Method Exception:

The exceptions for the method are controlled throughout the exception button. Place the cursor in the corresponding method and click exception button to enter the exceptions. The exceptions are of two types. They are local exceptions and global exceptions.

Method Redefinition:

The methods are defined using the redefinition option available on the top of the method table. The Redefinition of the method can be easily revoked using the Remove Redefinition option on top of the method table.

The inherited method or the super class method can be called using

super -> name_der_method().

Method parameters:

Figure 5 Method parameters

Events:

The events can be specified for the class using the tab events. Provide the event name, type and accessibility. The parameters can be defined for the events using the parameter button.

Constructors:

Instance Constructor: It will be called during the creation of the object.

Class Constructor: It will be calledduring the call of the static method.

Destructor: It will be called for the deletion of the object.

Figure 6 Constructor

1 thought on “Class Builder”

Comments are closed.