<?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 Dynamic ref to objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268813#M492664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo Buddies,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where I have to create the object of class dynamically,&lt;/P&gt;&lt;P&gt;The scenario is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User inputs the class name, and I have to create the object of the user input class dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, I know the interface of the user input class, and hence can get the reference to interface which I can point to the object created dynamically from the user input class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I do it? A code snippet will do a lot of help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 May 2007 07:11:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-24T07:11:23Z</dc:date>
    <item>
      <title>Dynamic ref to objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268813#M492664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo Buddies,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where I have to create the object of class dynamically,&lt;/P&gt;&lt;P&gt;The scenario is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User inputs the class name, and I have to create the object of the user input class dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, I know the interface of the user input class, and hence can get the reference to interface which I can point to the object created dynamically from the user input class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I do it? A code snippet will do a lot of help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 07:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268813#M492664</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T07:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ref to objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268814#M492665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample... and change according to your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF obj_sales_order&lt;/P&gt;&lt;P&gt;        sales_order_no LIKE &amp;lt;sales_order_no_type&amp;gt;,&lt;/P&gt;&lt;P&gt;        &amp;lt;...&amp;gt;,&lt;/P&gt;&lt;P&gt;        objref TYPE REF TO &amp;lt;SALES_ORDER_CLASS&amp;gt;&lt;/P&gt;&lt;P&gt;      END OF obj_sales_order,&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      reftab LIKE SORTED TABLES OF obj_sales_order&lt;/P&gt;&lt;P&gt;                  WITH UNIQUE KEY sales_order_no &lt;/P&gt;&lt;P&gt;                                  &amp;lt;other key attributes&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now all you need to do is to do a SELECT...ENDSELECT loop, and:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ...&lt;/P&gt;&lt;P&gt;obj_sales_order-sales_order_no = &amp;lt;selection result&amp;gt;&lt;/P&gt;&lt;P&gt;obj_sales_order-&amp;lt;other key attr&amp;gt; = &amp;lt;selection result&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;READ TABLE reftab INTO obj_sales_order&lt;/P&gt;&lt;P&gt;                  FROM obj_sales_order.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj_sales_order-objref&lt;/P&gt;&lt;P&gt;         EXPORTING ...&lt;/P&gt;&lt;P&gt;         EXCEPTIONS ...&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ...&lt;/P&gt;&lt;P&gt;    CONTINUE.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    INSERT obj_sales_order INTO TABLE reftab.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CALL METHOD obj_sales_order-objref-&amp;gt;&amp;lt;method&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 07:17:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268814#M492665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T07:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ref to objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268815#M492666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;parameter p_cls(30)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data obj type ref to &amp;lt;interface&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT obj TYPE (p_cls).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward with points, if useful.&lt;/P&gt;&lt;P&gt;Darshil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 07:19:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268815#M492666</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T07:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ref to objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268816#M492667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darshil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, question answered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 07:32:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-ref-to-objects/m-p/2268816#M492667</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T07:32:34Z</dc:date>
    </item>
  </channel>
</rss>

