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: 

Difference between Function Module Vs Method in Class Module

former_member577909
Participant
0 Kudos

1) Can you please tell the difference between the Function module used in abap program and the method of the class module used in abap programming.

2) does it necessary to do commit statement after calling the function module.

Thankyou for you time.

Bhaskar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

1)

Check this difference..

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. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.

2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..

Example

-


Update function modules requires COMMIT WORK to execute the function module.

Thanks,

Naren

4 REPLIES 4

Former Member
0 Kudos

Hi,

1)

Check this difference..

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. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.

2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..

Example

-


Update function modules requires COMMIT WORK to execute the function module.

Thanks,

Naren

0 Kudos

hi

I also want to know the difference between the FM and methods.

1. "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".

That means i cannot call a function module(instance of Function grp) more than once in a program.

Please tell me whether i am right or wrong. Could u please explain me what is the meaning of insatnce of function group..

Is there any other difference between these two.

2. what is the difference between static and instance method and function module?

in which scenario we need to use static and instance methods.?

Regards

Sudhansu

Former Member
0 Kudos

Hi Bhaskar,

Please check this link.

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm</a>

-Satya Priya

uwe_schieferstein
Active Contributor
0 Kudos

Hello Baskar

I would like to answer (1):

Function modules correspond to <b>static</b> methods of classes because all global attributes of the function group are valid all the time when calling one of its function modules. We cannot have instances, i.e. specific dataset combined with coding.

Thus far we cannot call class methods remotely but we have to use RFC-enabled function modules. However, if you check the possible categories of classes (SE24, tabstrip <i>Properties</i>) there will be great changes in the (near) future ahead!

Regards

Uwe