How To Fix EU357 - Method &1 of the class &2 is not public


SAP Error Message - Details

  • Message type: E = Error

  • Message class: EU - Development Environment

  • Message number: 357

  • Message text: Method &1 of the class &2 is not public

  • Show details Hide details
  • What causes this issue?

    Start methods for a transaction must always be public methods.

    System Response

    The system issues an error message and will not allow you to continue with this transaction until the error is resolved.

    How to fix this error?

    Procedure for System Administrators


    Error message extract from SAP system. Copyright SAP SE.


Smart SAP Assistant

  • What is the cause and solution for SAP error message EU357 - Method &1 of the class &2 is not public ?

    The SAP error message EU357 indicates that there is an issue with the visibility of a method in an ABAP class. Specifically, it means that the method you are trying to access is not declared as public, which restricts its visibility and accessibility from outside the class.

    Cause:

    1. Method Visibility: The method you are trying to call is defined with a visibility level that does not allow it to be accessed from the context in which you are trying to use it. In ABAP, methods can be declared as PUBLIC, PROTECTED, or PRIVATE. If a method is declared as PROTECTED or PRIVATE, it cannot be accessed from outside the class or from subclasses (in the case of PROTECTED).

    2. Incorrect Class Reference: You might be trying to call a method from an instance of a class that does not have the method defined as public.

    Solution:

    1. Change Method Visibility: If you have access to the class definition, you can change the visibility of the method to PUBLIC. This can be done by modifying the class definition in the ABAP Workbench (SE80 or SE24):

      • Open the class in the ABAP Workbench.
      • Locate the method in the method list.
      • Change its visibility from PROTECTED or PRIVATE to PUBLIC.
    2. Check Method Call: Ensure that you are calling the method correctly and that you are using the right instance of the class. If the method is intended to be used only within the class or its subclasses, you may need to refactor your code to comply with the intended design.

    3. Use Alternative Methods: If changing the visibility is not an option (for example, if the class is part of a standard SAP package), look for alternative public methods that provide similar functionality.

    Related Information:

    • ABAP Class Visibility: Understanding the visibility levels in ABAP is crucial for proper class design and usage. The three visibility levels are:

      • PUBLIC: Accessible from anywhere.
      • PROTECTED: Accessible only within the class itself and its subclasses.
      • PRIVATE: Accessible only within the class itself.
    • Debugging: If you encounter this error, you can use the ABAP debugger to trace the method calls and see where the access violation occurs.

    • Documentation: Refer to the official SAP documentation for more details on class design and method visibility in ABAP.

    By addressing the visibility of the method or adjusting your code to comply with the class design, you should be able to resolve the EU357 error.

    • Do you have any question about this error?


      Upgrade now to chat with this error.


Instant HelpGet instant SAP help. Start your 7-day free trial now.


Related SAP Error Messages

Click the links below to see the following related messages:

Click on this link to search all SAP messages.


Rating
ERPlingo's SAP support assistant is amazing. Saves me countless hours trying to solve complex SAP issues myself. It's a real game changer!
Rate 1
Thomas Michael
SAP Consultant, Author & Speaker