2014 Oct 22 10:42 AM
Hi Experts,
I have define a CLASS C1 in SAP 4.7 with Class Atribute A1 TYPE REF TO to CLASS C2.
If i execute this class C1 then all atrubutes for TYPE REF TO are showing *** illegal reference *** error where same thing is I tried in SAP ECC version in this system initialise Attributes to Initial.
So why this SAP 4.7 version does not Initialise Attribute variable for Class.
Please Suggest.
Thanks,
Idris Ahmed Khan.
2014 Oct 22 10:52 AM
Hi Idris,
have you tried to create an instance using "CREATE OBJECT". Maybe the ***illegal reference*** is just the value of an uninitialized reference in 4.7.
Christian
2014 Oct 22 11:03 AM
Hi Christian,
Thank you for reply. but same process working in ECC without CREATE OBJECT. it just initialise attribute without creating instance object.
Thanks,
Idris.
2014 Oct 22 12:56 PM
Hi Idris,
do you understand the difference between declaring a reference variable (DATA A1 TYPE REF TO C1) and actually assigning a value to this reference variable ( e.g. by creating an object instance and assinging this instance to the reference variable using CREATE OBJECT A1)? Without assigning an object instance to the variable it is not possible to invoke an methods or access an variable. If you would try to call a method in ECC on the initial reference variable A1 (e.g. A1->test( )) you'll get a dump.
I suspect that ***illegal reference*** is just the invalid value of a reference varible after declaring it. Therefor there is no difference between 4.7 and ECC. You need to assign an object to the variable first. A initial referende variable is just displayed differently.
Christian