cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Objects and using other objects as attributes

Former Member
0 Kudos

Hello,

I am trying to use Shared memory objects. The attributes of my object consists of simple types, internal tables and references to other objects(classes). The simple and itab data types work fine, but when trying to retrieve the object reference, it is null. Any thoughts, or any knowledge if this can acutally be done.

Thank you for your help

Josh

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I work in 4.6C so I have not had a chance to work with Shared Objects yet but maybe I have a solution that will work.

I assume you are storing objects and those stored objects have references to other objects that you are storing.

The solution I propose is to define your own references.

Add an integer attribute to each object. I will call it MY_REF. Assign a number to each object that you create to be stored. So for the first object MY_REF is set to 1, next object is number 2, etc.

In addition to each reference attribute in your objects, add an integer attribute. So if you have attribute REF1, then add integer attribute IREF1, for REF2, add integer attribute IREF2, etc.

At some point before you store the objects, use the reference variable, for example REF1, go to that object

and retrieve MY_REF. Set IREF1 to the value of MY_REF.

When you retrieve your objects, as you return each one and establish a reference variable for it, save the reference variable and the value of MY_REF in a hashed table keyed by MY_REF and holding the reference variable. In this hashed table, setting the reference variable to TYPE OBJECT should work.

After all objects have been retrieved, for each ojbect, use the IREF1, IREF2, etc, integer references and do a lookup in your hashed table. This will return the reference pointer to the object which you can store in REF1, REF2, etc. Now you can ignore the integer reference variables and do your normal object processing with the REF1, REF2, etc, reference variables.

Please let us know how it goes. I am sure that Shared Objects are new to a lot of us SDNers so your postings could be very educational.