<?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: Getting the type of an empty interface reference ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-type-of-an-empty-interface-reference/m-p/2063931#M426899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, how stupid can one be.. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; Next time, I will debug a little bit further before posting questions here in the forums. For anyone wanting to do something similiar, the answer to the question follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is that simple: CL_ABAP_REFDESRC owns a method to return the referenced type: GET_REFERENCED_TYPE. This method returns nicely an instance of CL_ABAP_INTFDESRC if passed an interface reference. With this interface type, one can get the name of the interface easily with GET_RELATIVE_NAME.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Mar 2007 15:00:36 GMT</pubDate>
    <dc:creator>markus_theilen</dc:creator>
    <dc:date>2007-03-06T15:00:36Z</dc:date>
    <item>
      <title>Getting the type of an empty interface reference ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-type-of-an-empty-interface-reference/m-p/2063930#M426898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strange question at first, but let me explain. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to write a method that gets an empty interface reference, determines the interface type and creates an instance of a predefined class that implements the given interface. Perhaps a bit of source code makes this a little bit clearer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lr_instance type ref to &amp;lt;Name of Interface, e.g. "IF_WORKFLOW"&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lr_instance ?= /eas/cl_plugin_factory=&amp;gt;get_instance_for_interface( lr_instance ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The returning parameter is type as REF TO OBJECT and the importing parameter as ANY. The passed reference is not bound before the call. The method's task is it to get the static type of the passed reference, lookup an implementing class (left out for simplification), create an instance of this class and bind it to the interface reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use the RTTI classes (CL_ABAP_TYPEDESCR), but the returned type instance is not of type CL_ABAP_INTFDESRC as expected, but CL_ABAP_REFDESRC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone an idea how to solve this puzzle ? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 14:47:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-type-of-an-empty-interface-reference/m-p/2063930#M426898</guid>
      <dc:creator>markus_theilen</dc:creator>
      <dc:date>2007-03-06T14:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the type of an empty interface reference ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-type-of-an-empty-interface-reference/m-p/2063931#M426899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, how stupid can one be.. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; Next time, I will debug a little bit further before posting questions here in the forums. For anyone wanting to do something similiar, the answer to the question follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is that simple: CL_ABAP_REFDESRC owns a method to return the referenced type: GET_REFERENCED_TYPE. This method returns nicely an instance of CL_ABAP_INTFDESRC if passed an interface reference. With this interface type, one can get the name of the interface easily with GET_RELATIVE_NAME.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 15:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-type-of-an-empty-interface-reference/m-p/2063931#M426899</guid>
      <dc:creator>markus_theilen</dc:creator>
      <dc:date>2007-03-06T15:00:36Z</dc:date>
    </item>
  </channel>
</rss>

