Application Development and Automation 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 only

Reading from memory.

Former Member
0 Kudos
806

Hello ABAP gurus,

I want to read a variable from memory and in my first function module I have this


i_val TYPE /bic/szsfppd96-/bic/zsfppd96.
EXPORT i_val to MEMORY ID 'PrjID'.

In my second function module I have this to read it out


i_val1 TYPE /bic/szsfppd96-/bic/zsfppd96.
IMPORT i_val1 FROM MEMORY ID 'PrjID'

And when I go into debugging mode and read

i_val1

I get an empty value. Any idea?

Edited by: SCHT on Aug 16, 2010 8:43 PM

3 REPLIES 3
Read only

alejiandro_sensejl
Active Participant
0 Kudos
691

Hello SCHT,

the syntax you've used is obsolete. It would only work if both variables have the same name (either i_val or i_val1).

I would recommend to use the following syntax instead:

EXPORT value1 FROM i_val

  TO MEMORY ID 'PrjID'.
IMPORT value1 TO i_val1
  FROM MEMORY ID 'PrjID'.

'value1' is a freely chosen name of the area used to store your variable in memory id 'PrjID'. This syntax allows unbundling the value from the name of the variable used to store it in the memory.

Read only

0 Kudos
691

Thanks for the helpful answer... does it work if i have 2 web session? e.g. the 1st web session is where i do the export statement and 2nd web session is where the import happens.

Read only

0 Kudos
691

No, the "EXPORT/IMPORT xxx TO/FROM MEMORY" statements are using the [ABAP Memory|http://help.sap.com/abapdocu_70/en/ABENABAP_MEMORY_GLOSRY.htm] that is not shared between sessions.

If you want to share it between sessions, you should have a look at the follwing concepts.

- GET/SET-Parameter

- EXPORT/IMPORT xxx TO/FROM SHARED BUFFER / EXPORT/IMPORT xxx TO/FROM SHARED MEMORY/ EXPORT/IMPORT xxx TO/FROM DATABASE

- [Persistence Service|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f5/a36828bc6911d4b2e80050dadfb92b/frameset.htm]

- [Shared Objects|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/14/dafc3e9d3b6927e10000000a114084/frameset.htm]

The list is sorted from the easiest implementation (which I would recommend only to use for storing a minor amount of data) to the more powerful statements.

Regards,

Alej