<?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: Execption handling in RFCs in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013473#M79411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If that is the case that we need not include these two exceptions explicitly, then I have another question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below code is IN the RFC.&lt;/P&gt;&lt;P&gt;__________________________________________________________&lt;/P&gt;&lt;P&gt;SELECT werks matnr &lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE it_mat_plantwise&lt;/P&gt;&lt;P&gt;FROM marc&lt;/P&gt;&lt;P&gt;WHERE werks = plant_werks.&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;  return = 'No materials selected for entered plant'.&lt;/P&gt;&lt;P&gt;  MESSAGE I001(AT) &lt;/P&gt;&lt;P&gt;  WITH 'Please Enter Correct Plant Number'&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;RAISING RE_ENTER_PLANT_NO&amp;lt;/b&amp;gt;.&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;I have included RE_ENTER_PLANT_NO inside the EXECPTIONS tab in function builder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this is what I see when I call this function in SE38.&lt;/P&gt;&lt;P&gt;__________________________________________________________&lt;/P&gt;&lt;P&gt;CALL FUNCTION '.....'&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;   RE_ENTER_PLANT_NO           = 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;&lt;/P&gt;&lt;P&gt;I will write a CASE statement to handle the SY-SUBRCs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is if RE_ENTER_PLANT_NO and OTHERS have SY-SUBRC values as 1 and 2 respectively, then how do I handle SYSYTEM_FAILURE and COMMUNICATIONS_FAILURE (I mean using what value of SY-SUBRC?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Jul 2005 03:31:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-29T03:31:24Z</dc:date>
    <item>
      <title>Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013468#M79406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read about the "Two Pre-Defined Execptions" for a RFC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a&amp;gt; SYSTEM_FAILURE&lt;/P&gt;&lt;P&gt;b&amp;gt; COMMUNICATION_FAILURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND that, while calling the RFC we can code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 1 MESSAGE msg&lt;/P&gt;&lt;P&gt;COMMUNICATION_FAILURE = 2 MESSAGE msg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody please help me on this? Both concept wise and the above code. I mean, what do you mean by Pre-Defined and how to successfully use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 06:01:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013468#M79406</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-28T06:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013469#M79407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, as my undetstand, these two exception is default been defined by system, for RFC function.&lt;/P&gt;&lt;P&gt;You don't need to add them into the Exceptions Defination in the SE37. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will be helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 06:39:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013469#M79407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-28T06:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013470#M79408</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;these two exceptions are defined in the system for each RFC-enabled function module. u don't need to define these in the interface of the function module but u must handle them in your code. The code sample that you have written is the correct way to code them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the following extract from documentation...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As well as the exceptions defined in the interface of the called function module, an external function call can also have the following predefined exceptions: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SYSTEM_FAILURE exception is the response to a runtime error that occurs when the remotely-called function module is executed. &lt;/P&gt;&lt;P&gt;The COMMUNICATION_FAILURE exception occurs when the connection to the partner system cannot be established or if the connection is lost during communication. &lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;We strongly recommend that you assign a return value to both these exceptions for every RFC, and that you handle this return value, as otherwise a runtime error will occur in the exception situations in question. &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;PJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 06:56:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013470#M79408</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-28T06:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013471#M79409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;just to add....you might find this extract useful too...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Identical to any call of a function module, the RFC initializes the system field sy-subrc in the calling program resp. sets it to the value specified in error handling. Additionally, RFC initializes the system fields sy-msgid, sy-msgno, sy-msgty and sy-msgv1 to sy-msgv4 in the calling program at every remote call of a function module. If an error or termination message is sent during the execution of a remotely called function module through the statement MESSAGE, then the exception SYSTEM_FAILURE is triggered in the calling program, to which you can assign a return value at calling time. If the exception occurs, then these system fields are supplied with the properties of the message. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;PJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 06:59:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013471#M79409</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-28T06:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013472#M79410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi...&lt;/P&gt;&lt;P&gt;built-in function modules generally contains some import , export parameters and probable exceptions.&lt;/P&gt;&lt;P&gt;here in RFC also there some expected exceptions which may occur for a particular reason.&lt;/P&gt;&lt;P&gt;if you are from a computers background i can explain you with an example in java. For example if i = 3 / 0 this may lead to arithmetic exception which occurs only when we divide a number with 0. &lt;/P&gt;&lt;P&gt;Here in abap also same, when communication fails or system fails respective exceptions will be raised.&lt;/P&gt;&lt;P&gt;That corresponding exception code value is placed in &lt;/P&gt;&lt;P&gt;sy-subrc system field. What we need to do is check for that value and proceed as we intended to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example we can handle those exception like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 1.&lt;/P&gt;&lt;P&gt;code to handle that exception.&lt;/P&gt;&lt;P&gt;for SYSTEM_FAILURE.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 2.&lt;/P&gt;&lt;P&gt;code to handle that exception.&lt;/P&gt;&lt;P&gt;for COMMUNICATION_FAILURE.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you got something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prasad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 07:32:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013472#M79410</guid>
      <dc:creator>former_member181959</dc:creator>
      <dc:date>2005-07-28T07:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Execption handling in RFCs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013473#M79411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If that is the case that we need not include these two exceptions explicitly, then I have another question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below code is IN the RFC.&lt;/P&gt;&lt;P&gt;__________________________________________________________&lt;/P&gt;&lt;P&gt;SELECT werks matnr &lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE it_mat_plantwise&lt;/P&gt;&lt;P&gt;FROM marc&lt;/P&gt;&lt;P&gt;WHERE werks = plant_werks.&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;  return = 'No materials selected for entered plant'.&lt;/P&gt;&lt;P&gt;  MESSAGE I001(AT) &lt;/P&gt;&lt;P&gt;  WITH 'Please Enter Correct Plant Number'&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;RAISING RE_ENTER_PLANT_NO&amp;lt;/b&amp;gt;.&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;I have included RE_ENTER_PLANT_NO inside the EXECPTIONS tab in function builder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this is what I see when I call this function in SE38.&lt;/P&gt;&lt;P&gt;__________________________________________________________&lt;/P&gt;&lt;P&gt;CALL FUNCTION '.....'&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;   RE_ENTER_PLANT_NO           = 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;&lt;/P&gt;&lt;P&gt;I will write a CASE statement to handle the SY-SUBRCs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is if RE_ENTER_PLANT_NO and OTHERS have SY-SUBRC values as 1 and 2 respectively, then how do I handle SYSYTEM_FAILURE and COMMUNICATIONS_FAILURE (I mean using what value of SY-SUBRC?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2005 03:31:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execption-handling-in-rfcs/m-p/1013473#M79411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-29T03:31:24Z</dc:date>
    </item>
  </channel>
</rss>

