<?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 Handling exceptions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488853#M227724</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement where I need to handle an exception. What i'm doing is a batch input, though I doing it over a standard transaction, I need to be sure that if a dump occurs in the time executing the transaction, I can catch it and execute some cleanup process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Controlled block:&lt;/P&gt;&lt;P&gt;Perform transaction 'XK02'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF an error ocurred, catch and execute cleanup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got an example, however it is through objects and I'm getting an error that CX_ROOT is unknown.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;report DEMO_HANDLE_EXCEPTIONS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters NUMBER type I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RESULT type P decimals 2.&lt;/P&gt;&lt;P&gt;data OREF type ref to CX_ROOT.&lt;/P&gt;&lt;P&gt;data TEXT type STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  write: / 'Testing divison and Sqare root with', NUMBER.&lt;/P&gt;&lt;P&gt;  uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  try.&lt;/P&gt;&lt;P&gt;    if ABS( NUMBER ) &amp;gt; 100.&lt;/P&gt;&lt;P&gt;      raise exception type CX_DEMO_ABS_TOO_LARGE.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    try.&lt;/P&gt;&lt;P&gt;      RESULT =  1 / NUMBER.&lt;/P&gt;&lt;P&gt;      write: / 'Result of division:', RESULT.&lt;/P&gt;&lt;P&gt;      RESULT = SQRT( NUMBER ).&lt;/P&gt;&lt;P&gt;      write: / 'Result of square root:', RESULT.&lt;/P&gt;&lt;P&gt;      catch CX_SY_ZERODIVIDE into OREF.&lt;/P&gt;&lt;P&gt;        TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;      cleanup.&lt;/P&gt;&lt;P&gt;        clear RESULT.&lt;/P&gt;&lt;P&gt;    endtry.&lt;/P&gt;&lt;P&gt;    catch CX_SY_ARITHMETIC_ERROR into OREF.&lt;/P&gt;&lt;P&gt;      TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;    catch CX_ROOT into OREF.&lt;/P&gt;&lt;P&gt;      TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;  endtry.&lt;/P&gt;&lt;P&gt;  if not TEXT is initial.&lt;/P&gt;&lt;P&gt;    write / TEXT.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  write: / 'Final result:', RESULT.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me how I could handle this, the cleanup it's pretty critical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Aug 2006 20:44:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-25T20:44:12Z</dc:date>
    <item>
      <title>Handling exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488853#M227724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement where I need to handle an exception. What i'm doing is a batch input, though I doing it over a standard transaction, I need to be sure that if a dump occurs in the time executing the transaction, I can catch it and execute some cleanup process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Controlled block:&lt;/P&gt;&lt;P&gt;Perform transaction 'XK02'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF an error ocurred, catch and execute cleanup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got an example, however it is through objects and I'm getting an error that CX_ROOT is unknown.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;report DEMO_HANDLE_EXCEPTIONS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters NUMBER type I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RESULT type P decimals 2.&lt;/P&gt;&lt;P&gt;data OREF type ref to CX_ROOT.&lt;/P&gt;&lt;P&gt;data TEXT type STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  write: / 'Testing divison and Sqare root with', NUMBER.&lt;/P&gt;&lt;P&gt;  uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  try.&lt;/P&gt;&lt;P&gt;    if ABS( NUMBER ) &amp;gt; 100.&lt;/P&gt;&lt;P&gt;      raise exception type CX_DEMO_ABS_TOO_LARGE.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    try.&lt;/P&gt;&lt;P&gt;      RESULT =  1 / NUMBER.&lt;/P&gt;&lt;P&gt;      write: / 'Result of division:', RESULT.&lt;/P&gt;&lt;P&gt;      RESULT = SQRT( NUMBER ).&lt;/P&gt;&lt;P&gt;      write: / 'Result of square root:', RESULT.&lt;/P&gt;&lt;P&gt;      catch CX_SY_ZERODIVIDE into OREF.&lt;/P&gt;&lt;P&gt;        TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;      cleanup.&lt;/P&gt;&lt;P&gt;        clear RESULT.&lt;/P&gt;&lt;P&gt;    endtry.&lt;/P&gt;&lt;P&gt;    catch CX_SY_ARITHMETIC_ERROR into OREF.&lt;/P&gt;&lt;P&gt;      TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;    catch CX_ROOT into OREF.&lt;/P&gt;&lt;P&gt;      TEXT = OREF-&amp;gt;GET_TEXT( ).&lt;/P&gt;&lt;P&gt;  endtry.&lt;/P&gt;&lt;P&gt;  if not TEXT is initial.&lt;/P&gt;&lt;P&gt;    write / TEXT.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  write: / 'Final result:', RESULT.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me how I could handle this, the cleanup it's pretty critical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2006 20:44:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488853#M227724</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-25T20:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488854#M227725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gilberto&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are doing standard BDC using&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL TRANSACTION 'XK02' USING lt_bdcdata
                        MESSAGES INTO lt_messages.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you can collect all messages of the batch-input and analyse them afterwards. So you do not need any TRY/CATCH block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if the syntax check says that CX_ROOT does not exist this would mean that you are working on an old release not having this root exception class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;   Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2006 21:27:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488854#M227725</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-08-25T21:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488855#M227726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uwe, thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You're right, i'm working on an older version that doesn't have the exception handling feature, I was suspecting that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I know you can collect the error messages, however what if while executing the batch input it gives a dump, the execution of the calling program (the program making the call transaction) will be ended too, and I need to process some clean up operations if this happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I know that usually and the probabilities that a standard transaction gives a dump its pretty low, but I still need to prevent that if an error(not a transaction error, by error I meaning a dump) still occurs do the clean up that it's critical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2006 21:41:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488855#M227726</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-25T21:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488856#M227727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that is possible. How can you catch and process an error thrown by a standard application. I know the probability is low, but if it happens then you have to fix it by implementing OSS notes if there is any for that error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2006 21:46:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488856#M227727</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-25T21:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Handling exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488857#M227728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Somen, thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I think this isn't possible either now. I thought in a beggining that a exception handling could do the trick, but now that I know I can't count with it, it seems that I won't be able to control an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will have to deal with the low probabilities of a standard transaction givin a dump, and if it happens fix it as soon as possible with OSS Notes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2006 22:38:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-exceptions/m-p/1488857#M227728</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-25T22:38:30Z</dc:date>
    </item>
  </channel>
</rss>

