ABAP Shared Memory Objects Tutorial with Sample ABAP Code.CRM Companies List.Web Based CRM Software.This ABAP Shared Memory Objects tutorial includes sample ABAP code showing how to code to store data in shared memory objects and read data from shared memory object.By following the instructions in this step by step ABAP tutorial, developers can create a shared memory object in SAP.Given sample ABAP codes and sample programs will help developers to write data or read data from shared memory objects using shared memory programming.ABAP developers can use following SAP transaction codes for Shared Memory Object development, debugging and monitoring SE8.SE2.ABAP Workbench Class Builder editor to create root class for data structure.SHMA SAP transaction for creating Shared Object Area class interface.SHMM to monitor Shared Memory Areas objects, their memory consumption, and view and display data contained in shared memory object.Of course ABAP developers can use transaction SE3.ABAP programs where they set the shared memory object value and read back from shared memory area object.Steps to Implement ABAP Shared Object Solution.Create a class that represents data structure.Update Statement In Sap Abap Tutorial' title='Update Statement In Sap Abap Tutorial' />Ill refer this class as root class.Use SE8.SE2.Create a shared memory area class to wrap data class for standard shared memory object methods.Ill refer this class as handle class.Use SHMA transaction.ABAP code to write data to shared memory object.CHECK statement can be used to terminate a subroutine conditionally.If the logical expression in the CHECK statement is untrue, the subroutine is terminated, and the.For example you can build a simple ABAP program using SE3.ABAP code to read data from shared memory object.A similar ABAP report can be written to read data from shared memory object using SE3.Naming of the root class and the shared memory area is important.The first part of the names of both classes should be same.On the other hand root class name should be ending with root and the shared memory area class name should end with area.In fact this naming simpifies the work of ABAP developer.ABAP programmers will have a better understanding about the objects theyre using to build a SAP shared memory object solution.Convert Ost To Pst Free Crack Giveaway on this page.Root Class for Shared Memory Object.In this section of the ABAP tutorial, we will create a class with Shared Memory Enabled option is selected.The class name is ZVBRKSHMTABLEROOT for the sake of naming standards.First of all, call SE8.Workbench transaction code and choose Class Interface as object type.Then type the name of the new root class for your shared memory object as seen in below screen shot.Press Enter key for next dialog.When your approval is requested to create the mentioned class since it does not exist, click Yes to continue to create the new root class for shared memory object.Choose Class option instead of Interface to indicate that youre creating a class not an interface.Press Enter or OK icon button.Provide class description for the shared memory object root class.Choose instantiation as Public.Class type is Usual ABAP class and mark Final checkbox.When you are finished with basic class properties, click Save to continue for the SAP Class Builder screen.Be sure that you do not forget to mark Shared Memory Enabled checkbox on class properties screen general data section.Now after we mark the class as shared memory enabled, we will now create an attribute where data will be stored and two class methods to set and get shared data in the class attribute.Now switch to Attributes tab and define a private attribute where data will be stored.For example we can create an attribute where ABAP developers can store a list of SAP document numbers in VBELN data type.When I searched the ABAP dictionary for an existing table type for VBELN data type, I found VBELNVLT table type.Ill use VBELNVLT table type in this tutorial to create a class attribute for storing SAP document numbers like invoice numbers or order numbers in a shared memory object.After attribute is created, ABAP developers can continue with next step.In this step, we will create two public methods.These methods will be used to set data to private attribute and get data read from private attribute of the shared memory object.SETVBELN method has import parameter PVBELN of type VBELNVLT which is a table type for VBELN data element.This method takes internal table of table type VBELNVLT to set as shared memory object data content.GETVBELN method has export parameter PVBELNTBL of type VBELNVLT which is a table type for document numbers.Using the export method GetVbeln, ABAP users will be able to return shared memory object table for all stored document numbers.After the developer defines class attribute and setget methods of the root class, within the methods following ABAP codes can be used.METHOD SETVBELN.SHMVBELNTBL PVBELN.ENDMETHOD.METHOD GETVBELN.PVBELNTBL SHMVBELNTBL.ENDMETHOD.Set method assigns the input parameter value as the value of shared memory object attribute.And the Get method returns the attribute value as export parameter.We will see how we will call these shared memory enabled class methods within other ABAP programs later in this ABAP tutorial.Create Shared Memory Area Handle Class.This tutorial step demonstrates the creation of the shared memory area.To create a Shared Memory Area ABAP developers can use SHMA SAP transaction code.Area name should be ZVBRKSHMTABLEAREA according to the naming rules which will help the developers to reference it without any confusion later.When you press Create button, following Create Area screen will be displayed.Enter the root class name we have created as shared memory root class in Attributes tab basic properties section.In our tutorial, we have defined the root class name as ZVBRKSHMTABLEROOT in previous steps.If you look at the details of the above Create Area screen, you will realize that an ABAP developer can enable versioning with a Shared Area object.It is also possible to define the maximum shared area object size that will keep on memory in k.Byte and maximum number of allowed versions.After you complete Shared Memory Area properties like deciding if you want to use it with Versioning is enabled or not, first press Save icon and then press Release button at top icons menu.The class category is Area Class Shared Objects when you display the shared memory area using SE8.The Root attribute of the handle class is automatically set to previously created root class at step 1.The below ABAP report whose source code is given reads shared memory object value.Root class attachforread method must be called before reading shared memory data using our custom GetVbeln method.At the end of the read process, ABAP developers must call detach method to free shared memory object.REPORT ZREADSHAREDMEMORYOBJECT.DATA ltvbeln type VBELNVLT.DATA lsvbeln like LINE OF ltvbeln.DATA lrhandle TYPE REF TO ZVBRKSHMTABLEAREA.ZVBRKSHMTABLEAREA attachforread.IMPORTING PVBELNTBL ltvbeln.In order to update data stored in memory using shared memory objects, developers must consider using one of attachforwrite or attachforupdate methods.Following ABAP report is demonstrating how to assign shared memory object value.First of all, using below ABAP a check is done to see if an active version of the shared memory object exists or not.This check is done by reading the shared memory object.If cxshmnoactiveversion exception is catched in the ABAP TRY and CATCH syntax, then ABAP developer should use attachforwrite method while creating the root class object handle.Otherwise, attachforupdate method can be used during root creation of the root class handle.REPORT zsharedmemoryobjectsample.PARAMETERS prvbeln LIKE vbrk vbeln DEFAULT 1.ABAP program appends pVBELN parameter value TO Shared Memory Object.DATA ltvbeln type VBELNVLT.DATA lsvbeln like LINE OF ltvbeln.DATA lrhandle TYPE REF TO zvbrkshmtablearea.Area Class.DATA lrroot TYPE REF TO zvbrkshmtableroot.Root attribute of handle class.SHM Model of a Data Clas First Try to Readdata excp type ref to cxshmnoactiveversion.IMPORTING PVBELNTBL ltvbeln.X. Adobe Reader Free Download Italiano Vero on this page. APPEND prvbeln to ltvbeln.IF lfreaderror X.ELSE.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |