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.
cancel
Showing results for 
Search instead for 
Did you mean: 

OOPS in ABAP

Former Member
0 Kudos
2,115

Can someone help me with some study material for ABAP OOPS???

Anita.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
602

Hi,

ABAP (Advanced Business Application Programming) is a programming language for developing applications for the SAP R/3 system, a widely-installed business application subsystem.

The latest version, ABAP Objects, is object-oriented programming. SAP will run applications written using ABAP/4, the earlier ABAP version, as well as applications using ABAP Objects.

SAP's original business model for R/3 was developed before the idea of an object-oriented model was widespread. The transition to the object-oriented model reflects an increased customer demand for it. ABAP Objects uses a single inheritance model and full support for object features such as encapsulation, polymorphism, and persistence.

ABAP Objects

ABAP Objects is a new concept in R/3 System and you can find its two distinct meanings --- one is for the entire ABAP runtime environment and the other represents the new object-oriented generation of this language.

The Runtime Environment

ABAP Objects, for the entire ABAP runtime environment, are an indication of how SAP has, for sometime, been moving towards object orientation. Object-oriented techniques have been used exclusively in system design. The ABAP language did not support these techniques earlier.

The ABAP Workbench will allow creating R/3 Repository objects in this regard. These objects are programs, authorization objects, lock objects, customizing objects, and so on and so forth. By using function modules, one can also encapsulate functions in separate programs with a defined lnterface. The Business Object Repository (BOR) allows you to create SAP Business Objects for internal and external use.

The Object-Oriented Language Extension

ABAP Objects support object-oriented programming. The ABAP Objects is a complete set of object-oriented statements, which has been introduced into the ABAP language. This object-oriented extension of ABAP builds on the existing language and is fully compatible with it.

The Object Orientation (OO), also known as the object-oriented paradigm, is a programming model that unites data and functions in objects. You can not only use ABAP Objects in existing programs, but also work with and use a conventional ABAP in new ABAP Objects programs. The rest of the ABAP language is primarily intended for structured programming, where data is stored in a structured form in database tables and function-oriented programs access and work with it.

Moreover, we should know that the object-oriented enhancement of ABAP is based on the models of Java and C++. It is compatible with external object interfaces such as DCOM and CORBA. The implementation of object-oriented elements in the kernel of the ABAP language has considerably increased response times when you work with ABAP Objects. Some other objects, such as SAP Business Objects and GUI objects, which are already object-oriented by themselves, are also benefiting from being incorporated into ABAP Objects.

About Classes

The classes are templates for objects. An abstract description of an object is the class. You could say it is a set of instructions for building an object. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects.

Local and Global Classes

In ABAP Objects, classes can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24.} in the ABAP Workbench. In the R/3 Repository, they are stored centrally in class pools in the class library. In an R/3 System, all of the ABAP programs can access the global classes. The local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, then it looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.

However, there is a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, then to define the outwardly visible components so that it fits into that program is usually sufficient. On the other hand, global classes must be able to be used anywhere. Since the system must be able to guarantee any program using an object of a global class, it can recognize the data type of each interface parameter and then certain restrictions are applied at the time of defining the interface of a global class.

Defining Local Classes

Local classes consist of ABAP source code, where the ABAP statements CLASS...ENDCLASS are enclosed. A complete class definition consists of the following parts, a declaration part and, if required, an implementation part. It is found that the declaration part of a class

ENDMETHODIn the same way as in other ABAP procedures (subroutines and function modules), you can declare local data types and objects in methods. You call the following methods by using the CALL METHOD statement.

Instance Method

You can declare instance methods by using the METHODS statement. They play a very important role as they can access all of the attributes of a class and can trigger all of the events of the class.

For more information refer the below thread:

/thread/415717

Both the thread contains many links for learning ABAP oops.....

Please refer to the following links,

http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm

Also if you working on ABAP mapping,refer to the following link,

http://help.sap.com/saphelp_nw04/helpdata/en/47/b5413acdb62f70e10000000a114084/content.htm

Reward if helpful.

5 REPLIES 5

Former Member
0 Kudos
602

normal ABAP is process oriented, where is OOP-ABAP is a new methodology in ABAP which uses object oriented programming.

we have C++, java, C#, etc as OOP languages.

ABAP has also implemented the OOP technology.

it uses classes, methods and interfaces instead of functiongroups and function modules.

As part of SAP’s long-standing commitment to object technology, Release 4.0

of R/3 will contain object-oriented enhancements to the ABAP programming

