ABAP Runtime Errors

CALL_METHOD_NOT_ACCESSIBLE SAP ABAP Runtime Error call method not accessible







CALL_METHOD_NOT_ACCESSIBLE is an ABAP runtime error which you may come across when using or developing within an SAP system. See below for the standard details explaining what it means and how you can avoid or fix this runtime error.

Short Dump Classification: A - ABAP Programming Error

You can view further information about a runtme error by using transaction code ST22 which will show you this and all runtime erros that have happen in your SAP system.

Also check out the Comments section below to view or add related contributions and example screen shots.


CALL_METHOD_NOT_ACCESSIBLE ABAP Runtime Error

The source code needs to be modified. In a CONSTRUCTOR, you should not use a reference to point to a subclass. The method cannot be accessed. Please see abap error for more details about the possible cause of this runtime error and how it could be avoided.

An attempt was made to call a 'non-visible' method. This problem can occur when calling methods from within a CONSTRUCTOR in ABAP Objects of a superclass.

How can this happen?

In ABAP Objects, the methods of any subclasses that can exist are NOT visible while a CONSTRUCTOR is running (during CREATE OBJECT). For example: Class C0 has a method m1, while C1 inherits from C0 and has redefined m1 (REDEFINITION). Both classes also have a CONSTRUCTOR. You now use CREATE OBJECT to create a new instance of C1.
The system then first processes the CONSTRUCTOR of C1 which then uses SUPER-> to call the CONSTRUCTOR of C0. If the system now calls method m1 from within the CONSTRUCTOR of C0, m1 of C0 is called instead of m1 of C1. This is to ensure that no methods of an object (of C1) are processed before the CONSTRUCTOR has been completely processed.
Now imagine C1 has another method m2 and implements an interface I1 (which in turn has a method m3). If you now use a reference of type C1 in the CONSTRUCTOR of C0 to point to the newly created instance 'ME', and then call method m2, this method is 'not visible', and this runtime error occurs.
The same happens if the ME is submitted using an interface reference, and an attempt is made to call an i1->m3.

Note that methods of subclasses are not visible while the CONSTRUCTOR is running, and not just in the CONSTRUCTOR. The same applies another method is called from within the CONSTRUCTOR which then in turn wants to call the method which is 'not visible'.

The current situation:

The instance created is of type '<runtime parameter>', but only components up to '<runtime parameter>' are visible. Please see abap error for more details about the possible cause of this runtime error and how it could be avoided.