0% found this document useful (0 votes)
11 views

Object Oriented Programming Part 1

Object oriented programming

Uploaded by

Syeeda Tanzila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Object Oriented Programming Part 1

Object oriented programming

Uploaded by

Syeeda Tanzila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction to Object Oriented

Programming in ABAP

OOPS stands for Object Oriented Programming System.

Object-Oriented Programming (OOP) is a programming paradigm used in


Advanced Business Application Programming (ABAP) that enables
programmers to design software components known as objects. These
objects may include the functions (or methods) that manipulate the data as
well as the data itself. Large codebases can be managed and maintained more
easily using the more modular and structured approach to software
development that OOP in ABAP offers.

ABAP OOPS is based upon two things :-

1. Class :-
A class is a blueprint for creating objects.

It defines the properties (data) and behaviors (methods) that objects of


that class will have.

A Class consists of Methods, Attributes, Events, Interfaces.

2. Objects :-
Object is an instance of a class.

Types of Classes :-
a) Global Class :-
A global class is a class that can be accessed from any ABAP program within
the same system.

Introduction to Object Oriented Programming in ABAP 1


Global classes are defined in the global class pool and are available for use
throughout the system.

We create Global Classes in SE24 ( Class Builder ) transaction code.

Types of Global Classes :-

1. Usual ABAP Class :-


A usual ABAP class is a fundamental programming construct in SAP
systems, written in the ABAP language. It encapsulates data and
functionality, following object-oriented programming principles. Typically,
an ABAP class comprises attributes (data), methods (functions),
constructor and destructor methods, events, interfaces, and visibility
sections. These classes facilitate the creation of modular and reusable
code for SAP applications, promoting efficient development and
maintenance.

Introduction to Object Oriented Programming in ABAP 2


It’s purpose is to write the logic.

2. Exception Class :-
An exception class in ABAP is a special type of class used for defining
custom exceptions. These exceptions represent specific error conditions
or situations that can occur during program execution.

Exception classes encapsulate error handling logic and can be raised


(signaled) within ABAP programs to indicate abnormal conditions.

Introduction to Object Oriented Programming in ABAP 3


3. Persistence Class :-
In the context of ABAP programming and SAP systems, a persistence class
refers to a class that facilitates the interaction with persistent storage, such
as a database.

These classes are responsible for handling data retrieval, storage, and
manipulation operations, ensuring that data is effectively managed and
maintained within the system.

Introduction to Object Oriented Programming in ABAP 4


4. Unit Test Class :-
A unit test class in ABAP is used for testing the functionality of individual
units of code, typically methods or functions, in isolation.

These tests verify that each unit of code behaves as expected under
various conditions and inputs.

Introduction to Object Oriented Programming in ABAP 5


b) Local Class :-
In ABAP programming, a local class is a class that is defined within the scope
of another ABAP program or function module.

Unlike global classes, which are defined independently and can be accessed
from any part of the system, local classes are confined to the program or
function module in which they are declared.

Dedicated to one program only. We can create local classes with the help of
SE38 transaction code.

Class Definition : Declaration Part

Class Implementation : Logic

Introduction to Object Oriented Programming in ABAP 6

You might also like