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: 

Abt OOAP

Former Member
0 Kudos

The main difference between real object orientation and function groups is that although a program can work with the instances of several function groups at the same time, it cannot work with several instances of a single function group.

This requirement is met by object orientation. ABAP Objects allows you to define data and functions in classes instead of function groups. Using classes, an ABAP program can work with any number of instances (objects) based on the same template.

QUESTION :

Can anyone tell how this above question is getting satisfied if true,When false how itis false..tell with some examples

1 ACCEPTED SOLUTION

0 Kudos

Hi,

When you have a Function group (Collection of Data and Modules).

You can work with one SET of DATA using the Modules that are there in the Function group.

Where as When you have a CLASS(Binding of Data and Methods). In you program you can create as many instances of the class as you want. That is you can work on many SETS of DATA.

So ABAP Objects lets you work with More instances which is not possible with Function modules. You cannot represent a REAL WORLD OBJECT using a Function group as you always know that there will me lot of instances for a REAL WORLD OBJECT.

Regards,

Sesh

6 REPLIES 6

former_member235056
Active Contributor
0 Kudos

Hi,

Function modules are mainly encapsulated to one single group and called separately by one single instance only no other function module can be used with it simultaneously whereas the classes contain the instances(objects) that can call

several methods simultaneously.

Pls reward points.

Regards,

Ameet

Former Member
0 Kudos

Hi,

ya u can call any number of times by creating objects.

see this code.

CLASS class1 DEFINITION.

public section.

METHODS:METH1.

ENDCLASS.

CLASS CLASS1 IMPLEMENTATION.

METHOD METH1.

WRITE:/ 'THIS IS FROM METHOD'.

ENDMETHOD.

ENDCLASS.

DATA: OBJ TYPE REF TO CLASS1.

DATA: OBJ1 TYPE REF TO CLASS1.

START-OF-SELECTION.

CREATE OBJECT OBJ.

CALL METHOD OBJ->METH1.

***********************************

write:/ 'this is the same output from another object'.

CREATE OBJECT OBJ1.

CALL METHOD OBJ1->METH1.

rgds,

bharat.

0 Kudos

Hi,

When you have a Function group (Collection of Data and Modules).

You can work with one SET of DATA using the Modules that are there in the Function group.

Where as When you have a CLASS(Binding of Data and Methods). In you program you can create as many instances of the class as you want. That is you can work on many SETS of DATA.

So ABAP Objects lets you work with More instances which is not possible with Function modules. You cannot represent a REAL WORLD OBJECT using a Function group as you always know that there will me lot of instances for a REAL WORLD OBJECT.

Regards,

Sesh

Former Member
0 Kudos

Hi Mahesh,

When you call a function module, the whole function group gets loaded into internal memory session for the first time.. now if you call same/ other function modules again from same function group then this function group from internal session is used and no other 'instance' is loaded into memory.. so you always work with only one 'instance' of the function group (this is not completely true as there are additions to the call function where you can ask for new 'instance' of function group..)

When you work with classes, you have option to create different instances of same class explicitly and work with methods of those specific objects..

Regards,

Abhijit

Former Member
0 Kudos

thanks