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
1,009

hi Experts,

Pls answer my questiion.

" While calling function module , the import parameters become export parameters in a calling program , why this is so"

pls send me detail explanation.

Thanks...

6 REPLIES 6
Read only

former_member150733
Contributor
0 Likes
748

When you take a Func. Module in SE37, there will be import and export parameters.

This means 'Import' to the Func. Module &

'Export' from the func. Module.

When you call the same Func. Module from Program, it is the other way.

You are 'Exporting' somedata to the called function module which is defined as 'Importing' inthe Func. Module & vice versa.

Read only

Former Member
0 Likes
748

Hi,

Let suppose -- you wrote a program and calling a function module for summing two variable and result in third variable

say you need to do C = A + B.

Now from your program you need to send A and B values to Function module

I.E you are exporting these A and B from program to FM..

so A and B becomes Exporting parameters in your program..

The FM get the Values of A amd B, i.e Fm is importing the values of A and B from the program to itself..and A and B becomes the importing values in FM.

Where as C you are passing a blank values from the program and calculationg c = A + B in FM so C is changing its values and thus C can be changing parameter..

Hope you understood

rewards if useful,,

rergards,

nazeer

Read only

Former Member
0 Likes
748

Hi,

refer sap help

http://help.sap.com/saphelp_nw04/helpdata/en/d1/801f50454211d189710000e8322d00/frameset.htm

Name

Explanation

Import

Values transferred from the calling program to the function module. You cannot overwrite the contents of import parameters at runtime.

Export

Values transferred from the function module back to the calling program.

Changing

Values that act as import and export parameters simultaneously. The original value of a changing parameter is transferred from the calling program to the function module. The function module can alter the initial value and send it back to the calling program.

Tables

Internal tables that can be imported and exported. The internal table's contents are transferred from the calling program to the function module. The function module can alter the contents of the internal table and then send it back to the calling program. Tables are always passed by reference.

Exceptions

Error situations that can occur within the function module.

The calling program uses exceptions to find out if an error has occurred in the function module. It can then react accordingly.

<b>Reward points</b>

Regards

Read only

Former Member
0 Likes
748

this is correct only just think in respective of the program as well as as respective of the fn module. Suppose you are exporting some value through fn module from abap editor by call fn. in respect of abap editor you are passing the value from abap editor. Now think in respect of the fn module it will take the value from your prog and do the processing as per the source code of the fm so it must be the import parameter for function module(se37).

regards

shiba dutta

Read only

Former Member
0 Likes
748

Hi,

A function module is required in order to give some output depending upon some data which is supplied to it.

In other words,the parameters it requires to work and give some output are called IMPORTING parameters for the Function Module alone.

The output parameters which the FM gives are called EXPORTING parameters for the FM alone.

Now if you call the FM in any program of yours,then you have to think from the program point of view.

In this case the program is expecting some output from the FM.The output values from the FM are nothing but teh FM EXPORTING parameters,but if you look from the program point of view,the program is trying to import the EXPORTING parameters from FM,hence from program point of view the EXPORTING parameters become the IMPORTING parameters.

The same can be said for the IMPORTING parameters of the FM,where the program EXPORTS values to the FM to work on.Hence the diference.

Hope it the explanation will be useful to you.

Thanks,

Sandeep.

Read only

Former Member
0 Likes
748

hi,

In FM's we have import and export parameters

import - which accepts input to FM's

export - which passes result as o/p to calling area.

when we consider in view of reports

import - which accepts input . but here we are calling FM

export- generally passing data i/p.

but our input[EXPORT] parameters becomes input [IMPORT] to Fm because we are passing input to FM means pasing data outside outside which is EXPORTING.

and similarly in reports weaccept data from FM [EXPORT] parameters as a resultant o/p [IMPORT] to our reports.

if helpful reward some [points.

with regards,

suresh.