Skip to Content
author's profile photo Former Member
Former Member

table with type ANY in function module

Hi all

I want to use a function module in different programs. I want to pass always a table and in a string the name of the structure, so that I can access the data with ASSIGN and the passed structure name.

For a structure I can use the type ANY, but if I want to use a table in a function module, I need to define a table type.

Is there a way to define a tabletype with the type ANY? A Workaround would be fine too.

Thanks and best regards!

Christian

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2008 at 03:42 AM

    Hi Christian,

    ANY TABLE is used to type a parameter, or field symbol, that can be a table of any type or structure.

    ANY is used to type a parameter, or field symbol, that can be any type. You can't, however, use any table operations on a parameter/field-symbol typed as ANY. For that, you have to use ANY TABLE.

    The same applies to ANY. You can pass to the method a data object, without specifying its type (i.e, in dynamic programs).

    Suppose that I need to split a line into a table, but I don't know the structure of this line:

    I have a method:

    codeMETHOD split_line_in_table IMPORTING im_line TYPE ANY

    EXPORTING ex_table TYPE ANY TABLE.

    [/code]

    codeMETHOD split_line_in_table.

    SPLIT im_line AT separator INTO TABLE ex_table.

    ENDMETHOD.[/code]

    Now, i can pass this method a line of ANY structure and get a table without specifying its structure.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.