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

Instance method with private visibility.

0 Kudos

Hi Experts,

How can I call a private instance method from a standard class?

For example, in class "CL_SMT_STORAGE," I want to call 'GET_DB_MAPPING_FIELDS'.

Thanks in advance.


Berinath Ulisi.


Active Contributor
0 Kudos

By definition, you cannot call a private instance method from outside the class. There are reasons for that behaviour.

If you can create a Z class and make it global friend with the standard one, you will be able to call it, but I'm not sure if it's a good practice (and I cannot even remember if the GLOBAL FRIENDS sentence must be add to the Z or the standard class... if the latter, do NOT do it!!!).

There must be a reason for SAP to put that method as a private.