2007 Jan 27 12:11 PM
hi friends..
i want to know ,
what is the purpose of import, export,changing, tables parameters ?
how we handle exception in functional module?
explain with some eg?
2007 Jan 28 6:20 AM
Hi,
Below are the meanings of the interface parameters:
import-for importing the values to the FM.
export-for exporting the values from FM.
changing-for importing and exporting back.
tables-for transferring internal tables.Rarely used in normal FM.
exception-for handling exceptions.
Cheers,
Hakim
2007 Jan 27 12:16 PM
hi,
You can specify the types of interface parameters in function modules in the same way as the parameter interfaces of subroutines.
<u><b> Import parameters:</b></u> 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.
<u><b> Export parameters:</b></u> 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.
<u><b>Changing parameters:</b></u> 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.
<u><b>Tables parameters:</b></u> You use these to pass internal tables. They are treated like CHANGING
parameters. However, you can also pass internal tables with other parameters if you specify the parameter type appropriately.
You can specify the types of the interface parameters, either by referring to ABAP
Dictionary types or elementary ABAP types. When you call a function module, you must
ensure that the actual parameter and the interface parameters are compatible.
Interface parameters are, by default, passed by value. However, they can also be
passed by reference. Tables parameters can only be passed by reference. You can
assign default values to optional importing and changing parameters. If an optional
parameter is not passed in a function module call, it either has an initial value, or is set to
the default value.
<u><b>Exceptions</b></u> are used to handle errors that occur in function modules. The calling
program checks whether any errors have occurred and then takes action accordingly.
Have a look at below links.
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801f02454211d189710000e8322d00/frameset.htm
I hope it helps.
Regards
Anver
2007 Jan 27 12:22 PM
Hi
The fm is like a box and a program can't see inside this box, so it can only communicate with the it through the interface of fm.
The interface is constituted by the IMPORT, EXPORT, CHANGING, TABLE parameters and EXCEPTION.
- IMPORT parameters are the parameter to transfer the data from program to funcion module: they can't be changed by the fm;
- EXPORT parameter are the parameter to transfer the data from function module to program: they can be changed by fm;
- CHANGING is a parameter is like IMPORT and EXPORT parameter at the same moment;
- TABLE is to transfer the data of an internal table from and to fm
Max
2007 Jan 28 6:20 AM
Hi,
Below are the meanings of the interface parameters:
import-for importing the values to the FM.
export-for exporting the values from FM.
changing-for importing and exporting back.
tables-for transferring internal tables.Rarely used in normal FM.
exception-for handling exceptions.
Cheers,
Hakim
2007 Jan 29 6:27 PM
Hi Selva,
1) Documentation
The documentation describes the purpose of the function module, lists the parameters
for passing data to and from the module, and the exceptions. It tells you how you can
pass data to and from the function module, and which errors it handles.
2) Interface parameters and exceptions
This section provides further information about the interface parameters and exceptions,
and how to use the function module. For further information, refer to Displaying
Information about Interface Parameters [Ext.] in the ABAP Workbench documentation.
Function modules can have the following interface parameters:
3) 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.
4) 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.
5) 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.
6) Tables parameters. You use these to pass internal tables. They are treated like CHANGING
parameters. However, you can also pass internal tables with other parameters if you specify
the parameter type appropriately.
You can use the EXCEPTIONS option to handle the exceptions of the function module. If an
exception <ei> is raised while the function module is running, the system terminates the function
module and does not pass any values from the function module to the program, except those that
were passed by reference. If <ei> is specified in the EXCEPTION option, the calling program
handles the exception by assigning <ri> to SY-SUBRC. <ri> must be a numeric literal.
If you specify of ERROR_MESSAGE in the exception list you can influence the message
handling of function modules. Normally, you should only call messages in function modules using
the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system to
treat messages that are called without the RAISING option in a function module as follows:
Messages of classes S, I, and W are ignored (but written to the log in a background job).
Messages of classes E and A stop the function module as if the exception
ERROR_MESSAGE had occurred (SY-SUBRC is set to <rE>).
If you specify OTHERS after EXCEPTIONS, the system assigns a single return code to all other
exceptions that you have not specified explicitly in the list.
You can use the same number <ri> for several exceptions.
Regards
Sreeni