<?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 Exceptions Handling Programs Needed! Pls!!! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exceptions-handling-programs-needed-pls/m-p/2385969#M530176</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;   Can any one give some sample programs of how exception handling is done in abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Pls send it guys looking for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  rahul.sapabap@gmail.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Rahul.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 10 Jun 2007 19:13:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-10T19:13:27Z</dc:date>
    <item>
      <title>Exceptions Handling Programs Needed! Pls!!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exceptions-handling-programs-needed-pls/m-p/2385969#M530176</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;   Can any one give some sample programs of how exception handling is done in abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Pls send it guys looking for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  rahul.sapabap@gmail.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Rahul.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jun 2007 19:13:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exceptions-handling-programs-needed-pls/m-p/2385969#M530176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-10T19:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exceptions Handling Programs Needed! Pls!!!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exceptions-handling-programs-needed-pls/m-p/2385970#M530177</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;Exceptions are situations that occur while an ABAP program is being executed, in which normal continuation of the program does not make any sense.&lt;/P&gt;&lt;P&gt; Exceptions can be raised either implicitly in the ABAP runtime environment or explicitly in the ABAP program.&lt;/P&gt;&lt;P&gt; For example, division by zero leads to an exception in the ABAP runtime environment. It is possible to determine this situation through a query in the ABAP program and to trigger an exception there.&lt;/P&gt;&lt;P&gt;See the demo program DEMO_HANDLE_EXCEPTIONS in se38.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*-------------------------------------EXAMPLE FOR RUNTIME ERROR---------------------------------------------------------------------------

*DATA : VALUE1 TYPE I.
*
*VALUE1 = 1 / 0. "-------------&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; IT MAKES RUN TIME ERROR.
*
*WRITE : VALUE1.

*---------------------------------EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC---------------------------------

*DATA : VALUE1 TYPE I.
*
*CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
*VALUE1 = 1 / 0.
*WRITE : VALUE1.
*ENDCATCH.
*
*IF SY-SUBRC = 1.
*WRITE : ' IT MAKES ERROR'.
*ELSE.
*WRITE : VALUE1.
*ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in abap program we handle exceptions based on value returned by the system variable SY-SUBRC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;means execution completed sucessfull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if SY-SUBRC = 1........n.&lt;/P&gt;&lt;P&gt;means execution compleated not sucessfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if sy-sbrc = 0.
write:/ 'execution sucessfull.
**here write logic as per u r requirement
else sy-subrc = '1'
message 
elseif sy-subrc eq '2'
message
elseif sy-subrc eq '3'
message
elseif sy-subrc eq '4'
message
endif&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;messages are defined in SE91..&lt;/P&gt;&lt;P&gt;these messages are 5 types..&lt;/P&gt;&lt;P&gt;A Termination Message&lt;/P&gt;&lt;P&gt; The message appears in a dialog box, and the program terminates. When the user has confirmed the message, control returns to the next-highest area menu.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;E Error Message&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt; Depending on the program context, an error dialog appears or the program terminates.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;I (nformation)&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; The message appears in a dialog box. Once the user has confirmed the message, the program continues immediately after the MESSAGE statement.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;S(Status Message)&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; The program continues normally after the MESSAGE statement, and the message is displayed in the status bar of the next screen.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;W(Warning)&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; Depending on the program context, an error dialog appears or the program terminates.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;X(Exit)&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; No message is displayed, and the program terminates with a short dump. Program terminations with a short dump normally only occur when a runtime error occurs. Message type X allows you to force a program termination. The short dump contains the message ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ashokreddy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Jun 2007 20:05:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exceptions-handling-programs-needed-pls/m-p/2385970#M530177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-10T20:05:06Z</dc:date>
    </item>
  </channel>
</rss>

