How to commit and wait

hai i want to use the wait concept i mean i dont want to go to next peice of code after calling bapi until it updates and save the records for this which statment i should use
regards
afzal

Hi,
U can use
COMMIT WORK AND WAIT.
Regards
Kannaiah

Similar Messages

  • How to execute a commit and wait via bol transaction context?

    Hi All,
    Currently a service contract is created via bol objects.
    Once all the objects are created, the modify() method is called bol_core instance.
    After that, the bol transaction context is assigned and the save() and commit() methods are called.
    This works fine, but the commit does not wait for the database to be updated before moving to the next steps.
    How can i get something like the 'commit work and wait' statement via the bol transaction context?
    would a commit work and wait statement work the same?
    regards,
    Leng

    Hi,
    It is a CRM specific issue.
    so the code sniplet is:
    go_bol_core = cl_crm_bol_core=>get_instance( ).
      go_bol_core->load_component_set( 'BT' ).
    create factory for BTorder
      go_bol_factory = go_bol_core->get_entity_factory( 'BTOrder' ).
      gs_param-name  = 'PROCESS_TYPE'.
      gs_param-value = 'ZSC1'.
      APPEND gs_param TO gt_param.
      go_btorder ?= go_bol_factory->create( gt_param ).
    send changes
      go_bol_core->modify( ).
      go_transaction_context = go_btorder->get_transaction( ).
        lv_success  = go_transaction_context->save( ).
        IF lv_success EQ abap_true.
          go_transaction_context->commit( ).
    so after the commit, it does not commit to the db straight away.
    i asked a collegue, and i got this:
    Using the BOL commit should perform the commit in one of two ways u2013 depending on the how the application (i.e. the GENIL layer has been implemented). It will either do a commit work and wait, or use a local update task and commit work statement. So based on this the update should be synchronous i.e. it should wait for the update to finish. In the case of the one order transaction it basically runs the update in local task.
    Basically i don't understand why it is behaving as it is.

  • NCO 2.0 problem in commit and wait

    Hi there,
    I use NCO 2.0. It provides a SAPClient.CommitWork() method to implement BAPI_TRANSACTION_COMMIT. However, it doesn't support commitandwait function. Now, my problem is how do I know my BAPI execution has committed ? 
    here is my scenario:
    I execute BAPI_SALESORDER_CHANGE to create a sales order items. Then I use SAPClient.CommitWork() method to commit the work. Sequently, I execute a RFC function to write WBS for each order item. The error occured and showed that "the salesdocument was locked". I think it is because the commit action has not finished.
    If I add thread.Sleep() to wait 5 seconds, then I can successfully execute the RFC function to update WBS.
    So, how could I know the SAPClient.Commit() has finished ? In BAPI_TRANSACTION_COMMIT, it provides WAIT function. But NCO 2.0 can't add BAPI_TRANSACTION_COMMIT proxy class and SAPClient.CommitandWait() method was intentionally disabled. does anyone meet this problem, too ?
    Please tell me how to solve it.
    Thanks in advanced
    BTW, I already know I can wrapper BAPI_TRANSACTION_COMMIT. That's the way I don't want to do. Since it could result in Deadlock. I want to know is there any method that I can know the commit work has finished.

    Hi,
    Idealy, if the calling program could be automatically notified as soon as the commitwork is finished. Unfortunately, there is not such method and even not a method that is a little eleganter than polling, i.e., waiting and trying.
    Regards,
    Guangwei

  • How to Commit and Restart 'Always begin new transaction' BTF ?

    Hi all,
    I have 'Always begin new transaction' BTF, which (at some button click) , should:
    1. commit the current T.F. transaction, AND, after that
    2. restart itself, so that it starts a new T.F. transaction again
    All this without using T.F. Return activity, because the user (after button clik) needs to continue working in this flow from beginning.
    In fact, it's a record entry, whereby the user on the Save button should have the ability to input a new record.
    Any advice ?

    Thanks for reply Navaneeth,
    but it is unclear for me, how to ensure that the return activity takes back to the same taskflow ?!?
    P.S. Always begin new transaction TF runs in the af:popup. So, popup should remains opened after Return activity.
    Hm... just wondering, instead of declarative use 'Always begin new transaction', whether this can be achieved with (default) method call activity which basically does
          DataControlFrame.beginTransaction();at t.f. beginning, and
          DataControlFrame.commit();at buton click, which navigates to default task flow activity (i.e beginTransaction()) ?
    Would this way be made the same effect?
    Navaneetha Krishnan Nataraj wrote:
    For your use-case, as you are using 'Always begin new transaction' - use task flow return activity to commit the transaction & exit the taskflow.
    But ensure that the return activity takes back to the same taskflow (which would be re-loaded).
    Thanks,
    NavaneethEdited by: Cvele_new_account on 07.07.2012. 13.47
    Edited by: Cvele_new_account on 07.07.2012. 13.54

  • VISA timeout, how to deselect and wait and wait...

    Hello All
    Is there a way to deselect (set to infinity) the time out of the serial port VISA?
    I know I can use loops, etc. but I am interested especially in this solution.
    Thanks a lot.
    Pawel

    Pawel:
    Yes, 0xFFFFFFFF is the timeout for infinite. It is a special value and should not time out after 1.5 months. (As you had noticed, 0 does mean immediate.)
    Dan Mondrik
    National Instruments

  • "Commit work and wait" possible with JCA/JRA ?

    Is it possible to specify the "commit and wait" directive with Java when attempting to commit a transaction via an RFC ? I am using JCA/JRA. If it is not possible with this version of JCA/JRA, will it be implemented in the next version ?
    Thanks in advance,
    Mark

    No, apparently it is not as simple as that
    An abap programmer explained to me that there is
    a difference between the 'commit' and 'commit and wait'
    directives; the former is asynchronous, the latter synchronous.
    When I call commit() on the UserTransaction object, I believe I am calling the asynchronous 'commit', whereas what I want is to call the synchronous version via the JCA api.
    Thanks,
    Mark

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

  • 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

  • How to use commit and rollback transaction if my i am using MS Access as a

    as per my knowledge the transactions commit and rollback is not work if my data base is MS Access then plz give me the logic how i used these transaction with MS Access.
    waiting for response
    plz mail ur respose if possible at [email protected]

    Same as every other relational database you can connect to with JDBC.
    try
        connection.setAutoCommit(false);
         // Perform your unit of work here
         connection.commit();
    catch (SQLException e)
        connection.rollback();
         e.printStackTrace();
    finally
        try { if (connection != null) connection.close(); } catch (SQLException ignore) {}
    }%

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

  • Rfc Adapter - commit work and wait

    Hi,
    Here is my problem:
    I'm calling a BAPI specifying 'Commit' in Communication Channel. After this call, in BPM i call another RFC (or BAPI) that needs to modify or use objects created in the first call. The problem is that the work made by the first BAPI wasn't updated in the database yet, and i receive errors in next calls.
    Is there anyway to wait for commit?
    Jose Neves

    Hi again,
    Thanks for your attention...
    Well i am using the 'WAIT' between Steps... But this is not how i would like to keep things... i can't assume how long i should wait and i don't want to have unneeded pauses during process (each process has about 18 calls to R3!).
    The only solution i see everywhere is Wrap Wrap Wrap... unfortunately this implies changing every BAPI to Z...
    I know that RFC Adapter uses JCO... I think in JCO you can start a transaction, using an identifier, passing this ID to every BAPI call, and call commit at the end, but i don't see anyway to do this in XI.
    Another solution i have heard around, is about using ABAP Proxy... is that true that i can encapsulate many BAPI calls in a proxy, and execute all in the same session? We have some configuration problems, and we are not using ABAP Proxy so we can't try... But if this is the solution...

  • My credit card was stolen,since i cancelled the card and waiting for a new one i cant update any of my apps because of the billing info is incorrect,how can i update without my new card?

    my credit card was stolen,since i cncelled and waiting for a replacement i cant update any apps or dl any apps because the billing info says its incorrect now,how can i update and dl while waiting for my new card?

    It would be best for you to open iTunes, sign in and view your account. If all the purchases were paid already instead of entering your new card information, it will give you an option for "NONE" as a payment method. Again this is not applicable of you have a pending charges with iTUnes

  • New iphone. someone else put in their username and password. time for me to update the iphone. downloaded itunes onto pc. plugged in iphone and waiting for prompt to show phone. pc thinks it is the camera. how do i get itunes/pc to recognize iphone ?

    new iphone. (someone else put in their username and password. so i had lots of apps that i had to eliminate but do NOT wish to compromise the contact list) time for me to update the iphone. downloaded itunes onto pc. plugged in iphone and waiting for prompt to show phone. pc thinks it is the camera. how do i get itunes/pc to recognize iphone ? then, how do i backup contacts and proceed before updating iphone?

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes or iPhone forums.
    Regards.

  • How can i browse using webbrowser to many pages one by one and waiting for each page to be completed loaded ?

    I have this method:
    string filename = "";
    private void GetHtmls()
    for (int i = 0; i < numberofforums; i++)
    uri = sourceUrlId + forumsIds[i] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    And in the document completed event:
    string forums;
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    if (e.Url.ToString() == uri)
    if (retrivedForumsInfo == true)
    targetHtmls = (combinedHtmlsDir + "\\"+ filename + ".txt");
    htmlloaded = true;
    StreamWriter write = File.CreateText(targetHtmls);
    write.Write(webBrowser1.DocumentText);
    write.Close();
    The problems are:
    1. When it's getting to the completed event already it's saving the text file with the id number of the second one in the ID's list.
        If in the method GetHtmls i used a breakpoint and see that forumsIds is 93 the first one when it's getting to the completed event  i see that the id there is already the second one like the loop continue or something.
       And if i will wait with the break point and click continue after some seconds the id will be the fourth or fifth depend on how long i'm waiting before click continue.
    2. When it's getting to the completed event after saving the text file it's not coming back to the GetHtmls method and not continue the loop and not navigating to the next page.
    I need to do it this logic:
    Make for loop navigate to the first page now wait somehow when it finished to save the text file of the first page in the completed event only then jump back to the GetHtmls method and continue the loop navigate to the second page and again wait/hold untill
    saving the text file of the seocnd page in the completed event. And so on all the loop in the GetHtmls.

    I tried it this way now and it's working untill the variable count is 5 then it stop and never continue i can't figure out why it stop and why when it's getting to 5(It's doing the 5 time but then stop and not continue).
    In the top of the form i did:
    private int counter = 1;
    private int countpages = 1;
    private int forumId = 0;
    private string uri;
    private bool htmlloaded = false;
    Then in the GetHtmls method:
    string filename = "";
    private void GetHtmls()
    uri = sourceUrlId + forumsIds[0] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    Then in the document completed event:
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    if (e.Url.ToString() == uri)
    if (retrivedForumsInfo == true)
    targetHtmls = (combinedHtmlsDir + "\\" + filename + ".txt");
    StreamWriter write = File.CreateText(targetHtmls);
    write.Write(webBrowser1.DocumentText);
    write.Close();
    htmlloaded = true;
    timer1.Enabled = true;
    Then in timer1 tick event:
    private void timer1_Tick(object sender, EventArgs e)
    if (htmlloaded == true)
    uri = sourceUrlId + forumsIds[counter] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    htmlloaded = false;
    timer1.Enabled = false;
    counter++;
    countpages++;
    I tried to use try and catch and a break point i couldn't find why it stop and what make it stop and what stopped ? Maybe the timer1 never continue ? But if the timer not continue why it stop when counter is 5 ?
    The number of id's in the List<int> forumsIds is 547 and it's equal to the number of forums 547.
    I still can't figure out why it stop on counter 5 and what make it stop.

Maybe you are looking for