Skip to Content
0

BOPF Optimistic Locking - How is it intended to work?

Dec 16, 2016 at 10:22 AM

251

avatar image

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:

  • How is the optimistic lock intended to be used in BOPF? (The new entries in help.sap don't help here)
  • How can I explicitly promote an optimistic lock to an exclusive one (via BOPF) and be notified, that I have to reload the data?
  • (Additional Question: What is the appropriate primary tag for BOPF questions?)

Help is very much appreciated.

Regards David

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Martin Fischer
May 08, 2017 at 01:11 PM
0

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

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hi,

the sequence is the following

  1. Lock object A optmisitic in session1
  2. Lock object A optmisitic in session2
  3. Change object A in session1
  4. Change object A in session2

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.

1

I guess you mean "3. Change object A in session1"?

0

Right :) That was what I meant

0

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

1