How can I check if all update finished (including V2 Update)?
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,
Christian Wohlfahrt replied
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).