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: 

FM Table TYPE ANY

sinan_keklik
Associate
Associate
0 Kudos
3,099

Hi,

is it possible to give an FM a table with the type ANY? The table type is dynamic.

Regards,

Sinan

13 REPLIES 13

Former Member
0 Kudos
826

HI,

sorry you cannot define type any

for typeing a table only table types should be used

reward if helpful

vivekanand

varma_narayana
Active Contributor
0 Kudos
826

Hi..

Yes we can do this.

In this case the Internal table will become Generic.

reward if Helpful.

0 Kudos
826

Hi,

how can I do that? Can you give me an Example?

I have something like that:

CALL FUNCTION 'FM'

IMPORTING

ls_table = ls_return

TABLES

lt_table = lt_tableset.

How can I define with SE37 the table parameter:

LT_TABLE TYPE ANY

and the structure parameter:

LS_TABLE LIKE ANY

meikandan_krishnan2
Participant
0 Kudos
826

Hi ,

It is possible to declare a table with generic type.ie as type any..

This can acccesed using a field symbol.

Regards

Meikandan

Former Member
0 Kudos
826

Yes sure...

You can define in the import & export parameter associate type....as any.

Like below:

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(ITAB) TYPE ANY

*" EXPORTING

*" REFERENCE(JTAB) TYPE ANY

*"----


0 Kudos
826

I get the following Error Message when I try to activate the FM:

For typing of TABLES parameters, only table types should be used. -

How can I make the tables parameter to be a reference?

""Local Interface:

*" IMPORTING

*" REFERENCE(LS_TABLE) TYPE ANY

*" TABLES

*" LT_TABLE TYPE ANY

Release: 4.6 c

0 Kudos
826

TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as internal standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to such a formal parameter, an empty header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. In the case of formal parameters defined with TABLES, no value transmission is possible.

Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created in the function module for the internal table using the addition LIKE LINE OF itab of the DATA statement in the function module.

So you cant use the Tables type any option.....

Message was edited by:

Muthurajan Ramkumar

0 Kudos
826

Hi,

now I get the Error Message that the changing Parameter is not a intern table.

*"----


""Lokale Schnittstelle:

*" EXPORTING

*" REFERENCE(LS_TABLE) TYPE ANY

*" CHANGING

*" REFERENCE(LT_TABLE) TYPE ANY

*"----


FIELD-SYMBOLS:

<fs_tab> LIKE LINE OF lt_table.

0 Kudos
826

May i know , why you want to assing lt_table as a fieldsymbol...

You can directly pass a workarea(structure) to the lt_table and do the operation...

I think, the like line of statement and the field symbol declaration is not needed...

Could you please brief your requirement....?

0 Kudos
826

The FM get a table with various Fields and give back a structure from that table. How can I define this table and structure in the FM without saving the type in DDIC?

0 Kudos
826

Hi Sinan Keklik ,

I was just browsing thru your post , I have the similar requirement can you please share how you solved the problem.

Regards,

Rachit

Subhankar
Active Contributor
0 Kudos
826

Hi.

This is pretty simple.

In the changing parameter you can defile one field type standard table . It will take all types of internal table.

Thanks

Subhankar

0 Kudos
826

Hi Subhankar,

Could you please give me some example.

Basically I don't know the structure of the result table , that's why i am seeing this option.

Regards,

Rachit Khanna