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

Accessing internal table of main program inside function module...

I have function module say ZFUNC and main program say ZMAIN and internal table defined as IT_TAB inside ZMAIN but not passed as parameter to Function module ZFUNC.

If I want to access the field value of IT_TAB of main program ZMAIN inside ZFUNC during debugging then, I simply put <b>(ZMAIN)IT_TAB-amount</b> in ABAP debugger and then change it when the debugger is inside ZFUNC.

How can I write code to change the value of internal table of main program in function module ZFUNC instead of doing in debugger ? I guess I have to use some field symbols, but not sure. Please suggest.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Sep 19, 2007 at 08:01 PM

    Yes, you do need to use a field symbol. Say for example, you had a internal table called IMARC in your program and you want to access it later in a funciton module, you would do something like this.

      data: xmarc type marc.
      field-symbols: <imarc> type marc_upl_tt.
    * Assign an internal table
      field = '(ZPROGRAM_NAME)IMARC[]'.
      assign (field) to <imarc>.
      loop at <imarc> into xmarc.
        write: / xmarc-matnr, xmarc-werks.


    Rich Heilman

    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.