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: 

How is a table parameter in function modules used ?

Former Member
0 Kudos
8,844

Dear all,

I am trying to use a table parameter for exporting multiple rows for output. I have done the logic in the code where at the end, I have my internal table with the results I want to show (after the import parameter is given). I have also created a table type and a table parameter. But, how can I relate my internal table to the table parameter I have created? How is this done, how do I tell the FM to get my internal table for the table parameter ?

Thanks in advance,

Shkelqim

8 REPLIES 8

sai_krishna24
Active Participant
0 Kudos
2,760

Hi,

If I understood correctly,

you have data in a internal table and you need to transfer that into the table interfacing parameter in Function module

1. why don't you directly use the same table interfacing parameter instead of local internal table.

2. if its a big task and if you don't have time

try like this

Consider , Interface table parameter - IT_INTER & Local internal table LT_ITAB

IT_INTER[]  = LT_ITAB[].

thanks

Sailkrishna

vladimir_erakovic
Contributor
0 Kudos
2,760

Hi Shkelqim,

I don't understand what is the problem? When you declare a table in Tables tab of function modul, you use it in code in FM and at the same time it is a table that FM exports.

Can you give some screenshots or explain better please?

Regards

Former Member
0 Kudos
2,760

Suppose...

ET_itab is your exporting parameter of type "Table type of  table1", is mentioned in the exporting tab of FM.

LT_itab is your local internal table of type ""Table type of  table1".

Now write this statement..

ET_ITAB = LT_ITAB.

*** If LT_itab and ET_ITAB are not exactly of same table type means table type is different for both, but they have some Same field, then 

Loop LT_Itab into LS_itab

move corresponding  ls_itab to ls_itab1.

append ls_itab1 to ET_itab.

endloop.

ls_itab.. Structure of Local table.

ls_itab1.. Structure of table used in Exporting para.

0 Kudos
2,760

Thanks for your reply Chandra.The problem is that I have a table parameter, but I am assigned to give a data type to it, which is the same one as a data element in another table. Now, I am not sure where to give the appropriate fields to that table parameter (the same ones as my internal table), how to give a structure to it?  The parameter table that I have now has a line type (char20), and that's it, no fields in it. 

0 Kudos
2,760

Try Creating a custom structure with your needed fields and assign to table interface parameter.

Thanks

Sai Krishna

0 Kudos
2,760

Sorry to say but i didn't understand your problem exactly.

I don't know i giving you correct solution or not still, You can create your custom structure with only required fields using SE11 and table type of same structure and you can use this table type in exporting parameter.

venkat_aileni
Contributor
0 Kudos
2,760

Hi-

At first to define Tables parameter in FM, go to tables tab and under Parameter Name provide the tables parameter name and associated structure should be a standard structure(You have to create this structure in SE11).

Now in your code define an Internal table which of type standard structure which you have created in se11 and used in FM.

DATA: it_result TYPE STANDARD TABLE OF <Your standard structure>.

From your se38 screen select Pattern push button which is available on your Application tool bar and give your FM name.

You FM template will be displayed with empty tables parameter where you have to pass your result internal table.

This is how we relate Internal table to tables parameter of a FM.

-Venkat

Former Member
0 Kudos
2,760

Hi,

table can be act as import as well as export parameter.
to assign type,
1. either you can use a database table name (use like)
2. create a global structure in se11 and then a table type with line parameter as above created structure. and use it as a type in table parameter in your FM