<?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 call a BAPI function for twice in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139232#M114015</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to create a pair of article document by using 'BAPI_GOODSMVT_CREATE'. If the second article document has error, the first one should be rollback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I call the function for the second time, an error said that the function cannot be called until a work is committed for the previous function call. But once I called 'BAPI_TRANSACTION_COMMIT', the first document cannot be rollback even though I found errors when creating the second document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if there are any ways to achieve this? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I know that I can create a single document with 2 items in it... but in my case, I need to to create 2 separate documents)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Jan 2006 04:50:37 GMT</pubDate>
    <dc:creator>former_member220801</dc:creator>
    <dc:date>2006-01-26T04:50:37Z</dc:date>
    <item>
      <title>call a BAPI function for twice</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139232#M114015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to create a pair of article document by using 'BAPI_GOODSMVT_CREATE'. If the second article document has error, the first one should be rollback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I call the function for the second time, an error said that the function cannot be called until a work is committed for the previous function call. But once I called 'BAPI_TRANSACTION_COMMIT', the first document cannot be rollback even though I found errors when creating the second document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if there are any ways to achieve this? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I know that I can create a single document with 2 items in it... but in my case, I need to to create 2 separate documents)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 04:50:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139232#M114015</guid>
      <dc:creator>former_member220801</dc:creator>
      <dc:date>2006-01-26T04:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: call a BAPI function for twice</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139233#M114016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I guess you can try this.&lt;/P&gt;&lt;P&gt;Call first 'BAPI_GOODSMVT_CREATE' in test run i.e. set the test flag.&lt;/P&gt;&lt;P&gt;If it gives success call second 'BAPI_GOODSMVT_CREATE' in test run.&lt;/P&gt;&lt;P&gt;If this also give success then call both without test flag set.&lt;/P&gt;&lt;P&gt;then u can commit both with 'BAPI_TRANSACTION_COMMIT'.&lt;/P&gt;&lt;P&gt;Regds,&lt;/P&gt;&lt;P&gt;Mithlesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 05:29:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139233#M114016</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T05:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: call a BAPI function for twice</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139234#M114017</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;This is not possible in a direct way: one goods receipt is a complete transaction, you can't call a 2nd transaction without doing a commit beforehand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the workaround Mithlesh proposed is quite good. Just a small performance improvement:&lt;/P&gt;&lt;P&gt;- Call the 2nd in test mode&lt;/P&gt;&lt;P&gt;- If test is OK, call 1st without test&lt;/P&gt;&lt;P&gt;- If 1st is OK, commit work &lt;/P&gt;&lt;P&gt;- If 1st was OK, book 2nd (+ commit work)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 07:39:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-a-bapi-function-for-twice/m-p/1139234#M114017</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-01-26T07:39:20Z</dc:date>
    </item>
  </channel>
</rss>

