<?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: How to use Exceptions for a function module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196820#M1003098</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;look at standard FM's U'll get a better idea ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex ... GUI_UPLOAD ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jul 2008 09:03:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-16T09:03:59Z</dc:date>
    <item>
      <title>How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196817#M1003095</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 created  a new function module.Its working fine, but i am not aware of using exceptions for a function module. I hav just declared an exception in the 'exception' tab. Could any body explain me how to use that in my FM source code....Thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 08:57:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196817#M1003095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T08:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196818#M1003096</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;roughly like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ... some condition (for example sy-subrc NE 0 after a DB selection)&lt;/P&gt;&lt;P&gt;RAISE name_of_exception ==&amp;gt; FM will stop, return to calling program with the exception.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also could used with MESSAGE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MESSAGE .... RAISING name_of_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:01:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196818#M1003096</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-07-16T09:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196819#M1003097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shyam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Have a look at this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  gd_file = p_infile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      filename                = gd_file&lt;/P&gt;&lt;P&gt;      has_field_separator     = 'X'  "file is TAB delimited&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                = it_record&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      file_open_error         = 1&lt;/P&gt;&lt;P&gt;      file_read_error         = 2&lt;/P&gt;&lt;P&gt;      no_batch                = 3&lt;/P&gt;&lt;P&gt;      gui_refuse_filetransfer = 4&lt;/P&gt;&lt;P&gt;      invalid_type            = 5&lt;/P&gt;&lt;P&gt;      no_authority            = 6&lt;/P&gt;&lt;P&gt;      unknown_error           = 7&lt;/P&gt;&lt;P&gt;      bad_data_format         = 8&lt;/P&gt;&lt;P&gt;      header_not_allowed      = 9&lt;/P&gt;&lt;P&gt;      separator_not_allowed   = 10&lt;/P&gt;&lt;P&gt;      header_too_long         = 11&lt;/P&gt;&lt;P&gt;      unknown_dp_error        = 12&lt;/P&gt;&lt;P&gt;      access_denied           = 13&lt;/P&gt;&lt;P&gt;      dp_out_of_memory        = 14&lt;/P&gt;&lt;P&gt;      disk_full               = 15&lt;/P&gt;&lt;P&gt;      dp_timeout              = 16&lt;/P&gt;&lt;P&gt;      OTHERS                  = 17.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;      write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.&lt;/P&gt;&lt;P&gt;      skip.&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;Regards,&lt;/P&gt;&lt;P&gt;Sai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:02:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196819#M1003097</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196820#M1003098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;look at standard FM's U'll get a better idea ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex ... GUI_UPLOAD ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:03:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196820#M1003098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196821#M1003099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this links:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:06:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196821#M1003099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196822#M1003100</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;We need to handle exceptions for function modules in code only with help of RAISING keyword in MESSAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF DOCUMENT_NUMBER IS INITIAL.
  MESSAGE E054 RAISING DOCUMENT_NUMBER_INVALID.
  ENDIF.

SELECT SINGLE * FROM EDIDC WHERE DOCNUM EQ DOCUMENT_NUMBER.
  IF SY-SUBRC EQ 0.
    MOVE EDIDC TO IDOC_CONTROL.
  ELSE.
  MESSAGE E062 WITH DOCUMENT_NUMBER RAISING DOCUMENT_NOT_EXIST.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;removed_by_moderator&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;dhanashri.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Julius Bussche on Jul 16, 2008 9:17 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:08:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196822#M1003100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196823#M1003101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shyam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Please find the below given example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FM exception tab having the message "INVALID_SALESORG".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; if i_vkorg[] is initial.&lt;/P&gt;&lt;P&gt;    raise invalid_salesorg.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:15:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196823#M1003101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Exceptions for a function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196824#M1003102</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;Say you have an exception named "NO_REC_FOUND" in the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In the source code of the FM we can handle the exception as follows.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT COUNT(*) FROM &amp;lt;TABLE&amp;gt; INTO &amp;lt;VAR&amp;gt; WHERE &amp;lt;COND&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF &amp;lt;VAR&amp;gt; EQ 0.&lt;/P&gt;&lt;P&gt;    RAISE NO_REC_FOUND.&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;&lt;STRONG&gt;IN the program where you are calling the FM the code looks like the following. Here we have to handle the exception on our own.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'XYZ'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;.......&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;.......&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;NO_REC_FOUND = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 1.&lt;/P&gt;&lt;P&gt;    Message 'No Records Found'  TYPE 'E'.&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;&lt;/P&gt;&lt;P&gt;Hope this would help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Murthy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:19:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-exceptions-for-a-function-module/m-p/4196824#M1003102</guid>
      <dc:creator>former_member787646</dc:creator>
      <dc:date>2008-07-16T09:19:16Z</dc:date>
    </item>
  </channel>
</rss>

