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: 

Read internal table in memory

Former Member
0 Kudos

Hello!! Is there a way to read an internal table that's not available in a program, but it's in the memory?... let's say i have a program with an internal table ITAB, in the program i call a function module where i need information from that internal table, but been the program standard i can't send the ITAB to the function module... is there a way to access that ITAB from the function module? i don't know if i can do it with field symbols or something like it...

6 REPLIES 6

nablan_umar
Active Contributor
0 Kudos

No, you can't access the internal table of a function module. Try looking, maybe there could be another function module within the function group that exported the internal table.

Former Member
0 Kudos

Could you help clarify?

You want to access an ITAB from a FM without passing the ITAB as a parameter? Doesn't this imply that you can change the FM? If you can change it, then you can add the ITAB as a parameter and mark it as optional if this is an issue with existing users of the FM.

If there is some reason why you do not want to change the interface of the FM, you could EXPORT the ITAB from your program and IMPORT the table in the FM. Do help on EXPORT and see the EXPORT TO MEMORY option. This will export your ITAB to the ABAP Memory which is available across a program and the FMs that it calls.

Does this help or have I misunderstood your problem?

0 Kudos

I agree entirely with what Charles Folwell has written but if there is a reason you can not do any of the suggestions he has made then there is a technique that may work using field symbols. This allows you to get data which is not directly available but is stored somewhere within the memory stack, i.e. available in the calling program. The code to do this is as follows:

  • create field symbol

FIELD-SYMBOLS: <f>.

  • Assign value of variable from calling prog to field symbol

ASSIGN ('(SAPMM06E)RM06E-BSART') TO <f>.

SAPMM06E being the program where the field exists and RM06E-BSART being the actual field name. <F> will now contain its value.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes you can read "out of context memory" in ABAP, although it is an unofficial feature - I believe. You construct a field symbol, but include the variable's owning program name.


data: plnum_field(120) type c.
field-symbols: <fs_plnum> type any.
move '(SAPLBARM)RM61B-PLNUM' to plnum_field.
assign (plnum_field) to <fs_plnum>.

Former Member
0 Kudos

Hi Jesus,

well... there is indeed another way to do so. You could try an "export itab to memory" to save the itab, and then "import itab from memory" to read it back.

Hope it helps. BR,

Alvaro

Former Member
0 Kudos

Dear Jesus,

There is no way, in my knowledge to do so, as you are accessing standard function module. But you can do one thing, copy that standard function module and give it your name and add one parameter for that table in that and pass your table.

Try it, if possible.

Sandip