<?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: Return Code value using 'starting new task' and 'wait until' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653803#M1445319</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to check for the RC for individual calls in the PERFORM Receive result, based on which you will do the necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if you want the processing to stop as soon as a RC(exception) is not zero, then you have to satisfy the condition for WAIT UNTIL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Mar 2010 13:22:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-19T13:22:05Z</dc:date>
    <item>
      <title>Return Code value using 'starting new task' and 'wait until'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653801#M1445317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having a minor issue with some return code values in my ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what part of it used to look like before I modified it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Code in version 1, the sy-subrc was not always zero, sometimes it would be 4.&lt;/P&gt;&lt;P&gt;That was fine, and my abap would do something based on the non-zero RC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; had a need to implement an RFC timeout, the only way I could see to do it was to use 'starting new task' etc as seen in Version 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, with my changes, sy-subrc is always zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ABAP runs fine but I know that sy-subrc should sometimes be 4, even when it returns within the allotted 60 seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I've coded it incorrectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone point me in the right direction?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
#&amp;gt;&amp;gt; Start of VERSION 1
  call function 'MY_FUNCTION_MODULE'
       destination RFCDEST
       tables
            orders_list          = t_orders_packet
            apo_orders_list      = t_apo_orders
            apo_resources        = t_apo_resources
       exceptions
            COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
            SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
            NO_ORDERS_SUPPLIED       = 3
            NO_PEGGED_ORDERS_FOUND   = 4
            ORDERID_CONVERSION_ERROR = 5
            OTHERS                   = 6.

if sy-subrc is initial.
  * do some stuff as RC was 0
else.
 * log non-zero return code etc
endif.
* &amp;lt;&amp;lt; End of Version 1
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 11:34:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653801#M1445317</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T11:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Return Code value using 'starting new task' and 'wait until'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653802#M1445318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And now Version 2.&lt;/P&gt;&lt;P&gt;I didn't put this into the 1st post as the formatting goes bonkers.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
#&amp;gt;&amp;gt; Start of VERSION 2
  call function 'MY_FUNCTION_MODULE'
       destination RFCDEST
       starting new task 'taskname'
       performing receive_result on end of task
       tables
            orders_list          = t_orders_packet
            apo_orders_list      = t_apo_orders
            apo_resources        = t_apo_resources
       exceptions
            COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
            SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
            NO_ORDERS_SUPPLIED       = 3
            NO_PEGGED_ORDERS_FOUND   = 4
            ORDERID_CONVERSION_ERROR = 5
            OTHERS                   = 6.

  WAIT UNTIL results_received = 'X' UP TO 60 SECONDS. 

if sy-subrc is initial.   &amp;lt;&amp;lt; Now this is always ZERO
  * do some stuff as RC was 0
else.
 * log non-zero return code etc
endif.

...
...

FORM receive_result USING iv_taskname.
  RECEIVE RESULTS FROM FUNCTION 'MY_FUNCTION_MODULE'
       tables
            orders_list          = t_orders_packet
            apo_orders_list      = t_apo_orders
            apo_resources        = t_apo_resources
       exceptions
            COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
            SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
            NO_ORDERS_SUPPLIED       = 3
            NO_PEGGED_ORDERS_FOUND   = 4
            ORDERID_CONVERSION_ERROR = 5
            OTHERS                   = 6.

  results_received = 'X'.
endform.                    "receive_result
* &amp;lt; End of Version 2
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 11:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653802#M1445318</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T11:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Return Code value using 'starting new task' and 'wait until'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653803#M1445319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to check for the RC for individual calls in the PERFORM Receive result, based on which you will do the necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if you want the processing to stop as soon as a RC(exception) is not zero, then you have to satisfy the condition for WAIT UNTIL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 13:22:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653803#M1445319</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T13:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Return Code value using 'starting new task' and 'wait until'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653804#M1445320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you mean if I have this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  results_received = 'X'.
  ret_rc = sy-subrc.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and check for that value as well as the other sy-subrc then that would give me what I want?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 13:28:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653804#M1445320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T13:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Return Code value using 'starting new task' and 'wait until'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653805#M1445321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Stephen, you have to check for ret_rc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 13:37:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-code-value-using-starting-new-task-and-wait-until/m-p/6653805#M1445321</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T13:37:51Z</dc:date>
    </item>
  </channel>
</rss>

