<?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 rollback after BAPI_TRANSACTION_COMMIT? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867409#M672708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately (or fortunately) a commit is a commit. There's not much you can do about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Sep 2007 14:42:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-19T14:42:22Z</dc:date>
    <item>
      <title>How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867400#M672699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two questions, please. In my dialog transaction I need to update 4 things. If one of them fails, I want to rollback all of them. I thought I could achieve this by putting them all in a function module. My first question is: will that work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My function module is like this:&lt;/P&gt;&lt;P&gt;PERFORM GOODS_MOVEMENT&lt;/P&gt;&lt;P&gt;PERFORM UPDATE_PRODUCTION_ORDER&lt;/P&gt;&lt;P&gt;PERFORM UPDATE_PURCHASE_ORDER&lt;/P&gt;&lt;P&gt;PERFORM GOODS_MOVEMENT (again)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my FORM GOODS_MOVEMENT I have CALL FUNCTION 'BAPI_GOODSMVT_CREATE' then 'BAPI_TRANSACTION_COMMIT'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My second question is: if I need to rollback all updates, how do I do that if I have already done 'BAPI_TRANSACTION_COMMIT' ? I tried leaving that out but If I don't do it the second PERFORM GOODS_MOVEMENT fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 12:47:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867400#M672699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T12:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867401#M672700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see if u r using dailogs( screens) ............y u have opted for bapi's (as bapis post the data directly to database ) ...............no need to use the screens here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u want work with screens u can do recording for u r own screen ...and work with bdc ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any how [BAPI_TRANSACTION_ROLLBACK] this is the function module to do rollback...................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u r working with screens u need to use commit work statement if any failure is there  do rollback with roll back statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ROLLBACK statement cancels the current transaction and starts a new transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&amp;lt;rollback_statement&amp;gt; ::= ROLLBACK [WORK] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ROLLBACK statement implicitly opens a new transaction. Any locks set within the new transaction are assigned to this transaction. The isolation leveldeclared in the CONNECT statement also applies for setting locks in the new transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;go thrugh the sample code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty_main,&lt;/P&gt;&lt;P&gt;         matnr type bapimathead-material,&lt;/P&gt;&lt;P&gt;         mtart type bapimathead-matl_type,&lt;/P&gt;&lt;P&gt;         mbrsh type bapimathead-ind_sector,&lt;/P&gt;&lt;P&gt;         matkl type bapi_mara-matl_group,&lt;/P&gt;&lt;P&gt;         meins type bapi_mara-base_uom,&lt;/P&gt;&lt;P&gt;         spras type bapi_makt-langu,&lt;/P&gt;&lt;P&gt;         maktx type bapi_makt-matl_desc,&lt;/P&gt;&lt;P&gt;         werks type marc-werks,&lt;/P&gt;&lt;P&gt;         herkl type marc-herkl,&lt;/P&gt;&lt;P&gt;         vkorg type mvke-vkorg,&lt;/P&gt;&lt;P&gt;         vtweg type mvke-vtweg,&lt;/P&gt;&lt;P&gt;       end   of ty_main,&lt;/P&gt;&lt;P&gt;       begin of ty_tab,&lt;/P&gt;&lt;P&gt;         matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;         werks type marc-werks,&lt;/P&gt;&lt;P&gt;       end   of ty_tab,&lt;/P&gt;&lt;P&gt;       begin of ty_error,&lt;/P&gt;&lt;P&gt;         matnr type bapimathead-material,&lt;/P&gt;&lt;P&gt;         mesg  type bapiret2-message,&lt;/P&gt;&lt;P&gt;       end   of ty_error.&lt;/P&gt;&lt;P&gt;data : it_main    type standard table of ty_main  with header line,&lt;/P&gt;&lt;P&gt;       it_makt    type standard table of bapi_makt  with header line,&lt;/P&gt;&lt;P&gt;       it_tab     type standard table of ty_tab with header line,&lt;/P&gt;&lt;P&gt;       it_error   type standard table of ty_error with header line,&lt;/P&gt;&lt;P&gt;       it_mathead type bapimathead,&lt;/P&gt;&lt;P&gt;       it_clientdata  type bapi_mara,&lt;/P&gt;&lt;P&gt;       it_clientdatax type bapi_marax,&lt;/P&gt;&lt;P&gt;       it_plantdata type bapi_marc,&lt;/P&gt;&lt;P&gt;       it_plantdatax  type bapi_marcx,&lt;/P&gt;&lt;P&gt;       it_salesdata type bapi_mvke,&lt;/P&gt;&lt;P&gt;       it_salesdatax type bapi_mvkex,&lt;/P&gt;&lt;P&gt;       it_return  type bapiret2,&lt;/P&gt;&lt;P&gt;       v_count type i,&lt;/P&gt;&lt;P&gt;       v_success type i,&lt;/P&gt;&lt;P&gt;       v_error type i.&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1.&lt;/P&gt;&lt;P&gt;  parameter : p_file type rlgrap-filename obligatory.&lt;/P&gt;&lt;P&gt;selection-screen end   of block b1.&lt;/P&gt;&lt;P&gt;at selection-screen on value-request for p_file.&lt;/P&gt;&lt;P&gt;  call function 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;   exporting&lt;/P&gt;&lt;P&gt;     program_name        = syst-cprog&lt;/P&gt;&lt;P&gt;     dynpro_number       = syst-dynnr&lt;/P&gt;&lt;P&gt;     field_name          = ' '&lt;/P&gt;&lt;P&gt;   importing&lt;/P&gt;&lt;P&gt;     file_name           = p_file.&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;  perform get_data.&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;  if not it_error[] is initial.&lt;/P&gt;&lt;P&gt;    describe table it_error lines v_error.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  perform get_summary.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  get_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_data .&lt;/P&gt;&lt;P&gt;  data : lv_infile type string.&lt;/P&gt;&lt;P&gt;         lv_infile = p_file.&lt;/P&gt;&lt;P&gt;         call function 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;           exporting&lt;/P&gt;&lt;P&gt;             filename                      = lv_infile&lt;/P&gt;&lt;P&gt;            filetype                      = 'ASC'&lt;/P&gt;&lt;P&gt;            has_field_separator           = 'X'&lt;/P&gt;&lt;P&gt;           tables&lt;/P&gt;&lt;P&gt;             data_tab                      = it_tab&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            file_open_error               = 1&lt;/P&gt;&lt;P&gt;            file_read_error               = 2&lt;/P&gt;&lt;P&gt;            no_batch                      = 3&lt;/P&gt;&lt;P&gt;            gui_refuse_filetransfer       = 4&lt;/P&gt;&lt;P&gt;            invalid_type                  = 5&lt;/P&gt;&lt;P&gt;            no_authority                  = 6&lt;/P&gt;&lt;P&gt;            unknown_error                 = 7&lt;/P&gt;&lt;P&gt;            bad_data_format               = 8&lt;/P&gt;&lt;P&gt;            header_not_allowed            = 9&lt;/P&gt;&lt;P&gt;            separator_not_allowed         = 10&lt;/P&gt;&lt;P&gt;            header_too_long               = 11&lt;/P&gt;&lt;P&gt;            unknown_dp_error              = 12&lt;/P&gt;&lt;P&gt;            access_denied                 = 13&lt;/P&gt;&lt;P&gt;            dp_out_of_memory              = 14&lt;/P&gt;&lt;P&gt;            disk_full                     = 15&lt;/P&gt;&lt;P&gt;            dp_timeout                    = 16&lt;/P&gt;&lt;P&gt;            others                        = 17.&lt;/P&gt;&lt;P&gt;         if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;         else.&lt;/P&gt;&lt;P&gt;           select matnr&lt;/P&gt;&lt;P&gt;                  mtart&lt;/P&gt;&lt;P&gt;                  mbrsh&lt;/P&gt;&lt;P&gt;                  matkl&lt;/P&gt;&lt;P&gt;                  meins&lt;/P&gt;&lt;P&gt;                  spras&lt;/P&gt;&lt;P&gt;                  maktx&lt;/P&gt;&lt;P&gt;                  werks&lt;/P&gt;&lt;P&gt;                  herkl&lt;/P&gt;&lt;P&gt;                  vkorg&lt;/P&gt;&lt;P&gt;                  vtweg&lt;/P&gt;&lt;P&gt;                  into table it_main&lt;/P&gt;&lt;P&gt;                  from  zanand_bapi_view&lt;/P&gt;&lt;P&gt;                  for all entries in it_tab&lt;/P&gt;&lt;P&gt;                  where matnr = it_tab-matnr&lt;/P&gt;&lt;P&gt;                  and   werks = it_tab-werks&lt;/P&gt;&lt;P&gt;                  and   spras = sy-langu.&lt;/P&gt;&lt;P&gt;           if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;             describe table it_main lines v_count.&lt;/P&gt;&lt;P&gt;             perform get_bapi.&lt;/P&gt;&lt;P&gt;           endif.&lt;/P&gt;&lt;P&gt;         endif.&lt;/P&gt;&lt;P&gt;endform.                    " get_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  get_bapi&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_bapi .&lt;/P&gt;&lt;P&gt;    loop at it_main.&lt;/P&gt;&lt;P&gt;      it_mathead-material = it_main-matnr.&lt;/P&gt;&lt;P&gt;      it_mathead-ind_sector = it_main-mbrsh.&lt;/P&gt;&lt;P&gt;      it_mathead-matl_type = it_main-mtart.&lt;/P&gt;&lt;P&gt;      it_clientdata-matl_group  = it_main-matkl.&lt;/P&gt;&lt;P&gt;      it_clientdata-base_uom = it_main-meins.&lt;/P&gt;&lt;P&gt;      it_clientdatax-matl_group = 'X'.&lt;/P&gt;&lt;P&gt;      it_clientdatax-base_uom = 'X'.&lt;/P&gt;&lt;P&gt;      it_plantdata-plant = it_main-werks.&lt;/P&gt;&lt;P&gt;      it_plantdata-countryori = it_main-herkl.&lt;/P&gt;&lt;P&gt;      it_plantdatax-plant = it_main-werks.&lt;/P&gt;&lt;P&gt;      it_plantdatax-countryori = 'X'.&lt;/P&gt;&lt;P&gt;      it_salesdata-sales_org = it_main-vkorg.&lt;/P&gt;&lt;P&gt;      it_salesdata-distr_chan = it_main-vtweg.&lt;/P&gt;&lt;P&gt;      it_salesdatax-sales_org = it_main-vkorg.&lt;/P&gt;&lt;P&gt;      it_salesdatax-distr_chan = it_main-vtweg.&lt;/P&gt;&lt;P&gt;      it_makt-langu = it_main-spras.&lt;/P&gt;&lt;P&gt;      it_makt-matl_desc = it_main-maktx.&lt;/P&gt;&lt;P&gt;      append it_makt.&lt;/P&gt;&lt;P&gt;      clear it_makt.&lt;/P&gt;&lt;P&gt;      call function 'BAPI_MATERIAL_SAVEDATA'&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          headdata                   = it_mathead&lt;/P&gt;&lt;P&gt;         clientdata                 = it_clientdata&lt;/P&gt;&lt;P&gt;         clientdatax                = it_clientdatax&lt;/P&gt;&lt;P&gt;         plantdata                  = it_plantdata&lt;/P&gt;&lt;P&gt;         plantdatax                 = it_plantdatax&lt;/P&gt;&lt;P&gt;       importing&lt;/P&gt;&lt;P&gt;         return                     = it_return&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;         materialdescription        = it_makt.&lt;/P&gt;&lt;P&gt;      if it_return-type = 'S'.&lt;/P&gt;&lt;P&gt;call function 'BAPI_TRANSACTION_COMMIT'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  WAIT          = WAIT&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  RETURN        = RETURN.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      else.&lt;/P&gt;&lt;P&gt;        it_error-matnr = it_main-matnr.&lt;/P&gt;&lt;P&gt;        it_error-mesg = it_return-message.&lt;/P&gt;&lt;P&gt;        append it_error.&lt;/P&gt;&lt;P&gt;        clear it_error.&lt;/P&gt;&lt;P&gt;        call function 'BAPI_TRANSACTION_ROLLBACK'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          RETURN        = RETURN.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      clear : it_main,it_mathead,it_clientdata,it_clientdatax,it_plantdata,it_plantdatax,it_salesdata,it_salesdatax,it_return.&lt;/P&gt;&lt;P&gt;      refresh it_makt.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;endform.                    " get_bapi&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  get_summary&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_summary .&lt;/P&gt;&lt;P&gt;  v_success = v_count - v_error.&lt;/P&gt;&lt;P&gt;  write : /10 'Total Reocrds: ',v_count,&lt;/P&gt;&lt;P&gt;          /10 'Successful Records: ',v_success.&lt;/P&gt;&lt;P&gt;  if not  v_error is initial.&lt;/P&gt;&lt;P&gt;    write :/10 'Error Records : ',v_error.&lt;/P&gt;&lt;P&gt;    skip 3.&lt;/P&gt;&lt;P&gt;    loop at it_error.&lt;/P&gt;&lt;P&gt;      write :/10 it_error-matnr,&lt;/P&gt;&lt;P&gt;             /10 it_error-mesg.&lt;/P&gt;&lt;P&gt;      clear it_error.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 13:06:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867401#M672700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T13:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867402#M672701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramyav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. So, you are saying to CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. The problem is the first goods movement update may be successful and I won't know that I have to rollback until all the other updates are complete. At that time, can I still do 'BAPI_TRANSACTION_ROLLBACK'? Will it know which transaction to rollback?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 13:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867402#M672701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T13:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867403#M672702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check the bapireturn parameter .................and collect all the error records (with msg type 'E' ]  and do rollback...................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstly,....bapi wont update the error records ..............u can directly view the error records in bapireturn table...................my advice is to use  BAPITET2 (bcoz it will capture error record and record number also so that u can easily identify)...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u r using bapi to create goods movement ............no need work on screens.......&lt;/P&gt;&lt;P&gt;u can find each and every field regarding to goods movement in bapi structures&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no need to create screens with fields ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 13:27:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867403#M672702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T13:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867404#M672703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramyav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again. I think you are talking about rolling back if the bapi is not successful. I am asking about rolling back a previously successful update. I am thinking that I cannot do that. I may have to use BDC instead. Do you know the answer to my first question. That is, how can I rollback 4 updates if, say , the last one is not successful. I tried putting them all in a function module but that does not seem to work. It is still keeping the successful updates even if the last one is not successful. Will it work if I call the FM in UPDATE TASK?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 13:37:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867404#M672703</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T13:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867405#M672704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have done something similar to this in batch input. Not sure if it would work with BAPIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call the first update and if successful, commit it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call the second update. If successfule, commit it; otherwise, rollback and then reverse the first update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Continue...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:25:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867405#M672704</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T14:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867406#M672705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I will have to resort to BDC, as you have done. I don't know how to do it if I have already committed a bapi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:28:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867406#M672705</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T14:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867407#M672706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, you would have to do it the same way. Call the BAPI so as to undo the cahnges you made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:34:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867407#M672706</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867408#M672707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I could. I just don't want to have multiple, in this case, goods movements back and forth. I would rather the update rolled back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:36:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867408#M672707</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T14:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867409#M672708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately (or fortunately) a commit is a commit. There's not much you can do about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:42:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867409#M672708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T14:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867410#M672709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After a commit (or bapi_transaction_commit which is a BAPi that do a commit and a refresh of itab) you can no monger reverse the database change with rollback or bapi_transaction_rollback. So you need to do a new bapi call that reverse movement or cancel change of orders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;call BAPI1
if ok 
- commit
else 
- rollback
- exit
endif
call BAPI2
if ok
- commit
else 
- rollback
- call BAPI1 reversed
- pray!
- commit
- exit
endif&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And remeber if third BAPI fails, you have two reverse call to execute, and what if the second of these reverse call fails...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So first, make all what is humanly (and budgetary) possible to insure that each call willl succeed, control data, check locks and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 14:53:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867410#M672709</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2007-09-19T14:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867411#M672710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Raymond,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see your point. I especially like the praying part....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 15:00:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867411#M672710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-19T15:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867412#M672711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way is to check the return table if the return table doesn't contain any error messages i.e. when return-msgty ne 'E' then only call the FM BAPI_TRANSACTION_COMMIT, else you an ROLLBACK WORK. or do the necessary action instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 12:35:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867412#M672711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-20T12:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867413#M672712</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 didn't get why are you &lt;/P&gt;&lt;P&gt;just don't fire commit work until everything is fine.&lt;/P&gt;&lt;P&gt;and try to read SAP LUW  &lt;A href="http://help.sap.com/erp2005_ehp_04/helpdata/EN/41/7af4c2a79e11d1950f0000e82de14a/frameset.htm" target="test_blank"&gt;http://help.sap.com/erp2005_ehp_04/helpdata/EN/41/7af4c2a79e11d1950f0000e82de14a/frameset.htm&lt;/A&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: lv_tid TYPE ARFCTID.

