<?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: How to avoid commit if any error occurs in further processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315915#M1835035</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Spandana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can try one thing as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a perform to call bapi and make it as in update task.&lt;/P&gt;&lt;P&gt;take a flag and make it x if any record goes into error. Check this outside loop and if not x do commit and if x do not commit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this way it will create a LUW and if LUW fails all records are rolled back and if succeeds all records are saved.&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;Sandeep Katoch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 May 2014 10:34:40 GMT</pubDate>
    <dc:creator>sandeep_katoch</dc:creator>
    <dc:date>2014-05-13T10:34:40Z</dc:date>
    <item>
      <title>How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315911#M1835031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a program which creates GR for a purchase order. This program is executed by passing the idocs. Code inside this program is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Loop at internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Bapi function module to create GR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Perform to update the idoc status. if the function module returns any error then status is set to 51 else to 53.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the requirement is, for any one of the records in internal table if error occurs in function module then the idoc status should be set to 51 and it should not process anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, i thought of adding the code after step2 as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if return table has any error.&lt;/P&gt;&lt;P&gt;&amp;nbsp; lv_flag = X.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bapi Rollback.&lt;/P&gt;&lt;P&gt;&amp;nbsp; exit.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bapi commit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if lv_flag = X.&lt;/P&gt;&lt;P&gt;&amp;nbsp; idoc status = 51.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&amp;nbsp; idoc status = 53.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is not working when the first record in the internal table has no errors because as per the code i have written, it is doing bapi commit but it should not happen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please suggest to come out of this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Spandana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 09:58:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315911#M1835031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T09:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315912#M1835032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Spanadana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I correctly understood then if there is no error it should do commit. That is what you have written,so where is the exact 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;Sandeep Katoch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:06:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315912#M1835032</guid>
      <dc:creator>sandeep_katoch</dc:creator>
      <dc:date>2014-05-13T10:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315913#M1835033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Spandana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, can you explain your issue in detail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sudeesh Soni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:09:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315913#M1835033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T10:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315914#M1835034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we are looping at the data segments of the idoc which is passed to this program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose i have 2 data records which means it creates 2 GR's for the PO. if error occurs for any one of these two the program should not create GR's for both the records and change the idoc status accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for the first record, i dint get any error while creating then program will do commit i.e, GR is created.&lt;/P&gt;&lt;P&gt;for the second record, if i get any error while creating then program should not process anything, i mean the GR created for the first record also should get deleted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:21:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315914#M1835034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T10:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315915#M1835035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Spandana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can try one thing as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a perform to call bapi and make it as in update task.&lt;/P&gt;&lt;P&gt;take a flag and make it x if any record goes into error. Check this outside loop and if not x do commit and if x do not commit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this way it will create a LUW and if LUW fails all records are rolled back and if succeeds all records are saved.&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;Sandeep Katoch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:34:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315915#M1835035</guid>
      <dc:creator>sandeep_katoch</dc:creator>
      <dc:date>2014-05-13T10:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315916#M1835036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Spandana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know which BAPI you used to create GR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check whether BAPI having parameter called testrun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If BAPI having testrun parameter then you need to call the BAPI twice with and without testrun .&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;But this method not recommended as part of &lt;/SPAN&gt;performance tuning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For an example BAPI_GOODSMVT_CREATE has testrun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:50:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315916#M1835036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T10:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315917#M1835037</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;Use the BAPI Commit outside loop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg.&lt;/P&gt;&lt;P&gt;Loop..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call BAPI..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if returntable has error..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lv_flag = 'X'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BAPI rollback back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif.&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;if lv_flag = X.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&amp;nbsp; idoc status = 51.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;else.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&amp;nbsp; BAPI commit work.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&amp;nbsp; idoc status = 53.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 10:53:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315917#M1835037</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T10:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315918#M1835038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Digesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if we do bapi commit outside the loop then it will do commit for the last record present that internal table right. correct me if i'm wrong.&lt;/P&gt;&lt;P&gt;but we need to do commit for each record in that internal table. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 13:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315918#M1835038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T13:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315919#M1835039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will not commit just last record. It will commit for all. eg. if you have 2 error free records, then it will create 2 GRs.&lt;/P&gt;&lt;P&gt;I have used same approach for BAPI_ACC_DOCUMENT_POST. and It's working fine.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 13:55:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315919#M1835039</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-13T13:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid commit if any error occurs in further processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315920#M1835040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;if we do bapi commit outside the loop then it will do commit for the last record present that internal table right.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't think so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT/ROLLBACK WORK (via BAPI_TRANSACTION_COMMIT/ROLLBACK) will end the LUW. So&amp;nbsp; all the update modules registered (during BAPI calls) should either get called (in case of COMMIT) or get deregistered(in case of ROLLBACK).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But tbh, this depends entirely on how the BAPI is coded. &lt;SPAN __jive_emoticon_name="confused" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/776/images/emoticons/confused.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 14:01:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-commit-if-any-error-occurs-in-further-processing/m-p/10315920#M1835040</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-05-13T14:01:56Z</dc:date>
    </item>
  </channel>
</rss>

