<?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: Getting error while calling two BAPIs in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882603#M1594965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi varunchopra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the SAP documentation is not 100 % clear here: They say, with COMMIT WORK all high-priority ("VB1") update function modules are executed in the order of their registration and in a shared database LUW.  With WAIT addition, the calling program will continue after the update work process has executed the VB1 function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably BAPI_WS_DELIVERY_UPDATE will also trigger one or more VB2 update functions that will keep the objects locked.&lt;/P&gt;&lt;P&gt;Ten years ago we used this code in a similar situation to wait for the update task for a material being changed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM WAIT_UPDATE.
  USING P_MAX_WAIT_SECONDS TYPE I
  CHANGING P_SUBRC LIKE SY-SUBRC.
  DATA:
  L_ENDTIME LIKE SY-UZEIT,
  L_TABIX LIKE SY-TABIX,
  L_TRIES TYPE I,
  L_SUCCESS LIKE SY-SUBRC,
  L_ANSW TYPE C,
  L_TRY_AGAIN LIKE RMCLS-XFLAG VALUE 'X'.
  GET TIME.
  L_ENDTIME = SY-UZEIT.
  ADD P_MAX_WAIT_SECONDS TO L_ENDTIME.
  WHILE L_TRY_AGAIN = 'X'.
    LOOP AT ITAB.
      PERFORM CHECK_LOCK_EMMARCE
        USING ZAUF-WERKS ITAB-MATNR CHANGING P_SUBRC.
      GET TIME.
      IF P_SUBRC &amp;lt;&amp;gt; 0 OR SY-UZEIT &amp;gt;= L_ENDTIME.
        EXIT.                          "Loop
      ENDIF.                           " sy-subrc = 0.
    ENDLOOP.                           " AT itab.
    IF P_SUBRC = 0.
      CLEAR: L_TRY_AGAIN.
    ELSE.
      IF SY-UZEIT &amp;gt;= L_ENDTIME .
        PERFORM POPUP_TO_CONFIRM_WAIT
          USING P_MAX_WAIT_SECONDS CHANGING L_ENDTIME P_SUBRC.
        IF P_SUBRC &amp;lt;&amp;gt; 0.
          CLEAR L_TRY_AGAIN.
        ELSE.
          CLEAR P_SUBRC.
        ENDIF.                         " p_subrc &amp;lt;&amp;gt; 0.
      ENDIF.                           " sy-uzeit &amp;gt;= l_endtime.
    ENDIF.                             " p_subrc = 0.
  ENDWHILE.                            " l_try_again = 'X'.
ENDFORM.                               " WAIT_UPDATE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The coding of CHECK_LOCK_EMMARCE was derived from SM12 lock overview and used FUNCTION 'ENQUE_READ'. Today I would just try to lock the object with ENQUEUE function - if you get foreign lock error, the updatze task lock is not yet released.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Monitor SM12 during test run to identify which lock object  must be checked. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The you have to decide: If you put a WAIT UP TO 1 SECONDS in the wait loop, you may lose up to 1 second per delivery. If you just LOOP until the locks are released you may put some non-necessary load on the machine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way will be faster than any unconditional wait - which may sometimes not be long enough.&lt;/P&gt;&lt;P&gt;&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>Sat, 30 Apr 2011 11:34:59 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2011-04-30T11:34:59Z</dc:date>
    <item>
      <title>Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882598#M1594960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear ABAPers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm stuck into a problem.&lt;/P&gt;&lt;P&gt;I have a situation where I'm using BAPI, WS_DELIVERY_UPDATE to update a delivery.&lt;/P&gt;&lt;P&gt;Then after this I have post a GR so for that I'm using BAPI_GOODSMVT_CREATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my problem is when I'm calling BAPI_GOODSMVT_CREATE it gives me an error &lt;/P&gt;&lt;P&gt;"CODE is not supported by BAPI2017_GOODSMVT_CREATE". I check my code thoroughly, but didn't find anything in that&lt;/P&gt;&lt;P&gt;which was wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, if I try to do the same, in debugging mode, its processes me in the way it should, without any error.&lt;/P&gt;&lt;P&gt;Also, If I use a hard coded DELAY of 2 mins, in my program after WS_DELIVERY_UPDATE, it again processes perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I've put COMMIT AND WAIT and FM DEQUEUE_ALL after WS_DELIVERY_UPDATE, but still not working, and this I'm getting&lt;/P&gt;&lt;P&gt;error from BAPI_GOODSMVT_CREATE - "No Items Transfered".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me sort this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Varun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 12:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882598#M1594960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-29T12:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882599#M1594961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;I check my code thoroughly, but didn't find anything in that which was wrong.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which movement CODE value do you use, there should be a value in "CODE &amp;amp; is not supported by BAPI2017_GOODSMVT_CREATE" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field GOODMVTS_CODE must exist in table T158G, which also carries a transaction code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 14:01:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882599#M1594961</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2011-04-29T14:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882600#M1594962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi varunchopra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no need for FM DEQUEUE_ALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After call of BAPI_WS_DELIVERY_UPDATE make sure thre are no errors, i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT RETURN TRANSPORTING NO FIELDS
  WHERE type CA 'EAX'.
