You are on page 1of 16

ABAP OBJECTS (BASIC)

Hadiantoro

AGENDA
Introduction
What is OOP
Advantages of OOP
Features of OOP
Build Basic ABAP OOP





Introduction
Classes are pieces of program code that describe
objects by defining their components.
Typical object components are attributes (data),
which describe an objects state, and methods
(functions), which describe an objects behavior.
Objects are instances of classes.
Many objects can be created from one class, but
each object has its own attributes.
Local Class ( ABAP Program ) and Global ( Class
Builder )
What is OOP
The fundamental idea behind Object Oriented
Programming (OOP) is to combine both data and the
functions (methods) those operate on that data into a
single unit. Such an unit is called Object.
Advantages of OOP
Better Programming Structure
Real world entity can be modeled very well
Stress on data security and access
Data encapsulation and abstraction
Reduction in code redundancy

Features of OOP
Abstraction
- Modeling real world entities and processes in a more natural way.
Encapsulation
- Hiding data and its related logic behind well defined interfaces.
Inheritance
- Reusing attributes and methods while allowing for specialization.
Polymorphism
- Simplifying by hiding varying implementations behind the same
interface.
Code Reuse
- Same code can be reused multiple times by using inheritance
History of ABAP OOP
SAP Basis Release 4.5 delivered the first version
of ABAP Objects.
SAP Basis Release 4.6 delivered complete
version of ABAP Objects by introducing
Inheritance.
SAP Web Application Server 6.10/6.20
enhanced ABAP Objects with Friendship and
Object Services
Advantages of ABAP OOP over conventional ABAP
Procedural Programming
ABAP Objects provides advance level of data encapsulation that
improves the maintainability and stability of ABAP programs.
ABAP Objects provides instantiation of multiple instances of a
single class.
ABAP Objects enhances code reuse through Inheritance.
ABAP Objects helps us to work with an objects business logic
through a standalone interface.
ABAP Objects makes it easy to incorporate event driven
programming models.
ABAP Objects are more explicit, and therefore simpler to use.
ABAP Objects offers cleaner syntax and semantic rules.
ABAP Objects offers the only way to use new ABAP technology.
Procedural ABAP and ABAP Objects

Basic Building blocks of OOP
Classes and Objects are the basic building
blocks of Object Oriented Programming. When a
real world entity is modeled into OOP world then
it is known as Class, characteristics as attributes
and functionality as methods.
Objects is an instance of a Class.
Classes ( Global + Local )
Classes can be of two types:
- Global Class (Created using class builder (SE24) and stored in
class repository as Class pool)
Local Class (Created in any ABAP program)
Declaring a Class (Local)
Components of Class ( Instance + Static )
Instance Components :
- Data ( for instance attributes )
- Methods ( for instance methods )
- Events ( for instance events )
Static Components :
- Class-Data ( for static attributes )
- Class-Methods ( for static methods )
- Class-Events ( for static events )
- Constants ( for constants )
DEMO

You might also like