2016 Dec 16 10:22 AM
Hi,
I am a bit confused how BOPF optimistic locking is intended to work.
I know, I can lock a DB line by retrieving it
me->o_phase_srv_mngr->retrieve(
EXPORTING
iv_node_key = /cenitapm/if_bo_pw_phase_c=>sc_node-pwph
it_key = t_key
iv_edit_mode = /bobf/if_conf_c=>sc_edit_optimistic
IMPORTING
eo_message = o_message
et_data = t_pwph
).
And I know, I can promote the lock to an exclusive one by executing an action.
If a lock gets promoted, all other optimistic locks on that DB line are removed and can't be promoted anymore.
My problem is now: How does the BOPF behave if its optimistic lock was removed when I want to execute an action or do a modification to the DB line.
What I see is, that the BOPF simply sets a normal exclusive lock and overrides what happened in other sessions. Which leads to inconsistencies in the data.
Now my questions:
Help is very much appreciated.
Regards David
2017 May 08 2:11 PM
Hi David,
did you find an answer for your question already?
If I got you right, you want to promote an optimistic lock after having an exclusive one?
I would do a retrieve as you showed in your coding. But maybe I got your question wrong.
BOPF should be the right tag. But the community just starts to get alive again after the relaunch.
Cheers,
Martin
2017 May 08 2:35 PM
Hi,
the sequence is the following
Step 4 should fail with an error telling me, that I can't change object A, because my data is not up to date.
What actually happens is that the BOPF just creates a direct exclusive lock and writes the data. With this, the changes made in session1 are overwritten.
2017 May 08 7:39 PM
2017 May 09 8:17 AM
2017 May 15 11:23 AM
Hi David,
your observation for the steps 1-4 would clearly indicate an error. If you have a reproducible example, you could open an incident.
What is your SAP_BASIS or SAP_BS_FND release and SP? There have been a number of SAP notes related to BOPF locking, the most important one being 2182397 (but also 2264813 may be of interest).
You may also want to check if the BO you are using has its own implementation of the LOCK action.
Regards,
Ivo
2021 Jul 22 7:42 AM
Hi David,
Between steps 3 and 4, if the changing in step 3 was saved then step 4 can also be done and saved again. there is no problem. Only you should keep in mind, that fields changed in step 3 (and saved) will be also updated after step 4 (and save). If in step 3 and step 4 the same fields were changed by users, then the change which is done in step 4 will be valid.
On the other hand if user doesn't save after step 3, the other user gets an error message after attempting to perform step 4. Because right after the changing in step 3, documents are locked with Exclusive Lock anymore. Which means u r the only person who can change anything until a save action.
Best Regards
Mustafa