‎2007 Sep 20 8:04 AM
Dear All,
Could anyone tell me,
How to CATCH EXCEPTION?
Thanks in advance,
Prasad
‎2007 Sep 20 8:17 AM
hi prasad,
simply write this code in ur program.
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
‎2007 Sep 20 8:20 AM
Hi,
Actually,
there is a RAISE statement in the FORM in one include, I want to check that EXCEPTION in RAISED there or not after the PERFORM (call for the FORM), in another Include.
But, I cannot change the Perform or it's parameters, as it is used at many places.
What is a solution for this?
Please ASAP.
Thanks in advance,
Prasad
‎2007 Sep 20 8:22 AM
Hi
<b>CATCH SYSTEM-EXCEPTIONS</b>
CATCH SYSTEM-EXCEPTIONS [exc1 = n1 exc2 = n2 ...]
[OTHERS = n_others].
[statement_block]
ENDCATCH.
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 execute catchable runtime errors and exception groups in any order. The numberic literal n1 n2 ... must be assigned to each of them. .
The language element OTHERS 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 specified exception groups occurs, the execution of the statement block is immediately terminated, 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 system field sy-subrc. If the list contains a catchable runtime error and its exception group or if a catchable runtime error occurs in some 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 same processing block, in which the class-based exceptions are handled in a TRY control structure or are triggered by the statement. RAISE EXCEPTION.
Catchable runtime errors are not passed from called Prozeduren to the caller. They can only be caught within a processing block. Within a processing block, catchable runtime errors are caught in control structures that can be nested in any depth. If multiple CATCH control structures are nested, the system branches behind the ENDCATCH statement of the inner CATCH control structure that handles the runtime error.
As of release 6.10, the handling of catchable runtime errors using CATCH SYSTEM-EXCEPTIONS is replaced with a TRY control structure. Since class-based exceptions are assigned to all catchable runtime errors, this is possible without restriction. The exceptions can be passed using a TRY control structures from procedures.
<b>Reward If USefull</b>