Show TOC

Creating ABAP ClassesLocate this document in the navigation structure

Context

You can create local or global ABAP classes to build a template for objects.

Note The following procedure is for all development objects that you can create completely using the Eclipse-based wizards. ABAP interfaces and executable programs are created in a similar manner.

Procedure

  1. In the Project Explorer, select the relevant package node.
  2. Open the context menu and choose Start of the navigation path New Next navigation step ABAP Class End of the navigation path to launch the creation wizard.
  3. Specify the Project and Package properties of the ABAP class to be created.
  4. Enter the Name and Description for the class to be created and choose Next.
    Note Use [Your Prefix]CL_[Your Class Name] as the name.
  5. Enter the name of the Superclass in case the new class has to be inherited from a specific superclass.
    Tip When editing the superclass, you can avail of the content assistant functionality by pressing Ctrl + Space.
  6. Assign a transport request.
  7. Start the creation with Finish.

Results

The back-end system creates an inactive version of a class pool in the selected package that is stored in the class library of the repository. In the Project Explorer, the new class is added to the Source Library of the corresponding package node. In the source code editor, the initially generated source code is displayed and ready for editing.

After you have created an ABAP class, the following tabs are available in the class editor:

Tab Description
Global Class Class that is stored in the class library of the central ABAP Repository
Class-Relevant Local Types Contains local definitions that are referenced in the private section of the global class
Note When these local definitions are changed, all subclasses and friends of the global class must be recompiled because they might depend on these definitions.
Local Types Contains local definitions that are NOT referenced by the global class
Test Classes Contains ABAP Unit test classes that enable automated tests during the development phase
Macros Allows you to add macro definitions for the given global class
Caution Macros are regarded as obsolete technology and should no longer be used in ABAP classes.