cancel
Showing results for 
Search instead for 
Did you mean: 

Function module

madan_ullasa
Contributor
0 Kudos

Hi frnds...

i have to pass say just 3 - 4 fields of a table from a function module. how do i declare it in the "tables" parameter.

eg. i have a itab with fields 'matnr', 'mbrsh','mtart' in the function module. how do i export it from the function module in the form of a table.

points assured for all answers...

regards,

Madan......

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Madan,

I hope this solves you to export the internal table with out declaring in dictionary.

Declare the itab in the TABLES tab of your FM with out any reference.

It means it is a text type internal table with one column.

Concatenate all the fields you want to export into

the table with some separator in the FM.

Now in the program after exporting the internal table from the FM, the table with the separator and map into your corresponding internal table of the program.

I hope it helps you.

regards,

Gopi.

madan_ullasa
Contributor
0 Kudos

hey gopinath,

plz elaborate a bit...

i assure u 10 points :):):)

madan...

alex_m
Active Contributor
0 Kudos

Hai! Madan.

The batter way is to declare a structure in dictionary then use it in your tables parameter. The second one suggested by gopinath its ok but u need more code while u r passing the records and while using also.

Alex

Former Member
0 Kudos

Hi Madan,

Please go thru the GUI_Upload FM, there he has done declaration in the internal table. You need to do in the same way.

Consider how u pass the internal table data for GUI_UPLOAD with unix file format. same way you consider here also.

I hope it clears you.

Regards,

Gopi.

Answers (2)

Answers (2)

Former Member
0 Kudos

1.are you asking how to define a FM with table parameter?

Ans.

you have declare a dictionary table zitab and activate it, which will have matnr etc fields.

now in your FM definition, in se37, go to table tab, and write

itab...like...zitab..-->save it

thats it.

2.are you asking how to pass table parameter to a sap defined FM..?

ans: declae an internal table:

data: begin of itab occurs 0,

matn like mara-matnr,

......................,

.................., 'more fields

end of itab.

now populate the itab, and send it to FM

as Call Function < name>

exporting

.....

importing

.....

tables

tab = itab.

you can click the pattern button on toolbar in se38 and insert the FM signature by writing FM name and selectig the radiobutton and pressing enter.

Former Member
0 Kudos

Madan,

You will have to create a structure and refer that structure in the input parameters.

In your code, declare an internal table of that structure, fill the internal table and pass that to the function.

Regards,

Ravi

Note : Please reward points if this helps.

madan_ullasa
Contributor
0 Kudos

Hi Ravi,

That i kno... but is there no other way other than creating a structure in the data base?

regrds,

Madan