<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Retrieving a reference variable value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933041#M1599972</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; I guess it's not possible then. Unless someone knows a trick to do it anyway? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I definitely agree. You can't access the address of either &lt;EM&gt;data reference&lt;/EM&gt; or &lt;EM&gt;object reference&lt;/EM&gt; which is "pointing" to a data and object respectively. There is also no trick to overcome this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the reason is quite obvious. C language is low level one, where accessing physical memory is often inevitable. ABAP is a high level language like JAVA where such inner low level details should not be of prime developer's interests (if at all). So the language designers didn't predict there will be a case when businees oriented developer should need to be provided with such information. It's simply quite hard to imagine the case where we could take advantage of that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jun 2011 08:40:48 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2011-06-03T08:40:48Z</dc:date>
    <item>
      <title>Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933033#M1599964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to retrieve the value of a reference variable (into a string)? So not the dereference, but the actual value of the variable itself. For instance, let's say I have three object reference variables. In the debugger I can see their values, which might look like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="O"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="O"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="O"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's these values I want to retrieve in my code. Is this possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 20:06:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933033#M1599964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-01T20:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933034#M1599965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi R.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what you see in the debugger is not the "value" of these reference variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="O"&gt;&lt;/SPAN&gt; is just a representation of the reference. In this case it is indicating this is a pointer to an instanciated class of type ZCL_MYCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps the reason you are asking this is that you want to determine at runtime the class type? If so you can use Runtime Type Services ([RTTS|https://wiki.sdn.sap.com/wiki/display/ABAP/Runtime&lt;EM&gt;Type&lt;/EM&gt;Services+(RTTS)]) to determine this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Graham Robbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 22:02:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933034#M1599965</guid>
      <dc:creator>GrahamRobbo</dc:creator>
      <dc:date>2011-06-01T22:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933035#M1599966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Graham, I know. What I tried to explain, is that I want to access the value of the reference variable, not the dereference (in the example, an object of type ZCL_MYCLASS).&lt;/P&gt;&lt;P&gt;If I'm not mistaken, in C it's done by placing the &amp;amp; operator in front of the variable name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 08:03:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933035#M1599966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-02T08:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933036#M1599967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi R,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In C you can create a pointer to the memory of the variable with the &amp;amp;.&lt;/P&gt;&lt;P&gt;In ABAP you have the statement: GET REFERENCE OF &amp;lt;variable&amp;gt; INTO &amp;lt;pointer&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[http://help.sap.com/saphelp_nw2004s/helpdata/en/4e/fb95f40e8f11d3b9370000e8353423/frameset.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robin Vleeschhouwer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: R. Vleeschhouwer on Jun 2, 2011 10:40 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 08:40:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933036#M1599967</guid>
      <dc:creator>RobinV</dc:creator>
      <dc:date>2011-06-02T08:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933037#M1599968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robin, I tried that too, but that way I'm still only able to access the dereference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 08:52:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933037#M1599968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-02T08:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933038#M1599969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just noticed the following in the ABAP documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;In ABAP, however, there is no real equivalent to pointers in the sense of variables which contain a memory address and can be used without the contents operator. You can only work with the data object to which a field symbol points.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess it's not possible then. Unless someone knows a trick to do it anyway? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 09:00:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933038#M1599969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-02T09:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933039#M1599970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be this is the trick you're looking for: [Accessing the inaccessible|http://wiki.sdn.sap.com/wiki/display/ABAP/Accessing&lt;EM&gt;the&lt;/EM&gt;Inacessible&lt;EM&gt;-&lt;/EM&gt;Local&lt;EM&gt;Classes&lt;/EM&gt;within&lt;EM&gt;Global&lt;/EM&gt;Classes]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: BTW did you try out Graham's suggestion to use the RTTI class?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 11:44:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933039#M1599970</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-06-02T11:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933040#M1599971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suhas, I'm not looking for ways to circumvent encapsulation, neither am I interested in runtime type identification. Did you read the entire thread?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 16:18:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933040#M1599971</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-02T16:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933041#M1599972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; I guess it's not possible then. Unless someone knows a trick to do it anyway? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I definitely agree. You can't access the address of either &lt;EM&gt;data reference&lt;/EM&gt; or &lt;EM&gt;object reference&lt;/EM&gt; which is "pointing" to a data and object respectively. There is also no trick to overcome this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the reason is quite obvious. C language is low level one, where accessing physical memory is often inevitable. ABAP is a high level language like JAVA where such inner low level details should not be of prime developer's interests (if at all). So the language designers didn't predict there will be a case when businees oriented developer should need to be provided with such information. It's simply quite hard to imagine the case where we could take advantage of that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2011 08:40:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933041#M1599972</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2011-06-03T08:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933042#M1599973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcin, the reason I asked is because I was looking for a way to (more or less) uniquely identify objects, the way Java does with its default implementation of the hashCode() method on the Object class, without defining a new root class myself.&lt;/P&gt;&lt;P&gt;I figured the only way to do this is to get the reference variable's value (the memory address), but alas, ABAP doesn't allow it.&lt;/P&gt;&lt;P&gt;So now I've come up with a solution using a guid and a custom hash implementation which seems to be working fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2011 09:08:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933042#M1599973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-03T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving a reference variable value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933043#M1599974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes René, a GUID usage is fine enought to assure uniqueness of the objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2011 09:51:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieving-a-reference-variable-value/m-p/7933043#M1599974</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2011-06-03T09:51:15Z</dc:date>
    </item>
  </channel>
</rss>

