<?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: LUW BAPI_TRANSACTION_COMMIT and Custom table Update in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/luw-bapi-transaction-commit-and-custom-table-update/m-p/12330738#M1991557</link>
    <description>&lt;P&gt;I guess you mean you have this code?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'BAPI'.
UPDATE yourtable SET column = 1 WHERE key = ...
IF sy-subrc &amp;lt;&amp;gt; 0. " unique key constraint error
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the BAPI updates tables via an update task, there can be theoretically a difference if the update task aborts, your table will be updated but not the tables updated by the BAPI. In that case, you should update your table in the update task to reduce the risk.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2021 19:13:50 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2021-01-15T19:13:50Z</dc:date>
    <item>
      <title>LUW BAPI_TRANSACTION_COMMIT and Custom table Update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/luw-bapi-transaction-commit-and-custom-table-update/m-p/12330737#M1991556</link>
      <description>&lt;P&gt;I call a BAPI. If the return table contains an error message I immediately call BAPI_TRANSACTION_ROLLBACK. Otherwise, I attempt to perform an update to a custom table. If the custom table update fails I call BAPI_TRANSACTION_ROLLBACK. &lt;/P&gt;
  &lt;P&gt;If the custom table update is successful I call BAPI_TRANSACTION_COMMIT. I want the BAPI commit and table update to exist as a LUW. If the custom table update fails I want to rollback the BAPI. I'm wondering if the attempt to update the custom table will automatically commit the prior database changes associated with the BAPI call. Also, I'm assuming I would not need to call COMMIT WORK or ROLLBACK WORK.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 18:26:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/luw-bapi-transaction-commit-and-custom-table-update/m-p/12330737#M1991556</guid>
      <dc:creator>former_member609989</dc:creator>
      <dc:date>2021-01-15T18:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: LUW BAPI_TRANSACTION_COMMIT and Custom table Update</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/luw-bapi-transaction-commit-and-custom-table-update/m-p/12330738#M1991557</link>
      <description>&lt;P&gt;I guess you mean you have this code?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'BAPI'.
UPDATE yourtable SET column = 1 WHERE key = ...
IF sy-subrc &amp;lt;&amp;gt; 0. " unique key constraint error
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the BAPI updates tables via an update task, there can be theoretically a difference if the update task aborts, your table will be updated but not the tables updated by the BAPI. In that case, you should update your table in the update task to reduce the risk.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 19:13:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/luw-bapi-transaction-commit-and-custom-table-update/m-p/12330738#M1991557</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-01-15T19:13:50Z</dc:date>
    </item>
  </channel>
</rss>

