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

how to assign current class reference to a variable

RachamallaKiran
Participant
0 Likes
2,721

hi all,

i want to assign current class reference to a variable.

ex; in the below example i am not knowing how to assign lref_A1 in class A2 with reference of A1.

may i know how to assign it.

class A1 defination,
 methods first,
endclass

class A2,
data lref_A1 type ref to A1,
methods some_test,
endclass.

class A1 implementaion.
method first.
create object lref_new2 type ref to A2.
*****how to assign lref_A1 the current reference 

***lref_new2-lref_A1 = this or lref_new2-lref_A1 = me "is not working 

********how to assign
end method.
endclass.

create object lref_new type A1.
lref_new->first( ).
1 ACCEPTED SOLUTION
Read only

Muthu_raja
Active Participant
0 Likes
2,016

Hi Kiran,

ME should work

class a1 implementation.

  method first.

    data: lref_new2 type ref to a2.

    create object lref_new2.

    lref_new2->lref_A1 = me.

  endmethod.

endclass.


Regards,

Muthu

5 REPLIES 5
Read only

Muthu_raja
Active Participant
0 Likes
2,017

Hi Kiran,

ME should work

class a1 implementation.

  method first.

    data: lref_new2 type ref to a2.

    create object lref_new2.

    lref_new2->lref_A1 = me.

  endmethod.

endclass.


Regards,

Muthu

Read only

2,016

kiran rachamalla tried ME but it couldn't work because the true error was that an attribute cannot be assigned with the structure component selector (minus character), it can be assigned only with the object component selector ->.

Read only

0 Likes
2,016

Yes Sandra, Exactly.

Read only

0 Likes
2,016

hi Muthu,

i only placed wrong actually i placed type ref to data

that leads to issue.

now corrected .

Regards,

kiran rachamalla.

Read only

0 Likes
2,016

So, Kiran, as far as I understand, your question had so many typos that nobody could even find the right issue. Next time, post a compilable source code, PLEASE!