Hi,
catch block will be executed when the exception mentioned is raised.
see this example.
DATA: result TYPE p DECIMALS 3,
number TYPE i VALUE 11.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 5.
DO.
number = number - 1.
result = 1 / number.
WRITE: / number, result.
ENDDO.
ENDCATCH.
SKIP.
IF sy-subrc = 5.
WRITE / 'Division by zero!'.
ENDIF.
rgds,
bharat.
Hi!
You can handle with this way some incorrect arithmetic operation, like division by zero...
Your program will not have a short dump, keeps the control, and you can write a nice error handling.
Note: there are catchable and non-catchable exceptions. Non-catchable ones will cause ABAP dump, even when they are between CATCH-ENDCATCH.
Regards
Tamá
Hi Neha,
When we are using some function modules in the program,there may be possibility of some arithemetic erros like dividing by zero or multiplying by some character variable ....and all.
Normally when this type of error occurs and if we dont handle/catch this type of exceptions means system goes to dump without givinvg any warning.
To avoid such type of dumps we catch through exceptions.
in our case sy-subrc = 4 ( particularly in this case) means arithemetic errors.
Add a comment