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

What is the difference between function groups and Object Orientation

Former Member
0 Likes
659

Hello all

I have read about this on the help.sap.com site, I still do not understand it completely, can some one explain me with a simple example please ? (Not the increment counter example please !).

Thanks a ton.

Rgds

Sameer

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
621

Hello Sameer

When you call a module of a function group for the first time in your program then the entire function group is loaded. However, this can happen only once within your report and all global variables within the function group will have the same values all the time (except they are manipulated via fm's).

In contrast, you can create as many instances of the same class as you want and all of them can have different global attributes. And all these instances are independent of each other.

On the other hand, if fm_A changes global attributes of the function group and fm_B reads these attributes then fm_B read the changed values.

Or in other words:

Function Group = can be instantiated only ONCE
Class = can be instantiated unlimited

Regards

Uwe

Read only

naimesh_patel
Active Contributor
0 Likes
621

In Classes, you could be having two different types of the Methods: Static and Instance. For the Instance method you MUST instantiate the object. Once you instantiate the object you can get access of attributes and methods as per their visibility. To access the Static methods, you don't have to instantiate the object.

You may consider: Function Modules in the Function groups may act as same as the Static Methods of the Class.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
621

This message was moderated.

Read only

Former Member
0 Likes
621

This message was moderated.