‎2006 Sep 07 9:05 PM
Hi Experts,
This is problem about ABAP memory.
I have two programs. Program-A & Program-B
Program-A sets value to variable and EXPORT command is used to set this variable in memory.
EXPORT variable TO DATABASE indx(st) ID 'KEYVALUE'.
Program-B gets variable using IMPORT command from memory.
IMPORT variable FROM DATABASE indx(st) ID 'KEYVALUE'.
User runs Program-A in SE38. Program-A calls Program-B using a button click event (SUBMIT).
The scenario is..
User1 executes the Program-A,
which set the variable = User1 in memory.
User2 executes the Program-A,
which set the variable = User2 in memory.
User2 clicks button to call Program-B,
which imports variable = User2 from memory.
User1 clicks button to call Program-B,
which imports variable = User2 from memory.
(But User1 expects the variable = User1).
So User1 gets wrong variable value set by another User.
How to handle this situation?. How to set memory variables user specific? I will appriciate all helpful answers.
Thanks in advance
Hari.
‎2006 Sep 07 9:12 PM
The problem can easily be resolved by qualifying the key....in Program A
lKey = Sy-uname.
EXPORT variable TO DATABASE indx(st) ID lKEY.
And in Program B.
lkey = Sy-Uname.
IMPORT variable FROM Database indx(st) ID Lkey.
Regards
Anurag
‎2006 Sep 07 9:08 PM
Hi
One way is, to have the <b>Userid</b> as the memoryID for both Export and Import statements.
Regards,
Raj
‎2006 Sep 07 9:13 PM
Instead of exporting a variable you can export an internal table to memory. So everytime you export do an import and check if there is an internal table in the memory, if there is then append the record. To identify who created create a field in the internal table with the user-name, so that you know who created the memory reference.
hith
Sunil Achyut
‎2006 Sep 07 9:08 PM
‎2006 Sep 07 9:11 PM
What you are using is global memory, if you don't want other sessions to see it, then you have to use a memeory id instead. This will work when submittin program b using the SUBMIT statement.
export variable to memory id 'ZRICHTEST'.
import variable from memory id 'ZRICHTEST'.Or you can simply make your KEYVALUE unique by giving the USERID as part of it.
Regards,
Rich Heilman
‎2006 Sep 07 9:12 PM
The problem can easily be resolved by qualifying the key....in Program A
lKey = Sy-uname.
EXPORT variable TO DATABASE indx(st) ID lKEY.
And in Program B.
lkey = Sy-Uname.
IMPORT variable FROM Database indx(st) ID Lkey.
Regards
Anurag