2008 Sep 26 10:38 PM
Hi,
I have suppose 3 stmts.
f1 = f2/f3.
f4 = f5/f6
f8 = f7/f5
I want to handle divided by zero exception. How do i handle that.
Thanks
2008 Sep 26 10:50 PM
See this example.
data : val type I.
data OREF type ref to CX_ROOT.
data TEXT type STRING.
val = 0.
try.
if val = 0.
raise exception type CX_SY_ZERODIVIDE.
endif.
catch CX_SY_ZERODIVIDE into OREF.
TEXT = OREF->GET_TEXT( ).
write : / Text.
endtry.
2008 Sep 26 10:47 PM
You can write any conditional statement such as case, if...endif. for your purpose
2008 Sep 26 10:50 PM
See this example.
data : val type I.
data OREF type ref to CX_ROOT.
data TEXT type STRING.
val = 0.
try.
if val = 0.
raise exception type CX_SY_ZERODIVIDE.
endif.
catch CX_SY_ZERODIVIDE into OREF.
TEXT = OREF->GET_TEXT( ).
write : / Text.
endtry.
2008 Sep 26 11:00 PM
DATA temp TYPE I.
temp = 10.
TRY.
temp = temp / 0.
CATCH cx_sy_zerodivide.
MESSAGE 'Oh noes ' TYPE 'E'.
ENDTRY.
WRITE / temp.