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

Locking multiple records in a database table at a time

Former Member
0 Likes
2,437

Hi Experts,

I have a requirement to lock multiple records in the database table for writing. I have created lock object in SE11. But with this we have only 2 possibilities either lock entire table or lock a single record at a time.

My requirement is, i have table with key field PROJECTID. I want more than one project to be locked, but not the complete table. I dont have any other field in the table to compare.

Thanks in advance..

Regards,

Asrar

Hi Experts,

I have a requirement to lock multiple records in the database table for writing. I have created lock object in SE11. But with this we have only 2 possibilities either lock entire table or lock a single record at a time.

My requirement is, i have table with key field PROJECTID. I want more than one project to be locked, but not the complete table. I dont have any other field in the table to compare.

Thanks in advance..

Regards,

Asrar

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
1,594

Hi welcome to SCN...

in su21 you can add some more data elements in the same Authorization object..

J@Y

Read only

Former Member
0 Likes
1,594

My objective is not with authorization objects. I cant fix values for locking.

Read only

0 Likes
1,594

you might have SAP_ALL access.. so you cannot test if its locking or not.....

AUTHORITY-CHECK OBJECT Hit F1 on this and find more info..

Read only

Former Member
0 Likes
1,594

Hi,

Try with FOR UPDATE in the SELECT sentence.

SELECT FOR UPDATE *

INTO Internal_Table

FROM Table

WHERE Conditions.

This sentence blocks the records that satisfy of the WHERE conditions.

Regards,

José

Read only

Former Member
0 Likes
1,594

I have used to lock the compolete table, and implemented the required logic in the program so that users did not get locking errors.

Read only

Former Member
0 Likes
1,594

Hi ,

Try with FOR UPDATE in the SELECT sentence.

SELECT FOR UPDATE *

INTO Internal_Table

FROM Table

WHERE Conditions.

UPDATE "Table_name" FROM TABLE Internal_Table.

COMMIT WORK.

This sentence blocks only the records that satisfy of the WHERE conditions (not the entire table) and unlocks after commit work.

Hope this information is help to you.

Regards,

José