Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module

Former Member
0 Likes
544

Hi all ,

I have a very basic doubt in FM .

We can pass data to a function module in EXPORTING , CHANGING , TABLES ,

IMPORTING .

Can we pass tables in EXPORTING OR CHANGING PARAMETER ???

IF yes then what is the use of tables parameter ???

If anybody can send me a comprehensive PDF document on FM , it will be of great use .

Thanks in advance

Regards

Saurabh Garg

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
521

hi

Export Parameters are the parameters that are being sent out. However, changing is more like pass by ref, the variable comes in you change the value and send it back.

Both are same when you pass by refernce.

but when you pass the parameter as value then any change in the EXPORT parameter will not be reflected in the calling program

this url will help u a lot

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm</a>

regards

navjot

reward points accordingly

4 REPLIES 4
Read only

Former Member
0 Likes
521

Hi Saurabh,

First, go to SE80, select from the listbox, "Function Group", enter the name of your function group, Hit enter. SYstem will ask if you want to create it, say yes. Once the function group is created, then righ-click on the node in the tree structure and select create->function module. Name it and give description.

Add your IMPORT and EXPORT parameters in the appropriate tab, add the source code in the appropriate tab. SAve and activate.

http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

Regards,

Priyanka.

Read only

Former Member
0 Likes
521

Hello saurabh,

check the link :

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

We can pass data in EXPORTING OR CHANGING PARAMETER.But if the data is an internal table then a table type is needed.

Tables i guess is obsolete now.

Read only

Former Member
0 Likes
522

hi

Export Parameters are the parameters that are being sent out. However, changing is more like pass by ref, the variable comes in you change the value and send it back.

Both are same when you pass by refernce.

but when you pass the parameter as value then any change in the EXPORT parameter will not be reflected in the calling program

this url will help u a lot

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm</a>

regards

navjot

reward points accordingly

Read only

Former Member
0 Likes
521

Hi,

· IMPORTparameters. 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.

· EXPORTparameters. 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.

· 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.

The interface parameters can be typed. You can do so 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.

Exceptions are used to handle errors that occur in function modules. The calling program checks whether any errors have occurred and then takes action accordingly.

Also chk the link:

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

regards,

keerthi