Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

regarding Object oreinted concepts

Former Member
0 Kudos

hello all,

do any one have basic learning material related to Object oreinted concepts in ABAP.

plz do forward it to me at

thanks for ur help..

if its useful i'll rewards points.


Former Member
0 Kudos

Hi Ravi,

OO ABAP is nothing but a class-method apprach to write ABAP codes and define them : below are few of the

informations which will be of help for a newbie :

Types of attributes and the basic concepts :

Public attributes

Private attributes

Instance attributes

Static attributes

Public methods

Private methods

Constructor method

Static constructor

Protected components


Public attributes

Public attributes are defined in the PUBLIC section and can be viewed and changed from outside the class.

There is direct access to public attributes. As a general rule, as few public attributes should be defined

as possible.


DATA: Counter type i.

Private attributes

Private attributes are defined in the PRIVATE section. The can only be viewes and changed from within the

class. There is no direct access from outside the class.


DATA: name(25) TYPE c,

planetype LIKE saplane-planetyp,

Instance attributes

There exist one instance attribute for each instance of the class, thus they exist seperately for each

object. Instance attributes are declared with the DATA keyword.

Static attributes

Static attributes exist only once for each class. The data are the same for all instances of the class, and

can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.


CLASS-DATA: counter type i,

Public methods

Can called from outside the class


METHODS: set_attributes IMPORTING p_name(25) TYPE c,

p_planetype LIKE saplane-planetyp,

Private methods

Can only be called from inside the class. They are placed in the PRIVATE section of the class.

Constructor method

Implicitly, each class has an instance constructor method with the reserved name constructor and a static

constructor method with the reserved name class_constructor.

The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT

statement, while the class constructor is executed exactly once before you first access a class.

The constructors are always present. However, to implement a constructor you must declare it explicitly

with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and

exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no


Static constructor

The static constructor is always called CLASS_CONSTRUCTER, and is called autmatically before the clas is

first accessed, that is before any of the following actions are executed:

Creating an instance using CREATE_OBJECT

Adressing a static attribute using <classname>->

Calling a ststic attribute using CALL METHOD

Registering a static event handler

Registering an evetm handler method for a static event

The static constructor cannot be called explicitly.

Protected components

When we are talking subclassing and enheritance there is one more component than Public and Private, the

Protected component. Protected components can be used by the superclass and all of the subclasses. Note

that Subclasses cannot access Private components.


Polymorphism: When the same method is implemented differently in different classes. This can be done using

enheritance, by redefining a method from the superclass in subclasses and implement it differently.

follow this link ABAP OBJECTS with good examples.......

check the below links lot of info and examples r there

Check this cool weblog:



these links

For funtion module to class

for classes

for methods

for inheritance

for interfaces

For Materials:

1) -- Page no: 1291










these are the links

Check this for basic concepts of OOPS


Editable ALV


General Tutorial for OOPS

Classical ALV:


<b>Reward Points if this helps,</b>


Former Member
0 Kudos


Here are few links


go through the following limks...


Object Handling

Declaring and Calling methods



Trigerring and handling Events

What is Object Orientation?

In the past, information systems used to be defined primarily by their functionality: data and functions were kept separate and linked together by means of input and output relations.

The object-oriented approach, however, focuses on objects that represent abstract or concrete things of the real world. These objects are first defined by their character and their properties which are represented by their internal structure and their attributes (data). The behaviour of these objects is described by methods (functionality).

Objects form a capsule which combines the character to the respective behaviour. Objects should enable programmers to map a real problem and its proposed software solution on a one-to-one basis.

Typical objects in a business environment are, for example, ‘Customer’, ‘Order’, or ‘Invoice’. From Release 3.1 onwards, the Business Object Repository (BOR) of SAP Web Applicaton Server ABAP has contained examples of such objects. The BOR object model will be integrated into ABAP Objects in the next Release by migrating the BOR object types to the ABAP class library.

A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.


Objects are instances of classes. They contain data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.


Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.

Object References

In a program, you identify and address objects using unique object references. Object references allow you to access the attributes and methods of an object.

In object-oriented programming, objects usually have the following properties:


Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself.


You can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.


