‎2008 Jun 23 7:16 AM
hi...
i want to know the detail notes about the function module
‎2008 Jun 23 7:20 AM
Hi...
Search in SDN as Function Module...U will get a lot of material....
Function module is a block of code that can be called from another program...It takes some values...and returns..required values or tables...
It increases modularisation and reusability in a program....
‎2008 Jun 23 7:20 AM
Hi Baskaran,
Below description gives you a detail idea of what a function module is!
Overview
--General purpose ABAP/4 routines that anyone can use.
--Large Number of standard function Modules.
--Organized into Function Groups: Collections of logically related functions.
--A Function Module is always associated with a Function Group.
--Transaction SE37.
--Called Using u201CCall Function u201D in ABAP/4 program.
Information Associated with Function Module
--Administration
--Import/Changing/Export parameters.
--Table Parameters/Exceptions.
--Documentation
--Source code u2013 L
*Contains the list of all the include files for that function group
Import parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. You cannot change them in the function module.
Export parameters. These pass data from the function module back to the calling program. Export parameters are always optional. You do not have to receive them in your program.
Changing parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. They can be changed in the function module. The changed values are then returned to the calling program.
To call a function module, use the CALL FUNCTION statement:
CALL FUNCTION
EXPORTING f1 = a 1.... f n = a n
IMPORTING f1 = a 1.... f n = a n
CHANGING f1 = a 1.... f n = a n
TABLES f1 = a 1.... f n = a n
EXCEPTIONS e1 = r 1.... e n = r n ERROR_MESSAGE = r E
OTHERS = ro.
When a Function Module is called from a Report the export parameters in the Report becomes the import Parameters in the Function Module and the import parameters in the report are the parameters that are exported by the the export parameters of the Function Module.
Calling subroutines
--Can be written at the end of function module in source code.
--Include program L is used for subroutines across function modules.
--Can call any number of external subroutines.
Raising Exceptions
--RAISE
Calling program handles the exception.
--SY-MSGID
--SY-MSGTY
--SY-MSGNO
--SY-MSGV1 to SY-MSGV4
If the system handles the exception
RAISE statement terminates the program and switches to debugging mode.
MESSAGE - RAISING displays a message and continues to according to message type.
Building New function Module
--Create a function Group (ZCAL).
--Create a function module, set the attributes and Save.
*Function group, Application, Short Text and Process Type
--Include file u201CLZCALU01u201D will have source code of first function module.
--Include file u201CLZCALTOPu201D will have global data.
--Main program u201CSAPLZCALu201D contains
Global data Include file u201CLZCALTOPu201D
Function modules include file u201CLZCALUXXu201D
*User defined Include files u201CLZCALF..u201D, u201CLZCALO..u201D and u201CLZCALI..u201D
--Define interface parameters and Exceptions
--Write the source code
--Activate Function Module
--Testing the Function Module
*Single Test & Debugging
--Documenting and Releasing a Function Module
Reward if useful.
Thankyou,
Regards.
‎2008 Jun 23 7:22 AM
‎2008 Jun 23 7:24 AM
hi
for creating Fm
http://www.saptechnical.com/Tutorials/ABAP/FunctionModule/page1.htm
Reward point if usefull
Cheers
Snehi
‎2008 Jun 23 7:25 AM
Hi,
Check this link out...
http://www.saptechnical.com/Tutorials/ABAP/FunctionModule/page1.htm
Regards,
Iyswarya
‎2008 Jun 23 7:26 AM
Hi!
Function Modules
Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.
Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.
The Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.
For details chk this link:
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm
Rewrd if useful.
‎2008 Jun 23 7:26 AM
Bhaskaran,
Kindly search on SDN by giving apropriate term in search box before throwing a thread.Am sure you will get hundred of answers for same.
please close this thread.
Amit.
‎2008 Jun 23 7:46 AM
\[removed by moderator as it was just a copy and paste answer of someone else's work without giving a source -- breaking our rules of engagement can lead to your account being banned\]
Edited by: Jan Stallkamp on Jun 23, 2008 11:02 AM
‎2008 Jun 23 10:05 AM
hi go to the tcode se37--> give the funtion module name->choose * function module documentation* on the menu tool bar...or check these links..
‎2008 Jun 23 10:20 AM