‎2008 May 05 12:36 PM
‎2008 May 05 12:39 PM
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.
DATA: result TYPE i,
number TYPE i.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 8.
...
result = 1 / number.
...
ENDCATCH.
IF sy-subrc 0.
...
ENDIF.
Regards,
Shiva.
‎2008 May 05 12:39 PM
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.
DATA: result TYPE i,
number TYPE i.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 8.
...
result = 1 / number.
...
ENDCATCH.
IF sy-subrc 0.
...
ENDIF.
Regards,
Shiva.
‎2008 May 05 12:40 PM
Hi,
this is not specific to BAPIs u can use catch..endcatch in programs,FMs,classes,...
catch..endcatch is for handling the catchable system exceptions.
for more info refer to this link.
http://help.sap.com/saphelp_nw70/helpdata/en/cf/f2bbce142c11d3b93a0000e8353423/content.htm
rgds,
bharat.
‎2008 May 05 12:43 PM
Hi ,
We can use ' catch & end catch' for a BAPI function module to catch the system exceptions when a program dumps?
Sample code check :
DATA : res TYPE i,
number TYPE i.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 8.
...
res = 1 / number.
...
ENDCATCH.
IF sy-subrc eq 0.
...
ENDIF.
Reward if useful.
Jagadeesh.G