Application Development and Automation 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: 
Read only

Lock Modules after Commit Work

Former Member
0 Likes
3,552

Hi,

Just need to clear a small confusion.

I am updating the custom table in my program. In that After the Update query i am checking the sy-subrc condition and if it success i am doing COMMIT WORK.

i just want to know do i need to call explicitely the DEQUEUE function module for releasing locks after the commit work.

Also,

if the sy-subrc fails i am doing ROLLBACK WORK. After that i am not using the DEQUEUE function module as the SCOPE parameter of the the function module is by default 2 and being so the locks will be removed automatically.

Please guide me in case of commit work.

Regards,

Anuja

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,752

Hi ,

Database systems do not usually provide commands for explicitly setting or releasing locks.

Therefore, prior to executing the database operation, database locks are set implicit when one of

the Open-SQL-statements SELECT, INSERT, UPDATE, MODIFY, DELETE

The updated rows are finally included in the table in the next database commit.

Up until this point, they can still be removed by a database rollback.

The statement UPDATE sets a database lock until the next database commit or rollback.

The statement COMMIT WORK completes the current SAP LUW and opens a new one.

In principle, one type of lock is enough to control conflicting data accesses. However, to achieve a greater degree of parallel running among transactions, database systems use several types of locks.

Using Lock Objects you can programatically define Locks.

For a detailed understanding for the differences between(Database and SAP Locks) them and the creation of Lock Objects :

http://help.sap.com/saphelp_nw04/helpdata/EN/e5/de86d835cd11d3acb00000e83539c3/frameset.htm

http://help.sap.com/saphelp_webas630/helpdata/en/c7/2d7037ecc92a7ee10000009b38f8cf/frameset.htm

http://help.sap.com/saphelp_webas630/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/frameset.htm

Regards,

Radhika.

5 REPLIES 5
Read only

Former Member
0 Likes
1,752

ENQUEUE and DEQUEUE are not physical locks on database , they are logical locks calling commit and then dequeuing is better way to do.

Read only

Former Member
0 Likes
1,752

Locks will be automatically released once the execution of the program/transaction is completed.

But as a better practice, the records should be unlocked once the updates are completed, so the records will be available as soon as possible for future updates if there are any.

Read only

0 Likes
1,752

The automatic release of SAP locks is depending on the SCOPE parameter of the enqueue function modules. See doku for details: http://help.sap.com/saphelpnw04/helpdata/DE/23/edae617ba64e85bd4997f25c77eb1f/content.htm

Read only

Former Member
0 Likes
1,753

Hi ,

Database systems do not usually provide commands for explicitly setting or releasing locks.

Therefore, prior to executing the database operation, database locks are set implicit when one of

the Open-SQL-statements SELECT, INSERT, UPDATE, MODIFY, DELETE

The updated rows are finally included in the table in the next database commit.

Up until this point, they can still be removed by a database rollback.

The statement UPDATE sets a database lock until the next database commit or rollback.

The statement COMMIT WORK completes the current SAP LUW and opens a new one.

In principle, one type of lock is enough to control conflicting data accesses. However, to achieve a greater degree of parallel running among transactions, database systems use several types of locks.

Using Lock Objects you can programatically define Locks.

For a detailed understanding for the differences between(Database and SAP Locks) them and the creation of Lock Objects :

http://help.sap.com/saphelp_nw04/helpdata/EN/e5/de86d835cd11d3acb00000e83539c3/frameset.htm

http://help.sap.com/saphelp_webas630/helpdata/en/c7/2d7037ecc92a7ee10000009b38f8cf/frameset.htm

http://help.sap.com/saphelp_webas630/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/frameset.htm

Regards,

Radhika.

Read only

Former Member
0 Likes
1,752

This message was moderated.