‎2007 Sep 26 5:08 AM
Hi Experts,
I have a question. I want to know that in terms of execution time which is faster -
a Function Module being used in a program or a subroutine of any other program being called in a program.
Kindly let me know your comments on this.
Points will be suitably rewarded to useful answers.
Thanks in advance.
Regards,
Himanshu
‎2007 Sep 26 5:10 AM
Subroutine is faster than the Function modules. This is because subroutine is a part of the main program or subroutine pool program and it does not take much time during runtime but for function modules, system accesses whole Function group associated to it which cause the bad performance and runtime is more compared to same code in a subroutine.
‎2007 Sep 26 5:10 AM
Subroutine is faster than the Function modules. This is because subroutine is a part of the main program or subroutine pool program and it does not take much time during runtime but for function modules, system accesses whole Function group associated to it which cause the bad performance and runtime is more compared to same code in a subroutine.
‎2007 Sep 26 5:11 AM
‎2007 Sep 26 5:11 AM
Hi Himanshu,
Both will require the same time, if the Import, Export parameters are the same & code is same.
The reason of using a FM instead of subroutine is for REUSE. You can use the same FM across different programs whereas subroutine is restricted to use only within the same program.
Best regards,
Prashant
‎2007 Sep 26 5:11 AM
Hi Himanshu..
Always better to call FMs instead of External Subroutines.
SAP will not recommend to use External subroutines.
So FMs will be fast compared to External subroutines.
<b>reward if Helpful.</b>
‎2007 Sep 26 5:11 AM
Himanshu,
I think it is function module which is faster when compared to Subroutines.Looking forward to SDN experts replies too.
Thanks,
K.Kiran.
‎2007 Sep 26 5:14 AM
hi
function modules increases u r program performances
when comparing with external sub routines
but subroutines provides readability & modularization
function modules provides reusability & encapsulation
function module gets process in function group
subroutine gets process in calling program thats the main difference between them
regards
Nagesh.Paruchuri
‎2007 Sep 26 5:14 AM
Hi,
<b>Subroutines</b>
Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.
<b>Function Modules</b>
Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.
<i>Subroutines executes faster than the fn modules because subroutines are defined within the program and they are executed after they have been called whereas the when u call a fn module, it is defined globally and it is accessed through a fn group in which they are stored. ALso the fn group should be active at the time of calling.</i>
Please reward if helpful.
‎2007 Sep 26 5:49 AM
‎2011 Oct 12 7:04 AM