<?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: Method call and exceptions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954971#M1489192</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;@Matt&lt;/STRONG&gt;, as far as I'm concerned your solution  is the &lt;STRONG&gt;only&lt;/STRONG&gt; solution and I keep wondering if other people try to come up with creative "alternatives" because you stated &lt;EM&gt;it's not pretty&lt;/EM&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;br/&amp;gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;lt;br/&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@Marcel/Clemens&lt;/STRONG&gt;: As I stated, Matt's solution works perfectly fine, I don't see why one would try to come up with questionable solutions. I.e. here's what the documentation tells us about [non-class based exceptions|http://help.sap.com/abapdocu_70/en/ABAPRAISE_EXCEPTION.htm]:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the exception is triggered in a method or function module whose caller does not assign a return value to the exception, a runtime error is then triggered whose short dump contains the name of the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The exception CX_SY_NO_HANDLER, is only used with [class based exceptions|http://help.sap.com/abapdocu_70/en/ABENEXCEPTIONS_EVENTS.htm] as far as I know. A quick test with a [TRY-ENDTRY|http://help.sap.com/abapdocu_70/en/ABAPTRY.htm] wrapper around a method call raising a non-class based exception via [RAISE|http://help.sap.com/abapdocu_70/en/ABAPRAISE_EXCEPTION.htm] gave me the expected short dump (for either of your suggestions). Maybe I'm missing something, but as far as I can tell the solutions cannot work...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 May 2010 23:29:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-29T23:29:35Z</dc:date>
    <item>
      <title>Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954965#M1489186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP you can call a method in a short way. However how do I catch the exceptions if the exception is not an exception class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
