Function Module
Function Module
Function Module
Functional modules are reusable components that are defined in functional library.
Each function module must be attached to one function group. Each contains two include programs by default.
One is for global declaration another one is for common subroutines. All the function modules can access the both the
include programs.
When ever we are calling any one of the function module then all other function modules will be loaded into the
memory of calling program. So it’s better to group related function module into one function group.
Execute SE37.
In the menu bar click on GO TO-->Function groups-->Create group(zsprao_fg).
Provide the function group name & short description.
Save. Click on local object.
1. Attributes
2. Import
3. Export
4. Changing
5. Tables
6. Exceptions
7. Source code
Attributes: -
Attributes specify the type of function module whether it’s a normal or remote enable. If the function module type
is normal then we can access the function module within the server only.
If the function module type is remote enable then we can access the function module within the server as well as
outside the server also.
Import: -
Import acts like input parameters [using in the server].
Export: -
Export acts like output parameters [changing in the server].
Changing: -
Changing acts like both import & export.
Tables: -
Tables acts like both import & export only for internal tables.
Exceptions: -
These are used to handle the errors in function module.
Source code: -
It contains the logic related function module.
Execute SE37.
Provide the function module name(zsprao_fm1).
Click on create.
Provide the function group name. Provide the short text. Click on save. Enter.
Click on import.
Provide parameter name, type, associated type.
I_EBELN type EKKO-EBELN
Click on export.
Provide parameter name, type, associated type.
E_WA TYPE EKKO
Click on source code.
Write source code.
Select single * from EKKO into E_WA where EBELN = I_EBELN.
Endfunction.
Save, check, activate the function module.