Application Development 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: 

creating a function module..

Former Member
0 Kudos
105

hi all,

i m new to function module. can any one tell me wat will be the associated type of the itab in the import of my function module. and my itab has fields from different table.

can any one send give me the link for creating a function module.

thnx

Message was edited by:

neha gupta

5 REPLIES 5

Former Member
0 Kudos
81

hi,

first of all create a strucutre in se11. this structure is similar to your internal table then declare the importing/exporting parameter with that structure type

thanks

Former Member
0 Kudos
81

Hi Neha,

Incase you want a function module interface table with fields from different DB tables, then create a structure in a type pool from SE11 and include the type pool in the main program (TOP include) of your function group.

Then you can use the structure as a TYPE decleration in your function module.

However if your function module is RFC enabled, then it is not possible to use type pool structures and you must create a structure in SE11 data dictionary level.

Regards,

Aditya

Former Member
0 Kudos
81

Hello,

Then U need to create a structure for the purpose in DDIC the associate this to the FM internal table.

Vasanth

Former Member
0 Kudos
81

Hi Neha,

Here's a link for creating a function module.

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

I hope it helps.

Best Regards,

Vibha

<b>*Please mark all the helpful answers</b>

Clemenss
Active Contributor
0 Kudos
81

Hi,

if you do not want to do the DDIC work and you remain inside your system (no RFC), you can use a reference variable of TYPE REF.

Calling program:


data:
  l_ref type ref to data.
  get reference of itab into l_ref.
call function 'ZXY'
  exporting 
    REF = l_ref
* ...
*
In the function:

field-symbols:
  <itab> type table.
assign REF->* to <itab>.
*...

For the sake of transparency, it is definitely better to create a structure and a table type with the stzructure as line type in data dictionary. But if you want flexibility, the passing of reference variables is a good method.

Regards,

Clemens