0% found this document useful (0 votes)
97 views2 pages

What Are The Features of OOABAP.: Global Class

Object oriented ABAP focuses on representing real-world objects as classes. There are two types of classes in ABAP - global classes which can be accessed via the class builder, and local classes which are defined within ABAP programs. The main components of a class are attributes, methods, events, and interfaces. Attributes are variables and constants, methods provide functionality, events allow methods to call each other, and interfaces define methods without implementation.

Uploaded by

Pankaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views2 pages

What Are The Features of OOABAP.: Global Class

Object oriented ABAP focuses on representing real-world objects as classes. There are two types of classes in ABAP - global classes which can be accessed via the class builder, and local classes which are defined within ABAP programs. The main components of a class are attributes, methods, events, and interfaces. Attributes are variables and constants, methods provide functionality, events allow methods to call each other, and interfaces define methods without implementation.

Uploaded by

Pankaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. What are the features of OOABAP.

 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.

ABAP Classes and It`s components

What is a Class ? A class is a user defined data type with attributes, methods, events, user-
defined types, interfaces etc for a particular entity or business application .

What are Objects ? Objects are nothing but instances of classes, each object has a unique
identity that is memory and it`s own attributes.

Declaring Classes and Objects


Syntax: DATA <instance> TYPE REF TO <class name> . "Declaring global
class in ABAP program using type ref to(type reference to )
CREATE OBJECT <instance> . "Create object for the declared
instance

Components of a Class
Attributes: Attributes are variables, constants declared within a class .

Methods: Methods are coding blocks which provides some functionality .

 These methods are similar to Function Modules in ABAP.


 Methods can access all attributes of it`s own class.
 Methods are defined in definition part and implemented in implementation part.
 We can call methods using CALL METHOD statement.

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.
Instance and Static Components

Instance components : These components exist separately in each instance (object) of the
class and are referred using instance component selector using ->

Static components : These components exists globally for a class and are referred to using
static component selector => .

Visibility of Components of Class

Each class component has a visibility.

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 and Local Class

Classes in ABAP Objects can be declared either globally or locally.

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.

You might also like