Sie sind auf Seite 1von 12

Object Oriented ABAP

Why ABAP Objects ?

• The idea behind the inception of this


concept in 1992 was encapsulate SAP
functionality with object oriented
interfaces for BAPIs’.
• They now provide additional OO
development and execution functionality

2 The ASPplus Solutions Compan


Features of Object Orientation

• Information-Hiding ( Through the


sections of the class such as
Public,Protected and Private )
• Encapsulation
• Inheritance ( Deriving additional
attributes from a base class)
• Abstraction (Interfaces)

3 The ASPplus Solutions Compan


Elements Of ABAP Objects

• Classes – Templates for the objects, no


memory.
• Interfaces – Includes definition but no
implementation
• Objects – Instance of a class

4 The ASPplus Solutions Compan


Classes

• Classes are templates for objects


• They have the following components
Attributes (Static and Instance )
Methods ( Static and Instance )
Events ( GUI trigger )

5 The ASPplus Solutions Compan


Attributes

• Attributes are data fields in a class. They


can have any ABAP data type. The
content of an attribute determines the
status of an object.
• Attributes can be of two types.
Instance attributes.
Static Attributes

6 The ASPplus Solutions Compan


Methods

• Methods are internal procedure in classes.


They can access all attributes of their
class and can thus change the status of an
object.
• They could be compared to the subroutine
in normal ABAP

7 The ASPplus Solutions Compan


Methods

• Again Methods are of two type


Static Methods
Instance Methods
• Special Method : Constructor

8 The ASPplus Solutions Compan


Events

• Events enable objects or classes to trigger


event handler methods in other objects or
classes.

9 The ASPplus Solutions Compan


Objects and Interfaces

• Objects are instance of classes. You can create


any number of objects(instances) for a class.
Each one has a unique identity and its own
attributes.
• An Interface is a mechanism of implementing
Abstraction and Polymorphism – Implementing
the same class in two different ways

10 The ASPplus Solutions Compan


Inheritance

• Inheritance allows you to define classes by


deriving them from existing classes. The new
class adopts or inherits all components of the
existing class. The existing class is called a
super class of the new class.
• A class can have any number of direct
subclasses, but only one super class. ABAP
Objects thus uses single inheritance.

11 The ASPplus Solutions Compan


THANK YOU

12 The ASPplus Solutions Compan