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

Methods Vs FM

Former Member
0 Likes
1,041

Hi Gurus,

Please clarify my query.

I have been using some of the methods in Objects (can also be done by using Functional Modules).

For an effective OO programming , the usage of functional modules are acceptable or not?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
921

Hello Raja,

Object oriented programming is mainly used when we need to cater to the requirement of simulating characteristics and behaviour of mulitple instants (or real life objects) of a specific type (class).

It is this advantage of multiple instantiation that leads us to use classes and objects. A class has atrributes and methods to describe characteristics and behaviour of real life entities respectively. Inside your method implementation if required you can use function modules, there is nothing wrong in that, but function modules should not be written as independent modularisation unit in a program written completely in object oriented manner.

1 more thing - function groups and function modules support encapsulation - a property of object oriented programming - global data of function group can be accessed only by function modules of that function group - but function groups and function modules do not support multiple instantiation unlike classes in object oriented programming. So if you need multiple instantiation you should use classes and methods instead of function groups and function modules.

Hope this clarifies.

Regards

Indrajit

4 REPLIES 4
Read only

thomasalexander_ritter
Product and Topic Expert
Product and Topic Expert
0 Likes
921

Hi,

well classes and function modules are quite different and should be used for different things. For example classes allow you to model the "real-world" more easily in your program and also provide better encapsulation.

However from my understanding methods cannot be called in a transactional context. So if you want to access the database in a transactional way (long transactions...) you have to use function modules.

Furthermore from what I know there is currently no way to call a method remotely (Java for example has RMI). So if you know that you want to call the functionality from different servers a function module might be a better choice.

From my experience you can often see a mixture between function modules and classes. For example when I need persistence logic I usually create a class which bundles all the persistence logic. But inside the class most of the actual database interaction is done via function modules.

cheers

Thomas

Read only

0 Likes
921

Hi Thomas,

Thanks a lot.

Cheers

Read only

aakash_neelaperumal2
Active Participant
0 Likes
921

one basic difference is in Methods you cannot use internal tables with header line.

everything same as of a FM, expect that it uses OO concept.

Read only

Former Member
0 Likes
922

Hello Raja,

Object oriented programming is mainly used when we need to cater to the requirement of simulating characteristics and behaviour of mulitple instants (or real life objects) of a specific type (class).

It is this advantage of multiple instantiation that leads us to use classes and objects. A class has atrributes and methods to describe characteristics and behaviour of real life entities respectively. Inside your method implementation if required you can use function modules, there is nothing wrong in that, but function modules should not be written as independent modularisation unit in a program written completely in object oriented manner.

1 more thing - function groups and function modules support encapsulation - a property of object oriented programming - global data of function group can be accessed only by function modules of that function group - but function groups and function modules do not support multiple instantiation unlike classes in object oriented programming. So if you need multiple instantiation you should use classes and methods instead of function groups and function modules.

Hope this clarifies.

Regards

Indrajit