Commit work and wait after bapi execution not working

Hi experts,
I have a requirement from my client that consists on posting 2 documents and then clearing them.
Right now Iu2019m posting the first 2 documents using BAPI_ACC_DOCUMENT_POST and for clearing both documents Iu2019m using Tcode F-51 but sometimes it's giving me an error clearing the documents because after the second bapi run, posting the second document, apparently all went right and a document number it's returned but the database doesnu2019t updated the doc number.
Iu2019m using commit work and wait, and already tried BAPI_TRANSACTION_COMMIT,  but it doesnu2019t work sometimes, and the only solution that i found was the Wait up 1 second command , which it's slowing the program execution.
i think the problem it's on the bapi posting execution, due to a lag on the database side, but Iu2019m not sure...
Did anyone already had this problem? Has anyone has a solution for this?
Thanks in advance
Best Regards
João Martins

Hi,
Normally every BAPI will work on Update task so that the data will be updated once the commit work is done. For the commit work, we will normally call the bapi function module - BAPI_TRANSACTION_COMMIT. It should work.
In your case, just try the below option:
Please call the bapi - BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT in a seperate function module and call this function module in your program (just pass the import / export / table parameters accordingly).
For the information, I had once a similar type of issue and it got solved once I did like the above.
Regards,
Selva K.

Similar Messages

  • In outlook 2013 Add-In, Adding dynamic menu to splitButton idMso="DialMenu" is working and the same code is not working in outlook 2010 Add-In.

    In outlook 2013 Add-In, Adding dynamic menu to <splitButton idMso="DialMenu"> is working and the same code is not working in outlook
    2010 Add-In. please let me know, if i am missing something. Below is the xml and screen shot
    <contextMenu idMso="ContextMenuFlaggedContactItem">
     <splitButton idMso="DialMenu">
              <menu>
                <dynamicMenu id="CallContactwithFreedomvoice
    " label="CallContactwithFreedomvoice" 
                            getContent="OnGetContenttest"                           insertAfterMso="Call"/> 
            </menu>       </splitButton>    </contextMenu> 

    Hi Narasimha prasad2,
    Based on the description, the context menu for the flagged contact doen't work in Outlook. I am tring to rerpoduce this issue however failed.
    I suggest that you check the state of the add-in first to see wether the add-in was loaded successfully.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Why my wi-fi is not working, and it says bluetooth is not working too??

    Why my wi-fi is not working, and it says bluetooth is not working too??
    My bluetooth n wi-fi are both unavailable! i had already restore my device, but it still doesn't work!!
    My name is juniper, i am from Taiwan! Any know what's wrong with this piece of XXXX!!?? Help me plzzzz!!

    Hi ,
    I am a specialist in Computer and Information Systems e. I am 40 years old from Egypt
    I have Iphone 3g 8g and my SN  868391XZY7H
    Tunes update killing my Iphone software , 3 days my Iphone not working  Although I am go to download 100% update and my iphone installed all  a software update but I don’t know what happened why my Iphone not working  ?
    now some one help me and he installed software for my iphone  and it is working but  Wi-Fi and Bluetooth not working
    I need help me because    Tunes   update from killing my Iphone  ??.
    i want my old Iphone software please
    thank you somuch
    [email protected]

  • Ear Sir: Yesterday on 18.09.2014 evening, I wanted to install IOS 8.0 according to your instructions iPhone 5S.during installation Stopped working and was closd, I can not work with him. Ibought it in the United States Apple Store Fifth 40venue 767 N

    Dear Sir: Yesterday on 18.09.2014 evening, I wanted to install
    IOS 8.0 according to your instructions iPhone 5S.during installation
    Stopped working and was closd, I can not work with him. Ibought it in
    the United States
    Apple Store Fifth 40venue 767 New York NY1053
    iPhone 5s Spase Gray 32 gb verizon.
    Part Number: ME344ll / A.
    Serial number: DN*******NjM.
    Model A1533. I would like to request a new password for opening the
    iPhone.  Passwod..... Thank you very much,
    Im not difficult for you to request a quick answer.Israel.
    <Personal Information Edited By Host>

    We are fellow users here on these forums, you're not talking to iTunes Support nor Apple - it looks like somebody has asked the hosts to remove your personal info from your post (it's not a good idea to post any personal info on any public forum).
    What do you 'stopped working and was closed, I can not work with him' ? What exactly are you seeing on the phone's screen ?
    If it's the activation screen and you can't remember your password for your account then see if you can get it reset via http://iforgot.apple.com

  • On iphoto my stop import is not working and the force quit does not work either

    please help - the stop import and force quit on iphoto both not working. thx!

    This happened to me today on the iPad; I put in the password 4 or 5 times. I began to think my account had been hacked. I tried again on my iPhone and it worked first time. Then I tried again on the iPad and same thing—worked first time. Maybe just a temporary glitch in the server?
    Michael

  • Easy Link 1.6 no longer works and latest version states will not work with my router

    I have the WRT54G router (version 8.00.2 firmware) and the Easy Link Software I got with it no longer works correctly (version 1.6), saying I am not connected to the internet even though I clearly am connected.  (I theorize that it tries to connect by pinging Linksys and I cannot ping Linksys using any method, so I think Linksys no longer accepts pings.)  I downloaded the newest version, thinking it would work, and the forum states it will only work with a few routers that are more recent (I bought mine in Jan 2008.)  Am I out of luck, with no verion working correctly?  I appreciated the information that was found in the Easy Link Advisor software that I no longer have.

    Cunning1_
    You are a legend!!  I have spent countless hours uninstalling, reinstalling itunes, playing with firewall settings, reading articles on this problem!!  I only have to un-sync my iphone 5 and then the airplay icon magically appeared!!!  Maybe I have too many devices syncing via wi-fi, or maybe it is the Iphone syncing??
    Whatever - one step and now I can enjoy my music through my house again!
    Thank you, Thank you, Thank you 

  • Restart and waking after sleep is not working properly

    okay. a couple of things.
    one: sometimes, when i put my computer to sleep and come back to it later, it wont re-start up. i know it is going to happen because it is only when i open the computer and the screen flashes the sign in instead of just coming right on. when i enter my password and press enter, it goes black. it isnt off, and i can still see the mouse, but it wont sign in. i have to hold the power button and re-boot it.
    two: it wont restart unless i have pretty much just started it and havent used anything. for example, when i get an update, it says would you like to install update, i press yes, and it says restart now? i say yes, and it just doesnt do anything. i cant re-start it or shut it down. again, i have to manually hold the power button and re-start it.
    can anyone help me?
    thanks so much!

    1. Boot from your system install DVD, run Disk First Aid from your Disk Utility and repair your permissions.
    2. Reset PRAM
    3. Reset your SMC.
    Resetting the System Management Controller >>
    4. Try trashing these 3 .plist preferences and reboot. Reset your Energy Saver preferences.
    HD > Library > Preferences > SystemConfiguration > com.apple.AutoWake.plist & com.apple.PowerManagement.plist
    User > Library > Preferences > com.apple.systemuiserver.plist
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Creator of 'Mac611 - Mobile Mac Support' (designed exclusively for an iPhone/iPod touch)

  • Commit work and wait don't work,why

    Hi All,
    I call BAPI 'BAPI_PO_CREATE1' and create PO, then commit via
    commit work and wait.
    after creating, query the new PO via
    SELECT ebelp pstyp INTO TABLE lt_ebelp
      FROM ekpo
      WHERE ebeln = p_lv_ebeln.
    but no result.
    If creating and waiting a moment, it do work.
    why, I already used 'commit work and wait' but not 'commit work'.
    thanks.
    regards.
    dou

    Okay ,first check whether po number is getting saved or not .
    If po is saving then use BAPI_TRANSACTION_COMIITT FM ..
    Now check ur select query like : Since wait upto n seconds ( This may not work)
    data : n Type i.
    n = 10.
    write the below code after  BAPI_TRANSACTIOn_COMITT.
    do n times.
    select query
    if sy-subrc eq 0.
    exit.
    endif.
    enddo.
    still document number is not coming ,testing purpose increate n as 20 and see the results.
    Thanks
    Seshu

  • COMMIT WORK AND WAIT does not work

    Hello,
    I know this question has been asked many times in various forums. But the fact remains that there is no definitive solution found for this problem which does not involve WAIT UP TO n SECONDS or SELECT until the DB commit has been completed.
    We have an IDoc based inbound interface for creating Project Defintion and WBS Elements. Here is how the code looks like in the processing function module:
    * Create Project Defintion
    CALL FUNCTION 'BAPI_PROJECTDEF_CREATE'
      EXPORTING
        project_definition_stru = lwa_proj_bapi
      TABLES
        e_message_table         = lt_messages.
    * If no errors
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = 'X'.
    * Other code
    * Create WBS Element (BAPI could not be used because not all fields are allowed to be updated)
    CALL TRANSACTION 'CJ11'
    Now while creating the WBS Element, transaction CJ11 returns an error that 'Project does not exist'. This is not correct because the same Project was successfully created in the previous step.
    It is clear that the problem is because of the delay in database commits.
    This happens only with few IDoc's and not all of them. And of course, the problem does not occur if I induce WAIT UP TO n SECONDS after BAPI_TRANSACTION_COMMIT. But this is not the best practice.
    The question is why BAPI_TRANSACTION_COMMIT does not wait even though we are forcing it to?
    Thanks in advance
    Sagar Acharya

    Suhas wrote:
    But i am baffled that although the COMMIT has happened earlier why is the data not updated in the DB ?
    Well, it's just a [COMMIT WORK|http://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm] and not a [COMMIT WORK AND WAIT|http://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm#@@AND%20WAIT@@COMMIT%20WORK@@]. Let me quote the ABAP help:
    If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating), but instead is resumed immediately after COMMIT WORK. However, if the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    @Sagar Acharya: Well, I thought you were looking for an explanation why sometimes the project isn't created (and you only had posted coding that showed details for step 1) - I'm trying hard, but my mind reading skills are rather limited yet...
    So let's think about step 2 and 3: I assume that you made sure that your coding always references the correct WBS element. Again the commit (without wait) is done already via CJ11 (e.g. check form BUCHEN in SAPLCJWB). I'd expect though that the synchronous update mode should make this work. Since it doesn't, I'd try local update mode, which is what I'd choose in your case anyhow.
    Apart from that my mind is pretty blank, except for the usual silly things to check. E.g. are you sure you're coding is correct, you are handling all return messages and log them for inspection later (e.g. application log), you are certain that the WBS was actually created by the same IDoc that throws the fit (and IDoc was not reprocessed), etc.
    So maybe somebody else has better ideas...

  • Data lock even after commit work and wait

    Hi Experts,
    Data is still locked even after commit work and wait step has run, which made me very confusing.
    The following are the details:
    These steps are in a FOP.
    Step1: Change Move-in Date of a move-in document in background after get the new move-date from user.
    Step2: Run BAPI_TRANSACTION_COMMIT and pass the wait parameter.
    Step3: Bring move-in document transaction to the user for other information changes.
               After the user confirms the changes and presses SAVE button, error message shows that the move-in document is still locked. But no other transaction is opened for the specified move-doc changing.
    Does any1 have any idea on this? How can I solve this issue?
    Thanks in advance and points will be rewarded.
    Vincent

    Hi,
    Normally every BAPI will work on Update task so that the data will be updated once the commit work is done. For the commit work, we will normally call the bapi function module - BAPI_TRANSACTION_COMMIT. It should work.
    In your case, just try the below option:
    Please call the bapi - BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT in a seperate function module and call this function module in your program (just pass the import / export / table parameters accordingly).
    For the information, I had once a similar type of issue and it got solved once I did like the above.
    Regards,
    Selva K.

  • COMMIT WORK and WAIT FOR n SECONDS

    I am designing a WebDynpro Java application.  It makes an update call followed immediately by a display call which should return the data that was just updated.  However, it appears that there is some DB latency involved and the data takes a few seconds to update.  The application displays old data if the display call is performed too quickly after the update call.
    All suggestions I could find point to having a Thread sleep on the Java side for a few seconds or have a WAIT FOR n SECONDS and/or COMMIT WORK AND WAIT statement in the ABAP function module.  Neither of these solutions is acceptable in a company-wide application where database latency could vary significantly based on traffic.
    I tried all kinds of functions (i.e. BAPI_TRANSACTION_COMMIT) as well as various forms of COMMIT WORK... nothing except a WAIT works correctly.  There must be a statement out there that waits for the database write to be complete!  How is this solved without picking an arbitrary WAIT time?  What am I missing?
    Thanks in advance!

    You can write the other way.
    declare one variable
    data : wa_try type i.
    wa_try = 10. -> set as 10 ,even you do not get value ,keep on incresing.
    after BAPI FM
    you can call comitt fm.
    after BAPI_TRANSACTION_COMITT
    just use simple logic.
    do wa_try.
    select * from table into table
                                  where record = bapi fm record ( You get in RET2 Message).
    if sy-subrc eq 0.
    exit.
    endif.
    Thanks
    Seshu

  • DUMP with Commit work and wait

    Hi all!! I need your help again!!
    I have this:
      WAIT UP TO 1 SECONDS.
                          UPDATE zpsc_ofertes
                          SET status = 'ENTRA'
                              status_v = 'CO/AA'
                          WHERE oferta = zpsc_ofertes-oferta
    AND versio = var_vers_destino.
    CALL FUNCTION 'STATUS_UPDATE_ON_COMMIT'.
        COMMIT WORK AND WAIT.
    CALL FUNCTION 'BUFFER_REFRESH_ALL'
    That code creates a dump... Why could be this problem??
    Thanks!!

    Let's see.
    The current application triggered a termination with a short dump.
    ¿Qué ha sucedido?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).
    ¿Qué puede hacer?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    The code...
    000010   *
    000020   ***INCLUDE LPS_BAPIF01 .
    000030   *
    000040   *&
    000050   *&      Form  CHK_PRECOMMIT
    000060   *&
    000070   *       check precommit
    000080   *
    000090   FORM chk_precommit.
    000100
    000110     DATA: chk_precommit_ok TYPE c,
    000120           chk_error        type c.
    000130
    000140     CALL FUNCTION 'PS_FLAG_GET_GLOBAL_FLAGS'
    000150          IMPORTING
    000160               e_precommit_ok = chk_precommit_ok
    000170               e_error        = chk_error.
    000180
    000190     IF chk_precommit_ok = space.
    000200   *   Precommit wurde noch nicht aufgerufen.
         >       MESSAGE x030(cnif_pi).
    000220     ELSEIF chk_precommit_ok <> 'Y'.
    000230   *   Precommit wurde nicht erfolgreich durchlaufen.
    000240       MESSAGE x033(cnif_pi).
    000250     elseif not chk_error is initial.
    000260   *   At least one single BAPI failed
    000270       MESSAGE x056(cnif_pi).
    000280     ENDIF.
    000290
    000300   * commit work was called successfully after the precommit
    000310     PERFORM ps_bapi_init_global_variables.
    000320
    000330   ENDFORM.                    " CHK_PRECOMMIT
    000340

  • BAPI_REQUISITION_CREATE Problem with COMMIT WORK AND WAIT

    I ran into an issue and wanted to get your opinions about what might be happening.
    This is my original code that did not work correctly using COMMIT WORK AND WAIT. After the select statement, lv_count was zero even though there were PR items that had been created. I'm thinking that the database update was not complete, but why would that be?
        CALL FUNCTION 'BAPI_REQUISITION_CREATE'
          IMPORTING
            number            = lv_number
          TABLES
            requisition_items = gt_reqitem
            return            = gt_return.
    *   Purchase requisition has been created
        IF lv_number IS NOT INITIAL.
          COMMIT WORK AND WAIT.
    *     Get number of items in PR
          SELECT COUNT( DISTINCT bnfpo ) INTO lv_count
            FROM eban
            WHERE banfn = lv_number.
    This is my corrected code that works. I removed the AND WAIT from the commit statement and added a separate wait statement. I now get the correct number of PR items that were created.
        CALL FUNCTION 'BAPI_REQUISITION_CREATE'
          IMPORTING
            number            = lv_number
          TABLES
            requisition_items = gt_reqitem
            return            = gt_return.
    *   Purchase requisition has been created
        IF lv_number IS NOT INITIAL.
          COMMIT WORK.
          WAIT UP TO 1 SECONDS.
    *     Get number of items in PR
          SELECT COUNT( DISTINCT bnfpo ) INTO lv_count
            FROM eban
            WHERE banfn = lv_number.
    Any ideas?
    Brenda

    Brenda Bankert wrote:
    Yes, I was able to see the message in RETURN and no, I am not calling the FM in a loop. My program calls it one time.
    > Brenda
    If you were able to see the message 'Purchase requisition number & created' it means that the macro macro_end is getting executed within which the COMMIT WORK statement is encapsulated.
    I have quickly developed a dirty program to test the behaviour of 'SET UPDATE TASK LOCAL' and it seems to work as expected.
    Everytime I executed the below program with 'SET UPDATE TASK LOCAL', I see the value of lv_count as 1000, however if I execute the below program with out the statement  'SET UPDATE TASK LOCAL' the value of count varies everytime, typically around 10 - 15, however the database is successfully updated with all the 1000 entries, this makes me believe that the 'SET UPDATE TASK LOCAL' statement will infact make the subsequent COMMIT synchronous.
    REPORT zytest.
    DATA:
      ls_zytest    TYPE zytest,
      ls_db_zytest TYPE zytest,
      lv_numc04    TYPE numc4 VALUE 1001,
      lv_count     TYPE i,
      lv_index     TYPE i.
    DO 1000 TIMES.
      lv_index = sy-index.
      CLEAR ls_zytest.
      lv_numc04 = lv_numc04  + 1.
      CONCATENATE 'KF00' lv_numc04 INTO ls_zytest-keyfield1.
      CONCATENATE 'KF00' lv_numc04 INTO ls_zytest-keyfield2.
      SET UPDATE TASK LOCAL.
      CALL FUNCTION 'ZYTEST_BAPI'
        EXPORTING
          is_zytest = ls_zytest.
      SELECT SINGLE * FROM zytest INTO ls_db_zytest WHERE keyfield1 = ls_zytest-keyfield1
                                                      AND keyfield2 = ls_zytest-keyfield2.
      IF sy-subrc IS INITIAL.
        WRITE:/ lv_index, ls_db_zytest-keyfield1,ls_db_zytest-keyfield2.
        lv_count = lv_count + 1.
      ENDIF.
    ENDDO.
    WRITE:/ lv_count.
    FUNCTION zytest_bapi .
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IS_ZYTEST) TYPE  ZYTEST
    DATA: transaction_id LIKE arfctid.
      clear transaction_id.
      macro_start.
      CALL FUNCTION 'ZYTEST_UPDATE' IN UPDATE TASK
        EXPORTING
          is_zytest = is_zytest.
      macro_end.
    ENDFUNCTION.
    FUNCTION ZYTEST_UPDATE.
    *"*"Update Function Module:
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(IS_ZYTEST) TYPE  ZYTEST
    INSERT zytest from is_zytest.
    ENDFUNCTION.
    definition of the database table 'ZYTEST'
    MANDT     MANDT
    KEYFIELD1     CHAR20
    KEYFIELD2     CHAR20
    NONKEYFIELD     CHAR50
    -Rajesh

  • Issue with Commit Work and Wait.

    Hi All,
    None of the programs are working in my system which are calling BAPI BAPI_TRANSACTION_COMMIT.
    On COMMIT WORK AND WAIT statement, the process is going into indefinite loop. Everything was fine till last Thursday and there are no updates or patch level change or notes applied in the system.
    Please advice.

    <div style="text-align:left">We tried everything but still the issue is there.</div>
    Normally it's much easier to get help if you try to be as detailed as possible when explaining the problem and what exactly you have tried. No offense, but tried everything most likely translates into almost everything...
    Some information/checks I'd be looking for:
    <ul style="list-style:square!important">
    <li>What functions are (or coding is) involved? Are they all standard or custom?</li>
    <li>Have you tried update debugging and/or the usual traces (runtime analysis, SQL trace, etc.)?</li>
    <li>What do you see in the process overview?</li>
    <li>What about system log, developer trace, database logs/alerts, etc.?</li>
    </ul>
    Obviously my list is much too short and incomplete - yours must be longer. If you share your results (including your exchange with SAP) I suspect you have a better chance (though of course no guarantee) of somebody providing a valuable clue.
    Not sure if it's just me, but the part that sounds so odd and suspicious is that you only mention commits via BAPI_TRANSACTION_COMMIT. As this is just a wrapper around a COMMIT WORK I'm tempted to think it's the functionality that's invoked before (i.e. linked to the registered update functions/modules). Without any additional knowledge though, my first shot was for general update problems (which you ruled out).

  • Purpose of Commit work and wait

    Hi Friends,
    Kindly let me know what is the Exact Purpose of Commit work and wait
    Akshitha.

    Hai,
    <b>COMMIT WORK</b>
    This is the standard form, which specifies asynchronous processing. Your program does not wait for the requested functions to finish processing.
    <b>COMMIT WORK AND WAIT</b>
    This form specifies synchronous processing. The commit statement waits for the requested functions to finish processing. Control returns to your program after all high priority (V1) function modules have run successfully.
    The AND WAIT form is convenient for switching old programs to synchronous processing without having to re-write the code. Functionally, using AND WAIT for update-task updates is just the same as dialog-task updates with PERFORM ON COMMIT.
    Regards,
    Padmam.

Maybe you are looking for

  • How to display a report in tree format

    hai can any one send me the code to display the report in a tree format if i take example of customer numbers as tree branches and if i click each customer number the tree should expand showing all sales orders for a customer ragrds afzal

  • How to convert my NTSC project to PAL?

    Hi! I'd like know how i can convert my ntsc project into PAL. I need finish a DVD for my client take to ANGOLA and there is PAL system.It is possible? My Encore is 2.0. Or It is possible put my NTSC movie into PAL project and let encore transcode the

  • Making a DVD in IDVD with a project from FCPx

       I've tried a number of things but have not been successful.    The first time I hit the "Share" button, I selected the "Export File" option. At the next dialog box just took all the default settings. The result was a very large SD file that didn't

  • Documents in the cloud seems to be dead after update

    After the latest update (Mac and iOS) iCloud Documents is no longer working. icloud with calender and contacts is working but not documents in the cloud. I use iwork on all my devices (iPad/iPhone/Mac) and it worked well in the last year. Now all fun

  • How to convert Purchase Reqisitions to Purchase order

    Hai, I want to convert all my purchase requisitions into Purchase order. I want to know there is any bapi or function module is available or not . If it is available can you plz tell me how to do?