<?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: catch exception using message in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023740#M414508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;thank you very much. allow me to clarify this. what you all mean by this message meant for reporting? i still not really clear.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2007 13:51:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-09T13:51:19Z</dc:date>
    <item>
      <title>catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023732#M414500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, i do not know what are the message below meant for. if i can catch or handle the exception, do i need to have the message statement? in this way, i do not have to specifically write when sy-subrc = 1 then do what, = 2 do what, =3 do what and so on in the calling program? assuming in the FM there are raise keyword for each exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt;0.&lt;/P&gt;&lt;P&gt;message-id sy-msgid type sy-msgty number sy-msgno with&lt;/P&gt;&lt;P&gt;sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&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, 09 Mar 2007 13:38:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023732#M414500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023733#M414501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By using the EXCEPTIONS section, you are merely catching the errors, not reporting about them.  So if require to catch the exception as well as report the error to the user, then you would use  some message here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not require a message to the user, you can simply delete that part.&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;RIch Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:43:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023733#M414501</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-03-09T13:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023734#M414502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the messages which are displayed below when you call a function module, are those generated when you raise exceptions in the function module... so uncomment them so that the exceptions are raised....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want additional exceptions to be handled in the program... give the messages in your report...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:45:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023734#M414502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023735#M414503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can interpret messages with these system variables by using FM&lt;/P&gt;&lt;P&gt;MESSAGE_GET_TEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:45:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023735#M414503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023736#M414504</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 don't have to have the message statment to catch the excepction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To catch the exception and avoid a Dump (if an exception occurs) you should declare the EXCEPTIONS statment em the FM Declaration. With this declaration &lt;/P&gt;&lt;P&gt;the exception is controled, the message statmente after is use only if you want to inform the user/program about the specific error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:46:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023736#M414504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023737#M414505</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 are right. If you are going to handle the exception ,aybe you do not need to show the message. &lt;/P&gt;&lt;P&gt;This message is not really necesary, it is only writed by default when you Call a funtion using get partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:46:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023737#M414505</guid>
      <dc:creator>francisco_asensio</dc:creator>
      <dc:date>2007-03-09T13:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023738#M414506</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;&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;&lt;/P&gt;&lt;P&gt;it is not needed to write messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:47:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023738#M414506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023739#M414507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi el,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two ABAP statements for raising exceptions. They can only be used in function modules:&lt;/P&gt;&lt;P&gt;RAISE exc.&lt;/P&gt;&lt;P&gt;MESSAGE.....RAISING exc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The effect of these statements depends on whether the calling program handles the 'exc' exception or not. The calling program handles an exception If the name of the 'exc' exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the calling program does not handle the exception&lt;/P&gt;&lt;P&gt; The RAISEstatement terminates the program and switches to debugging mode.&lt;/P&gt;&lt;P&gt; The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps u a bit,&lt;/P&gt;&lt;P&gt;all the best,&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sampath&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;mark helpful answers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:50:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023739#M414507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023740#M414508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;thank you very much. allow me to clarify this. what you all mean by this message meant for reporting? i still not really clear.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 13:51:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023740#M414508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T13:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: catch exception using message</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023741#M414509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If an exception is raise inside the function module and you are not defining the execeptions in the calling program, then you will get an ABAP runtime exception.  In order to handle the error gracefully, you need to define the exceptions in the function call and then handle them.  So if you have two exceptions, the first one being ERROR and the second OTHER, then you would set  them like so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EXCEPTIONS
         ERROR  = 1
         OTHER  = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now, if either is raised in the function module, you know the SY-SUBRC value will be set to either 1 or 2.  Next you can handle them if you need. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CASE SY-SUBRC.
    when '1'.
    message e001(00) with 'There was some error'.

    when '2'.
    message e001(00) with 'I have no idea what the problem is'.
endcase.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 14:01:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-exception-using-message/m-p/2023741#M414509</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-03-09T14:01:17Z</dc:date>
    </item>
  </channel>
</rss>

