How To Fix OO087 - Only C destructors are currently supported


SAP Error Message - Details

  • Message type: E = Error

  • Message class: OO - Class Builder/API

  • Message number: 087

  • Message text: Only C destructors are currently supported

  • Show details Hide details
  • What causes this issue?

    A destructor is a special method that is automatically called when an
    object is deleted. You can use destructors to destroy resources that
    are used by the object but not taken into account by the garbage
    collector. There is not currently a destructor in ABAP Objects in which
    you can program a normal ABAP processing block.

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

    For special cases, and only for internal use, you can create the
    special predefined instance method DESTRUCTOR in the public section
    of the class.
    The implementation of the method DESTRUCTOR may currently only
    contain this one statement:
    SYSTEM-CALL C-DESTRUCTOR 'name' USING attr.

    Error message extract from SAP system. Copyright SAP SE.


Smart SAP Assistant

  • What is the cause and solution for SAP error message OO087 - Only C destructors are currently supported ?

    The SAP error message "OO087 Only C destructors are currently supported" typically occurs in the context of ABAP Object-Oriented programming when there is an attempt to use a destructor that is not compatible with the current implementation of the ABAP runtime environment.

    Cause:

    1. Non-C Destructor Usage: The error indicates that the destructor being defined or used is not a C-style destructor. In ABAP, destructors should be defined in a specific way that adheres to the C-style conventions.
    2. Incorrect Class Definition: The class might be defined in a way that is not compatible with the expected destructor format.
    3. Inheritance Issues: If the class is inheriting from another class that has a non-C destructor, it may lead to this error.

    Solution:

    1. Check Destructor Definition: Ensure that the destructor is defined correctly in your class. The destructor should be defined using the DESSTRUCTOR keyword and should not have any parameters. For example:

      CLASS my_class DEFINITION.
        PUBLIC SECTION.
          METHODS: constructor,
                   destructor.
      ENDCLASS.
      
      CLASS my_class IMPLEMENTATION.
        METHOD constructor.
          " Constructor logic
        ENDMETHOD.
      
        METHOD destructor.
          " Destructor logic
        ENDMETHOD.
      ENDCLASS.
    2. Review Inheritance: If your class is inheriting from another class, check the parent class's destructor. Ensure that it is also defined correctly and adheres to the C-style destructor conventions.

    3. Update ABAP Version: If you are using an older version of ABAP, consider updating to a newer version that may have better support for object-oriented features.

    4. Consult Documentation: Refer to the official SAP documentation for object-oriented programming in ABAP to ensure compliance with the latest standards and practices.

    5. Debugging: If the issue persists, use debugging tools to trace the execution and identify where the error is being triggered.

    Related Information:

    • ABAP Object-Oriented Programming: Understanding the principles of object-oriented programming in ABAP can help in avoiding such errors. Familiarize yourself with classes, methods, constructors, and destructors.
    • SAP Notes: Check SAP Notes for any known issues or patches related to this error message.
    • Community Forums: Engage with the SAP community forums or Stack Overflow for insights from other developers who may have encountered similar issues.

    By following these steps, you should be able to resolve the "OO087 Only C destructors are currently supported" error in your ABAP code.

    • 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 simplifies finding the accurate answers to SAP message errors. I now use every week. A must have tool for anyone working with SAP! Highly recommended!
Rate 1
Kent Bettisworth
Executive SAP Consultant