2007 Dec 29 10:00 AM
Hi,
Can any one tell me how to use Shared Buffer through Import/Export statements in detail. I have did studied about SHARED BUFFER addition of IMPORT/EXPORT but i wan't to know about name of the shared buffer, weather we need to create a new one or can we use existing or can we skip this addition. i believe i have to implement this as i have to pass data to two programs which run in two different work processes.
Please provide detail about name of shared memory area, and also how to delete the stored values.
Thanks in advance,
Zafar Ali
2007 Dec 29 10:22 AM
Hi zafar,
shared memory process exhibits.
for that u have to create AREA CLASS/ AREA INSTANCE ..
& THEN use query to WHICH DATA / OBJ U R GOIN 2 SHARED.
v have different process called read commit & write commit...
if the data is already shared, no need to share again,
as SAP defined , some data are already shared, for that u no need to share again,
ur sharin ur own define data thru DB to appln server, so that , its very fast to access. so no need to select that same object frm db again & again.time consuming
hope u got it.
reward if its useful
2007 Dec 29 10:22 AM
Hi zafar,
shared memory process exhibits.
for that u have to create AREA CLASS/ AREA INSTANCE ..
& THEN use query to WHICH DATA / OBJ U R GOIN 2 SHARED.
v have different process called read commit & write commit...
if the data is already shared, no need to share again,
as SAP defined , some data are already shared, for that u no need to share again,
ur sharin ur own define data thru DB to appln server, so that , its very fast to access. so no need to select that same object frm db again & again.time consuming
hope u got it.
reward if its useful
2007 Dec 29 10:41 AM
use t-code shma try @ ecc 5.0 & above
DEFINE CLASS zcl_my_root SHARED MEMORY ENABLED
Check out properties tab for the same in SE24 while defining root class.
CRETAE OBJECT myRoot AREA HANDLE myShmHandle
CREATE DATA dref AREA HANDLE myShmHandle
Define Area handle and Root instance
Data : myShmHandle TYPE REF TO zcl_my_area, zcl_my_area is same as area name
myRoot TYPE REF TO zcl_my_root.
*Get area class instance or area handle and use handles ATTACH_FOR_WRITE
*method to export your data in SOM.
myShmHandle = zcl_my_area=>attach_for_write( ).You can specify instance name, here DEFAULT is used
Start filling the contents of shared memory enabled root class into SOM instance
CREATE OBJECT myRoot AREA HANDLE myShmHandle.
myRoot->name = `My first area instance`. name is simple public attribute in root class
APPEND `Harry` TO myRoot->itab. itab defined as public internal table of type string
dref is data reference to string. You can even try with dynamic data types
CREATE DATA myRoot->dref AREA HANDLE myShmHandle.
myRoot->dref->* = `Jul-04-2005`.
IF ...
tell area handle who is going to work as root- dont miss this, Root is always stored as attribute of area class
myShmHandle->set_root( myRoot ).
Finally put the root instance (and hence all its attributes/data) in SOM
myShmHandle->detach_commit( ).
ELSE.
myShmHandle->detach_rollback( ).
ENDIF.
After this if you will fill in attributes of root instance w/o above blocks; that wont sit in SOM at all
.
However if you repeat another similar block, this time with new data for example in root object, a new SOM instance will\
get created
process Ends*******************
Another way..............
here a thru READ Program This mostly contains opposite methods of AREA class to import the instances:
DATA:
myShmHandle TYPE REF TO zcl_my_area,
myRoot TYPE REF TO zcl_my_root,
txt TYPE string.
This time get the handle through static ATTACH_FOR_READ method of area class
myShmHandle = zcl_my_area=>attach_for_read( ).
Try catching different exceptions of methods
*Root instance should already be active and present as writing would have been already done using export pgm.
myRoot = myShmHandle->root.
*Now read the contents as you normally do w/o SOM
READ TABLE myRoot->itab INTO txt INDEX 1.
WRITE: / txt.
CONCATENATE myRoot->name
myRoot->dref->* INTO txt SEPARATED BY space.
WRITE: / txt.
myShmHandle->detach( ).
Even if you dont detach, sys will remove at the end of pgm
have this coding.. make use if it..
Reward it its useful
2007 Dec 29 11:12 AM
Hi Irfan,
From the response it seems that i have to create memory area name in SHMA, but can u tell me how to use it in EXPORT/IMPORT statement, and also in root class what methods needs to be created . I feel that its getting too complex, as i have to only share a internal table data to another program which will be called after execution of current program in another work process, using simple EXPORT/IMPORT statements.
With Regards,
Zafar Ali
2008 Jul 15 7:37 AM
2008 Oct 07 9:45 AM