How To Fix OO804 - Class &1 is abstract and cannot be instantiated


SAP Error Message - Details

  • Message type: E = Error

  • Message class: OO - Class Builder/API

  • Message number: 804

  • Message text: Class &1 is abstract and cannot be instantiated

  • Show details Hide details
  • What causes this issue?

    The class is flagged as abstract. Abstract classes cannot be
    instantiated, but only their non-abstract subclasses.

    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?

    Test a non-abstract subclass.

    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 OO804 - Class &1 is abstract and cannot be instantiated ?

    The SAP error message OO804 indicates that you are trying to instantiate an abstract class in ABAP (Advanced Business Application Programming). An abstract class is a class that cannot be instantiated directly; it is meant to be a base class that other classes can inherit from and implement its abstract methods.

    Cause:

    The error occurs when:

    1. You attempt to create an instance of an abstract class using the CREATE OBJECT statement.
    2. The class you are trying to instantiate is defined as abstract in its declaration.

    Solution:

    To resolve this error, you need to do the following:

    1. Check Class Definition: Verify that the class you are trying to instantiate is indeed abstract. You can do this by checking the class definition in the ABAP Workbench (SE80 or SE24).

    2. Use a Concrete Subclass: Instead of trying to instantiate the abstract class directly, you should instantiate a concrete subclass that inherits from the abstract class. The subclass should implement all the abstract methods defined in the abstract class.

      Example:

      " Assuming 'ZCL_ABSTRACT' is the abstract class
      " and 'ZCL_CONCRETE' is a concrete subclass
      DATA(lo_object) = NEW zcl_concrete( ).
    3. Implement Required Methods: Ensure that the concrete subclass implements all the abstract methods defined in the abstract class. If any abstract methods are not implemented, you will not be able to instantiate the subclass.

    Related Information:

    • Abstract Classes: In ABAP, an abstract class is defined using the ABSTRACT keyword in the class definition. It can contain abstract methods (methods without an implementation) that must be implemented by any concrete subclass.

    • Inheritance: Abstract classes are often used in object-oriented programming to define a common interface or behavior that can be shared among multiple subclasses.

    • Documentation: For more information on object-oriented programming in ABAP, you can refer to the official SAP documentation or the ABAP programming guidelines.

    By following these steps, you should be able to resolve the OO804 error and successfully work with your classes in ABAP.

    • 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
The AI Support Assistant is great. It provides comprehensive assistance even on the most difficult issues. I highly recommend this service.
Rate 1
John Jordan
SAP Consultant & Author