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

More instances

Former Member
0 Likes
391

Hi!

I think it will be easy for you, but it's still unclear for me.

I've created a class in SE24 called ZCL_HK with a method called TEST, please read the following code.

DATA: hk TYPE REF TO ZCL_HK.

CREATE OBJECT hk.

CALL METHOD hk->test.

CALL METHOD hk->test.

CALL METHOD hk->test.

CREATE OBJECT hk.

CALL METHOD hk->test.

CALL METHOD hk->test.

CREATE OBJECT hk.

CALL METHOD hk->test.

Each create object statement creates a new instance of the class.

My question is, now, how can I access the 3 different instances and their methods and attributes? I mean now I wanted to access both the 1st and the second instances attributes, not only the third...

Thank you

Tamás

Edited by: Tamás Nyisztor on Aug 4, 2009 1:13 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
349

hi,

you need to create 3 object ref variable with different name like hk1, hk2, .... of the same class... then use the create object statement to create 3 different instances ..... then you can access all their methods and respective attributes.

hope this will surely help you!!!

thanks & regards,

Punit Raval.

hi,

you need to create 3 object ref variable with different name like hk1, hk2, .... of the same class... then use the create object statement to create 3 different instances ..... then you can access all their methods and respective attributes.

hope this will surely help you!!!

thanks & regards,

Punit Raval.

1 REPLY 1
Read only

Former Member
0 Likes
350

hi,

you need to create 3 object ref variable with different name like hk1, hk2, .... of the same class... then use the create object statement to create 3 different instances ..... then you can access all their methods and respective attributes.

hope this will surely help you!!!

thanks & regards,

Punit Raval.