Show TOC

Propagating an ExceptionLocate this document in the navigation structure

You can add an exception to the method signature based on an existing RAISE EXCEPTION statement of the method implementation.

Prerequisites

This functionality is provided since SAP NetWeaver 7.5 SP00.

Context

Example

Before Execution After Execution

To copy the source code example, click here Code Example Before Execution

In the implementation of the drive method, the check_fuel method that can raise an exception is called. In order to propagate the exception, you need to define it in the public section. In the signature of the drive method, the cx_no_fuel exception class is added to the RAISING clause.

Procedure

  1. In the implementation part, select the exception class that you want to define in the method signature.
  2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
  3. Apply Add raising declaration.