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

Passing Internal Table to a function

Hi ,

Can we pass an internal table along with its header to a function.



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 06:48 AM

    Hi Arun,

    Of course you can pass an internal table to a Function Module. When you define the Function Module in SE37, define a TABLES parameter with the same structure as the internal table ( which should again be a dictionary structure).

    In the program, when you call this function module, pass the internal table to the tables parameter you have defined for the function module.

    Please note that:

    1. Tables parameters are always passed by reference. so, you need to be very careful in their usage. Also, use as few tables parameters as necessary.

    2. Whenever you pass a tables parameter, the system will automatically create a header line for the tables parameter which can be used in the Function Module logic.

    3. However, the table header will not get passed automatically along with the table body (from the calling program). You have to pass it explicitly. For that, you need to define an exporting parameter of the line type of the table.

    In my experience, it has never been necesasary to pass the table header to the function module. In general, the contents of the table header would be present as one of the lines in the internal table, right?

    Hope this information helps.


    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      just to correct point 3 of the above answer.

      TABLES are used to declare so called table parameters. Table parameters are obsolete formal parameters that are typed as internal standard tables with header lines.

      If an internal table without header line or a table body is transferred as an actual parameter to such a formal parameter, then an empty local header line is generated in the procedure. If an internal table with header line is used as the actual parameter, then <b>both the table body and the header line</b> are passed to the procedure. For formal parameters defined with TABLES, no pass by value is possible.



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.