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

doubt help SAP Library Objects

I don´t understand the next paragraph (help SAP Library)

link sap library

Is there a error? CREF1 to

CREF3

?
If it could not be so,why CREF2?

"The effect of the assignment statement is to copy the reference from

CREF1 to CREF2

. As a result, the reference in CREF3 also points to the object C_COUNTER<1>. No more references point to the object C_COUNTER<2>, and it is automatically deleted by the garbage collection. The internal name C_COUNTER<2> is now free again."

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 04:54 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 05:10 PM

    Hello Lopez

    To clarify the question I have pasted the coding here:

    DATA: cref1  TYPE REF TO c_counter,
              cref2  TYPE REF TO c_counter,
              cref3  LIKE CREF1.
    
    CREATE OBJECT: cref1, cref2.  " 'pointers' for both instances exist
    
    MOVE cref2 TO cref3.               " cref2 and cref3 point to the same instance
    
    CLEAR cref2.                           " cref3 still filled -> still pointers to both instances exist
    
    cref3 = cref1.                           " cref3 points no longer to instance<2> but instance<1>
                                                  " Thus, there is no pointer to instance<2> anymore
                                                  " instance<2> will be removed by garbage collector

    Regards

    Uwe

    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.