Identical (identically-named) methods behave differently in different classes. In ABAP Objects, polymorphism is implemented by redefining methods during inheritance and by using constructs called interfaces.

Uses of Object Orientation

Below are some of the advantages of object-oriented programming:

· Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques.

· In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required.

· Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components.

· In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.

Achieving these goals requires:

· Object-oriented programming languages

Object-oriented programming techniques do not necessarily depend on object-oriented programming languages. However, the efficiency of object-oriented programming depends directly on how object-oriented language techniques are implemented in the system kernel.

· Object-oriented tools

Object-oriented tools allow you to create object-oriented programs in object-oriented languages. They allow you to model and store development objects and the relationships between them.

· Object-oriented modeling

The object-orientation modeling of a software system is the most important, most time-consuming, and most difficult requirement for attaining the above goals. Object-oriented design involves more than just object-oriented programming, and provides logical advantages that are independent of the actual implementation.

This section of the ABAP User’s Guide provides an overview of the object-oriented extension of the ABAP language. We have used simple examples to demonstrate how to use the new features. However, these are not intended to be a model for object-oriented design. More detailed information about each of the ABAP Objects statements is contained in the keyword documentation in the ABAP Editor. For a comprehensive introduction to object-oriented software development, you should read one or more of the titles listed below.

ABAP supports a hybrid programming model. You can use an object-oriented ("OO") programming model based on classes and interfaces, and you can use the more classic procedural and event-driven programming model based on function modules, subroutines, dialog modules, and event blocks. Both models can be used in parallel. You can use classes inside classic processing blocks or you can call classic procedures from methods. In ABAP Objects, SAP has implemented a cleanup of the ABAP language. Within the scope of this language cleanup, stricter syntax checks are performed in classes that restrict the usage of obsolete language elements.

Object orientation in ABAP is an extension of the ABAP language that makes available the advantages of object-oriented programming, such as encapsulation, interfaces, and inheritance. This helps to simplify applications and make them more controllable.

ABAP Objects is fully compatible with the existing language, so you can use existing statements and modularization units in programs that use ABAP Objects, and can also use ABAP Objects in existing ABAP programs.

Check these links



This is good for beginners


Reward all helpfull answers

Former Member
0 Kudos

Check this info.

Object Orientation

A programming technique in which solutions reflect real world objects

What are objects?

An object is an instantiation of a class. E.g. If “Animal” is a class, A cat can be an object of that class.

With respect to code, Object refers to a set of services (methods/attributes) and can contain data

what are classes?

A class defines the properties of an object. A class can be instantiated as many number of times

Advantages of Object Orientated approach

Easier to understand when the system is complex

Easy to make changes

Encapsulation - Can restrict the visibility of the data ( Restrict the access to the data )

Polymorphism - Identically named methods behave differently in different classes

Inheritance - You can use an existing class to define a new class

Polymorphism and inheritance lead to code reuse

Classes in abap

Classes in ABAP are either local or global

Global classes are declared in class builder (SE24 )

Local classes are declared within programs

Components of a class

Attributes : Internal data fields of class

Attributes can be either instance attributes – specific to each instance of the class ( object ) or static attributes which are common to all instances

Methods :

Subroutines / procedures in a class that define the behavior of the object. Methods can also be instance methods or static methods

Encapsulation in ABAP

Encapsulation is obtained through the restriction in visibility of attributes / methods attained through the definition of Public, Private and Protected section of a class

Public Section

All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.

Protected Section

All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it.

Private Section

Components that you declare in the private section are only visible in the methods of the same class.

Inheritance in ABAP

Inheritance allows you to derive a class based on an already existing class.







All attributes / methods of super class become the property of the subclass too. Only public and protected attributes / methods are visible in the subclass

Polymorphism in ABAP

when methods with same name perform differently under different circumstances we call it polymorphism.

Methods redefined in a subclass is an example for Polymorphism


Interfaces are used to define the model of a class.

They also like classes can be either local or global.

Global interfaces are defined through SE24 and local interfaces are defined in program.

Please check this online document (starting page 1291).

Also check this links as well.


check the below links lot of info and examples r there

Check this cool weblog: