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

hi all

Former Member
0 Likes
579

hi

how will u unlock the following

SELECT employee_name FROM employees WHERE employee_id = 123 FOR UPDATE.

i have not created any lock object. i want to lock single record through the above syntax.

after select querry it should get unlock

thanx

rocky

hi

how will u unlock the following

SELECT employee_name FROM employees WHERE employee_id = 123 FOR UPDATE.

i have not created any lock object. i want to lock single record through the above syntax.

after select querry it should get unlock

thanx

rocky

3 REPLIES 3
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
554

Hi,

When you use SELECT alon with FOR UPDATE addition the record will be unlocked with the COMMIT WORK tatement. Or when the program is terminated.

When the dialogstep completes there is an utomatic DB commit hat happens so with the commit the record gets unlocked.

Regards,

Sesh

Read only

Former Member
0 Likes
554

Hi

Try with this



SELECT employee_name FROM employees 
                                   WHERE employee_id = '123' FOR UPDATE.

this statement will only unlock

Reward all helpfull answers

Regards

Pavan

Read only

Clemenss
Active Contributor
0 Likes
554

Hi Rocky,

next time please use a subject for your question.

You must SELECT SINGLE if you want to use the FOR UPDATE addition.

Sap online help on SELECT says:

SINGLE

The result of the selection should be a single entry. If it is not possible to identify a unique entry, the system uses the first line of the selection. If you use the FOR UPDATE addition, the selected entry is protected against parallel updates from other transactions until the next database commit (see LUW and database lock mechanism). If the database system identifies a deadlock, a runtime error occurs.

Yes it is possible to lock this way without lock object but you may run into database dead locks causing a dump.

It may be better to check what kinds of locks are set by possibly conflicting transactions and use the same lock objects.

Regards,

Clemens

Regards,

Clemens