GET_SOURCE_POSITION , are applied at the position of the RAISE
statement. In addition, the attribute IS_RESUMABLE is set to a
new value, depending on how the addition RESUMABLE is used.
The RAISE EXCEPTION statement must not be used in a method or
function module in whose interface
non-class-based exceptions are declared. Also, the statement does not
permit simultaneous use of the
CATCHSYSTEM-EXCEPTIONS statement for the obsolete handling of
catchable runtime errors , and
the RAISE or
MESSAGE RAISING statements to raise
non-class-based exceptions in function modules and methods in the
current processing block.
Latest notes: If the TYPE addition is used, an exception object
is only created when required, for performance reasons, that is, when an
appropriate CATCH or CLEANUP block with the addition
INTO is used in a surrounding TRY control
structure. In principle, an exception is the same thing as an exception
object being generated. A difference in behavior can occur only if a
non-handled exception of the instance constructor replaces the original
exception when the object is generated. However, this situation should
never arise.
If oref is specified, either an exception object instantiated
using CREATE OBJECT can be used, or an exception that was
previously caught during exception handling can be raised again.
If a caught exception is raised again, note that the exception object
does not remain unmodified and that the information about the position
of the exception is changed. If the original information is to be
propagated to an external handler, a new exception from the same class
can be raised. The original exception object is then passed to the
parameter PREVIOUS of the constructor of this class. It may be
enough to propagate the original exception implicitly (and not raise it
again using RAISE ). The corresponding original exception can then
be evaluated in the CLEANUP block, if
required
If a procedure is exited by raising an
exception, the content of the formal parameter for which the
pass by value is defined is not
assigned to the respective actual parameters.
Only the constants of the exception class that specify an
exception text of the exception class
should be passed to the TEXTID input parameters of the instance
constructor of the exception class.
The addition THROW in
a conditional expression makes it
possible to raise a class-based exception in an operand position.
Example ABAP Coding See Exceptions, RAISE .
Example ABAP Coding A predefined exception is raised explicitly for which an
exception text other than the standard exception text is selected and
whose placeholder TOKEN is filled by passing a
value to the attribute with the same name.
DATA exc TYPE REF TO cx_sy_dynamic_osql_semantics.
TRY.
...
RAISE EXCEPTION TYPE cx_sy_dynamic_osql_semantics
EXPORTING textid =
cx_sy_dynamic_osql_semantics=>unknown_table_name
token = 'Test'.
...
CATCH cx_sy_dynamic_osql_semantics INTO exc.
MESSAGE exc->get_text( ) TYPE 'I'.
ENDTRY.
ABAP_ADDITION ... RESUMABLE
What does it do? The RESUMABLE addition raises an exception as a
resumable exception . When an
exception of this type is handled in a CATCH
block, the RESUME statement can be used to
jump back to directly before the raising statement, as long as the
context of the exception was not deleted before the exception was
handled.
Latest notes: If the RESUMABLE statement is used to raise an
exception as a resumable exception
, the handler has to determine whether processing is resumed after
RAISE EXCEPTION , or whether processing for the current context is
canceled completely. Both alternatives can occur when an exception is
raised. It is important to note that CLEANUP
blocks are only executed when the context is deleted.
When exceptions of the types CX_STATIC_CHECK and
CX_DYNAMIC_CHECK (which are raised as resumable) are propagated, they
can become non-resumable if the RESUMABLE addition is not
declared for the RAISING addition (for the exception) in each
interface involved.
When exceptions of type CX_NO_CHECK are propagated, the
resumable attribute is always retained. However, caution should be used
when raising exceptions of type CX_NO_CHECK as resumable, and it
is important to ensure a procedure always displays the required
behavior.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved