ABAP Keyword Documentation → ABAP − Reference → Program Flow Logic → Exception Handling → Runtime Error
RAISE SHORTDUMP
Other versions:
7.31 | 7.40 | 7.54
Syntax
RAISE SHORTDUMP
{ {TYPE cx_class [
message] [EXPORTING p1 = a1 p2 = a2 ...]}
| oref }.
Effect
This statement interrupts the execution of the current statement block and raises the
runtime error RAISE_SHORTDUMP. This performs a
database rollback. This runtime error is associated with an
exception object using TYPE
or oref
:
-
If the addition
TYPE
is specified, an exception object of the exception class cx_class is created. Every exception classcx_class
visible at this point can be specified afterTYPE
. The exception category is ignored.
- The addition
EXPORTING
can be used to assign actual parameters to the input parameters of the instance constructor. The syntax and semantics are the same as for the statementRAISE EXCEPTION
.
-
If
oref
is specified, no new exception object is created.oref
expects an object reference variable that points to an existing exception object. The static type oforef
must be an exception class (namely a subclass of CX_ROOT or the class itself).oref
is a general expression position. In the existing exception object, the internal attributes that describe the location of the exception are applied at the location of theRAISE
statement.
The short dump of the runtime error contains the name of the exception class and the exception text. The attributes of the exception object can be displayed in the transaction ST22. Under Chain of Exception Objects, the long text of the short dump contains the attributes referenced in the attribute PREVIOUS of the exception object.
Notes
-
The statement
RAISE SHORTDUMP
works in roughly the same way as used to raise a class-based exception that does not have a handler. There is no propagation from procedures, however, which removes the risk of violating interfaces and raising further exceptions such as CX_SY_NO_HANDLER. This means that the exception category of the exception class in question is ignored inRAISE SHORTDUMP
. -
The statement
RAISE SHORTDUMP
does not raise class-based exception that can be caught usingCATCH
. The exception object is used exclusively for the transport of information to the short dump. -
The statement
RAISE SHORTDUMP
is an alternative to raising exit messages ( messages of type X). The attributes of the exception class are capable of sending more information about an error to the short dump than a message text. More specifically, the attribute PREVIOUS can reference preceding exceptions. -
If
oref
is specified, either an exception object instantiated usingNEW
or CREATE OBJECT can be used or a previously caught exception can be transformed into a runtime error in exception handling. - If a caught exception is transformed into a runtime error, it should be noted 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 transported to the short dump, a new exception object from the same class can be created. The original exception object is then passed to the constructor parameter PREVIOUS of the new object.
-
The addition
THROW SHORTDUMP
in a conditional expression makes it possible to raise a runtime error in an operand position.
Example
Raises a runtime error with an exception object of the exception class CX_DEMO_T100. The instance constructor is given parameters that define the exception text and fill any variable text parts with values.
RAISE SHORTDUMP TYPE cx_demo_t100
EXPORTING
textid = cx_demo_t100=>demo
text1 = 'I'
text2 = 'need'
text3 = 'a'
text4 = 'break!'.
Example
Like the previous example, but the exception object is created first and not in the statement RAISE SHORTDUMP
.
DATA(oref) = NEW cx_demo_t100(
textid = cx_demo_t100=>demo
text1 = 'I'
text2 = 'need'
text3 = 'a'
text4 = 'break!' ).
RAISE SHORTDUMP oref.
Example
Raises a runtime error when an exception is handled. A reference to the preceding exception object of
the class cx_sy_zerodivide
is passed to the attribute PREVIOUS of the new
exception object of the class cx_demo
. The chain of exception objects is displayed in the long text of the short dump.
CLASS cx_demo DEFINITION INHERITING FROM cx_static_check.
ENDCLASS.
CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main RAISING cx_sy_zerodivide.
ENDCLASS.
CLASS demo IMPLEMENTATION.
METHOD main.
DATA(num) = 1 / 0.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
TRY.
demo=>main( ).
CATCH cx_sy_zerodivide INTO DATA(oref).
RAISE SHORTDUMP TYPE cx_demo EXPORTING previous = oref.
ENDTRY.