<?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: function module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422843#M202834</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the Exceptions tab while creating FM , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; eg: give any name eg : &amp;lt;b&amp;gt;NOT_VALID&amp;lt;/b&amp;gt;  and its short text as &amp;lt;b&amp;gt;Check not valid&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the source code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT SINGLE * FROM T005 WHERE LAND1 = COUNTRY.
  IF SY-SUBRC NE 0.
    MESSAGE E001 WITH COUNTRY RAISING &amp;lt;b&amp;gt;NOT_VALID&amp;lt;/b&amp;gt;.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Jul 2006 09:17:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-11T09:17:31Z</dc:date>
    <item>
      <title>function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422835#M202826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;   iam creting  a function module . but i dont know how to give exceptions. can any body explain how give exceptions in FM.&lt;/P&gt;&lt;P&gt;                         chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:10:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422835#M202826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422836#M202827</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;   Goto Exception Tab &lt;/P&gt;&lt;P&gt;   Enter the Exception Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u want to raise exception in code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just write &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; raise &amp;lt;Exception Name&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declaring Exception is similar to declaring a simple importing / Exporting Parameter.&lt;/P&gt;&lt;P&gt;Only diffrence is it dont have any type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Exception Tab ; Enter these Values&lt;/P&gt;&lt;P&gt;1) Exception Name&lt;/P&gt;&lt;P&gt;2) Exception Discription.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:14:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422836#M202827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422837#M202828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Chandra,&lt;/P&gt;&lt;P&gt;Check this out&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="804792"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use Raise statement for the same&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  if sy-subrc = 1.                     
    raise file_write_error.            
  elseif sy-subrc = 2.                 
    raise gui_refuse_filetransfer.     
  elseif sy-subrc = 3.                 
    raise gui_refuse_filetransfer.     
  endif. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;                              &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;santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:15:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422837#M202828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422838#M202829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello In the Exceptions Tab,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give Like this.&lt;/P&gt;&lt;P&gt;INCONSISTENT_PARAMETERS&lt;/P&gt;&lt;P&gt;UPLOAD_OLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sy-Subrc will be set as 1 &amp;amp; 2 etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If useful reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:16:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422838#M202829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422839#M202830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can create the Exceptions in the Exceptions tab in the Function module,&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;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;RAISE &amp;lt;except&amp;gt;.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;MESSAGE..... RAISING &amp;lt;except&amp;gt;.&amp;lt;/b&amp;gt;&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 exception or not. If the name &amp;lt;except&amp;gt; of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program. &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;&lt;/P&gt;&lt;P&gt;The RAISE statement terminates the program and switches to debugging mode. &lt;/P&gt;&lt;P&gt;The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type. &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;&amp;lt;b&amp;gt;See this link for more info&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801f02454211d189710000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801f02454211d189710000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:16:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422839#M202830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422840#M202831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandra,&lt;/P&gt;&lt;P&gt;In the Exceptions tab you have to declare your exceptions and the short text for that exception.In the source code of the FM.You have to raise these exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'VIEWPROC_V_T6B1'&lt;/P&gt;&lt;P&gt;             EXPORTING&lt;/P&gt;&lt;P&gt;                  FCODE               = FUNCTION&lt;/P&gt;&lt;P&gt;                  VIEW_ACTION         = MAINT_MODE&lt;/P&gt;&lt;P&gt;                  VIEW_NAME           = VIEW_NAME&lt;/P&gt;&lt;P&gt;                  CORR_NUMBER         = CORR_NUMBER&lt;/P&gt;&lt;P&gt;             IMPORTING&lt;/P&gt;&lt;P&gt;UPDATE_REQUIRED = STATUS_V_T6B1-UPD_FLAG&lt;/P&gt;&lt;P&gt;             TABLES&lt;/P&gt;&lt;P&gt;                  EXCL_CUA_FUNCT      = EXCL_CUA_FUNCT&lt;/P&gt;&lt;P&gt;EXTRACT = V_T6B1_EXTRACT&lt;/P&gt;&lt;P&gt;TOTAL = V_T6B1_TOTAL&lt;/P&gt;&lt;P&gt;                  X_HEADER            = X_HEADER&lt;/P&gt;&lt;P&gt;                  X_NAMTAB            = X_NAMTAB&lt;/P&gt;&lt;P&gt;                  DBA_SELLIST         = DBA_SELLIST&lt;/P&gt;&lt;P&gt;                  DPL_SELLIST         = DPL_SELLIST&lt;/P&gt;&lt;P&gt;                  CORR_KEYTAB         = E071K_TAB&lt;/P&gt;&lt;P&gt;             EXCEPTIONS&lt;/P&gt;&lt;P&gt;                  MISSING_CORR_NUMBER       = 1&lt;/P&gt;&lt;P&gt;                  NO_VALUE_FOR_SUBSET_IDENT = 2&lt;/P&gt;&lt;P&gt;                  SAVING_CORRECTION_FAILED  = 3.&lt;/P&gt;&lt;P&gt;        CASE SY-SUBRC.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;          WHEN 1. RAISE MISSING_CORR_NUMBER.&lt;/P&gt;&lt;P&gt;          WHEN 2. RAISE NO_VALUE_FOR_SUBSET_IDENT.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;          WHEN 3.&lt;/P&gt;&lt;P&gt;        ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This FM is called in another Function module that you will create both the exceptions 'RAISE MISSING_CORR_NUMBER' 'RAISE NO_VALUE_FOR_SUBSET_IDENT' with the text you have to declare in your exceptions tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: mukesh kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:17:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422840#M202831</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422841#M202832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;execeptions are just nothing but identifiers&lt;/P&gt;&lt;P&gt;which u can use to raise a sensible message to the user other wise it would have dumped on screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give any name for exception and a description &lt;/P&gt;&lt;P&gt;eg: not_valid  : not a valid number&lt;/P&gt;&lt;P&gt;and when ever in the code u want to raise an exception &lt;/P&gt;&lt;P&gt;use statement &lt;/P&gt;&lt;P&gt;raise not_valid.&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;Harish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:17:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422841#M202832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422842#M202833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;define all your exceptions, in the function module,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex : FILE_WRITE_ERROR is the exception i defined in the function module &amp;amp; to call use RAISE&lt;/P&gt;&lt;P&gt;if you want to raise any exception,&lt;/P&gt;&lt;P&gt;use&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;RAISE FILE_WRITE_ERROR.&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;srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:17:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422842#M202833</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422843#M202834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the Exceptions tab while creating FM , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; eg: give any name eg : &amp;lt;b&amp;gt;NOT_VALID&amp;lt;/b&amp;gt;  and its short text as &amp;lt;b&amp;gt;Check not valid&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the source code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT SINGLE * FROM T005 WHERE LAND1 = COUNTRY.
  IF SY-SUBRC NE 0.
    MESSAGE E001 WITH COUNTRY RAISING &amp;lt;b&amp;gt;NOT_VALID&amp;lt;/b&amp;gt;.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:17:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422843#M202834</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422844#M202835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lets say we have a FM to fetch material description for a given material number. So one exception can be created as MATERIAL_NOT_FOUND. GO to the exceptions tab in your FM through SE37 and give an exception name MATERIAL_NOT_FOUND. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To raise this exception inside the code use syntax : RAISE MATERIAL_NOT_FOUND.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:17:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422844#M202835</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422845#M202836</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;In FM you will have a tab called exceptions name the exceptions in that place .once that is done go to source code . and write the following thing based on certain condition are something where you like to raise the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this write &lt;/P&gt;&lt;P&gt;if condition.&lt;/P&gt;&lt;P&gt;raise excpetionname.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Manohar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2006 09:18:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/1422845#M202836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-11T09:18:47Z</dc:date>
    </item>
  </channel>
</rss>