CALL FUNCTION 'TRANSACTION_BEGIN'
 IMPORTING
   TRANSACTION_ID       = lv_tid

          .
PERFORM GOODS_MOVEMENT.
*Check for an error here or inside the perform
* and put this code there

IF &amp;lt;your logical expression here&amp;gt;."in case of an error
* this fires ROLLBACK
  CALL FUNCTION 'TRANSACTION_ABORT'
    EXPORTING
      transaction_id       = lv_tid
            .
ENDIF.

PERFORM UPDATE_PRODUCTION_ORDER.
* another check for errors
IF &amp;lt;your logical expression here&amp;gt;."in case of an error
* this fires ROLLBACK
  CALL FUNCTION 'TRANSACTION_ABORT'
    EXPORTING
      transaction_id       = lv_tid
            .
ENDIF.

PERFORM UPDATE_PURCHASE_ORDER.
* another check for errors
IF &amp;lt;your logical expression here&amp;gt;."in case of an error
* this fires ROLLBACK
  CALL FUNCTION 'TRANSACTION_ABORT'
    EXPORTING
      transaction_id       = lv_tid
            .
ENDIF.

PERFORM GOODS_MOVEMENT.
* another check for errors
IF &amp;lt;your logical expression here&amp;gt;."in case of an error
* this fires ROLLBACK
  CALL FUNCTION 'TRANSACTION_ABORT'
    EXPORTING
      transaction_id       = lv_tid
            .
 ELSE."No errors