language. SAP’s object strategy is based on SAP Business Objects and now

covers modeling, programming, interfacing, and workflow. By using principles

like encapsulation, inheritance, and polymorphism, the object-oriented

extensions of ABAP will support real object-oriented development. This will

result in improvements in the areas of reusability, maintenance, and quality of

code. SAP offers an evolutionary approach toward objects which leverages

SAP’s own and its customers’ investments in existing business processes,

functionality and data.

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

http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm

check the below links lot of info and examples r there

http://www.sapgenie.com/abap/OO/index.htm

http://www.geocities.com/victorav15/sapr3/abap_ood.html

http://www.brabandt.de/html/abap_oo.html

Check this cool weblog:

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm

http://www.sapgenie.com/abap/OO/

http://www.sapgenie.com/abap/OO/index.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm

http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt

http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt

http://www.allsaplinks.com/

http://www.sap-img.com/

http://www.sapgenie.com/

http://help.sap.com

http://www.sapgenie.com/abap/OO/

http://www.sapgenie.com/abap/OO/index.htm

http://www.sapgenie.com/abap/controls/index.htm

http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf

http://www.sapgenie.com/abap/OO/index.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

http://www.sapgenie.com/abap/OO/

these links

http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm

For funtion module to class

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm

for classes

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm

for methods

http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm

for inheritance

http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm

for interfaces

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm

For Materials:

1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291

2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt

3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf

5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt

6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf

7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt

😎 http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8

1) http://www.erpgenie.com/sap/abap/OO/index.htm

2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

these are the links

Check this for basic concepts of OOPS

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20...

Tabstrip

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20...

Editable ALV

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20...

Tree

http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm

General Tutorial for OOPS

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20ea...

http://www.sapdevelopment.co.uk/reporting/alvhome.htm

http://www.sap-img.com/abap/what-is-alv-programming.htm

http://www.sap-img.com/abap-function.htm

http://www.geocities.com/mpioud/Abap_programs.html

http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm

http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf

http://www.sap-img.com/abap-function.htm

Classical ALV:

http://www.geocities.com/mpioud/Abap_programs.html

OOPS ALV:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a41...

Reward points if found helpful.

Edited by: Sravan Prakash.V on Jan 10, 2008 10:44 AM

Former Member
0 Kudos
603

Hi,

ABAP (Advanced Business Application Programming) is a programming language for developing applications for the SAP R/3 system, a widely-installed business application subsystem.

The latest version, ABAP Objects, is object-oriented programming. SAP will run applications written using ABAP/4, the earlier ABAP version, as well as applications using ABAP Objects.

SAP's original business model for R/3 was developed before the idea of an object-oriented model was widespread. The transition to the object-oriented model reflects an increased customer demand for it. ABAP Objects uses a single inheritance model and full support for object features such as encapsulation, polymorphism, and persistence.

ABAP Objects

ABAP Objects is a new concept in R/3 System and you can find its two distinct meanings --- one is for the entire ABAP runtime environment and the other represents the new object-oriented generation of this language.

The Runtime Environment

ABAP Objects, for the entire ABAP runtime environment, are an indication of how SAP has, for sometime, been moving towards object orientation. Object-oriented techniques have been used exclusively in system design. The ABAP language did not support these techniques earlier.

The ABAP Workbench will allow creating R/3 Repository objects in this regard. These objects are programs, authorization objects, lock objects, customizing objects, and so on and so forth. By using function modules, one can also encapsulate functions in separate programs with a defined lnterface. The Business Object Repository (BOR) allows you to create SAP Business Objects for internal and external use.

The Object-Oriented Language Extension

ABAP Objects support object-oriented programming. The ABAP Objects is a complete set of object-oriented statements, which has been introduced into the ABAP language. This object-oriented extension of ABAP builds on the existing language and is fully compatible with it.

The Object Orientation (OO), also known as the object-oriented paradigm, is a programming model that unites data and functions in objects. You can not only use ABAP Objects in existing programs, but also work with and use a conventional ABAP in new ABAP Objects programs. The rest of the ABAP language is primarily intended for structured programming, where data is stored in a structured form in database tables and function-oriented programs access and work with it.

Moreover, we should know that the object-oriented enhancement of ABAP is based on the models of Java and C++. It is compatible with external object interfaces such as DCOM and CORBA. The implementation of object-oriented elements in the kernel of the ABAP language has considerably increased response times when you work with ABAP Objects. Some other objects, such as SAP Business Objects and GUI objects, which are already object-oriented by themselves, are also benefiting from being incorporated into ABAP Objects.

