Application Development 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: 

Issue in locking Table

Former Member
0 Kudos

Hi All,

I need to update a ZTABLE with UNIQUE serial number while creating shipment and Delivery.

I have used ENQUEUE_E_TABLE to lock the table before updating table in both the ZProgram which will update the serial numbers.

The problem is even though i locked the table , i am facing problem with creation of duplicate number serial numbers while shipment and delivery happens at the same time.We have tested this with multiuser environment.

Since both shipment and delivery updating in UPDATE TASK i coudnt use COMMIT WORK in the programs.

Please let me know if there are any tricks how to lock the table and also for using COMMIT WORK inside UPDATE TASK.

Give some example program for locking tables especialy used in update task.

Thanks and Regards,

kandakumar

4 REPLIES 4

Former Member
0 Kudos

Hi

U should lock the table before updating it in UPDATE TASK process, in order to stop the saving if the lock is still active.

Max

Former Member
0 Kudos

are you checking for locks before updating the table. SAP locks using lock object is not a physical lock, so unless you check for that and check sy-subrc after check, it will still allow you to update the record

Former Member
0 Kudos

Hi

Lock the table before updating it and check the locking with sy-subrc and if it is not locked then use do loop to lock the table.

See the dummy code ,hope it will help you.

Do n times.

*Lock the table

*Check sy-subrc if it is 0 exit the loop else

try again.

if locking is suceessfull.

set a flag.

endif.

Enddo.

If flag is not set give the message table is not locked.

else if it is locked then proceed with updation

Cheers

Neha shukla

P561888
Active Contributor
0 Kudos

Hi ,

ENQUEUE_E_TABLE is used to lock the table when ever the Zprogram has run.

when u r editing the table and running the program will give an error .and change the logic part in ur code .. and unlock the table after completion of updation.

regards,

Bharani