<?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: rollback multiple transaction in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067118#M726829</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob, I overlooked that part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bo,&lt;/P&gt;&lt;P&gt;The logic as per my first post (now with Rob's correction) should work fine. I don't see how it would not work for your requirement. In the loop instead of calling the old BAPI call the new BAPI_SALESORDER_CREATEFROMDAT2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sougata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I reckon its not working because Bo is not rewarding us points! What do you say Rob? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sougata Chatterjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Nov 2007 05:49:53 GMT</pubDate>
    <dc:creator>Sougata</dc:creator>
    <dc:date>2007-11-26T05:49:53Z</dc:date>
    <item>
      <title>rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067111#M726822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts:&lt;/P&gt;&lt;P&gt;   Got a quick question needs fast answer..&lt;/P&gt;&lt;P&gt;   I am doing a sales order create and then turn into invoice. two function handle it.&lt;/P&gt;&lt;P&gt;BAPI_SALESORDER_CREATEFROMDATA for sales order and BAPI_BILLINGDOC_CREATEMULTIPLE to turn it into invoice. Sales order fail, that's fine. But if invoice failed. I want the sales order to roll back as well. Is there a start transaction ... then end with roll back or commit kind of thing in ABAP? Appreciate any hint at all.! !!!! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely Yours&lt;/P&gt;&lt;P&gt;Bo Peng&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 01:26:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067111#M726822</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-26T01:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067112#M726823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Bo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try like this: (see pseudo code below)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at Sales Docs.   "For every sales document
 CALL FUNCTION BAPI_SALESORDER_CREATEFROMDATA .....

  If success.   "sales order was created but not yet written to database
    CALL FUNCTION BAPI_BILLINGDOC_CREATEMULTIPLE .....
      If success.   "invoice was created but not yet written to database
       Commit Work.     "or use FM BAPI_TRANSACTION_COMMIT
      else.           "failed to create invoice
           Rollback Work.
      endif.
  Endif.
Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;Don't forget to reward points please.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sougata.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 01:56:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067112#M726823</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2007-11-26T01:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067113#M726824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sougata:&lt;/P&gt;&lt;P&gt;   Yes. this is what I have tried as well. However I think there is a commit build in BAPI_Salesorder_createfromdata. I have the exact same structure. As you did... I even tried using BAPI_TRANSACTION_ROLLBACK. But the sales order is still created.  Any ideas? Should I try reverse the sales order in that case then? How to reverse sales order?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 03:00:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067113#M726824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-26T03:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067114#M726825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another idea...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of creating the sales orders/invoices, try to simulate them first using BAPI_SALESORDER_SIMULATE and BAPI_BILLINGDOC_SIMULATE. Then check if everything OK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If OK go ahead with the actual create/post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not OK, delete the lines of the internal table in error and write as exception report, then go ahead with the rest of the internal table which now has only "Good" ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you think?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or instead of using SIMULATE you can use the same BAPIs with TESTRUN = 'X', then check the RETURN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sougata Chatterjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 03:11:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067114#M726825</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2007-11-26T03:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067115#M726826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sougata:&lt;/P&gt;&lt;P&gt;   I thought of that as well. The problem is I am creating billing document base on existing sales order. &lt;/P&gt;&lt;P&gt;   Option 1. using BAPI_SALESORDER_SIMULATE and BAPI_BILLINGDOC_SIMULATE. Then check if everything OK. &lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; If sales order doesn't actually get created then billing document doesn't have a reference to create from. Or does it? I assume when using salesorder_simulate. It doesn't actually create the sales order just trying to create then roll back. So I need something that will actually create, but still easily to roll back to. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Option 2.  TESTRUN = 'X', then check the RETURN.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; BAPI_SALESORDER_CREATEFROMDATA doesn't have a testrun. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought there might be a standard way of doing this, since this got to be a pretty usual problem... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your help very much. And I am gonna keep on trying to see what works. I was actually thinking about reverse sales order if billing document does get created successfully Don't know if that's a proper thing to do or not! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely Yours&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 03:50:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067115#M726826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-26T03:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067116#M726827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure which release you are on but you should be using BAPI_SALESORDER_CREATEFROMDAT2 to create sales orders and indeed it has a import parameter named TESTRUN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note BAPI_SALESORDER_CREATEFROMDATA is obsolete as of release 4.0A so avoid using it if you are &amp;gt;= release 4.0A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I understand, your objective is to create the Invoices if Sales Order creation is successful. That's the reason I asked you to use TESTRUN = 'X' or SIMULATE...&lt;/P&gt;&lt;P&gt;It will not create the Sales Order but this way you can eliminate the "bad" orders from your internal table i.e. for the ones you don't want to create the Invoices. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you delete all the "bad" (error) lines in your main sales order itab you'll be left with "good" ones. Now if you loop at sales order itab and call the BAPI_SALESORDER_CREATEFROMDAT2 with TESTRUN = space you'll actually create the sales orders in the database without fail. So in the same loop you can create the Invoices as well now that you know sales order creation will not fail for sure...so no rollback is required, just commit work after all sales orders and invoices are finished creating. &amp;lt;b&amp;gt;Before deleting the error lines of your sales order internal table, append it to another internal table say error_tab&amp;lt;/b&amp;gt;..then once you are finished with creating all sales orders/invoices, handle the error_tab as per your requirement i.e. print/email/display as error log etc. with error message e.g. "Sales Order/Invoices cannot be created with the following data" etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you get my point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see any points yet and already I've spent more than 30 mins for you out of my busy schedule!! &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sougata Chatterjee&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sougata Chatterjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 04:23:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067116#M726827</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2007-11-26T04:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067117#M726828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Sougata - I've modified your code to add another rollback. I haven't tested it, so I don't know if it will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at Sales Docs.   "For every sales document
 CALL FUNCTION BAPI_SALESORDER_CREATEFROMDATA .....
 
  If success.   "sales order was created but not yet written to database
    CALL FUNCTION BAPI_BILLINGDOC_CREATEMULTIPLE .....
      If success.   "invoice was created but not yet written to database
       Commit Work.     "or use FM BAPI_TRANSACTION_COMMIT
      else.           "failed to create invoice
           Rollback Work.
      endif.
      else.
            ROLLBACK.             "&amp;lt;========
  Endif.
Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 05:28:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067117#M726828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-26T05:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: rollback multiple transaction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067118#M726829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob, I overlooked that part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bo,&lt;/P&gt;&lt;P&gt;The logic as per my first post (now with Rob's correction) should work fine. I don't see how it would not work for your requirement. In the loop instead of calling the old BAPI call the new BAPI_SALESORDER_CREATEFROMDAT2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sougata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I reckon its not working because Bo is not rewarding us points! What do you say Rob? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sougata Chatterjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2007 05:49:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rollback-multiple-transaction/m-p/3067118#M726829</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2007-11-26T05:49:53Z</dc:date>
    </item>
  </channel>
</rss>

