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

Calling Instance Method in a Global Class

Former Member
0 Likes
6,816

Hi All,

Please can you tell me how to call a instance method created in a global class in different program.

This is the code which I have written,

data: g_cl type ref to <global class>.

call method g_cl -> <method name>

I am not able to create Create object <object>.

It is throwing the error message " Instance class cannot be called outside...."

Please can anybody help me..

*Text deleted by moderator*

Thanks

Sushmitha

5 REPLIES 5
Read only

matt
Active Contributor
0 Likes
2,593

Look at the global class attributes in SE24. It probably has instantiation set to "private". Look at the methods of the class. There's probably a method called FACTORY, or CREATE. These are what you should use to instantiate the class - not the CREATE OBJECT.

matt

Read only

Former Member
0 Likes
2,593

Hi Matt,

I have a similar scenario in which i have to call a instance method from the class 'CL_HRECM00_BUDGET_EE_SRV', in which the instantiation is set to 'Private' but there is no such methods by name 'FACTORY' or CREATE. How shall i call a instance method in my case. Please help me.

Regards,

Sarathy.

Read only

Former Member
0 Likes
2,593

what is the global class....?

Read only

Former Member
0 Likes
2,593

Hi susmitha,

1.

data: g_cl type ref to <global class>.

2.

Create object <object>.

3.

call method g_cl -> <method name>.

if still you are getting error.

then first check that method level and visibility in se24.

1.if level is static you can not call it threw object.

2. if visibility is protected or private then you can not call it directly.

If still you are facing same problem please paste the in this thread so that i can help you better.

Regards.

Punit

Edited by: Punit Singh on Nov 3, 2008 11:54 AM

Read only

Former Member
0 Likes
2,593

Thanks a lot!