ABAPCATCH_SYS - CATCH SYS
Vendor Master (General Section) ROGBILLS - Synchronize billing plansThis documentation is copyright by SAP AG.
CATCH SYSTEM-EXCEPTIONS
Obsolete Syntax
CATCH SYSTEM-EXCEPTIONS [exc1 = n1 exc2 = n2 ...]
[OTHERS = n_others].
[statement_block]
ENDCATCH.
Effect
The statement CATCH SYSTEM-EXCEPTIONS introduces a control structure containing a statement block statement_block that is always processed. In the list exc1 = n1 exc2 = n2 ..., you can listcatchable runtime errors andexception groups in any order. The numberic literal n1 n2 ... must be assigned to each of them.
The OTHERS addition can be executed independently or after the list exc1 = n1 exc2 = n2 ....Its effect is the same as the specification of an exception group that includes all catchable runtime errors of the runtime environment.
The system treats the CATCH control structure as follows:
- If one of the specified catchable runtime errors or a catchable runtime error contained in the specifiedexception groups occurs in the statement_block, the execution of the statement block is immediatelyterminated, the program continues after the statement ENDCATCH, and the number n1 n2 ...assigned to the catchable runtime error or the exception group, is stored for evaluation in the systemfield sy-subrc. If the list contains a catchable runtime error and its exception group or ifa catchable runtime error occurs in more than one of the specified exception groups, sy-subrc contains the assigned number of the first position in the list.
- If a catchable runtime error that is not listed in the statement CATCH SYSTEM-EXCEPTIONS or is not contained in one of the specified exception groups occurs in the statement block, the program terminates with a short dump.
- If the end of the statement block is reached and no runtime error occurs, sy-subrc is set to 0.
A CATCH control structure cannot be defined in the sameprocessingblock, in which the class-based exceptions are handled in a TRYcontrol structure or are triggered by the statement RAISE EXCEPTION.
Notes
- Catchable runtime errors are not passed from calledproceduresto the caller. They can only be caught within a processing block. Within a processing block, catchableruntime errors are caught in control structures that can be nested in any depth. If multiple CATCHcontrol structures are nested, the system branches behind the ENDCATCH statement of the inner CATCH control structure that handles the runtime error.
- The handling of catchable runtime errors using CATCH SYSTEM-EXCEPTIONS is obsolete and shouldbe replaced with a TRYcontrol structure. Since class-based exceptions are assigned to all catchable runtime errors, this ispossible without restriction. In particular, the exceptions can be passed from procedures using a TRY control structure.
Example
Catching all possible catchable runtime errors in a statement block. Catchable runtime errors of theexception group ARITHMETIC_ERRORS set sy-subrc to 4, all other catchable runtime errors set sy-subrcto 8. The division by 0 causes the catchable runtime error COMPUTE_INT_ZERODIVIDE, which is contained in the exception group ARITHMETIC_ERRORS. In this case, sy-subrc is also set to 4.
DATA: result TYPE i,
number TYPE i.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 8.
...
result = 1 / number.
...
ENDCATCH.
IF sy-subrc <> 0.
...
ENDIF.
TXBHW - Original Tax Base Amount in Local Currency SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up
This documentation is copyright by SAP AG.
Length: 5327 Date: 20120518 Time: 203128 triton ( 206 ms )






