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

Similar Messages

  • 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...

  • Flash Player And adobe reader not working and downloads don't work

    I have IE 8 and windows vista and everything has worked great for 2 years until 2 or 3 weeks ago.  At that time my flash player stopped working so I could no longer get videos , streaming stock quotes, weather map loops, etc and when I go to websites that use Flash (i.e. Piaaz Hut) it wouldn't work.  Also, at that same time my adobe reader stopped working properly and I can't view mosy PDF Files.
    I have gone through many of the posts on this forum and have tried many of the fixes, but none have work for me.
    I tried to uninstall the Flash Player, but I didn't use the Adobe uninstaller.
    Whenever I try to update or load the Flash player, a dialog box with the globe tossing papers to the folder appears and then after a few seconds I get the the message that IE can't install_flash_player_ax.exe from fp download.adobe.com, and then a message that says IE was not able to open this internet site. The requested site is either unavailable or cannot be found.
    In control panel programs I have listed
    Adobe AIR      no size
    Adobe Flash Player 10 active X           no size
    Adobe Reader 9.3     141mb
    Macromedia Shockwave player      no size
    In Tools i have the following add ons and they are all enabled
    Shockwave Flash object 10.0.42.34
    Adobe PDF Link Helper
    Adobe PDF Reader
    Macromedia Shockwave Active X Control 10.1
    As I said I've already attempted a number of the fixes on this forum, but so far no luck.
    Does anyone have any suggestions on what else I might try?
    Thanks

    Ok, I tried to download the firefox browser but IE wouldn't let me download it.  My friend downloaded it from their computer to a flash drive and I loaded it to my computer from the flash drive.  The download of Firefox from the flash drive worked, and now I'm using Firefox & both my adobe flash player and my adobe reader are working just great.
    However, neither the flash player nor the reader are working if I use IE, so I guess I will just have to use Firefox as my browser.
    I'm going to mark my question as answered since I really don't care that I have to use Firefox instead of IE,although I can't understand why it works using Firefox but not using IE.
    Thank you so much for your assistance in walking me step-by-step through this problem until I was able to reach a satisfactory solution.

  • MY USB micro SD card is not working and I don't know why?

    I recently purchased a micro SD card and for whatever reason my usb micro sd card reader is not working.  It recognizes a device is plugged in but doesnt recognize any files on their.

    Nvm I found everything on their was hidden via the properties on my windows pc. I'll have to fix it using a friends pc.

  • I don't know how to get help. Since yesterday 17th October, my Mac is refusing to open copied documents. I can't work, and I don't  understand why this has suddenly happened, or how to stop it. HELP PLEASE

    Dear Mac users, could you please tell me how to get Mac technical support. Thank you very much.

    If you are still under warranty, you can call AppleCare. If not, you can still call them and pay a fee for service.
    Or, you can further explain your problem here and we will try to help.
    What error messages are you getting.
    Where are you copying from and to?

  • My iPad when I open safari will allow me to type a address and it will go to the web site but when it gets there the screen is darkened and it will not let me do anything but go to anouther adress. Touch screen doesn't work and tabs don't work.

    I am having problems with safari. The screen is darkened and I can't use touch screen or tabe. But I can use the address bar and go to anouther website. Other then that I can see website but can't touch nothing, how do I fix

    Go to Settings>Safari>Clear Cookies and Data. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Or
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Or if those do not work - quit Safari 
    Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • 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

  • 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.

  • 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

  • COMMIT WORK AND WAIT IN BDC

    All stock transfer order updates, generating deliveries and picking and post good issues(PGI) are done via BDC processing. That is we have BDC for tcodes: me22, ye02 and vl02.
    The issue is the deliveries are not picked and te PGI is completed. we have to use COMMIT WORK AND WAIT statement after every BDC processing.
    There is a form ' insert-transaction using tcode '
    This form calls BDC_OPEN GROUP, BDCINSERT and BDC_CLOSE_GROUP.
    So we write this COMMIT AND WAIT statement after call transaction <tcode>( eg call transaction me22) every time  or just after BDC_CLOSE _GROUP in  the form.

    Hi,
    you the call of BDC inside a loop and set the COMMIT WORK AND WAIT for the endloop.
    loop ...
      bcd-processing.
      COMMIT WORK AND WAIT
    endloop
    Regards
    Nicole

  • 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.

  • I cannot sync Ical on my iMac with my professional calendar (outlook web access). and I don't understand why it doesn't work since I have already made it with my iPhone. Help

    Hello,
    I bought an iMac few days ago. I would like to sync ical on my iMac with my professional calendar I use in my company (from outlook web access).
    I was easy to manage it on my iPhone (I just add a new "exchange" mail account and ask for a calendar sync only) and it worked very quickly.
    But I cannot do it with the iMac, and I don't undersatnd why?
    the domain is is used for my iPhone is the following :
    owa.companyname.com
    I tried all the solutions I found in this forum but it doesn't work.
    Many thanks in advancefor your help.
    Matt

    Does it have to be an applet?
    If you want the same behaviour as in the code with traffic lights, change
    class MortgageApplet extends JApplet implements ActionListener {
    to
    class MortgageApplet extends JFrame implements ActionListener {
    and change
    public void init() {
    to
    public MortgageApplet() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 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

  • "Problem" with COMMIT WORK AND WAIT

    Hi everyone!
    I'm facing the following situation:
    I have a Z program that calls MIGO, via CALL TRANSACTION. The only thing I do when calling this is filling a few fields, so the user has to complete the  operation before going back to Z program.
    When someone executes MIGO in the normal way, I mean, without a CALL TRANSACTION command, there was a additional step, a modification made in the standard code for someone before. But this part of the code didn't execute when calling MIGO via CALL TRANSCATION.
    What I have found out is that just before this code inserted, there was a COMMIT WORK AND WAIT command, and was exactly in this point that, when using the first aproach, it leaves MIGO.
    Is there a way to execute the entire process in MIGO,  I mean , do not leave it at COMMIT command? I've tried to pass at CALL TRANSACTION command diferent UPDATE parameters (i.e: 'S', 'A' and 'L'), but it didn´t work as well.
    I hope you could get the point!
    Thanks in advance!
    Raphael

    I've just found out something interesting about that.
    When I make a CALL TRANSACTION, without passing a table bdcdata, the transaction doesn't leave at the COMMIT WORK command.
    So,  I think it won't work with the bdcdata!
    Raphael

  • 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).

Maybe you are looking for

  • HT201250 How do I find and delete local backups.  This is taking up over 200g of space on my MBP

    I recently looked at my hard disc drive and backups were taking over 200gb of space.  I used the terminal command to stop taking local backups, but when I rechecked disc space it only moved the space from backup to other.  Is there a way to find and

  • How do I place a logo above a movie?

    Hi, I am a newbie to After Effects and the company I work for wants me to put their logo in After Effects so it sits "stationary" above the movie when it is playing. The logo is currently a .png file with a transparent background. Do I just place it

  • N97 mini hugely disappointing

    Where do i begin...i'll try to be brief. I know the vast majority of my complaints have probably been raised on numerous occassions but i feel the need to vent myself.  Just as a bit of background about myself  I have spent six years in various techn

  • Outer join with first of zero or more rows

    Hi! I'm trying to make a join where one part is the first row of zero or more rows. I seem to be getting much poorer performance than I ought to be able to. My tables Node and RelayGroup have 6000 and 3000 rows respectively, while the CommandHist tab

  • Procedure containg select from Database link

    Hi, I have one database link xxx which is getting some data from one table from Sqlserver database. Now I am writing one procedure which contain if(c=1) --get from databaselink select name,num from table1@xxx; else --get from the Oracle table; Now ia