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

Internal table in function Module

Former Member
0 Likes
6,741

How can one pass internal table in Function table.

In my case importing & exporting an internal table. the table gets updated in the function module.

Problem is internal table is not defined like a DDIc structure. Infact its defined using various field from various tables. so when tried to put loop on internal table it says table is not defined as internal table.

In such case where to define internal table.

coding is

Import:

ITAB1

ITAB2

Export:

ETAB1

ETAB2

PLS HELP

11 REPLIES 11
Read only

Former Member
0 Likes
2,352

Hi Anupma,

You have 2 choices:

1. Pass the tables using the TABLES parameters (both import and export).

2. Declare in the Data Dictionary table types for the internal tables ITAB1 ITAB2 ETAB1 and ETAB2; then you can pass the internal tables to the FM with reference to the table type defined in the Data Dictionary.

Regards,

John.

Read only

Former Member
0 Likes
2,352

Instead of using that in import parametet, use that in tables.

Import/export parameter are only workareas and not tables.

Regds

gv

Read only

Former Member
0 Likes
2,352

hi, you can transfer this kind of table with ANY TABLE.

You can reference the example like FM 'REUSE_ALV_LIST_DISPLAY' table T_OUTTAB.

Without specify the type of the table, you can transfer it into FM.

And GET REF TO to get the reference of the table, assign to a Field-Symbol.

Then you can use some way to populate the internal table, E.G. ASSIGN Field-Symbol, or RTTI technology.

There are many resources you can reference in the SDN.

Sorry for haven't too much time for list the resources for you.

Hope it will be helpful

thanks a lot

Read only

Former Member
0 Likes
2,352

I am not sure whether i under stood your problem clearly but let me explain one thing.

In a FM if you want to pass any table to it or take values from a table from FM, it is declared under tab 'Tables'.

Here which ever tables you declare say.

vartab type dbstr.

it is same as define in editor as

Data vartab type dbstr occurs 0 with header line.

i hope it help you

regards

Read only

Former Member
0 Likes
2,352

Hi,

I thing the problem with work area / Header line.

you do like

1. first define the structure ( now you defined as internal table

Data : begin of ISTRuc,

matnr like mara-matnr,

eindt like mara-eindt,

end of Istruc.

DATA : Itab type Istruc occurs 0 with header line.

else

you keep the same internal table and define one more work area process the data with help of work area

data : wa_a like itab.

loop at itab into wa_a.

endloop.

Cheers,

Sasi

Read only

Former Member
0 Likes
2,352

Hi,

Typically 'IMPORT' and 'EXPORT' parameters of a function module are not tables, even though there are exceptions.

How are ITAB1 ITAB2 ETAB1 ETAB2 defined in your funtion module interface?

If they don't have any type reference, then how is the function module recognizing the structure and modifying it(you said 'the table gets updated in the function module.')?

When you are passing your internal table to the function module, all you are passing is the header of the internal table. Once you get your ETAB1 and ETAB2 you need to modify your internal table accordingly.

But if the function module code is what you want change, then put the ITAB1, ITAB2, ETAB1, ETAB2 in the tables parameters.

Look at GUI_UPLOAD or GUI_DOWNLOAD function modules, they use a table without structure.

Please give us more information.

Srinivas

Read only

0 Likes
2,352

Is this resolved? If so, please reward and close.

Read only

0 Likes
2,352

<b>It is discouraging to see that the posts are not being closed. Please close the post if answered, and if not please let the forum know. It doesn't have to be left open like this.</b>

Thanks for your attention,

Srinivas

Read only

0 Likes
2,352

How to close the post if we satisfy with reply.

Read only

0 Likes
2,352

on to the left of the post (reply to your question) you will see three radio buttons. choose the one based on the answer. choosing solved will mark the thread as answered.

Regards

Raja

Read only

Former Member
0 Likes
2,352

I have faced a similar situation in one of my earlier programs. In this case, I have used ABAP Memory option.

That is, first I have exported the internal table ITAB to memory

using EXPORT ITAB from ITAB to MEMORY ID 'ZITAB'.

& later on inside the Function Module, I have retrievied the ITAB contents by importing it. ( IMPORT ITAB to ITAB FROM MEMORY ID 'ZITAB'. )

I am sure this will solve your problem.

Thanks

Atul