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

Table locking for Update

Former Member
0 Likes
3,675

Hi All,

I have one doubt...Iam updating the Table using UPDATE statement..is it mandatory to use Table locking befoe updating the table.

For DELETE..no need to use table locking..iam sure but for UPDATE is it required or not. Please help me..

Since iam facing the issues with table locking i posted this one.

5 REPLIES 5
Read only

Former Member
0 Likes
2,616

HI,

For every database operation you require to have the locking system . When you are updating or modifying the database record then at the same time no one should try to modify this data so in this case you need to lock the entry.

Even in case of Delete if some one is trying to modify the same entry which you deleting.. so to overcome this you need to have locking.

Read only

Former Member
0 Likes
2,616

hi sreehari,

Table locking is important before updating or modifying ir deleting the record.

because if some is opened table maintainence view for that table the record if you want to delete or update or modify it will not work.

so if it is a custom table create lock object for primary key field

E_(custom table name)..

Automatically it creates two function modules with name 'ENQUEUE_(lock object created) &'DEQUEUE_(lock object created).

-


so when ever you update for delete the particular record

use CALL FUNCTION 'ENQUEUE_(lock object created) "To lock record

-->then delete or modify

Use CALL FUNCTION 'DEQUEUE_(lock object created) "To unlock Record.

Regards,

Prabhudas

Read only

Former Member
0 Likes
2,616

If there is no possibility of someone else accessing a table entry when you are updating, there is no need to lock.

Rob

Read only

Former Member
0 Likes
2,616

Hi Sreehari,

Try this to lock the rows. The rows are unlock after do commit.

SELECT SINGLE FOR UPDATE *

INTO wa_table

FROM table

WHERE ......

AND ......

AND .......

Hope this information is help to you.

Regards,

José

Read only

Peranandam
Contributor
0 Likes
2,616

generally we are locking ztable entries before doing updation for avoiding inconsistancy. lock applicable depending upon table utilization in business point of view.

Good porgrame manner is to lock the table before doing updation activity.

create lock object for your ztable and call lock module(ENQEUE AND DEQUEUE) within your application program. or call FM ENQUEUE_E_TABLE for locking ztable without creating lock object.

Regards,

Peranandam