<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Handling Exceptions. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267435#M492163</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santhosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code to avoid run time error,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------" /&gt;EXAMPLE FOR RUNTIME ERROR--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*DATA : VALUE1 TYPE I.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*VALUE1 = 1 / 0.        -&lt;/P&gt;&lt;HR originaltext="------------" /&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; IT MAKES RUN TIME ERROR.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------" /&gt;EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : VALUE1 TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.&lt;/P&gt;&lt;P&gt;VALUE1 = 1 / 0.&lt;/P&gt;&lt;P&gt;WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 1.&lt;/P&gt;&lt;P&gt;WRITE : ' IT MAKES ERROR'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Reward If helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 May 2007 05:37:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-18T05:37:49Z</dc:date>
    <item>
      <title>Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267433#M492161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Is there are any way to Handle Exceptions  raised From the 'IF..ENDIF' Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data  a type i.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS: conversion_errors = 2.&lt;/P&gt;&lt;P&gt;if a = 'adsdsd'.&lt;/P&gt;&lt;P&gt;write 'dsdfsdf'.&lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  MESSAGE i000msgclass) WITH 'santosh'.&lt;/P&gt;&lt;P&gt;ENDIF..&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Execute the code...then you will come to know.&lt;/P&gt;&lt;P&gt;Exception is Not Raised.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will definitely Gives Runtime Error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Points will be rewarded...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;santosh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267433#M492161</guid>
      <dc:creator>Santosh_Kezkhepatmelathil</dc:creator>
      <dc:date>2007-05-18T05:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267434#M492162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to avoid that.u have to use try,catch functionality.&lt;/P&gt;&lt;P&gt;have alook at this below link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Bharat Kalagara&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:36:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267434#M492162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-18T05:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267435#M492163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santhosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code to avoid run time error,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------" /&gt;EXAMPLE FOR RUNTIME ERROR--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*DATA : VALUE1 TYPE I.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*VALUE1 = 1 / 0.        -&lt;/P&gt;&lt;HR originaltext="------------" /&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; IT MAKES RUN TIME ERROR.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------" /&gt;EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : VALUE1 TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.&lt;/P&gt;&lt;P&gt;VALUE1 = 1 / 0.&lt;/P&gt;&lt;P&gt;WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 1.&lt;/P&gt;&lt;P&gt;WRITE : ' IT MAKES ERROR'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;WRITE : VALUE1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Reward If helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:37:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267435#M492163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-18T05:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267436#M492164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this case is a conversion error under the error class CONVERSION_ERRORS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS convt_no_number = 1.&lt;/P&gt;&lt;P&gt;    WRITE a .&lt;/P&gt;&lt;P&gt;  ENDCATCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:39:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267436#M492164</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-05-18T05:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267437#M492165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use Sy-msg and sy-subrc to give a message if the condition wont work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:41:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267437#M492165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-18T05:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267438#M492166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;    If you want to handle the exception then always check the sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message ' run time error'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***do reward if usefull&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:42:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267438#M492166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-18T05:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267439#M492167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sory Friends,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to catch the excpetion...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 05:43:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267439#M492167</guid>
      <dc:creator>Santosh_Kezkhepatmelathil</dc:creator>
      <dc:date>2007-05-18T05:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Exceptions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267440#M492168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have analyzed your program. There is one problem with IF-ENDIF block that you have written in CATCH block.You have to directly assign the value first and then use it in any conditional statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the exception type is &amp;lt;i&amp;gt;&amp;lt;b&amp;gt;CONVT_NO_NUMBER&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt; in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is the correct code -&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data a type i.

CATCH SYSTEM-EXCEPTIONS: CONVT_NO_NUMBER = 5.
  a = 'adsdsd'.
  IF a = 'adsdsd'.
    a = 'adsdsd'.
  ENDIF.
ENDCATCH.

IF sy-subrc = 5.
  WRITE 'ERROR'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As this sort out your query, kindly mark the thread &amp;lt;i&amp;gt;&amp;lt;b&amp;gt;Solved&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt; and close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2007 06:14:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/2267440#M492168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-18T06:14:38Z</dc:date>
    </item>
  </channel>
</rss>