l_case = cl_scmg_case_api=&amp;gt;open_case( im_case_guid = me-&amp;gt;caseguid im_enqueue = 'X' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exceptions are "catchable" if you call the method in the "long" way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 call method cl_scmg_case_api=&amp;gt;open_case
    exporting
      im_case_guid          = lv_guid
*      im_enqueue            = SPACE
*      im_mode               = IF_SRM_SP_ENQUEUE=&amp;gt;MODE_EXCLUSIVE
*      im_scope              = IF_SRM_SP_ENQUEUE=&amp;gt;SCOPE_DIALOG
*      im_update_task        = IF_SRM=&amp;gt;FALSE
*      im_check_authority    = SPACE
*      im_close_after_commit = SPACE
    receiving
      re_case               =
    exceptions
      failed                = 1
      enqueue_failed        = 2
      invalid_guid          = 3
      cx_srm_gsp_back       = 4
      no_authority          = 5
      illegal_case_type     = 6
      others                = 7
          .
  if sy-subrc &amp;lt;&amp;gt; 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 May 2010 08:14:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954965#M1489186</guid>
      <dc:creator>b_deterd2</dc:creator>
      <dc:date>2010-05-25T08:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954966#M1489187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not very pretty, but you do it like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
l_case = cl_scmg_case_api=&amp;gt;open_case( EXPORTING im_case_guid = me-&amp;gt;caseguid im_enqueue = 'X' 
                                      EXCEPTIONS failed = 1 ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 May 2010 08:43:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954966#M1489187</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-05-25T08:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954967#M1489188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 May 2010 08:57:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954967#M1489188</guid>
      <dc:creator>JerryWang</dc:creator>
      <dc:date>2010-05-25T08:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954968#M1489189</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;you have another -not very nice but possible - option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you dont catch it in your statement ABAP runtime will raise an exception&lt;/P&gt;&lt;P&gt;of type "cx_sy_no_handler".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can put all your function calls into a try block and catch it at the end.&lt;/P&gt;&lt;P&gt;... in the catch  block you should still have the sy-message variables available&lt;/P&gt;&lt;P&gt;to propagate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be that helps bit.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 May 2010 02:11:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954968#M1489189</guid>
      <dc:creator>Marcel_Wahl</dc:creator>
      <dc:date>2010-05-29T02:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954969#M1489190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Euurg. Not nice at all! At least that was my first thought. However, if it makes the code more readily understandable, then maybe it isn't so bad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 May 2010 06:46:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954969#M1489190</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-05-29T06:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954970#M1489191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;quick'n dirty;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.
  l_case = cl_scmg_case_api=&amp;gt;open_case( im_case_guid = me-&amp;gt;caseguid im_enqueue = 'X' ).
CATCH cx_root.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 May 2010 19:40:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954970#M1489191</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-05-29T19:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954971#M1489192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;@Matt&lt;/STRONG&gt;, as far as I'm concerned your solution  is the &lt;STRONG&gt;only&lt;/STRONG&gt; solution and I keep wondering if other people try to come up with creative "alternatives" because you stated &lt;EM&gt;it's not pretty&lt;/EM&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;br/&amp;gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;lt;br/&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@Marcel/Clemens&lt;/STRONG&gt;: As I stated, Matt's solution works perfectly fine, I don't see why one would try to come up with questionable solutions. I.e. here's what the documentation tells us about [non-class based exceptions|http://help.sap.com/abapdocu_70/en/ABAPRAISE_EXCEPTION.htm]:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the exception is triggered in a method or function module whose caller does not assign a return value to the exception, a runtime error is then triggered whose short dump contains the name of the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The exception CX_SY_NO_HANDLER, is only used with [class based exceptions|http://help.sap.com/abapdocu_70/en/ABENEXCEPTIONS_EVENTS.htm] as far as I know. A quick test with a [TRY-ENDTRY|http://help.sap.com/abapdocu_70/en/ABAPTRY.htm] wrapper around a method call raising a non-class based exception via [RAISE|http://help.sap.com/abapdocu_70/en/ABAPRAISE_EXCEPTION.htm] gave me the expected short dump (for either of your suggestions). Maybe I'm missing something, but as far as I can tell the solutions cannot work...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 May 2010 23:29:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954971#M1489192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-29T23:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954972#M1489193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Harald,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you for enlightening us, always with a pinch of welcome lightning, but I like that &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I think I could have made the same kind of erroneous answer, ABAP language has tortuous (but often logical) syntaxes and functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I wouldn't have asked the question as the solution is in the manual (and the online abap help), as very often : [ABAP doc for method parameters|http://help.sap.com/abapdocu_70/en/ABAPCALL_METHOD_PARAMETERS.htm] (it is said in the main [CALL METHOD|http://help.sap.com/abapdocu_70/en/ABAPCALL_METHOD.htm] article, that the list of parameters is the same whatever you used the leading "CALL METHOD" or not)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sandra&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: could you tell us your secrets how you are able to make all these hyperlinks so quickly? &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sandra Rossi on May 30, 2010 11:56 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 May 2010 09:54:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954972#M1489193</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2010-05-30T09:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Method call and exceptions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954973#M1489194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you tell us your secrets how you are able to make all these hyperlinks so quickly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I wish there was a secret and that it really was quickly... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's no magic, but I usually try to provide references to official SAP documents to give others the chance to evaluate more easily if I'm telling rubbish or not (though I'm aware that the links cannot always do that, but I think they help). Actually, I sometimes have to discard some lengthy answer (with nice links), because before posting I usually try to check for any updates and often other people have answered much faster (often without any official SAP references though)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I wouldn't have asked the question as the solution is in the manual&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yep, I fully agree and I would usually avoid answering such questions. However, I think it's important to question answers that we think are incorrect. I've seen too much stuff out here that's not right, though most of the times I'm too lazy to comment (especially on the trivial questions). I know I also have my share of incorrect answers/advises, but for all our benefit I'm hoping that somebody will jump in and correct me....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 May 2010 10:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/method-call-and-exceptions/m-p/6954973#M1489194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-30T10:22:37Z</dc:date>
    </item>
  </channel>
</rss>

