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

pass value from program to function module

Former Member
0 Likes
3,106

hi,

i want to call program from Function Module. then i want to pass some value from program to that Function module.how do i transfer value from program to FUNCTION MODULE.

reply ASAP.

regards,

supriya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

hey call that function module in program and pass values to that by specifieng the parameters existing in that function module . when you call thee FM autometically it ask for some parameters values h=just pass values to that parameters ok.

5 REPLIES 5
Read only

Former Member
0 Likes
1,471

Hi,

You can pass values to the function module through the IMPORTING or TABLE parameter of the function module.

E.g. if you want to pass a material number to the function module, you create a IMPORTING parameter in the function module as e.g.

I_MATNR TYPE MATNR_D

Then when calling the function module through patten (Crtl + F6) function, you shall get the following

CALL FUNCTION 'ZFM'

EXPORTING

I_MATNR = v_matnr.

As shown above, you pass the variable v_matnr from program to function module.

Cheers,

Aditya

Edited by: Aditya Laud on Feb 21, 2008 1:06 AM

Read only

Former Member
0 Likes
1,472

hey call that function module in program and pass values to that by specifieng the parameters existing in that function module . when you call thee FM autometically it ask for some parameters values h=just pass values to that parameters ok.

Read only

Former Member
0 Likes
1,471

You can try using:

EXPORT var = var TO MEMORY ID 'MID'. " In Program
IMPORT var = var FROM MEMORY ID 'MID'. " In Function Module
Note that your definition of VAR should be same in both Program and Function Module.

Read only

Former Member
0 Likes
1,471

Hi Friend,

For passing hard-coded values pass them into a variable of the appropriate type and pass the variable to the function module by assigning the variable to the appropriate parameter.

Also,Internal Tables are passed to FMs ,so populate the IT prior to passing it to the FM.

If you need more share it with me.

Regards,

Lakshmanan

Read only

Former Member
0 Likes
1,471

Do like this

gv_field = ur value.

CALL function_module

exporting

field = gv_field.

try like this

dont pass value directly to FM. pass the variable .

Regards,

Ajay