* ERROR - handle it
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The call FM BAPI_TRANSACTION_COMMIT&lt;/P&gt;&lt;P&gt;EXPORTING WAIT = 'X'.&lt;/P&gt;&lt;P&gt;&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, 29 Apr 2011 15:02:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882600#M1594962</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-04-29T15:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882601#M1594963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Raymond,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using 01 for MB01 in BAPI_GOODSMVT_CREATE, but its giving error "CODE is not supported" without any code, i.e. its not taking any code with it..also if I try to pass the coded hard codedly in the FM itself, then I'm getting error " No Items Transfered".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My observation is that..we get our control back in the application server after the processing of WS_DELIVERY UPDATE, but there is a parallel processing that is going in the database server, which doesn't allows us to process BAPI_GOODSMVT_CREATE until the database processing is complete for the first BAPI. And if we use DELAY even of two minutes its works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ Clemens,&lt;/P&gt;&lt;P&gt;I have already put a check on the return table of WS_DELIVERY_UPDATE. But its working fine and does not returns me any error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 04:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882601#M1594963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-30T04:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882602#M1594964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Raymond,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using 01 for MB01 in BAPI_GOODSMVT_CREATE, but its giving error "CODE is not supported" without any code, i.e. its not taking any code with it..also if I try to pass the coded hard codedly in the FM itself, then I'm getting error " No Items Transfered".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My observation is that..we get our control back in the application server after the processing of WS_DELIVERY UPDATE, but there is a parallel processing that is going in the database server, which doesn't allows us to process BAPI_GOODSMVT_CREATE until the database processing is complete for the first BAPI. And if we use DELAY even of two minutes its works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ Clemens,&lt;/P&gt;&lt;P&gt;I have already put a check on the return table of WS_DELIVERY_UPDATE. But its working fine and does not returns me any error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 04:34:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882602#M1594964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-30T04:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882603#M1594965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi varunchopra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the SAP documentation is not 100 % clear here: They say, with COMMIT WORK all high-priority ("VB1") update function modules are executed in the order of their registration and in a shared database LUW.  With WAIT addition, the calling program will continue after the update work process has executed the VB1 function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably BAPI_WS_DELIVERY_UPDATE will also trigger one or more VB2 update functions that will keep the objects locked.&lt;/P&gt;&lt;P&gt;Ten years ago we used this code in a similar situation to wait for the update task for a material being changed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM WAIT_UPDATE.
  USING P_MAX_WAIT_SECONDS TYPE I
  CHANGING P_SUBRC LIKE SY-SUBRC.
  DATA:
  L_ENDTIME LIKE SY-UZEIT,
  L_TABIX LIKE SY-TABIX,
  L_TRIES TYPE I,
  L_SUCCESS LIKE SY-SUBRC,
  L_ANSW TYPE C,
  L_TRY_AGAIN LIKE RMCLS-XFLAG VALUE 'X'.
  GET TIME.
  L_ENDTIME = SY-UZEIT.
  ADD P_MAX_WAIT_SECONDS TO L_ENDTIME.
  WHILE L_TRY_AGAIN = 'X'.
    LOOP AT ITAB.
      PERFORM CHECK_LOCK_EMMARCE
        USING ZAUF-WERKS ITAB-MATNR CHANGING P_SUBRC.
      GET TIME.
      IF P_SUBRC &amp;lt;&amp;gt; 0 OR SY-UZEIT &amp;gt;= L_ENDTIME.
        EXIT.                          "Loop
      ENDIF.                           " sy-subrc = 0.
    ENDLOOP.                           " AT itab.
    IF P_SUBRC = 0.
      CLEAR: L_TRY_AGAIN.
    ELSE.
      IF SY-UZEIT &amp;gt;= L_ENDTIME .
        PERFORM POPUP_TO_CONFIRM_WAIT
          USING P_MAX_WAIT_SECONDS CHANGING L_ENDTIME P_SUBRC.
        IF P_SUBRC &amp;lt;&amp;gt; 0.
          CLEAR L_TRY_AGAIN.
        ELSE.
          CLEAR P_SUBRC.
        ENDIF.                         " p_subrc &amp;lt;&amp;gt; 0.
      ENDIF.                           " sy-uzeit &amp;gt;= l_endtime.
    ENDIF.                             " p_subrc = 0.
  ENDWHILE.                            " l_try_again = 'X'.
ENDFORM.                               " WAIT_UPDATE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The coding of CHECK_LOCK_EMMARCE was derived from SM12 lock overview and used FUNCTION 'ENQUE_READ'. Today I would just try to lock the object with ENQUEUE function - if you get foreign lock error, the updatze task lock is not yet released.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Monitor SM12 during test run to identify which lock object  must be checked. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The you have to decide: If you put a WAIT UP TO 1 SECONDS in the wait loop, you may lose up to 1 second per delivery. If you just LOOP until the locks are released you may put some non-necessary load on the machine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way will be faster than any unconditional wait - which may sometimes not be long enough.&lt;/P&gt;&lt;P&gt;&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>Sat, 30 Apr 2011 11:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882603#M1594965</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-04-30T11:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while calling two BAPIs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882604#M1594966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its actually the BAPI WS_DELIVERY_UPDATE which is creating a Goods Issue for the Delivery and this delvery being done against a PO so it locks the Purchase Order for further updates as per the GI being done, and it is the one which is taking time to process .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So Thanks, now I have put a WHILE loop as per the code given by you, which is checking for any locks in the PO. So now it won't process further until the PO is free. Atleast, I got a solution to rid of the DELAY put in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also raised an OSS to SAP regarding the same. Waiting for them to reply on, why the WS_DELIVERY_UPDATE is taking time to process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Again Clemens, Hence closing the post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 12:48:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-calling-two-bapis/m-p/7882604#M1594966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-02T12:48:12Z</dc:date>
    </item>
  </channel>
</rss>

