<?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: BAPI_TRANSACTION_COMMIT problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750142#M1675331</link>
    <description>&lt;P&gt;Creating a custom RFC with built-in commit is not the right approach for this problem: you're doing server-side ABAP changes while the issue is with the C# client needing to call the stateful BAPI RFC in the same context as the commit call so that the right LUW is understood by SAP to complete. Often client side programmers don't have dev access to SAP server to change or add to RFCs. The problem is that by default the connection is stateless, the BAPI RFC is never matched with the commit and vice versa. The commit returns a dummy success that just indicates that SAP committed the default empty transaction. Instead the two calls needs to be bound together. The approach of using an RfcTransaction object for that is correct. Another approach may be to pin the context on the RfcDestination with BeginContext, then call the BAPI RFC, then explicitly call the BAPI COMMIT, then optionally call EndContext (will work without but nicer to JCo / Nco to allow clean up of the contexts it keeps track of).&lt;/P&gt;&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;markus.tolksdorf&lt;/SPAN&gt; did I get this right?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Apr 2019 19:39:03 GMT</pubDate>
    <dc:creator>david_burg</dc:creator>
    <dc:date>2019-04-22T19:39:03Z</dc:date>
    <item>
      <title>BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750134#M1675323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a .net program, according to the messages returned from SAP, I am getting a Purchase Order created using BAPI_PO_CREATE1.&amp;nbsp;&amp;nbsp; In fact every time I execute, I get a new next higher number PO.&amp;nbsp;&amp;nbsp; That seems to&amp;nbsp; be working fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Also, Immediately after the BAPI returns to my .net program I am then executing BAPI_TRANSACTION_COMMIT.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However when I look in SAP, the PO does not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The RETURN structure from the BAPI_TRANSACTION_COMMIT is initial.&amp;nbsp; So there are no errors there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried this with the same results for both WAIT = X and WAIT defaulting in BAPI_TRANSACTION_COMMIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a special place in the process where this BAPI_TRANSACTION_COMMIT should be called?&amp;nbsp;&amp;nbsp; I "assumed" immediately after the CREATE PO BAPI is called would have been the correct time and&amp;nbsp; place.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Apr 2012 20:06:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750134#M1675323</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-14T20:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750135#M1675324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What are the messages that you receive in the return table of the bapi 'BAPI_PO_CREATE1'?&lt;/P&gt;&lt;P&gt;Check the import parameter 'TESTRUN', this parameter must be blank inorder to create the PO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vijaymadhur.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 06:41:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750135#M1675324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-15T06:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750136#M1675325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wardell,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I am getting your question correctly , its a two step process. first u call bapi PO to create PO then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u call BAPI_TRANSACTION_COMMIT to commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the first step when the call returns back to .net program , the data of buffer in sap got refreshed and when u call commit in second step , there is no data in buffer to write to database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u want to achieve this functionality then u have to write a customer RFC , in which u call PO&amp;nbsp; bapi then u call BAPI_TRANSACTION_COMMIT. Now call this RFC in ur .net program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Jitendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 06:58:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750136#M1675325</guid>
      <dc:creator>jitendra_it</dc:creator>
      <dc:date>2012-04-15T06:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750137#M1675326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jitendra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not necessarily; as long as the connection used in the create BAPI is still open, you must still be able to commit it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Wardell,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please share the return messages for BAPI_PO_CREATE1?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Karl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 08:29:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750137#M1675326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-15T08:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750138#M1675327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the return to .NET causes an interrupt that does a database commit. Because BAPIs make extensive use of PERFORM ON COMMIT, they are not executed. This only happend with explitic COMMIT WORK (as issued in BAPI_TRANSACTON_COMMIT).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may try Jitendra's suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 12:23:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750138#M1675327</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2012-04-15T12:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750139#M1675328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wardell,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my experience using external calls to BAPI's that need commit, here's how I managed to solve that problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I created a Z copy of the original BAPI;&lt;/LI&gt;&lt;LI&gt;The Z_BAPI calls the original BAPI and &lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;BAPI_TRANSACTON_COMMIT&lt;/SPAN&gt; at the end;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And that's it! Of course I'm not very proud with this solution, but it works. Another solution would be using an implicit enhancement point of the original BAPI (at the end) and test the session parameters (user, user type, etc) in order to decide wheter or not call &lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;BAPI_TRANSACTON_COMMIT - it works too!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;João&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 19:07:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750139#M1675328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-15T19:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750140#M1675329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There were no return messages from the COMMIT BAPI, which I assume meant the commit was suuccessful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 02:20:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750140#M1675329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-16T02:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750141#M1675330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;All,&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Thanks to everyone for their replies.&amp;nbsp; However I was able to find the solution.&amp;nbsp;&amp;nbsp; The solution was to&amp;nbsp; wrap the BAPI_PO_CREATE1 function object into a Transaction object, then commit the transaaction after calling the BAPI to create the PO.&amp;nbsp;&amp;nbsp; I ended up NOT calling Commit BAPI (at least not explicitly).&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;C# code snippet follows:&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;...........&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;SPAN style="color: #2b91af; font-family: Courier New; font-size: 10pt;"&gt;RfcTransaction&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; transaction = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Courier New; font-size: 10pt;"&gt;RfcTransaction&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;();&amp;nbsp; //Create a transaction object&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM style="font-size: 10pt; font-family: Courier New;"&gt;&lt;DIV&gt;transaction.AddFunction(function);&amp;nbsp; //Add BAPI_PO_CREATE to the transaction object&lt;/DIV&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;...........&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;SPAN style="color: #2b91af; font-family: Courier New; font-size: 10pt;"&gt;RfcSessionManager&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;.BeginContext(destination);&amp;nbsp;&amp;nbsp; //Begin the transaction&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;function.Invoke(destination);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;//Call BAPI_PO_CREATE&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;transaction.Commit(destination);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;//Transaction object&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;SPAN style="color: #2b91af; font-family: Courier New; font-size: 10pt;"&gt;RfcSessionManager&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;.EndContext(destination); //End the transaction&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM style="font-size: 10pt; font-family: Courier New;"&gt;........&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 02:35:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750141#M1675330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-04-16T02:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750142#M1675331</link>
      <description>&lt;P&gt;Creating a custom RFC with built-in commit is not the right approach for this problem: you're doing server-side ABAP changes while the issue is with the C# client needing to call the stateful BAPI RFC in the same context as the commit call so that the right LUW is understood by SAP to complete. Often client side programmers don't have dev access to SAP server to change or add to RFCs. The problem is that by default the connection is stateless, the BAPI RFC is never matched with the commit and vice versa. The commit returns a dummy success that just indicates that SAP committed the default empty transaction. Instead the two calls needs to be bound together. The approach of using an RfcTransaction object for that is correct. Another approach may be to pin the context on the RfcDestination with BeginContext, then call the BAPI RFC, then explicitly call the BAPI COMMIT, then optionally call EndContext (will work without but nicer to JCo / Nco to allow clean up of the contexts it keeps track of).&lt;/P&gt;&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;markus.tolksdorf&lt;/SPAN&gt; did I get this right?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2019 19:39:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750142#M1675331</guid>
      <dc:creator>david_burg</dc:creator>
      <dc:date>2019-04-22T19:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750143#M1675332</link>
      <description>&lt;P&gt;Using an RfcTransaction implies that it is executed as asynchronous request and the application will not get response parameters. Hence, if a synchronous processing is desired, using RfcSessionManager.BeginContext/JCoContext.begin to start a stateful sequence in which both the BAPI and BAPI_TRANSACTION_COMMIT are invoked, is the only valid approach. Hence, you got this right, but I am not considering the RfcSessionManager.EndContext/JCoContext.end optionally, because if not using them you would delay the release of backend resources to the point in time the session is finalized on the connector side and this all open connection associated with this session are released. Good coding style will release resources as early as possible.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Markus&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:48:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/8750143#M1675332</guid>
      <dc:creator>MarkusTolksdorf</dc:creator>
      <dc:date>2019-04-23T13:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_TRANSACTION_COMMIT problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/13942730#M2037924</link>
      <description>&lt;P&gt;i did try it and it works fine for me with c# program&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 01:28:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-transaction-commit-problem/m-p/13942730#M2037924</guid>
      <dc:creator>chakibG</dc:creator>
      <dc:date>2024-11-20T01:28:20Z</dc:date>
    </item>
  </channel>
</rss>

