<?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 return value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244949#M143271</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there is an error message issued in the function module without actually using 'RAISE' you will still get a non-zero sy-subrc(and not equal to any of the values you specified in your EXCEPTIONS values).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Apr 2006 20:46:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-04-18T20:46:19Z</dc:date>
    <item>
      <title>Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244944#M143266</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;When we call a function module how will the sy-subrc value will be set ? Is it based upon the exception value ? say a FM is called and it is returning a value other than 0 and not matches with the eception values, how can we identify why the FM call failed ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Varun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:18:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244944#M143266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244945#M143267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you call a function module and an exception is not raised, sy-subrc has the value 0 after the FM executes. (At least, that's what happened in my test.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:32:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244945#M143267</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244946#M143268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can sy-subrc take any value other than zero when the exception is not raised ? How can we identify what the error is when sy-subrc is not 0 and exception is not raised ? In my case FM is calling some other FM and the chain continues like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Varun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:38:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244946#M143268</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244947#M143269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran the following test:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest MESSAGE-ID zc.

sy-subrc = 8.

CALL FUNCTION 'Z_ROB_TEST'.

break rburbank.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The function 'Z_ROB_TEST' was:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
function z_rob_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*"----------------------------------------------------------------------

  sy-subrc = 9.

endfunction.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After the execution of the FM, sy-subrc was 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:42:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244947#M143269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244948#M143270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
    CALL FUNCTION 'F4IF_DETERMINE_SEARCHHELP'
         EXPORTING
              TABNAME   = TABNAME
              FIELDNAME = FIELDNAME
              selection_screen = selection_screen
         IMPORTING
              SHLP      = SHLP_TOP
         EXCEPTIONS
              FIELD_NOT_FOUND    = 1
              NO_HELP_FOR_FIELD  = 2
              INCONSISTENT_HELP  = 3
              OTHERS    = 4.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above call, as you can see, the numbers 1, 2, 3 are given by you when you are calling it. The call function will set the sy-subrc to the value that is against the given exception. Within the function module, the exception is raised by its name. So in this function module code, you will see the code like &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
              RAISING FIELD_NOT_FOUND.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you will get a sy-subrc of 1 because that is the number you gave. But if give a number 10 instead of 1 for FIELD_NOT_FOUND, your sy-subrc will be 10. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are getting a value other than the ones specified in exceptions, then you have to trap it in OTHERS exception. This is an exception not raised, but just occured in the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this clarifies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:44:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244948#M143270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module return value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244949#M143271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there is an error message issued in the function module without actually using 'RAISE' you will still get a non-zero sy-subrc(and not equal to any of the values you specified in your EXCEPTIONS values).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2006 20:46:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-return-value/m-p/1244949#M143271</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-18T20:46:19Z</dc:date>
    </item>
  </channel>
</rss>

