Skip to Content
author's profile photo Former Member
Former Member

Shared Objects and using other objects as attributes

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 23, 2005 at 03:22 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.