<?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: Using EXCEPTIONS in functions. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238478#M1381795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
Try this way.
&amp;lt;li&amp;gt;Create function module with RAISE statement.
&lt;PRE&gt;&lt;CODE&gt;
FUNCTION zget_marc_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(WERKS) TYPE  MARC-WERKS
*"  TABLES
*"      IT_MARC STRUCTURE  MARC
*"  EXCEPTIONS
*"      NO_DATA
*"----------------------------------------------------------------------

  SELECT * FROM marc INTO TABLE it_marc WHERE werks = werks.
  IF sy-subrc NE 0.
    RAISE no_data.
  ENDIF.

ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;
&amp;lt;li&amp;gt;Call this function module in the program.
&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest_notepad.
DATA: it_marc TYPE TABLE OF marc.
CALL FUNCTION 'ZGET_MARC_DATA'
  EXPORTING
    werks   = 'X000'
  TABLES
    it_marc = it_marc
  EXCEPTIONS
    no_data = 1
    OTHERS  = 2.
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;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Oct 2009 04:24:41 GMT</pubDate>
    <dc:creator>venkat_o</dc:creator>
    <dc:date>2009-10-04T04:24:41Z</dc:date>
    <item>
      <title>Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238474#M1381791</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;I would like to use excepions in function  modules, could you please explain to me how should I use it? If I pass an internal  table if there is some error, I would like to have exceptions instead of get a dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gabriela.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 20:42:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238474#M1381791</guid>
      <dc:creator>former_member204025</dc:creator>
      <dc:date>2009-10-02T20:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238475#M1381792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For an example look at FM : AUTHORITY_CHECK_TCODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;look in the exceptions tab.. ok and not_ok are present..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the source code based on some conditions they use &lt;STRONG&gt;Raise OK&lt;/STRONG&gt; statement to raise the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________&lt;/P&gt;&lt;P&gt;if you are calling an FM just un-comment the exception section, which you get when u hit pattern and have call that FM in ur code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 20:51:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238475#M1381792</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2009-10-02T20:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238476#M1381793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in the exception tab:&lt;/P&gt;&lt;P&gt;add the exceptions... like READ_ERROR_EXCEP, or some other what ever you wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in source code when the fail occurs.&lt;/P&gt;&lt;P&gt;use RAISE exceptionname.&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt;RAISE READ_ERROR_EXCEP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 22:14:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238476#M1381793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-02T22:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238477#M1381794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please look here: [ABAP: Using EXCEPTIONS in functions.|http://www.google.cn/search?hl=zh-CN&amp;amp;q=ABAP%3A&lt;EM&gt;Using&lt;/EM&gt;EXCEPTIONS&lt;EM&gt;in&lt;/EM&gt;functions.+++&lt;EM&gt;&amp;amp;btnG=Google&lt;/EM&gt;%E6%90%9C%E7%B4%A2&amp;amp;aq=f&amp;amp;oq=]&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>Fri, 02 Oct 2009 23:47:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238477#M1381794</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2009-10-02T23:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238478#M1381795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
Try this way.
&amp;lt;li&amp;gt;Create function module with RAISE statement.
&lt;PRE&gt;&lt;CODE&gt;
FUNCTION zget_marc_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(WERKS) TYPE  MARC-WERKS
*"  TABLES
*"      IT_MARC STRUCTURE  MARC
*"  EXCEPTIONS
*"      NO_DATA
*"----------------------------------------------------------------------

  SELECT * FROM marc INTO TABLE it_marc WHERE werks = werks.
  IF sy-subrc NE 0.
    RAISE no_data.
  ENDIF.

ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;
&amp;lt;li&amp;gt;Call this function module in the program.
&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest_notepad.
DATA: it_marc TYPE TABLE OF marc.
CALL FUNCTION 'ZGET_MARC_DATA'
  EXPORTING
    werks   = 'X000'
  TABLES
    it_marc = it_marc
  EXCEPTIONS
    no_data = 1
    OTHERS  = 2.
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;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2009 04:24:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238478#M1381795</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2009-10-04T04:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using EXCEPTIONS in functions.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238479#M1381796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried -and read- with your suggestions and it worked!! &lt;STRONG&gt;Thank you for teach me! &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Have a very nice day!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Gaby&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2009 12:23:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-exceptions-in-functions/m-p/6238479#M1381796</guid>
      <dc:creator>former_member204025</dc:creator>
      <dc:date>2009-10-04T12:23:29Z</dc:date>
    </item>
  </channel>
</rss>

