Application Development 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: 

SHARED MEMORY AREA - SHMM and data on application server

3,435

Hi All,

I have created Shared memory area and ROOT class and stored the data on one of the application servers.

1) in our landscape, i have noticed two application servers.

2) in the SHMM transaction , i can see the instances created .

3) I am able to access these instances through ABAP program ( by creating handle through attach_for_read( ) )

Things are fine till this point.

Problem:

From the UI, the same program is called but i am unable to get the instances (data) stored in the shared memory on the application server.

I understand that the shared memory is specific to application server .

i believe that the abap backend is getting executed on another app server where the shared memory data does not exist .

1) is there any configuration so share the shared memory across all app servers ?

how can i overcome this problem?

Thanks in advance.

Regards,

Ravi.

4 REPLIES 4

FredericGirod
Active Contributor
1,270

Apparently you cannot share the memory between AS:

  • Area Binding
The context specified for this property defines the visibility and lifetime of the area instance version of the instance. Possible contexts are:
  • Application server

    Area instance versions exist until the application server is shut down.
  • User session

    Area instances exist until the last ABAP session of the current user session ends. For area binding, every user logon to an AS ABAP counts individually. This also applies in particular when users log on using external interfaces such as RFC or ICF.
  • Top level transaction

    The top level transaction is the first program in a call sequence. These area instances exist for as long as the ABAP memory assigned to a call sequence is loaded, in other words for as long as the internal session of the top level transaction is loaded.

gasparerdelyi
Product and Topic Expert
Product and Topic Expert
1,270

In what context, for what purpose would you like to use shared memory and overcome the problem of having two instances?

michael_piesche
Active Contributor
1,270

Your main problem is, that if two instances of your programm are run at the same time, but both being run on different application servers, they can not access the others data in the 'shared memory', as the shared memory is only application server specific.

Please have a look at the discussion from this question:

Basically, you have three options to rewrite your program:

  1. Use ABAP Channels
    ABAP Channels are event-based communication using messages between application servers (and with the Internet). The AMC part is the one you would need to implement:
    ABAP messaging channels (AMC) are a method of communication between ABAP programs using messages. Using a publish-and-subscribe mechanism, messages can be exchanged between any AS ABAP programs, including communication between different user sessions and application services
  2. Use Shared Objects
    Shared objects are objects in areas of shared memory. Shared Objects are Application Server specific.
    a) create a Shared Object on one specific Application Server A
    b) create a Destination for Application Server A
    c) create an FM that 'exposes' the Shared Object
    If your program is running on Application Server A, you can access the Shared Object
    If your program is running on a different Application Server, you access it with the RFC to Application Server A
  3. Rewrite your coding
    You will have to put in some work to set up 1. and 2. and also brain power to figure out how to handle concurrent read/write accesses to the Shared Object (same with a DB)
    Rewriting your coding might be the best option, if it is feasible.

0 Kudos
1,270

ravichandra.kss, were you able to find a solution to your problem or did new issues come up?