<?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: Dynamic ClassLoader in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379607#M1237246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Allright, yout solution works perfecrtly, thanks for pointing me the right way. Btw. have you any further sources of information or some nice linke about RTTS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Apr 2009 05:37:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-09T05:37:00Z</dc:date>
    <item>
      <title>Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379605#M1237244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;i am trying to program a dynamic classloader in Abap. by now i came this far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA classname TYPE string VALUE 'ZCL_TEST'.
DATA dref TYPE REF TO data.
DATA type_descr TYPE REF TO cl_abap_typedescr.

FIELD-SYMBOLS &amp;lt;ref&amp;gt; TYPE ANY.
*
type_descr = cl_abap_typedescr=&amp;gt;describe_by_name( p_name = classname ).
classname = type_descr-&amp;gt;absolute_name.
*
CREATE DATA dref TYPE REF TO (classname).
ASSIGN dref-&amp;gt;* TO &amp;lt;ref&amp;gt;.
*
CREATE OBJECT &amp;lt;ref&amp;gt; TYPE (classname).

dref-&amp;gt;to_string( ). -----&amp;gt; ERROR
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ClassLoading itselfs works perfectly, but now i don't know how to call a method of that class... Can't beliieve that i can instantiate a Class but not call a method?!?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So has someone done it already and can point me the right way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mathias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 14:05:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379605#M1237244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-08T14:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379606#M1237245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To be able to access the object's method, you need to get the reference of the OBJECT, not of the DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA classname TYPE string VALUE 'ZCL_TEST_TEXT'.
DATA: lo_obj TYPE REF TO object.

FIELD-SYMBOLS &amp;lt;ref&amp;gt; TYPE ANY.

CREATE OBJECT lo_obj TYPE (classname).

CALL METHOD lo_obj-&amp;gt;('VALIDATE_MATNR').

WRITE: 'test'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 15:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379606#M1237245</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-04-08T15:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379607#M1237246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Allright, yout solution works perfecrtly, thanks for pointing me the right way. Btw. have you any further sources of information or some nice linke about RTTS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 05:37:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379607#M1237246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T05:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379608#M1237247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I still don't get it entierely &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; what is the difference between a DATA Reference and an OBJECT Reference? I derieved my original code from the F1 Help&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
INTERFACE i1. 
  ... 
ENDINTERFACE. 

CLASS c1 DEFINITION. 
  PUBLIC SECTION. 
    INTERFACES i1. 
ENDCLASS. 

DATA dref TYPE REF TO data. 

FIELD-SYMBOLS &amp;lt;ref&amp;gt; TYPE ANY. 

... 

CREATE DATA dref TYPE REF TO 
           ('\program=kellerh_test\interface=i1'). 

ASSIGN dref-&amp;gt;* TO &amp;lt;ref&amp;gt;. 
CREATE OBJECT &amp;lt;ref&amp;gt; TYPE c1. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so what is happening here and why do they use the CREATE DATA Statement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 06:09:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379608#M1237247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T06:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379609#M1237248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know what would be the use of creating the object with REF TO DATA and than assign it back to the variable REF TO OBJECT to be able to access the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CREATE DATA dref TYPE REF TO 
           ('\program=kellerh_test\interface=i1'). 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you are creating the TYPE at runtime which is type referent to the Interface. You get the object reference to the Field-Symbol. But Since field-symbol is not allowing to access the attributes, we need to cast that into the variable TYPE REF TO OBJECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  ztest_np_1.

INTERFACE i1.
  DATA: w_num TYPE i.
ENDINTERFACE.                    "i1

CLASS c1 DEFINITION.
  PUBLIC SECTION.
    INTERFACES i1.
ENDCLASS.                    "c1 DEFINITION

DATA dref TYPE REF TO data.

FIELD-SYMBOLS &amp;lt;ref&amp;gt; TYPE any.

CREATE DATA dref TYPE REF TO
           ('\program=ZTEST_NP_1\interface=i1').

ASSIGN dref-&amp;gt;* TO &amp;lt;ref&amp;gt;.
CREATE OBJECT &amp;lt;ref&amp;gt; TYPE c1.

*----
FIELD-SYMBOLS &amp;lt;attr&amp;gt; TYPE ANY.
DATA: lo_obj TYPE REF TO object.

lo_obj ?= &amp;lt;ref&amp;gt;.
ASSIGN lo_obj-&amp;gt;('I1~W_NUM') TO &amp;lt;attr&amp;gt;.
&amp;lt;attr&amp;gt; = 10.
*----

WRITE: 'Test'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 13:32:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379609#M1237248</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-04-09T13:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ClassLoader</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379610#M1237249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Allright, i slowly get it &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt; maybe the SAP guys should then change their online documentation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But anyway. thanks a lot for your time and effort&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings Mathias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 13:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-classloader/m-p/5379610#M1237249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T13:42:00Z</dc:date>
    </item>
  </channel>
</rss>

