Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Class attribute getting *** illegal reference *** while executing class in SAP 4.7 version.

Former Member
0 Likes
859

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.

3 REPLIES 3
Read only

ceedee666
SAP Champion
SAP Champion
0 Likes
630

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

Read only

Former Member
0 Likes
630

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.

Read only

0 Likes
630

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