01.introduction and Concepts of Object Oriented ABAP
01.introduction and Concepts of Object Oriented ABAP
The main feature of Object Oriented programming is representing real-time objects in the
form of class objects.
Object Oriented ABAP focus on representing real-time objects of classes.
SAP ABAP Object Oriented programming is available in two flavors .
One is Global Classes and another one is local class.
Global Class
Global Class is an ABAP object which can be accessible via SAP Class Builder, T-code for SAP
Class Builder is SE24.
Local Class
Local classes are classes which are available in ABAP programs, we can access them via ABAP
editor SE38.
What are Objects ? Objects are nothing but instances of classes, each object has a unique identity
that is memory and it`s own attributes.
Components of a Class
Attributes: Attributes are variables, constants declared within a class .
Events: Event is a mechanism through which one method of a class can raise method of other
class, without hazard of instantiating that class.
Interfaces: Interfaces are similar to classes which contain methods Without any implementation.
Interfaces are mainly used to extend the scope or functionality of the class.
Static components : These components exists globally for a class and are referred to using static
component selector => .
In ABAP Objects, the whole class definition is separated into three visibility sections:
PUBLIC .
PROTECTED .
PRIVATE.
Public section: Data declared in public section can be accessed by the class itself, by its
subclasses as well as by other users outside the class.
Protected section: Data declared in the protected section can be accessed by the class itself, and
also by its subclasses but not by external users outside the class.
Private Section: Data declared in the private section can be accessed by the class only, but not by
its subclasses and by external users outside the class.
Global Class: Global classes and interfaces are defined in the Class Builder (Transaction SE24) in
the ABAP Workbench.
All of the ABAP programs in an R/3 System can access the global classes.
Local Class: Local classes are define in an ABAP program (Transaction SE38) and can only be
used in the program in which they are defined.
Learner Questions
Properties: The properties tab contains class properties like created user name, last changed
user name, package etc.
Interfaces: Contains the list of the interfaces that are implemented in this class( will discuss
in later lessons).
Friends: contains friend classes ( we will discuss later lessons).
Attributes: The attributes tab contains the list of attributes declared in that class.
Methods : Contains the methods with importing and exporting parameters and with some
business functionality (source code).
Events: Contains events declared and implemented in that class.
Types: The types tab contains user defined type decelerations.
Aliases: Contains alias names for interface methods ( will discuss in later lessons).
Learner Questions
Provide short description, save.
Save it in a Local Object or in your test package.
Go to attributes tab and define an attribute as below.
AV_NAME-INSTANCE-PUBLIC-TYPE-CHAR25.
Learner Questions