Skip to Content

How can I check if all update finished (including V2 Update)?

Hi,

I have the following issue:

- in our Customer program there is a call for transaction MIR4

        SET PARAMETER ID 'RBN' FIELD rbkp-belnr.
        SET PARAMETER ID 'GJR' FIELD rbkp-gjahr.
        SET PARAMETER ID 'CHG' FIELD 'X'.
        CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.

- in MIR4 the user can change the Invoice from here and save/hold it

- when the user comes back to the customer transaction, all the updated values should be displayed

I have the following code

* Commit data if the Invoice was changed, otherwise select can return with the old value
        COMMIT WORK AND WAIT.

        SELECT SINGLE *
         FROM rbkp
         WHERE belnr = ls_belnr
           AND gjahr = ls_gjahr.

However even if I have the COMMIT WORK statement, sometimes the SELECT statement still returns with the old value.

I think there are some V2 updates and COMMIT WORK AND WAIT waits only for the type V1 update.

'WAIT UP TO time SECONDS' might be an option, however for large invoices it might be not a reliable way.

Any idea on this one?

Thanks in advance,

Peter Inotai

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    Apr 06, 2006 at 02:34 PM

    Hi Peter!

    Your commit work and wait has absolute no influence. In the transaction is already a commit work, your second commit can just trigger the changes between the first and the second - which is more or less nothing.

    Instead you can try to call the transaction in a different way:

    CALL TRANSACTION 'MIR4' USING bdc_data MODE 'E' UPDATE 'L'.

    Here update 'L' (or 'S') will have an effect like a commit work and wait inside of MIR4. In bdc_data you just fill data for the first screen (including the first OK_CODE. Because no bdc_data for the second screen is found, the batch will stop ('no data for screen ...' message?).

    If you run completely a session, the bdc-options will work - if they are still valid after an error, I can't tell.

    Checking the locks of MIR4 is the next best option - but I couldn't find the locks set by MIR4 - for me it's a pure display transaction (maybe you can jump to a change, but I didn't find). I would have expected RBKP-BELNR, -GJAHR as a lock-key - but just go in one example (in change mode) and have a lock at SM12 - there you should see an matching entry, double click to see the lock object.

    Try to set after returning from call transaction a lock -> booking should be complete in case of success (and remove the lock again).

    Regards,

    Christian

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Christian,

      Sorry for the late feedback, there were other things to fix.

      Finally I got time to change it and test it and with option UPDATE 'L' it works fine.

      Thanks a lot for your help.

      Cheers,

      Peter

  • Apr 06, 2006 at 03:07 PM

    Hi Peter,

    The best thing, in such cases, to do is rewrite your SELECT as follows

    SELECT SINGLE *
             FROM rbkp <u><b>BYPASSING BUFFER</b></u>
             WHERE belnr = ls_belnr
               AND gjahr = ls_gjahr.

    What BYPASSING BUFFER does is that it actually goes to the database and fetches your record where the record is there. The reason why you don't see it with normal SELECT is that, system fetches it from the buffer. In most cases the buffer is updated immediately in human timeframes, but in processing terms, it sometimes is out of sync with the actual database entries.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 06, 2006 at 08:19 AM

    Hello,

    Whenever you want to select new value of invoice try like this,

    do.

    SELECT SINGLE *

    FROM rbkp

    WHERE belnr = ls_belnr

    AND gjahr = ls_gjahr.

    if old_invoice <> new_invoice.

    exit.

    endif.

    enddo.

    But, keep in mind to exit the loop after some time.

    Regards,

    Naimesh

    PS: Reward points, if it is useful..!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 06, 2006 at 09:04 AM

    Hello Peter,

    I don't think it has anything to do with V2, as all the updation related to the transactions are done via V1 and any statistical updates will happen through V2. Also commit and work deals only with V1.

    Just a long shot is check VBMOD also if possible.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Abhijit Dani,

      Thanks for your suggestion. VBMOD is a good idea, however I was not able to catch the update in SM13. Even if I press refresh right after the save/post, I cannot see any entry in SM13.

      Peter

  • avatar image
    Former Member
    Apr 06, 2006 at 10:18 AM

    Hello Peter,

    In that case the updates have finished without any delay and the result should be available for further use. Another option u can check is if the MIR4 is using any lock objects to lock the table. If there are any then u can check the existence of lock and if not then u can assume that the updates must have happened.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 06, 2006 at 01:06 PM

    Hello Peter,

    No u don't have to find lock for V2 but for the V1 process. I.e to say check if the tables which are getting updated have any locks done before updation and then check for release of them.

    Hope this helps.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 06, 2006 at 01:30 PM

    I don't think u should even look for V2, almost sure it will not do any updates related to database in V2. It only does statistical updates and any other non important activity. As u are looking for a change in the invoice fields, it has to be updated in V1 unless it is importatn statistically like LIS or SIS.

    Add comment
    10|10000 characters needed characters exceeded