Function group is considered to be the closest to the OOPs concept in procedural programing. Knowing similarities and difference between "Function group" and a "Class" can help us understand more about OOPs.
Let us look at similarities
- Like a Class, FG too has attributes and methods (FMs)
- The attributes of a FG can only be accessed through FMs. That is data declared in a FM is global to its methods, but not accessible by FMs of other FGs. Similarly, in a class, its private attributes can only be accessed through its methods. This ensures consistency of data.
Now let us look at the differences
- In a Function group
Variables(attributes) are always Private
Function modules are always Public.
- When a FM is called, an instance of FG is created and the FG attributes are loaded into internal session memory. If you call another FM of the same FG, or call the same FM again, no new instance of FG is created. You have only one instance of the FG. That is an ABAP program can work with several instances of a same class (objects), but it cannot work with several instances of a FG.
Note: Because of the limitations of FG, it is more often used as a modularization technique not as a OO technique. I.e. A programmer rarely uses a FG to declare variables, rather he declares local variables inside a FM. So data gets stored in the calling program and FM is just used to manipulate it.
I will not compare the other OOPs concepts with FG, since FG does not provide any comparable abilities. Hope this article was useful. Let me know your comments.
Let us look at similarities
- Like a Class, FG too has attributes and methods (FMs)
- The attributes of a FG can only be accessed through FMs. That is data declared in a FM is global to its methods, but not accessible by FMs of other FGs. Similarly, in a class, its private attributes can only be accessed through its methods. This ensures consistency of data.
Now let us look at the differences
- In a Function group
Variables(attributes) are always Private
Function modules are always Public.
- When a FM is called, an instance of FG is created and the FG attributes are loaded into internal session memory. If you call another FM of the same FG, or call the same FM again, no new instance of FG is created. You have only one instance of the FG. That is an ABAP program can work with several instances of a same class (objects), but it cannot work with several instances of a FG.
Note: Because of the limitations of FG, it is more often used as a modularization technique not as a OO technique. I.e. A programmer rarely uses a FG to declare variables, rather he declares local variables inside a FM. So data gets stored in the calling program and FM is just used to manipulate it.
I will not compare the other OOPs concepts with FG, since FG does not provide any comparable abilities. Hope this article was useful. Let me know your comments.
Thank you for writing such a useful blog.
ReplyDeleteNice article for the SAP beginners.Thanks for sharing.Recently I bought the SAP BO videos from http://www.itlearnmore.com/special-offer-bo-dw-package/
ReplyDeleteat very low price and I loved the videos
In let us look at similarities :
ReplyDeleteIf I am not wrong, That is data declared in a Function Group is global to its methods,
SAP FI/CO Users Mailing Lists complete marketing information
ReplyDeleteSuperb explanation & it's too clear to understand the concept as well, keep sharing admin with some updated information with right examples.Keep update more posts.
ReplyDeleteSAP HR Training in Chennai
SAP SD Training in Chennai
SAP Basis Training in Chennai
Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding sap topic in an effective way.Thank you so much.
ReplyDeleteSAP ABAP Training in Chennai
SAP FICO Training in Chennai