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

save object in memory

Former Member
0 Likes
2,430

Hi all,

i have to save an instance in memory because i need the information later.

The Programm goes like this:

1) Get instance1

2) call sap-classes and methods

3) create instance2

4) Call function to show instance2

5) Start BDT functions. And at this point i loose my information about instance1

how can i write the instance1 into "global memory" for accessing all data all the time?

Thanks

stefan

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,466

Have you heard about Shared Memory Objects? This is a new concept implemented in NetWeaver 2004, and enhanced in NetWeaver 7.0. It is pretty straight forward to use and really powerful.

http://help.sap.com/saphelp_nw2004s/helpdata/en/14/dafc3e9d3b6927e10000000a114084/frameset.htm

Regards,

Rich Heilman

Read only

0 Likes
1,466

Hi,

that sounds good but i don't define classes i only use the sap classes to create instances. and i want the instance to stay reachable via memory or as a global durably instance that exists in the SAP methods, functions and untill the end of my programm.

Thank you

Stefan

Read only

singhsmi
Product and Topic Expert
Product and Topic Expert
0 Likes
1,466

Hi Stefan,

I think you are not using BDT, so this will not help.

Thanks and warm regards,

Smita.

Read only

0 Likes
1,466

Hi Smitha,

Yes and no. I don't use BDT but i call a sap function that starts the BDT and i need my instance at DSAVE. After store the obejct i return to my programm.

But then it's too late

Thanks for your help

Stefan

Read only

singhsmi
Product and Topic Expert
Product and Topic Expert
0 Likes
1,466

Hi,

Is you application using BDT? If yes, then you can use BDT_INSTANCE_SELECT with pop option. You can use push and pop to push one instance and pop other one.

Thanks and warm regards,

Smita.

Read only

Peter_Inotai
Active Contributor
0 Likes
1,466

Stefan,

I think what you can try is to serialize the instance to write it to a string in XML format and export/import this string and deserialize.

I never tried, but this approach should work.

Check these blogs:

/people/tobias.trapp/blog/2006/10/06/xml-processing-in-abap-part-9-150-abap-processing-using-xslt

/people/patrick.baer/blog/2005/03/01/abap-serialization--part-ii-serialization-of-arbitrary-data

/people/thomas.jung3/blog/2005/04/21/webservice-navigator-page-for-abap-and-java

Best regards,

Peter

Message was edited by:

Peter Inotai

Read only

Former Member
0 Likes
1,466

Hi Stefan,

If you want to save an instance of a class in memory, you can use persistent classes.

Generally ABAP programs work with data and objects that are valid at

runtime. They are transient i.e. temporary and disappear when program ends.

To store this data permanently and independently of the program context,

i.e. persistently, it must be stored in the database. This means instances of

global classes can be written to database tables.

Persistent Services in ABAP Objects can be used to write the current attribute

values of objects defined as persistent to associated transparent tables.

On request, these values can be imported from the tables and assigned to an

object previously defined as persistent.

To use persistent services for objects, their types must be created as

persistent classes in Class Builder.

Send me your mail ID so that I can pass you a document on creation of persistent classes.

Award points if found useful.

Regards

Indrajit.

Read only

Former Member
0 Likes
1,466

the following statement just worked fine

EXPORT P_DATUM to MEMORY id 'G_DATUM'.

Later in other coding:

IMPORT ...from memory id

Thanks all