<?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: Error handling for class CL_BCS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457964#M1742232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I suppose you can process the exception considering that the exception was raised inside the method. Looking at the coding done in the method, exception is not raised immediately in the method, but other methods called inside it do raise the exception depending on some conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; So, you must be able to handle the exception using the CATCH statement written as above. Take the error text, write it to an error file so that you can&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get the list of IDOCs where email sending was failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;~Athreya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 May 2013 10:05:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-05-23T10:05:57Z</dc:date>
    <item>
      <title>Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457962#M1742230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not particularly bright as will soon become apparent... so any help is greatly appreciated. Also I am not familiar with error handling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an inbound IDOC which runs every evening around 22h00 in background. I have created an enhancement to send an email to various parties if the IDOC does not process successfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most of the time it works and if the IDOC is unsuccessful then an email is sent. There are however times when the email is not sent and I need some ideas of how to handle this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code (utilising Class CL_BCS) is currently:&lt;/P&gt;&lt;P&gt;send_request-&amp;gt;send(&lt;/P&gt;&lt;P&gt;&amp;nbsp; EXPORTING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_with_error_screen = 'X'&lt;/P&gt;&lt;P&gt;&amp;nbsp; RECEIVING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = sent_to_all ).&lt;/P&gt;&lt;P&gt;COMMIT WORK.&lt;/P&gt;&lt;P&gt;WAIT UP TO 1 SECONDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am thinking of changing the code to this:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;try&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;send_request&lt;SPAN class="L0S70"&gt;-&amp;gt;&lt;/SPAN&gt;send&lt;SPAN class="L0S55"&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="L0S52"&gt;exporting&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_with_error_screen &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'X'&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; receiving&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;sent_to_all &lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="L0S52"&gt;commit &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;work&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="L0S52"&gt;catch &lt;/SPAN&gt;cx_send_req_bcs&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="L0S52"&gt;endtry&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;If I use this code to catch the error what happens? I would like to know if an email was sent or not, I don't want to have to keep physically checking the IDOC logs every day. If I catch the error at this point and perhaps save it to an internal table then what should I do next?&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 09:30:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457962#M1742230</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2013-05-23T09:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457963#M1742231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - How about creating a ZTABLE and update the same in times of exception?&lt;/P&gt;&lt;P&gt;2 - As IDOCs ae processed in a job, how about using a "WRITE" statement in times of exception?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This will ensure, in the job log you have the IDoc # for whom the mail is not sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY&lt;/P&gt;&lt;P&gt;send_request&lt;SPAN class="L0S70"&gt;-&amp;gt;&lt;/SPAN&gt;send&lt;SPAN class="L0S55"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="L0S52"&gt;exporting&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_with_error_screen &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'X'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; receiving&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;sent_to_all &lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;commit &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;work&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="L0S52"&gt;catch &lt;/SPAN&gt;cx_send_req_bcs INTO lv_text&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp; Write: Idoc no, lv_text-&amp;gt;errortext.&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;ENDTRY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;Abhinab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 09:56:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457963#M1742231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-05-23T09:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457964#M1742232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I suppose you can process the exception considering that the exception was raised inside the method. Looking at the coding done in the method, exception is not raised immediately in the method, but other methods called inside it do raise the exception depending on some conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; So, you must be able to handle the exception using the CATCH statement written as above. Take the error text, write it to an error file so that you can&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get the list of IDOCs where email sending was failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;~Athreya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 10:05:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457964#M1742232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-05-23T10:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457965#M1742233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;I am not particularly bright as will soon become apparent... &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;That's the funniest thing i've heard today, you made my day mate! &lt;SPAN __jive_emoticon_name="mischief" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/1474/images/emoticons/mischief.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Back to your question, did you trouble shoot why the email sending is failing? Imo the best way to write error logs is to use Application log (SLG* t-codes) &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1474/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 10:06:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457965#M1742233</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2013-05-23T10:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457966#M1742234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a good option to write the Idoc details for which mail is not sent in spool (Job log) as specified Abhinab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also store the data sent in email in AL11 or write it to spool as a backup if you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 10:54:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457966#M1742234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-05-23T10:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling for class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457967#M1742235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank u all for your help. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1474/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 11:53:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-handling-for-class-cl-bcs/m-p/9457967#M1742235</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2013-05-24T11:53:13Z</dc:date>
    </item>
  </channel>
</rss>

