01-20-2005 10:06 PM
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...
01-20-2005 10:11 PM
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.
01-20-2005 10:28 PM
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?
01-20-2005 11:25 PM
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.
01-21-2005 8:11 AM
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>.
01-21-2005 8:32 AM
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
01-24-2005 9:58 AM
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