2008 Oct 30 11:17 AM
HI,
i want to now what is the benefit of try and catch?
what i think until now is if between the stetment try and catch i get dump , the program won't crash ,
but i try it and i have dump between the try and catch sentence .
Regards
2008 Oct 30 11:21 AM
Hi,
dump would occur if you dont catch all the exceptions.
Cheers,
KD
HI,
i want to now what is the benefit of try and catch?
what i think until now is if between the stetment try and catch i get dump , the program won't crash ,
but i try it and i have dump between the try and catch sentence .
Regards
2008 Oct 30 11:21 AM
Hi,
dump would occur if you dont catch all the exceptions.
Cheers,
KD
2008 Oct 30 11:36 AM
HI Krutiman
Thanks ,
from what u tell i have to catch all the scenarios,
assume i do a catch on casting and i do in the try block divide operation i have to write onother catch for divide by i.e. to write 2 catch commend after the try ?
Regards
2008 Oct 30 11:37 AM
Yes Ricardo.
You need to create a separte catch for this.
Thanks,
Chidnanand
2008 Oct 30 11:51 AM
Class CX_ROOT is the superclass for global exceptions. If you catch this, you should catch most exceptions; however the error messages you get may not be as helpful as those you would get from one of the more specific class based exceptions.
2008 Oct 30 11:23 AM
Hi Ricardo,
The concept of Try and Catch is when ever any exception comesup and you want to handle by your program then you need to use the Try and Catch Statement.
Thanks,
Chidanand
2008 Oct 30 11:26 AM
Check out the following code
It catched devide by zero error.
DATA: w_var TYPE i,
text TYPE string,
oref TYPE REF TO cx_root.
TRY.
w_var = 10 / 0.
CATCH cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
CATCH cx_root INTO oref.
text = oref->get_text( ).
ENDTRY.
WRITE / text.
2008 Oct 30 11:32 AM
TRY and END TRY is used with the CATCH statement. These statements used to handle the Exceptions at the Runtime so the program will not go into the Dump.
What ever code we wrirter inside the Try ENDTRY block is handled for Exception.
Refer this link for detail explanation :
http://help.sap.com/saphelp_nw70/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |