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: 

Object Oriented ABAP

Former Member
0 Kudos

hi experts,

I want to know from scratch about OOPS ABAP. Starting from classes , objects , their syntax , i saw some documents but i am unable to understand them.please guide me from scratch.

Thank you.

1 ACCEPTED SOLUTION

matt
Active Contributor

Do you already know classic ABAP? If so, I suggest you follow what I did. I got the book "Head First Java" from the O'Reilly press. I learned oo techniques in the java environment from this book (which is the only teach-yourself book I've ever completed - it's that good ). I developed a few java programs to really embed the knowledge I'd gained.

Then I started writing OO Abap programs (I'd done the Abap Objects training course, but you could also benefit from the Abap Objects book available from SAP Press). My opinion is that it is very hard to learn how to program in OO fashion with Abap Objects. It's much easier to learn about inheritance, polymorphism, etc. with Java, then transfer that knowledge across.

Actually, even if you're a complete ABAP newbie, I'd still suggest this route to mastering ABAP Objects.

matt

6 REPLIES 6

Former Member
0 Kudos

Hi

OOPs ABAP uses Classes and Interfaces which uses Methods and events.

If you have Java skills it is advantage for you.

There are Local classes as well as Global Classes.

Local classes we can work in SE38 straight away.

But mostly it is better to use the Global classes.

Global Classes or Interfaces are to be created in SE24.

SAP already given some predefined classes and Interfaces.

This OOPS concepts very useful for writing BADI's also.

So first create a class in SE 24.

Define attributes, Methods for that class.

Define parameters for that Method.

You can define event handlers also to handle the messages.

After creation in each method write the code.

Methods are similar to ABAP PERFORM -FORM statements.

After the creation of CLass and methods come to SE38 and create the program.

In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.

chk out the links below:

General Tutorial for OOPS

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

Have a look at these links for OO ABAP.

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

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.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://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

SDN Series:

https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b... [original link is broken]

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf

Basic concepts of OOPS

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c4...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b...

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

http://www.henrikfrank.dk/abapuk.html

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

Regards

Anji

Former Member
0 Kudos

Hi Praveen,

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

Polymorphism

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.

PUBLIC SECTION.

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.

PRIVATE SECTION.

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.

PRIVATE SECTION.

CLASS-DATA: counter type i,

Public methods

Can called from outside the class

PUBLIC SECTION.

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

parameters.

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

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

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

<b>Reward Points for helpful answers</b>

Regards,

Satish

matt
Active Contributor

Do you already know classic ABAP? If so, I suggest you follow what I did. I got the book "Head First Java" from the O'Reilly press. I learned oo techniques in the java environment from this book (which is the only teach-yourself book I've ever completed - it's that good ). I developed a few java programs to really embed the knowledge I'd gained.

Then I started writing OO Abap programs (I'd done the Abap Objects training course, but you could also benefit from the Abap Objects book available from SAP Press). My opinion is that it is very hard to learn how to program in OO fashion with Abap Objects. It's much easier to learn about inheritance, polymorphism, etc. with Java, then transfer that knowledge across.

Actually, even if you're a complete ABAP newbie, I'd still suggest this route to mastering ABAP Objects.

matt

Former Member
0 Kudos

Hi.

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.

Refer these basics

OO ABAP

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

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

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

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

Detailed

OOPS – OO ABAP

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

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

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

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

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

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

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

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

To be Reward all helpfull answers.

Regards,

Jay

Former Member
0 Kudos

Hi

In SAP World how much you use OO programming using ABAP.

thanks

siva