‎2012 Dec 07 3:34 PM
Dear experts,
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:
DATA object_reference TYPE REF TO object.
DATA name_of_the_object TYPE classname value 'CL_FOBU_FORMULA'.
CREATE OBECT <obj_reference> TYPE (name_of_the_object)
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
DYN_CALL_METH_PARAM_TYPE
CX_SY_DYN_CALL_ILLEGAL_TYPE
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?
Thanks in advance
Andreas
‎2012 Dec 07 6:32 PM
Hello Andreas,
I am assuming that you are using an object type 'OBJECT' to pass into the parameter 'IM_ENVIRONMENT'.
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.
Do correct me If I am missing anything here.
Thanks,
Venkat
‎2012 Dec 07 6:32 PM
Hello Andreas,
I am assuming that you are using an object type 'OBJECT' to pass into the parameter 'IM_ENVIRONMENT'.
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.
Do correct me If I am missing anything here.
Thanks,
Venkat
‎2012 Dec 10 8:31 AM
Dear Venkat,
you're assuming right that I declared the reference variable that I wanted to pass as of type OBJECT,
assuming that I dynamically could create an instance of an object that includes the IF_FOBU_CONNECTOR interface.
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.
Nonetheless - thanks a lot for your answer that I've marked as helpful!
Andreas