BAPI_TRANSACTION_COMMIT with WAIT = 'X' does not work.  Any suggestions?

1) 'BAPI_PRODORD_CREATE'
2) CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
3) BAPI_PRODORD_CHECK_MAT_AVAIL
Sometimes it works fine, other times the BAPI_PRODORD_CHECK_MAT_AVAIL passes an error that says the "Order does not exist."
I tried a "Wait up to 10 seconds".  That makes the processing go extremely slow and even that doesn't make it work 100%.
Any suggestions?

From what I found,
1) the commit_wait is automatically ran in many BAPI's, but not all.  It is oftern duplication to add it yourself
2) The commit_wait logic appears to end on the application server.  Once the application server passes the commit to the database then the application server thinks it is done and continues processing the program.  In reality the database is still processing and the record is still locked in the database.  This means the commit and wait code is not a 100% guarantee.
Solution:
1) Function module ENQUEUE_READ (or transaction SM12).  This checks to see if the database lock is in place.  Set a break-point in the code and in a separate window run one of these.  You will see the locks.  Now you know the lock condition add some ABAP code to Do loop at reading the results on the relevant lock. Exit and continue processing when the locks are removed.  See my comments in step 2 about a wait a few seconds between loops and providing an exit time to avoid infinite loops.  I think solution 1 is better than solution 2, even though I implemented solution 2. 
or
2) loop on a select from the database (you need to know the table being updated by the bapi to do this).  exit the loop when the record is inserted.  This is what I did since I hadn't found the solution in step 1 when I implemented my fix.  Don't put a wait statement in the loop though.  The wait is taxing on the database because it executes a commit.    I used "get time field" to handle a 2 second wait between database reads.  I also used this to exit after 30 seconds to avoid an infinite loop.
Below is some sample code of solution 2.  I used it in between a BAPI production order create and BAPI check production order material availability.  I was getting an error saying the production order hadn't been created in the material availability check when in fact it had been created but just not committed to the database.
  DO.
Only select from DB every two seconds
      CLEAR do_time3.
      do_time3 = do_time1 - do_time2.
      IF do_time3  GT gc_000002.
* Determine if confirmation has committed to database
        SELECT SINGLE aufnr FROM resb INTO lv_aufnr WHERE aufnr = g_aufnr AND
                                                          xloek = space   AND
                                                          xwaok =  gc_x    AND
                                                          kzear =  gc_x    AND
                                                          matnr IN r_range.
        IF sy-subrc EQ 0.
          EXIT.
        ENDIF.
      ENDIF.
      GET TIME  FIELD do_time1.
      do_time2 = do_time2 + gc_000002.
      do_exit = ( do_time1 - do_time ).
      IF do_exit GT gc_000030.
        EXIT.
      ENDIF.
      CLEAR do_exit.
    ENDDO.

