06-20-2006 6:45 PM
Hi Everyone,
I tried a lot but dont which exception to use in this case, the code is like below and i want to catch the exception and throw up a message can anyone help me please. In this case it again throws the runtime error.
<b>CONVT_OVERFLOW
CX_SY_CONVERSION_OVERFLOW
Overflow when converting from "2.35589e+35"</b>
<b>data a(16) type p decimals 4.
data max_value(16) type p value 999999999999.
PARAMETER b(16) type p decimals 2.
PARAMETER no_rb RADIOBUTTON GROUP RAD1.
PARAMETER year_rb RADIOBUTTON GROUP RAD1.
if year_rb = 'X'.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
a = b ** 365. <---- error line
ENDCATCH.
IF sy-subrc = 1.
a = max_value.
message i100.
else.
write: AT 2'SY-SUBRC', AT 25'A'.
write:/ sy-subrc, a.
endif.
endif.</b>
Can anyone please give a solution to handle this exception i tried a lot but nothing works.
Prashant
06-20-2006 7:13 PM
Use <b><u>convt_overflow</u></b>. If you take out your CATCH, ENDCATCH portion and run your computation alone, you will get a dump. The very first statement of the dump will tell you what the system exception is. You have to use that one. In this case it is convt_overflow.
06-20-2006 6:49 PM
06-20-2006 6:51 PM
Hi,
I give a value 1.25 and any number with decimal point it not working.
Regards,
Prashant.
06-20-2006 6:57 PM
06-20-2006 7:01 PM
Hi Rich,
No i changed the b from 16 to 8 but still the same problem.
It throws the same error.
What could be done.
Any solution.
Thanks,
Prashant.
06-20-2006 7:03 PM
06-20-2006 7:07 PM
06-20-2006 7:08 PM
If I use convt_overflow, it worked for me. What version of SAP are you on?
06-20-2006 7:09 PM
06-20-2006 7:11 PM
This works for me.
DATA a(16) TYPE p DECIMALS 4.
DATA max_value(16) TYPE p VALUE 999999999999.
PARAMETER b(16) TYPE p DECIMALS 2.
PARAMETER no_rb RADIOBUTTON GROUP rad1.
PARAMETER year_rb RADIOBUTTON GROUP rad1.
IF year_rb = 'X'.
CATCH SYSTEM-EXCEPTIONS convt_overflow = 1.
a = b ** 365.
ENDCATCH.
IF sy-subrc = 1.
a = max_value.
ENDIF.
ENDIF.
MESSAGE i100.
WRITE: AT 2'SY-SUBRC', AT 25'A'.
WRITE:/ sy-subrc, a.
06-20-2006 7:13 PM
Use <b><u>convt_overflow</u></b>. If you take out your CATCH, ENDCATCH portion and run your computation alone, you will get a dump. The very first statement of the dump will tell you what the system exception is. You have to use that one. In this case it is convt_overflow.
06-20-2006 9:21 PM
Hi Everyone,
thanks for all your replies it works when i change the exception to cont_overflow. But again when u give a value 12.35 or so it throws up a error
Overflow or underflow with exponentiation.
compute_pow_range
cx_sy_arithmetic_overflow.
How do I capture all the exception.
Is there where I can specify when others exception and capture them so that I need not specify a particular exception.
Any help on this will be of great use to me.
thanks,
Prashant.
06-20-2006 9:26 PM
06-20-2006 9:49 PM
Hi,
i tried giving as u have done, but when u specify the b value as 12.35 the value of a is 00. whereas it has to calculate and put the value, but instead it gives a zero.
what can be done????????
thanks,
Prashant.
06-20-2006 9:55 PM
Try this.
DATA a(16) TYPE p DECIMALS 4.
DATA max_value(16) TYPE p VALUE 999999999999.
PARAMETER b(16) TYPE p DECIMALS 2.
PARAMETER no_rb RADIOBUTTON GROUP rad1.
PARAMETER year_rb RADIOBUTTON GROUP rad1.
IF year_rb = 'X'.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 1
conversion_errors = 2.
a = b ** 365.
ENDCATCH.
IF sy-subrc <> 0.
a = max_value.
ENDIF.
ENDIF.
MESSAGE i100.
WRITE: AT 2'SY-SUBRC', AT 25'A'.
WRITE:/ sy-subrc, a.
06-21-2006 1:10 AM
Thanks sreeni finally it worked.
thanks everyone for all your answers.
Regards,
Prashant.
06-21-2006 1:12 AM