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: 

regarding Object oreinted concepts

Former Member
0 Kudos
87

hello all,

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

plz do forward it to me at abapravikumar7@gmail.com.

thanks for ur help..

if its useful i'll rewards points.

3 REPLIES 3

Former Member
0 Kudos
40

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

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 if this helps,</b>

Satish

Former Member
0 Kudos
40

Hi

Here are few links

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

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

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

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

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

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

Hi

go through the following limks...

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

Classes

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

Object Handling

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

Declaring and Calling methods

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

Inheritance.

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

Interfaces.

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

Trigerring and handling Events

http://help.sap.com/saphelp_47x200/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm

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

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

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:

Encapsulation

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.

Inheritance

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.

Polymorphism

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

/people/thomas.jung3/blog/2005/09/08/oo-abap-dynpro-programming

/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action

This is good for beginners

/people/sap.user72/blog/2005/05/10/a-small-tip-for-the-beginners-in-oo-abap

Reward all helpfull answers

Former Member
0 Kudos
40

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.

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.

Please check this online document (starting page 1291).

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

Also check this links as well.

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

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

http://www.futureobjects.de/content/intro_oo_e.html

http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm

/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action

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/