sapdev logo background
sapdev logo sapdev logo
Comments

SAP EXCEPTIONS PRE 610 documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Exceptions Before Class-Based Exceptions
Exceptions are class-based . Before the introduction of exception classes, there were the following types of exceptions:
  • Exception situations detected by the system whose causes could be handled effectively by the program, raised

  • catchable runtime errors that could be handled by the statement CATCH SYSTEM-EXCEPTIONS . Catchable runtime errors are obsolete. An exception class is assigned to each catchable runtime error, to be handled in a TRY block . Conversely, not all predefined, class-based exceptions are assigned to a catchable runtime error. No new catchable runtime errors are created, and existing runtime errors that should be made ready for handling are no longer converted to catchable runtime errors. Instead, exception classes are assigned to them.
  • Self-defined handleable exceptions were allowed only in the interfaces of function modules and methods. These types of exceptions can be raised within the

  • procedure by the statement RAISE or MESSAGE RAISING as soon as an exception situation is recognized. The procedure caller can use the addition EXCEPTIONS of the statement
    CALL FUNCTION or meth( ... )
    to assign return codes for the system field sy-subrc to the exceptions the caller wants to handle and evaluate them after the call. However, this is not true exception handling in the sense of reacting to an event.

    Interaction of the Exception Concepts
    The class-based exceptions replace and enhance the previous concepts in full. Class-based exceptions can be raised and handled in all ABAP contexts (programs, processing blocks). In particular, all previously catchable runtime errors can be handled as class-based exceptions, with the previous exception groups being mapped to shared superclasses. For reasons of downward-compatibility, the catchable runtime errors and the non-class-based exceptions defined in the interfaces of methods and function modules have not been abolished, but their use has been restricted as follows:
  • Within a processing block , only one kind of exception can be raised.

  • Within a procedure interface, the declaration of class-based exceptions and the definition of non-class-based exceptions exclude one another.

  • Within a processing block, catchable runtime errors cannot be caught using CATCH SYSTEM-EXCEPTIONS if class-based exceptions are handled there in TRY blocks or are raised using RAISE EXCEPTION

  • or the addition THROW
    in a conditional expression . Instead, catchable runtime errors must be caught when handling the associated class-based exception.
    For reasons of interoperability, class-based exceptions can be handled within a processing block and return codes of function modules and methods evaluated there using non-class-based exceptions.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    EXCEPTIONS_NON_CLASS
    EXCEPTIONS_PROCEDURES




    comments powered by Disqus