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

How to use Enqueue/Dequeue to prevent concurrent write?

Former Member
0 Likes
1,058

Hi All,

I have a report program that allows multiple users to save to the database tables.

How do I incorporate ENQUEUE and DEQUEUE statements to prevent concurrent write to ensure data integrity? Are there sample codes that I could refer to?

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
822

hi,

Go to se11,

create a lock object with name starting fron E.

give the table names you want to lock.

after activating this will create two FM for enqueue and dequeue .

you can check names for these by following path in same window:

GOTO->LOCK MODULES

call these FM in your program.

Regards,

Talwinder

Read only

0 Likes
822

Hi, must the lock object start with E?

Read only

Former Member
0 Likes
822

Hi,

here screen get locked

CALL FUNCTION 'ENQUEUE_EIQMEL'

EXPORTING

mandt = sy-mandt

qmnum = i_final_ap-qmnum -Notification number

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

*--Setting the task "PE03" for notification on screen

CALL FUNCTION 'IQS4_ADD_DATA_NOTIFICATION'

EXPORTING

i_qmnum = i_final_ap-qmnum

i_conv = ' '

i_post = c_x

i_commit = c_x

i_wait = c_x

TABLES

i_viqmsm_t = i_viqmsm_tmp

return = i_return.

CALL FUNCTION 'DEQUEUE_EIQMEL'

EXPORTING

mandt = sy-mandt

qmnum = i_final_ap-qmnum.

Read only

0 Likes
822

Hi thanks.

But I am referring to the locking of database records, so that when multiple users access the same record, they won't overwrite each other. How do I go about doing it?