Similar Messages

  • TS1574 I'm having issues with just one speaker not working, any suggestions?

    for some reason, one of my speakers will stop working. i've tried the apple suggested quick fixes but so far nothing has worked. Any suggestions??

    You have tried all the Apple suggestions,they didn't work, and now it is time to take it it for diagnosis.

  • Sybase "Top (n) percent" does not work, any suggestions?

    Hi All,
    I want to select a percentage of records in Sybase. I can only use "SELECT TOP n" to select n rows. If I want to select 100% of the rows in SQL I use "SELECT TOP (100) PERCENT", Sybase does not recognize the syntax.
    Does anyone know if this is possible in Sybase? What is the syntax in Sybase?
    Thank you in advance.
    Regards,
    Reshma
    Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered

    Try : SELECT TOP 100 PERCENT ...
    and find a right forum to ask question related Sybase. It is not the same product now.

  • I own the 4s and my BT Planttronics Pro works fine with calls but does not work to listen to music? Any ideas on how to correct this?

    I own the 4s and my BT Planttronics Pro works fine with calls but does not work to listen to music?
    Any ideas on how to correct this?
    Thanks-Vitaleyes

    I don't know what they call it, but my plantronics voyager pro, and my wifes plantronics voyager pro+ will not let you hear music through the headset.  My Blueant T1 does support it and plays the music through the deadset.

  • Hello, the 'Save As' dialog box used to allow the backspace button to go up one level in the directory when the focus is in the folder contents box but it does not work any more, please help.

    Hello, the 'Save As' dialog box used to allow the backspace button to go up one level in the directory when the focus is in the folder contents box but it does not work any more, please help. BTW the same 'Save As' dialog in other applications still allow the backspace button to go up one level in the directory.

    cor-el,
    I kept forgetting and procrastinating about following your instructions, since I have internet access only for limited amounts of time and usually I am busy with important tasks when I am.
    Out of the blue, the problem corrected itself (the Save As box started to open full screen, then shrunk down to a normal size and the edges can now be dragged to a custom size).
    Even the copy and paste problem in the filenaming area seems to have been less troublesome lately even though there have been no updates to Firefox in a few weeks.
    Even though I marked the solution as not helpful, the problem has in fact been resolved. I will save the solution instructions in case the issue returns.

  • HT4623 I updated to ios 7.1 on Thursday.  My ipad basically does not work any more.  I am running around in circles on this site and on other "forums" trying to fix.  ???  Don't have time for this.....

    I updated to ios 7.1 on Thursday.  My ipad basically does not work any more.  I am running around in circles on this site and on other "forums" trying to fix.  ???  Don't have time for this.....Any advice appreciated.

    give us more to work with in terms of info then "basically does not work any more"
    it can be from it's on fire to the a key on the onscreen keyboard don't respond

  • The paint bucket tool is not working properly. The colors does not change, any suggestion?

    The paint bucket tool is not working properly. The colors does not change, any suggestion?

    Maybe on the wrong layer.
    It would be more beneficial if you capture your screen with the layers panel open and any layers that are collapsed, expand them.

  • One speaker of my i phone 4s does not working any more and my phone still new ?

    One speaker of my i phone 4s does not working any more ? and it s still new !

    There is only one speaker, other side is microphone. You
    may wish to download and become familiar with the user guide.
    It is a link in Safari on your iPhone, you can download the user
    manual after you download iBooks app, or you can find it here:
    http://support.apple.com/manuals/#iphone

  • My Home Sharing does not work any more after latest iTunes update

    After iTunes update to 11.1.3 my Home Sharing does not work any more!
    It worked just fine for several years...
    I tryed to do everything I could find on Apple support... NOTHING works.
    Most of Apple so called updates turn out real crap...
    I am wondering whats happening to Apple?...

    Hello igor_rena,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    Troubleshooting Home Sharing
    http://support.apple.com/kb/ts2972
    Best of luck,
    Mario

  • Connecting Wahoo Blue HR with iPhone 5 does not work, tried everything possible

    Connecting Wahoo Blue HR with iPhone 5 does not work, tried everything what I could find in the interenet as solution??????

    IPhone 4s, iOS 7.1.1: iphone can't connect to wahoo HR BT4.0 sensor :((( Wverything worked fine with iOS 6 !!!

  • Hyperlink with tracking applied does not work in PDF

    We use lots of web addresses in our advertising and generally the web addresses automatically convert to hyperlinks when we distill the files and make PDFs. Recently we've had two instances where someone applied tracking or justification to the line of text containing the url to make it spread across the page. When we make our PDF the url is not clickable. Is there anyway around this? We tried actually creating a hyperlink manually in InDesign by using the Hyperlinks panel and entering the address, but that didn't work either.

    Peter,
    We'll look into that. We already do two separate PDFs for print and web, but
    we are distilling both right now. Wouldn't be too much of a problem to
    change to exporting the web version I don't think.
    I did a test, just curious, is there a way to keep it from putting a black
    box around the link on the PDF?
    Thanks for your help! We appreciate it!
    Beth
    From: Peter Spier <[email protected]>
    Reply-To: <[email protected]>
    Date: Fri, 14 May 2010 13:24:04 -0600
    To: Beth Phillips <[email protected]>
    Subject: Hyperlink with tracking applied does not work in PDF
    Distilled PDF uses Postscript which does not support hyperlinks and
    interactivity. To make your hyperlinks in ID you'll need to export and check
    the Include Hyperlinks and Include Interactiviity boxes.
    Your printer doesn't need hyperlinks because they don't work on a printed
    page. The requirements for print and interactive PDF are quite different, and
    you may find you need to make two versions.
    >

  • What if sync with new computer does not work. logical connection to old with WindowsXP, 32 bit version of iTunes. New is Windows7 with 64bit version

    What if sync with new computer does not work?
    logical connection to old with WindowsXP, 32 bit version of iTunes.
    New is Windows7 with 64bit version

    Syncing to a new iTunes library or computer will erase your iPod. Only if you back up your iPod manually before syncing, you can restore your device from that backup again. A manual backup does not include the sync process.
    Do this:
    Disable autosync in iTunes, connect your iPod to your new computer and right click on it in the device list and choose backup. iTunes will backup your iPod without syncing.
    Transfer your purchases the same way, choosing "transfer purchases" this time.
    When you connect your phone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
    Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the iPod for the first time.
    Music is one way only, from the computer to your device, unless you bought the songs in iTunes and transferred your purchases.
    There is 3rd party software out there, but not supported by Apple, see this thread: http://discussions.apple.com/thread.jspa?threadID=2013615&tstart=0
    About backups and what's saved: http://support.apple.com/kb/HT4946
    How to back up and restore:http://support.apple.com/kb/HT1414
    How to download apps for free again:http://support.apple.com/kb/HT2519
    Saving other data is also described here. How to back up your data and set up as a new device
    If your iPod can't be recognized by Windows, try these tips: iOS: Device not recognized in iTunes for Windows

  • Since IOS7,The synchronization itunes does not work any more

    since IOS7, the synchronization itunes does not work any more....

    Hi martinafromlimassol,
    Welcome to the Apple Support Communities!
    I understand that you iPhone has been dropped and the display no longer functions. In this situation, it may be necessary to have your iPhone 5 evaluated for repair. Please use the attached link for information on the process of having your iPhone evaluated. 
    iPhone Repair and Service - Apple Support
    Best regards,
    Joe

  • My sons power button on his iPhone 4S does not work any more, does anyone know how much it will cost to fix? 1 year warranty just ran out.

    My sons iPhone 4S power button does not work any more, does anyone know how much it costs to fix? 1year warranty has just expired

    Out-of-Warranty Service
    If you own an iPhone that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will service your iPhone for the Out-of-Warranty Service fee listed below.
    iPhone model
    Out-of-Warranty Service
    iPhone 5s, iPhone 5c,
    iPhone 5
    $269
    iPhone 4S
    $199
    iPhone 4, iPhone 3GS,
    iPhone 3G, Original iPhone
    $149
    A $6.95 shipping fee will be added if service is arranged through Apple and requires shipping. All fees are in U.S. dollars and are subject to local tax.

  • My camera works with the photobooth and with skype but does not work with online applications such as "lolcam from facebook" or "faceonthehole" application. Please help

    My camera works with the photobooth and with skype but does not work with other applications like the "lolcam" from facebook or the " faceonthe hole" application. Can anyone help?

    There was a issue with school computers being used to spy on kids in their bedrooms, Mac's were involved.
    So Apple most likely tightened the API's to only select, trustworthy companies as not to abuse the web cam access priviledge.
    If you want to use a web cam with these other programs and services, you'll likely have to buy a third party USB one, so you can manually disconnect it.
    There isn't a way to physcially disconnect the built in web cam on Mac's without busting open the machine.

Maybe you are looking for