2013 Nov 20 6:24 AM
Hi Gurus,
I have a requirement where I need multiple values of a field in SAP memory or something similar to that so that it should hold user specific values.
Say material number like below :
10000
10001
10002
10003
10005
Now I want all of these values to be stored in SAP memory. Is it possible?
If not then can we have something that hold values like this but it should be user specific, as multiple user can set different values.
Regards,
Supratik
2013 Nov 20 6:32 AM
Hi Supratik Panja
Pass to internal table and and get like this
data: it001 type table of t001 with header line.
select * into table it001 from t001.
export it001 = it001 to memory id 'ZTEST'.
clear it001. refresh it001.
import it001 = it001 from memory id 'ZTEST'.
loop at it001.
write:/ it001-bukrs, it001-butxt.
endloop.
2013 Nov 20 6:32 AM
Hi Supratik Panja
Pass to internal table and and get like this
data: it001 type table of t001 with header line.
select * into table it001 from t001.
export it001 = it001 to memory id 'ZTEST'.
clear it001. refresh it001.
import it001 = it001 from memory id 'ZTEST'.
loop at it001.
write:/ it001-bukrs, it001-butxt.
endloop.
2013 Nov 20 6:36 AM
Hi Ramesh,
Will it be user specific. say if user1 has 4 values in that table can user2 can have 10 values in that table.
Thanks,
Supratik
2013 Nov 20 6:47 AM
Hi Supratik Panja
Then create on filed for internal table and stores values with sy-uname.
and fetch values based on username.
you can try like this also
data: it001 type table of t001 with header line.
select * into table it001 from t001 up to 10 rows.
if sy-uname = 'SAPUSER'.
export it001 = it001 to memory id 'ZTEST_1'.
elseif sy-uname = 'MYUSER'.
export it001 = it001 to memory id 'ZTEST_2'.
endif.
clear it001. refresh it001.
if sy-uname = 'SAPUSER'.
import it001 = it001 from memory id 'ZTEST'.
elseif sy-uname = 'MYUSER'.
import it001 = it001 from memory id 'ZTEST_2'.
endif.
loop at it001.
write:/ it001-bukrs, it001-butxt.
endloop.
if i am wrong correct me...
2013 Nov 20 6:37 AM
HI panja,
The SAP Memory is a user-specific memory area of the application server, which is accessed by all main sessions of a user session at once. ABAP programs have access to SPA/GPA parameters stored in the SAP Memory (also called SET/GET parameters).
SET PARAMETER ID pid FIELD dobj. .
and to retrive ..
GET PARAMETER ID pid FIELD dobj.
Regards,
Krishna .
2013 Nov 20 6:43 AM
Hi,
its possible to export or import multiple values.
Maintain all user specific values in internal table and use import/export
export internal table like below.
EXPORT IT_vbeln[] TO MEMORY ID 'IT_VBELN'.
and Import the above internal table like below
IMPORT IT_vbeln[] FROM MEMORY ID 'IT_VBELN'.
Thanks,
Sree
2013 Nov 20 6:51 AM
2013 Nov 20 6:59 AM
Plus the datatype from your sap table shall match with data type of SAP_BSEG table of other database
2013 Nov 20 7:09 AM
supratik ,
the only way to use specifice memory area for specific user is that you have to maintain a ztable with user id and memory id and then use it in your programe through select query using sy-uname then you can select the specifice memory area and sending the data to accordingly to specific user area.
e,g
program 1.
data: v_memr type c LENGTH 10 value 'ZTEST'.
DATA: B TYPE I VALUE 10.
EXPORT B = B TO MEMORY ID V_MEMR.
CALL TRANSACTION 'ZTEST3'.
Program 2 have a tcode ZTEST3.
PROGRAM zhtest.
DATA: B TYPE I.
DATA: V_MEMR TYPE C LENGTH 10 VALUE 'ZTEST'.
data: username type sy-uname value '107221'. "your session user name
if username = sy-uname.
IMPORT B = B FROM MEMORY ID V_MEMR.
WRITE: B.
else.
WRITE: 'no data found'.
endif.