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

Multiple values to SAP memory

Former Member
0 Likes
3,741

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

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,882

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.

8 REPLIES 8
Read only

former_member209120
Active Contributor
0 Likes
1,883

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.

Read only

0 Likes
1,882

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

Read only

0 Likes
1,882

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...

Read only

Former Member
0 Likes
1,882

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 .

Read only

Former Member
0 Likes
1,882

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

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,882

How do you want to use that data from the memory?

Read only

0 Likes
1,882

Plus the datatype from your sap table shall match with data type of SAP_BSEG table of other database

Read only

Former Member
0 Likes
1,882

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.