Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

SAP memory, SMO, singleton classes related to each user's activity

$
0
0

Hi all gurus,

facing a challenging task and would like to ask you for some clarifications...

 

In short; an user has to select a value from a WD custom popup. This value should then be retrieved in a standard method (by enhancing it) that follows in the process flow.

 

The problem is that between the popup and the method, a new user session is started ( the process I'm talking about is the creation of a shopping cart in SRM).

 

So:

- 1 - i tried to create a singleton class with GET & SET methods... but this is not working, as after the SET , a new user session starts and the previous singleton class instance is lost;

- 2 - I tried to "convert" the above class into a Shared Memory Area enabled one... defining the binding at Application Server level, it works. In the method in which I have to get the value, that is correctly retrieved.

But SMO seems not to fit with my requirement, as it's not user-specific. To better understand the issue, think about two users, say A and B, which are both processing that execution flow. Considering the following sequence:

  1. user A selects a value (say "foo") from the popup; this is stored in SMA.
  2. user B selects a different value (say "bar") from the same popup just a second after user A; this value OVERRIDES the previous one stored in SMA, as SMA is not user-specific!
  3. As a result, when the execution flow for user A reaches the method in which the value is retrieved... the resulting value will be "bar", and not "foo".

 

I then read about SAP Memory which seems to be:

- user-specific;

- usable on multiple sessions from the same user.

 

I then tried as follows: when I have to set the value, I used the following instruction:

EXPORT proctype from proctype TO MEMORY ID 'ZPROCTYPE'.

where obviously proctype variable contains the user selection.

 

In the method, I used the following statement:

IMPORT proctype TO proctype  FROM MEMORY ID 'ZPROCTYPE'.

 

and, as in the case -1- of the singleton class, I get an empty value. Please notice that if I try to get the value BEFORE the new session is started, I can retrieve it correctly.

 

What am I missing? Does SAP Memory guarantee communication between multiple sessions started by the same user?

 

Any help will be highly appreciated ... as the question is quite urgent.

Thanks in advance


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>