‎2006 Dec 28 10:18 AM
hi everyone,
can anyone explain exactly what is the difference between a sub-routine and a function module
in which scenario can we use them exactly, an example would be welcome.
Thanks in Advance,
rama
‎2006 Dec 28 10:47 AM
Hi,
A Subroutine can only be called within a program, will be destroyed/out of scope at outside the program, cannot be called from any other program.
Where as a Function module is availabe in SAP repository and can used in any no. of programs. It is having Scope in entire SAP repository. It can be declared globally and can be used in any program.
regards
Rakesh
pls don't forget to reward points if u'r problem is solved
‎2006 Dec 28 10:28 AM
A subroutine can only be called from a program while a function module can be executed as a standalone..
~Suresh
‎2006 Dec 28 10:37 AM
hi ,
Function module existed in global lever where as subroutine is related to program.
and exceptions rising is also possible in function module but not in subroutine.
‎2006 Dec 28 10:41 AM
hi,
suroutine- will be used inside a prog
FM -will be used globally
siva
‎2006 Dec 28 10:47 AM
Hi,
A Subroutine can only be called within a program, will be destroyed/out of scope at outside the program, cannot be called from any other program.
Where as a Function module is availabe in SAP repository and can used in any no. of programs. It is having Scope in entire SAP repository. It can be declared globally and can be used in any program.
regards
Rakesh
pls don't forget to reward points if u'r problem is solved
‎2006 Dec 28 10:50 AM
FM's are global. Also client independant. But Sub routines can not.
Cheers.
‎2006 Dec 28 11:01 AM
‎2006 Dec 28 11:00 AM
Function Module can be run individually using SE37 transaction.But subroutine cant be run individually.
you can't catch exceptions in subroutines. But in Function modules you can.
‎2006 Dec 28 11:09 AM
Hi,
subroutine is program specific logical group of abap sentence which has using changing and tables as parameters which achieves a particular functioanlity.
FM is at global levels means u can call same FM in different programs and parameters are import export, tables and exceptions etc. u have to pass import and export parameters to FM.
Also in case of subroutines u can call it from other program like,
Perform sub_name in program ( Program name ) if found.
Regards
Ashutosh
Reward points if helpful
‎2006 Dec 28 12:14 PM
thanks a lot for the replies friends,
i want to reward points to all, but i could do it to only one guy
how can i do it to others
and i want to make sure bt one thing, subroutines are client-independent
and even though this thread is solved, i please request my friends to reply to this thread if at all any other difference is found
Cheers,
rama
‎2006 Dec 28 2:17 PM
Subroutines cannot be called in different server
where functional module can be remotely called in another server.....
Hop this is also a big difference...