Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to release an exclusive lock

former_member184711
Participant
0 Kudos

Hi,

I don't know, how to release a lock, after locking exclusive.

We're locking our BOPF Object like this:

o_task_srv_mngr->retrieve(
        exporting
          iv_fill_data            = abap_false
          iv_node_key             =  /cenitapm/if_bo_pw_task_c=>sc_node-pwtsk  " Node
          it_key                  =   t_key  " Key Table
          iv_edit_mode            = /bobf/if_conf_c=>sc_edit_exclusive
        importing
          eo_message              = o_message
      ).

Now how do I release the lock again?

I know, It is released after a save of the transaction manager, but how do i achieve an unlocking without that save?

Regards David

1 ACCEPTED SOLUTION

former_member184711
Participant

After some investigation, I came to following result:

Locks are released on commit or rollback.

So if I want to release an exclusive lock, I have to rollback everything in the current session.

After feeling limited by this design in the first place, I now think, this is a great way to secure my data integrity.

I only want to release an exclusive lock if I don't want to save my data, or if I want to save it 😉

I just have to ensure, all data not belonging to the actual transaction is saved before setting an exclusive lock to another object.

So thumbs up for the designer of this concept.

1 REPLY 1

former_member184711
Participant

After some investigation, I came to following result:

Locks are released on commit or rollback.

So if I want to release an exclusive lock, I have to rollback everything in the current session.

After feeling limited by this design in the first place, I now think, this is a great way to secure my data integrity.

I only want to release an exclusive lock if I don't want to save my data, or if I want to save it 😉

I just have to ensure, all data not belonging to the actual transaction is saved before setting an exclusive lock to another object.

So thumbs up for the designer of this concept.