Monday, January 5, 2009

Function Modules

Function Modules

Tcode: SE37
Function modules are ABAP routines that are administered in a central function library.
They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group.
A function group is nothing but a container for the function modules.

Create a Function Group

->Goto Object Navigator (SE80).
->From the Object Selection window select Function group, enter 'ZFG_TEST' as name of your function group, and choose Display.
->Since the function group 'ZFG_TEST' does not yet exist, the system asks you whether to create it. Confirm with Yes.
->Enter a short description and choose Save.
->In the window Create Object Catalog Entry choose Local object or save in your package.
->Activate it.Now you can create Function Modules within the Function Group.

Create Function Module

->Goto transaction SE37 and enter the name of the FM to be created 'ZFM_calc_1'
->Then it will ask for the name of the Function Group that was created before.
->In the 'Attributes' tab give a short description to FM and other details like normal FM,RFC etc.
->Click on the 'Import' tab and enter the Parameter name, Type and Reference type of variables.
->Click on 'Export' tab and enter the Parameter name, Type and reference type
->In the 'Changing' and 'Tables' tab enter the required paramters and tables
->Click on 'Exceptions' tab and enter the Exception and short text for that exception.
->In the 'Source code' tab enter the source code for the FM
->Check syntax and activate the FM.
->Also you can test and exexute the FM created
->Now you have created a global FM and can be called globally.

No comments:

Post a Comment