Show TOC

Generating Class Constructor MethodsLocate this document in the navigation structure

Context

You can create a public method called class_constructor with an empty implementation.

Example

Here, the class_constructor method is added:

CLASS cl_car_constructor_generator DEFINITION PUBLIC CREATE PUBLIC . 
 PUBLIC SECTION. 
ENDCLASS. 
 
CLASS cl_car_constructor_generator IMPLEMENTATION. 
ENDCLASS.

Procedure

  1. In the definition part, select the name of the class.
  2. In the context menu, choose Quick Fix or use the shortcut (Ctrl 1).
  3. In the Quick Fix dialog box, double-click Generate class constructor.

Results

In the definition, the class_constructor method is declared as CLASS-METHODS.

In the implementation, the empty body of the class_constructor method is added.

Example

ABAP class after generating

CLASS cl_car_constructor_generator DEFINITION PUBLIC CREATE PUBLIC . 
 PUBLIC SECTION.
  CLASS-METHODS class_constructor.
ENDCLASS.
 
CLASS cl_car_constructor_generator IMPLEMENTATION.
 METHOD class_constructor. 
 ENDMETHOD.

ENDCLASS.