About Classes

The classes are templates for objects. An abstract description of an object is the class. You could say it is a set of instructions for building an object. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects.

Local and Global Classes

In ABAP Objects, classes can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24.} in the ABAP Workbench. In the R/3 Repository, they are stored centrally in class pools in the class library. In an R/3 System, all of the ABAP programs can access the global classes. The local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, then it looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.

However, there is a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, then to define the outwardly visible components so that it fits into that program is usually sufficient. On the other hand, global classes must be able to be used anywhere. Since the system must be able to guarantee any program using an object of a global class, it can recognize the data type of each interface parameter and then certain restrictions are applied at the time of defining the interface of a global class.

Defining Local Classes

Local classes consist of ABAP source code, where the ABAP statements CLASS...ENDCLASS are enclosed. A complete class definition consists of the following parts, a declaration part and, if required, an implementation part. It is found that the declaration part of a class

ENDMETHODIn the same way as in other ABAP procedures (subroutines and function modules), you can declare local data types and objects in methods. You call the following methods by using the CALL METHOD statement.

Instance Method

You can declare instance methods by using the METHODS statement. They play a very important role as they can access all of the attributes of a class and can trigger all of the events of the class.

For more information refer the below thread:

/thread/415717

Both the thread contains many links for learning ABAP oops.....

Please refer to the following links,

http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm

Also if you working on ABAP mapping,refer to the following link,

http://help.sap.com/saphelp_nw04/helpdata/en/47/b5413acdb62f70e10000000a114084/content.htm

Reward if helpful.

Former Member
0 Kudos
602

hi Anitha,

We can implement OOPS concepts in SAP using ABAP objets concept.

ABAP Objects is a new concept in R/3 Release 4.0. The term has two meanings. On the one hand, it stands for the entire ABAP runtime environment. On the other hand, it represents the object-oriented extension of the ABAP language.

The Runtime Environment

The new name ABAP Objects for the entire ABAP runtime environment is an indication of the way in which SAP has, for some time, been moving towards object orientation, and of its commitment to pursuing this line further. The ABAP Workbench allows you to create R/3 Repository objects such as programs, authorization objects, lock objects, Customizing objects, and so on. Using function modules, you can encapsulate functions in separate programs with a defined interface. The Business Object Repository (BOR) allows you to create SAP Business Objects for internal and external use (DCOM/CORBA). Until now, object-oriented techniques have been used exclusively in system design, and have not been supported by the ABAP language.

The Object-Oriented Language Extension

ABAP Objects is a complete set of object-oriented statements that has been introduced into the ABAP language. This object-oriented extension of ABAP builds on the existing language, and is fully compatible with it. You can use ABAP Objects in existing programs, and can also use "conventional" ABAP in new ABAP Objects programs.

ABAP Objects supports object-oriented programming. Object orientation (OO), also know as the object-oriented paradigm, is a programming model that unites data and functions in objects. The rest of the ABAP language is primarily intended for structured programming, where data is stored in a structured form in database tables and function-oriented programs access and work with it.

The object-oriented enhancement of ABAP is based on the models of Java and C++. It is compatible with external object interfaces such as DCOM and CORBA. The implementation of object-oriented elements in the kernel of the ABAP language has considerably increased response times when you work with ABAP Objects. SAP Business Objects and GUI objects - already object-oriented themselves - will also profit from being

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.

CLASS <subclass> DEFINITION INHERITING FROM <superclass>.

…..

ENDCLASS.

CLASS <subclass> IMPLEMENTATION.

……

ENDCLASS.

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

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.

check the below links lot of info and examples r there

http://www.sapgenie.com/abap/OO/index.htm

http://www.geocities.com/victorav15/sapr3/abap_ood.html

http://www.brabandt.de/html/abap_oo.html

Check this cool weblog:

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm

http://www.sapgenie.com/abap/OO/

http://www.sapgenie.com/abap/OO/index.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423

Reward points if it is usefull .....

thanks and regards

suma sailaja

Former Member
0 Kudos
602

Hi Anita,

You can go through this document as a starter...

[http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt]

You can refer these docs for more information...

[http://esnips.com/web/OOP]

The following link gives you a complete concept of oops abap with sample codes too which might help you..

[http://abapprogramming.blogspot.com/2007/10/oops-abap-1.html]

Reward if helpful.

Thankyou,

Regards.

Former Member
0 Kudos
602

Hi,

please go through this link.

http://abapprogramming.blogspot.com/2007/10/oops-abap-8.html

Regards,

swami