Application Development and Automation 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: 
Read only

How to use shared memory

0 Likes
1,795

Hi Experts,

I have a scenario from wherein I am fetching a huge set of data using RFC. I want to store this data(in internal table format) into SAP Shared memory, so that I can access this data as and when required.

Can you please suggest me as to how to store data into SAP Shared memory and how to retrieve them.

Thanks & Regards,

Ritwik.

Hi Experts,

I have a scenario from wherein I am fetching a huge set of data using RFC. I want to store this data(in internal table format) into SAP Shared memory, so that I can access this data as and when required.

Can you please suggest me as to how to store data into SAP Shared memory and how to retrieve them.

Thanks & Regards,

Ritwik.

9 REPLIES 9
Read only

Former Member
0 Likes
1,373

Ritwik,

please search scn and google

http://help.sap.com/abapdocu_70/en/ABAPEXPORT_DATA_CLUSTER_MEDIUM.htm

Thanks

Bala Duvvuri

Read only

Former Member
0 Likes
1,373

Hi

If you are using SHMA (Shared memory area concept ),

U will have to create a class for that purpose suing T code : SHMA .(WIll generate a shared memory for your internal table ),

a root class wil lbe genrated , Define a Table structure in the ATTRIBUTE of that class .

And u are ready to use this Internal table wer u want to .

Regards

Swapnil

Read only

0 Likes
1,373

Hi Swapnil,

Thanks for the quick reply.

I tried the transaction, but the usage is still not clear as to how to use this class and its attributes. Can you please give me some examples or some scenario where shared memory is used so that I can get some pointers on that and start the developement.

Thanks & Regards,

Ritwik.

Read only

0 Likes
1,373

HI

Goto SHMA --> give a class name u want to use >>>create >>>give a root class name u want to create >>>>>just foll th procedures .

It will directly take u to ROOT Class Created . In the attribute section please check on SHARED MEMORY CLAS in GENEARKL DATA tab . Just generate the Class .

EXAMPLE ::::::

Zkomv :Defined table type

IT_price : Internal Table u want to use .

ZCL_PRICE_ROOT :: Root class created .

ZCL_PRICE_AREA : Shared memeory area create .

DATA : IT_PRICE TYPE ZKOMV,

WA_PRICE like line of IT_PRICE .

DATA : ROOT TYPE REF TO ZCL_PRICE_ROOT .

DATA : HANDLE TYPE REF TO ZCL_PRICE_AREA.

TRY.

HANDLE = ZCL_PRICE_AREA=>ATTACH_FOR_READ( ).

.

CATCH CX_SHM_INCONSISTENT .

CATCH CX_SHM_NO_ACTIVE_VERSION .

CATCH CX_SHM_READ_LOCK_ACTIVE .

CATCH CX_SHM_EXCLUSIVE_LOCK_ACTIVE .

CATCH CX_SHM_PARAMETER_ERROR .

CATCH CX_SHM_CHANGE_LOCK_ACTIVE .

ENDTRY.

ROOT = HANDLE->ROOT.

MOVE ROOT->PDATA TO IT_PRICE.

BREAK-POINT.

LOOP AT IT_PRICE INTO WA_PRICE .

WRITE : WA_PRICE-KWERT .

ENDLOOP .

USING THE PROGRAMME any wer :

DATA : IT_PRICE TYPE ZKOMV.

DATA : WA_PRICE LIKE LINE OF IT_PRICE .

DATA : HANDLE TYPE REF TO ZCL_PRICE_AREA.

DATA : ROOT TYPE REF TO ZCL_PRICE_ROOT.

DATA : RC TYPE SHM_RC.

*SELECT * FROM komv INTO TABLE ITAB UP TO 10 ROWS.

BREAK-POINT.

TRY.

CALL METHOD ZCL_PRICE_AREA=>FREE_AREA

EXPORTING

TERMINATE_CHANGER = ABAP_TRUE

RECEIVING

RC = RC.

CATCH CX_SHM_PARAMETER_ERROR .

ENDTRY.

TRY.

HANDLE = ZCL_PRICE_AREA=>ATTACH_FOR_WRITE( ).

CATCH CX_SHM_EXCLUSIVE_LOCK_ACTIVE .

CATCH CX_SHM_VERSION_LIMIT_EXCEEDED .

CATCH CX_SHM_CHANGE_LOCK_ACTIVE .

CATCH CX_SHM_PARAMETER_ERROR .

CATCH CX_SHM_PENDING_LOCK_REMOVED .

ENDTRY.

CREATE OBJECT ROOT AREA HANDLE HANDLE.

MOVE IT_PRICE[] TO ROOT->PDATA[].

TRY.

HANDLE->SET_ROOT( ROOT ).

CATCH CX_SHM_INITIAL_REFERENCE .

CATCH CX_SHM_WRONG_HANDLE .

ENDTRY.

TRY.

CALL METHOD HANDLE->DETACH_COMMIT.

CATCH CX_SHM_WRONG_HANDLE .

CATCH CX_SHM_ALREADY_DETACHED .

CATCH CX_SHM_SECONDARY_COMMIT .

CATCH CX_SHM_EVENT_EXECUTION_FAILED .

CATCH CX_SHM_COMPLETION_ERROR .

ENDTRY.

Hope it helps .

Regards

Swapnil

Read only

Read only

MarcinPciak
Active Contributor
0 Likes
1,373

I have a scenario from wherein I am fetching a huge set of data using RFC. I want to store this data(in internal table format) into SAP Shared memory,

This is not a good scenario to use shared memory as data are stored on Application Server side. Therefore huge volume of data will cause low memory issues. It is recommended for small set of data not big ones. So I suggest to go for custom table creation and storing these data directly in DB.

If you persist of using them please refer [Shared Objects|http://help.sap.com/saphelp_sm32/helpdata/en/14/dafc3e9d3b6927e10000000a114084/frameset.htm], but consider the performance of the AS.

Regards

Marcin

Read only

Former Member
0 Likes
1,373

SUBMIT YOUR RFC CALL exporting list to memory and then retrieve by id.

Read only

Former Member
0 Likes
1,373

Ritwik use a sppo/text file rather.Why you want to go so complicated man.

Read only

0 Likes
1,373

Hi Aditya,

Can you please let me know the usage and how it will work in my scenarion.

Thanks & Regards,

Ritwik.