‎2007 Jul 12 10:28 AM
‎2007 Jul 12 10:30 AM
Hi,
Here is the notes of differences bet. FM and Subroutines.
Hi Function modules are for modularization urpose. You can the Function Module in any program. That is available all over in the SAP system.
Where as subroutine is program specific. Once you create a subroutine in one program then you can use that in that program and related programs like includes in the program or you have to call the subroutine specifically using the main program name.
Finally subroutines are for program modularization. Not for generic use.
FM's are for generic use. Not program dependent.
FMs are mainly used when a routine is to be performed by many programs.
Subroutines (forms) are generally only executed within one program.
You can perform routines from other programs, but it's not often done.
both forms and FMs are reusable modularization units.
To distinguish we generally say that forms are used for internal modularization and
FMs are used for external modularization.
To decide on which to implement, consider whether you need the content to be used just for a limited program
or wheteher it can be called from many independent programs.
For the first purpose it is better to implement a form whereas for the second we implement an FM.
However, ABAP does not isolate the usage context.
That is; you can call a form from another program within whose code the form is not actually implemented.
However, this requires attention since the form may utilize global variables.
The same issue holds for FMs.
FMs are encapsulated in function groups and function groups may have global variables that can be globally
used by all FMs inside it.
Regards,
Priyanka.
‎2007 Jul 12 10:31 AM
‎2007 Jul 12 10:31 AM
Hi,
Subroutines are defined locally in the program and FMs are globally defined in SAP system.
You cant upload data or remotely access data using Subroutines, its possible in FM
Reward if useful!
‎2007 Jul 12 10:34 AM
hi
Subroutines are program modules, which can be called from other ABAP/4 programs or within the same program.
types of subroutines:
Internal Subroutines: The source code of the internal subroutines will be in the same ABAP/4 program as the calling procedure (internal call).
External Subroutines: The source code of the external subroutines will be in an ABAP/4 program other than the calling procedure.
It is possible to create an ABAP/4 program, which contains only Subroutines
In contrast to normal subroutines function modules have uniquely defined interface. Declaring data as common parts is not possible for function modules. Function modules are stored in a central library
reward if useful.
‎2007 Jul 12 10:34 AM
hi,
they can both return values.
FMs are mainly used when a routine is to be performed by many programs.
Subroutines (forms) are generally only executed within one program.
You can perform routines from other programs, but it's not often done.
both forms and FMs are reusable modularization units.
To distinguish we generally say that forms are used for internal modularization and
FMs are used for external modularization.
To decide on which to implement, consider whether you need the content to be used just for a limited program
or wheteher it can be called from many independent programs.
For the first purpose it is better to implement a form whereas for the second we implement an FM.
However, ABAP does not isolate the usage context.
That is; you can call a form from another program within whose code the form is not actually implemented.
However, this requires attention since the form may utilize global variables.
The same issue holds for FMs.
FMs are encapsulated in function groups and function groups may have global variables that can be globally
used by all FMs inside it.
Regards
Reshma
‎2007 Jul 12 10:37 AM
In contrast to normal subroutines function modules have uniquely defined interface. Declaring data as common parts is not possible for function modules. Function modules are stored in a central library.
Refer this link...
http://www.sapbrainsonline.com/FAQs/TECHNICAL/SAP_ABAP_MODULARIZATION_FAQ.html
Regards,
Pavan