‎2007 May 24 6:04 AM
Hi all,
What exactly the Diff between <b>FM</b> and <b>Methods</b> and <b>Subroutines</b>?
What is the <b>use of OOP</b>,If u say <b>performance</b> and <b>re-usability</b>...same thing we can approch by using <b>Fm</b> and <b>Subroutines</b> in <b>normal ABAP</b>.
Please clarify this..
<b>Kishi.</b>
‎2007 May 24 6:09 AM
hi,
<b><u>FM and Methods and Subroutines</u></b>
Well, 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.
<b><u>
use of OOP,If u say performance and re-usability</u></b>
OOPS is more flexible. They are build upon 6 pillers which improves its performance aand re-usabilty.
Chk this link.
http://www.springerlink.com/index/h3u8105483400743.pdf
Rgds
Anversha
‎2007 May 24 6:09 AM
hi,
<b><u>FM and Methods and Subroutines</u></b>
Well, 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.
<b><u>
use of OOP,If u say performance and re-usability</u></b>
OOPS is more flexible. They are build upon 6 pillers which improves its performance aand re-usabilty.
Chk this link.
http://www.springerlink.com/index/h3u8105483400743.pdf
Rgds
Anversha
‎2007 May 24 6:43 AM
HI,
<b>What is the difference between the function module and a normal ABAP/4 subroutine?</b>In contrast to normal subroutines function modules have uniquely defined interface.
Sub routines do not return values.
Sub routines do not return exceptions.
Sub routines cannot be tested independently.
Declaring data as common parts is not possible for function modules. Function modules are stored in a central library.
Apart from those:
Subroutines :
1. You must have the same number of actual parameters as formal parameters , parameters are assigned in the sequence in which they are listed.
2. When you call a subroutine using PERFORM, the system checks whether the types of the actual parameters in the PERFORM statement are compatible with the formal parameters.
3. The interface is defined in the FORM routine. USING and CHANGING in the PERFORM statement are purely documentary.
4. Internal tables are passed without their work area. You therefore need to declare one using a local DATA statement. Internal Tables must be passed by TYPE.
Function Modules :
1.Function modules are external subroutines with a transparent interface, optional parameters are allowed.
2.Are central Repository objects, and are accessible system-wide. They are present as a set of function in a function module.
3. Are developed and tested using the Function Builder
4. Can be coded to RAISE exceptions
<b>Regards,
jackie..</b>