<?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 Problem with creating ABAP Objects instances dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142202#M1709643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;recently I've written an application that includes the SAP formula editor (classes CL_FOBU_FORMULA, CL_FOEV_FORMULA, etc.) in a subscreen. Now I'm supposed to rework my program for our customers who still have 4.6C systems, in which those classes don't yet exist. The application doesn't necessarily need to work under 4.6C. The minimum requirement is that at least it doesn't cause loads of errors during the import in the customers system. My approach was to check my options to create all the necessary object instances dynamically and only after successfully checking their existence in system, by using the dynamic TYPE assignment that can be used with the CREATE OBJECT statement, as shown in the following code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA object_reference TYPE REF TO object. &lt;/P&gt;&lt;P&gt;DATA name_of_the_object TYPE classname value 'CL_FOBU_FORMULA'.&lt;/P&gt;&lt;P&gt;CREATE OBECT &amp;lt;obj_reference&amp;gt; TYPE (name_of_the_object)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The creation of objects seems to work fine, at least the creation of object instances doesn't cause short dumps, but it looks as if the instances created this way are not fully compatible with objects that have been created in the normal non-dynamic way. When dynamically calling either of the CL_FOBU_FORMULA methods LOAD or CREATE I get a parameter mismatch short dump&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DYN_CALL_METH_PARAM_TYPE&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;CX_SY_DYN_CALL_ILLEGAL_TYPE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which refers to an object instance that I'm handing over to the parameter IM_ENVIRONMENT. This object instance was created the "dynamic way", as shown above. I don't get the short dump when the instances are created non-dynamic. Does anybody in the ABAP developer community have had those kinds of problems, too? Any experience that I could benefit from?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2012 15:34:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-12-07T15:34:08Z</dc:date>
    <item>
      <title>Problem with creating ABAP Objects instances dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142202#M1709643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;recently I've written an application that includes the SAP formula editor (classes CL_FOBU_FORMULA, CL_FOEV_FORMULA, etc.) in a subscreen. Now I'm supposed to rework my program for our customers who still have 4.6C systems, in which those classes don't yet exist. The application doesn't necessarily need to work under 4.6C. The minimum requirement is that at least it doesn't cause loads of errors during the import in the customers system. My approach was to check my options to create all the necessary object instances dynamically and only after successfully checking their existence in system, by using the dynamic TYPE assignment that can be used with the CREATE OBJECT statement, as shown in the following code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA object_reference TYPE REF TO object. &lt;/P&gt;&lt;P&gt;DATA name_of_the_object TYPE classname value 'CL_FOBU_FORMULA'.&lt;/P&gt;&lt;P&gt;CREATE OBECT &amp;lt;obj_reference&amp;gt; TYPE (name_of_the_object)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The creation of objects seems to work fine, at least the creation of object instances doesn't cause short dumps, but it looks as if the instances created this way are not fully compatible with objects that have been created in the normal non-dynamic way. When dynamically calling either of the CL_FOBU_FORMULA methods LOAD or CREATE I get a parameter mismatch short dump&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DYN_CALL_METH_PARAM_TYPE&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;CX_SY_DYN_CALL_ILLEGAL_TYPE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which refers to an object instance that I'm handing over to the parameter IM_ENVIRONMENT. This object instance was created the "dynamic way", as shown above. I don't get the short dump when the instances are created non-dynamic. Does anybody in the ABAP developer community have had those kinds of problems, too? Any experience that I could benefit from?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 15:34:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142202#M1709643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-12-07T15:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with creating ABAP Objects instances dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142203#M1709644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andreas, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am assuming that you are using an object type 'OBJECT' to pass into the parameter 'IM_ENVIRONMENT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameter mismatch could be due to the fact that you are passing an object reference of type 'OBJECT' to a parameter which would accept references of type IF_FOBU_CONNECTOR, thereby narrowing the cast. I am not sure if this issue would arise only in 4.6c . If my assumption is right, then the above error should come in all systems, simply due to the fact that class type 'Object' does not implement the interface IF_FOBU_CONNECTOR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do correct me If I am missing anything here. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 18:32:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142203#M1709644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-12-07T18:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with creating ABAP Objects instances dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142204#M1709645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you're assuming right that I declared the reference variable that I wanted to pass as of type OBJECT,&lt;/P&gt;&lt;P&gt;assuming that I dynamically could create an instance of an object that includes the IF_FOBU_CONNECTOR interface. &lt;/P&gt;&lt;P&gt;I guess I will close this thread because meanwhile I've realized that there doesn't seem to exist a way of surviving a syntax-check in 4.6C. &lt;/P&gt;&lt;P&gt;Nonetheless - thanks a lot for your answer that I've marked as helpful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2012 08:31:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-creating-abap-objects-instances-dynamically/m-p/9142204#M1709645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-12-10T08:31:00Z</dc:date>
    </item>
  </channel>
</rss>

