<?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: Exception Handling in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160597#M994688</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get the answers to your questions in the article above:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f86c9290-0201-0010-7a93-dda3716dc0d2].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jul 2008 12:37:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-14T12:37:17Z</dc:date>
    <item>
      <title>Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160596#M994687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;could anyone please tell me the correct statements in the below...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)Class based exceptions can be raised using ABAP statement RAISE EXCEPTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)Class based exceptions can be raised by the runtime environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)Class based exceptions are limited to object oriented contexts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4)Class based exceptions can be raised and handled in all ABAP Processing blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 12:21:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160596#M994687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T12:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160597#M994688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get the answers to your questions in the article above:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f86c9290-0201-0010-7a93-dda3716dc0d2].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 12:37:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160597#M994688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T12:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160598#M994689</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;In your case 1 and 2 will be correct ans.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For detail clarification refer to,&lt;/P&gt;&lt;P&gt;[http://help.sap.com/saphelp_nw70/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anirban Bhattacharjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 13:03:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160598#M994689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T13:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160599#M994690</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;The use of class-based exceptions is not restricted to ABAP Objects. On the contrary, class-based exceptions are designed to replace the previous concepts. Class-based exceptions can, therefore, be raised and handled in all ABAP contexts (programs, processing blocks). In particular, all the previous catchable runtime errors can be handled as class-based exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Class-based exceptions are either raised by the ABAP statement RAISE EXCEPTION or by the ABAP runtime environment. If a class-based exception occurs, the system interrupts the normal program flow and tries to find a suitable handler. If it does not find a handler, a runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Handlers are not only defined for the statements within a program but are defined for entire call sequences. Exceptions that are raised in procedures but are not handled in the procedure itself are forwarded to the caller. The caller can either handle the exception or forward it. To ensure that the caller of a procedure knows which exceptions may occur in a procedure, all the unhandled exceptions of the procedure must usually be listed in their interface after the RAISING interface parameter. This rule can be circumvented using specific exception classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Handlers are defined for one or more exception classes. To define handlers for all the subordinate classes of the exception classes, a superclass is specified. This enables entire groups of related exceptions to be handled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Grouping self-defined and predefined exceptions on the basis of exception classes provides users with the option of raising all the exceptions themselves. It also offers the advantage of consistent error handling throughout the entire program flow. The ABAP syntax for class-based exceptions results in a clear distinction between normal program processing and error handling. The syntax check supports the programming of the exception handling as far as possible by identifying exceptions that have not been handled or forwarded.&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;Check this Link you will get the Answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/cf/f2bbc8142c11d3b93a0000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/cf/f2bbc8142c11d3b93a0000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/83/636d1412fc11d5991e00508b5d5211/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/83/636d1412fc11d5991e00508b5d5211/content.htm&lt;/A&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;Regards,&lt;/P&gt;&lt;P&gt;Sujit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 13:07:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160599#M994690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T13:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160600#M994691</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;1 =&amp;gt; True&lt;/P&gt;&lt;P&gt;2 =&amp;gt; True&lt;/P&gt;&lt;P&gt;3 =&amp;gt; False&lt;/P&gt;&lt;P&gt;4 =&amp;gt; True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~ Piyush Patil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 09:40:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160600#M994691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T09:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exception Handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160601#M994692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys&lt;/P&gt;&lt;P&gt;this is GOBBLEDOOK -- I think the OP needs a CLEAR answer which explains what he wants.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example I'm using the Function Module  DAYS_BETWEEN_TWO_DATES for determining things like shelf life.&lt;/P&gt;&lt;P&gt;However the silly function module only has a NUM 6 field (with a sign) so including the sign if you say  compare a date with today and say year 2500 then you'll get a CONVT_NO_NUMBER exception. Since people can quite correctly enter a date of 31.12.9999 for a shelf life expiry then if you want to see how many days before the product needs to be replaced the program will fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So simply do something like this. I've wrapped the function module into a class ZCL_GET_DAYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

METHOD daycount .

  CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
      i_datum_bis        = sy-datum
      i_datum_von        = fromdate
      i_stgmeth          = '2'
    IMPORTING
      e_tage             = daytot
    EXCEPTIONS
      method_not_defined = 1
      OTHERS             = 2.
  CATCH SYSTEM-EXCEPTIONS  convt_no_number = 5.

    lv_days = daytot.
  ENDCATCH.

  IF sy-subrc = 5.
   if  fromdate ge sy-datum.
    lv_days = 9999.
    lv_days =  lv_days * - 1.
   ENDIF.
  ENDIF.

ENDMETHOD.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now  my application program won't blow up / short dump  when calculating the days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data:   go_days type ref to zcl_get_days.

 if go_days is initial.
    create object  go_days.
  endif.
  lv_days = go_days-&amp;gt;daycount( p1 ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameter p1 is the expiry date which ccould be 9999.12.31&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think actual examples are probably more useful than "canned definitions" from the help menu or lists of loads of links.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For using your own class based exceptions you need to create a handler and code the whole lot within a TRY --ENDTRY but I can honestly say that I've never found a need for these --the system exceptions are easy to use and cover nearly every case you are likely to need in day to day abap work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jimbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2008 08:14:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-handling/m-p/4160601#M994692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-18T08:14:05Z</dc:date>
    </item>
  </channel>
</rss>

