You can find detailed information about ABAP classes in the ABAP manual under
Classes.Prerequisites
When you name your class, observe the naming conventions for global ABAP classes.
Procedure
To create a new class from the initial screen of the ABAP Workbench:
The Create Class dialog box appears with the name of the class:
- Class
Name of the new class.
Create Inheritance
When you choose this function, the Inherits from dialog box appears. You can define the inheritance relationship here by specifying the name of the superclass.
You can define the superclass as any class from the class library that is not defined as final.
- Description
A short text describing the new class.
- Inst. Creation
In general, classes are marked with the Public option. This means that each user can create instances of the particular class (with CREATE OBJECT).
The Protected option defines that only inherited classes or the relevant class itself can create instances of this class.
If you choose the Private option, only the relevant class itself can create its instances (only using its own method).
You can define an abstract class with the Abstract option. You cannot create an instance for this class. An abstract class can be used as template for your subclasses. You can only access this class with your static attributes or with your subclasses.
- Class type
You define the basic type and use of the class here. Copy the entry Normal ABAP class. You can also choose Exception class or Persistent class. You can find more information about these special classes under:
- Final
You define a final class with the Final option. This class completes the inheritance hierarchy since a final class may not create any further subclasses.
If an abstract class is also defined as final. This is advisable if you only want to access the static components of this class.
- Modeled only
If you select this option, the class is not included in the class pool. You will not be able to address it at runtime or test it.
The Create Object Catalog Entry dialog box is displayed.
The method display of the
Result
You have now defined a new class and entered its basic data. The system creates a class pool for the new class (as long as you did not define it as Modeled only).
Exactly one global class is defined in a class pool. Analogous to function groups, you can specify local classes as auxiliary classes or local types here.