* this fires commit work
   CALL FUNCTION 'TRANSACTION_END'
     EXPORTING
       transaction_id       = lv_tid
             .

ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Aug 2010 19:20:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867413#M672712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-22T19:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867414#M672713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joy,&lt;/P&gt;&lt;P&gt;I Actually Haven't worked a lot in BAPI's but this what I have seen While Surfing through Other Forums:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT W_BAPIRET2
   WHERE TYPE = 'E'.

   WRITE:/ '* Erreur : Probleme de mise a jour des ' , 'caractÃ©ristiques'.
   WRITE:/ ' -&amp;gt; Message SAP : ' , w_bapiret2-message.

ENDLOOP.
IF sy-subrc eq 0.
* Do your rollback

ELSE.
* do your commit

ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just Check It May be Helpful!!!!!!!!!!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Aug 2010 09:25:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867414#M672713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-23T09:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to rollback after BAPI_TRANSACTION_COMMIT?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867415#M672714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Calling the function BAPI_TRANSACTION_COMMIT uses 1. WAIT (Exporting) and 2. RETURN (importing) use these 2 when ur call this function pass 'X' in wait and pass an empty structure same as BAPIRETURN2 table for RETURN importing parameter. Then check whether the return-msgty = 'E' means error while commit. and then ROLLBACK WORK if this true or else COMMIT WORK is already executed in the above bapi function itself.&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 09:23:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-rollback-after-bapi-transaction-commit/m-p/2867415#M672714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-15T09:23:55Z</dc:date>
    </item>
  </channel>
</rss>

