Understanding Shared Object Memory

By Vakada Raghava, Mouri Tech Solutions

“In this tutorial, I would like to explain about Implementing scenario on Shared Object Memory. If you wish to share data across the external memory and increase the performance of the your objects, you can access shared memory through Shared objects. The Shared Objects can be created using the SAP standard transaction “SHMA” and assign root class to shared objects. In this scenario I am creating Root class ZCL_SHARED_ROOT that will use GET_MESSAGE and SET_MESSAGE. This information is maintained in the shared memory. I have created Shared object ZCL_SHARED_AREA and report programs for reading message ZSHARED_MEMORY_READ and writing message ZSHARED_MEMORY_WRITE. The shared objects are stored in Shared Memory (SHMM)”. 

Go to SE24 and create ROOT class “ZCL_SHARED_ROOT” and Check on Shared Memory enabled 

 

Create Attribute “MY_MESSAGE” 

 

Assign an interface “IF_SHM_BUILD_INSTANCE” in the interface tab.  

 

Create “GET_MESSAGE” and “SET_MESSAGE” methods. 

 

Enter the following code in the interface method “Build” 

 

Enter the following code in the for “GET_MESSAGE” method 

 

Enter the following code in the for “SET_MESSAGE” method 

 

Go to SHMA and enter the area name “ZCL_SHARED_AREA” and enter the root class name 

 

Enter the following details shown below.

 

Save the shared Object

Go to SE38 and create a report program “ZSHARED_MEMORY_READ”

 

The Shared object is not available in Shared memory( SHMM ) area because instance has not been generated. 

 

Run the report program “ZSHARED_MEMORY_READ” the result would be shown below. 

 

The Shared object is now available in Shared memory( SHMM ) areas because instance has been generated. 

 

Go to SE38 and create a report program “ZSHARED_MEMORY_WRITE”

 

Run the report program “ZSHARED_MEMORY_WRITE” for writing the message in shared memory area and display previous data. The result is as shown below. 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image