Application Development and Automation 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: 
Read only

OO - Encapsulation, inheritance, polymorphism

Former Member
0 Likes
3,040

Hiii

can anyone please give code concrete example on the object oriented ABAP especially concerning inheritance, polymorphism and encapsulation

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,593

Hello,

POLYMORPHISM:-

Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class. For example, a method can be declared in a parent class, but each subclass can have a different implementation of that method. This allows each subclass to differ, without the parent class being explicitly aware that a difference exists.

CLAUSES REGARDING POLYMORPHISM:-

1.Allows one interface to be used for a general class of actions.

2.When objects from different classes react differently to the same procedural call.

3.User can work with different classes in a similar way, regardless of their implementation.

4.Allows improved code organization and readability as well as creation of “extensible” programs.

5.Although the form of address is always the same, the implementation of the method is specific to a particular class.

Check this link for example:

http://www.saptechnical.com/Tutorials/OOPS/Polymorphism/page1.htm

Inheritance is the concept of passing the behavior of a class to another class.

You can use an existing class to derive a new class.

Derived class inherits the data and methods of a super class.

However they can overwrite the methods existing methods and also add new once.

Inheritance is to inherit the attributes and methods from a parent class.

Inheritance:

Inheritance is the process by which object of one class acquire the properties of another class.

Advantage of this property is reusability.

This means we can add additional features to an existing class with out modifying it.

Check this link for Example:

http://www.saptechnical.com/Tutorials/OOPS/Inheritance/demo.htm

Check this for OOPS concept:

http://www.saptechnical.com/Tutorials/OOPS/MainPage.htm

<REMOVED BY MODERATOR>

Thanks,

Swati

Edited by: Alvaro Tejada Galindo on Feb 26, 2008 2:12 PM

3 REPLIES 3
Read only

Former Member
0 Likes
1,594

Hello,

POLYMORPHISM:-

Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class. For example, a method can be declared in a parent class, but each subclass can have a different implementation of that method. This allows each subclass to differ, without the parent class being explicitly aware that a difference exists.

CLAUSES REGARDING POLYMORPHISM:-

1.Allows one interface to be used for a general class of actions.

2.When objects from different classes react differently to the same procedural call.

3.User can work with different classes in a similar way, regardless of their implementation.

4.Allows improved code organization and readability as well as creation of “extensible” programs.

5.Although the form of address is always the same, the implementation of the method is specific to a particular class.

Check this link for example:

http://www.saptechnical.com/Tutorials/OOPS/Polymorphism/page1.htm

Inheritance is the concept of passing the behavior of a class to another class.

You can use an existing class to derive a new class.

Derived class inherits the data and methods of a super class.

However they can overwrite the methods existing methods and also add new once.

Inheritance is to inherit the attributes and methods from a parent class.

Inheritance:

Inheritance is the process by which object of one class acquire the properties of another class.

Advantage of this property is reusability.

This means we can add additional features to an existing class with out modifying it.

Check this link for Example:

http://www.saptechnical.com/Tutorials/OOPS/Inheritance/demo.htm

Check this for OOPS concept:

http://www.saptechnical.com/Tutorials/OOPS/MainPage.htm

<REMOVED BY MODERATOR>

Thanks,

Swati

Edited by: Alvaro Tejada Galindo on Feb 26, 2008 2:12 PM

Read only

Former Member
0 Likes
1,593

I can explain you the concept:

Encapsulation is the mechanism it binds together the code and the data it manipulates and keeps both safe from outside interference and misuse.

Encapsulation is a protective wrapper

that prevents the code and data from being arbitrarily accessed by other code defines outside the wrapper.+

Access to the code and data inside wrapper is tightly controlled through well defined interface.

polymorphism:It is something like same name multiple forms.

we can have a class which does addition.

ther can be multiple methods ADD(... ..)

takning paremetrs as nos to add. now multiple methods can exist with same name add in the class depending on the kind of parametrs passedlike if they are integers or floats or 2 strings where they are concatenated.

inheritance: replated to reuse. here we can use the exsiting class and extend the same to add our own functionality.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 26, 2008 2:12 PM

Read only

Former Member
0 Likes
1,593

Hi,

Please check these links:

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

DIRLL DOWN AND INTERACTIVE REPORT

http://www.sap-img.com/abap/difference-between-drilldown-report-and-interactive-report.htm

PAGE BREAK FOR ALV LIST

check out this link

http://www.abap4.it/download/ALV.pdf

good book on ABAP objects(OOPS)

http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Pro...

How to check Cluster Table Data

https://forums.sdn.sap.com/click.jspa?searchID=5215473&messageID=3520315

http://www.sap-img.com/abap/the-different-types-of-sap-tables.htm

http://help.sap.com/saphelp_47x200/helpdata/en/81/415d363640933fe10000009b38f839/frameset.htm

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

<REMOVED BY MODERATOR>

Cheers,

Chandra Sekhar.

Edited by: Alvaro Tejada Galindo on Feb 26, 2008 2:13 PM