07-05-2007 11:58 AM
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
07-05-2007 12:11 PM
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
07-05-2007 12:07 PM
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
07-05-2007 12:09 PM
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.
07-05-2007 12:11 PM
Hi,
Check this link for concepts and examples in OOPS
http://www.henrikfrank.dk/abapuk.html
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
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
Regards,
Padmam.
07-05-2007 12:11 PM
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
07-05-2007 12:54 PM
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
07-17-2007 11:43 AM