ABAP Local Class and Global Class

There are two flavors of classes in Object-Oriented ABAP (OOABAP), Local class and Global class.

  • Local Class – Class is defined within an ABAP Program. This class is local to the ABAP program and are called local Class. Use of local class and local interface is confined to the ABAP Program where they are defined. It helps you write object oriented ABAP programs.
  • Global Class – Global class and Interface is defined in Class Builder (Tcode SE24 ) and is available throughout the SAP system. They are stored centrally in class pools in the class library. You can call a global Class anywhere, that is from ABAP programs.

DIFFERENCE BETWEEN LOCAL CLASS AND GLOBAL CLASS

LOCAL CLASSGLOBAL CLASS
Local classes and interfaces are part of ABAP program can only be used within the program in which they are defined.Global classes and interfaces are stored centrally in the class repository and are available throughout the SAP system.
Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS.. ENDCLASSGlobal classes are defined with GUI of Class Builder ( Tcode SE24 )
Local class name can begin with any character.User defined Global class name must start with Y or Z.

STRUCTURE OF ABAP CLASS

The structure of both ABAP Local and Global class comprises of 3 things:

  • Class components
  • Each class component assigned to a visibility section
  • Implementation of methods