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

Re-Modification of Database table.

Former Member
0 Likes
614

Hi Expert,

i am modifing one database ztable from different program.before modifing i am locking the same table

after locking i am modifing the ztable.

But my question is if my table is already locked from 1st program than what will happen in the 2nd program which runs in between time . either modification will success or not in 2nd program.

Please provide me answer.

Thanks,

Shyam.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

Hi,

As you are saying that you are locking the table in both the programs.

So you should go for table modification only when Lock on the table is successful else come out.

In case you are not locking the table and trying to modify the table at the same moment, SAP should through an error in form of DUMP.

and if the modification happens with a difference of fraction of seconds, the last run program changes would be written in the table.

Hope this helps...in case of any further questions pls respond back.

Regards,

Lalit Kabra

Hi Expert,

i am modifing one database ztable from different program.before modifing i am locking the same table

after locking i am modifing the ztable.

But my question is if my table is already locked from 1st program than what will happen in the 2nd program which runs in between time . either modification will success or not in 2nd program.

Please provide me answer.

Thanks,

Shyam.

4 REPLIES 4
Read only

Former Member
0 Likes
590

Hi,

You can isse an error message saying another user is modifying the data and need to exit inorder to have consistant data.

there are types of LOCKS like E. X, S.

you can check VA02 or other tcodes this happens there/

Regards

Ramchander Rao.K

Read only

Former Member
0 Likes
591

Hi,

As you are saying that you are locking the table in both the programs.

So you should go for table modification only when Lock on the table is successful else come out.

In case you are not locking the table and trying to modify the table at the same moment, SAP should through an error in form of DUMP.

and if the modification happens with a difference of fraction of seconds, the last run program changes would be written in the table.

Hope this helps...in case of any further questions pls respond back.

Regards,

Lalit Kabra

Read only

Former Member
0 Likes
590

Hi Shyam,

Well if 1st program has locked a table & if 2nd program is trying to modify records from the same table, then it will get an error message if you have locked the table at TABLE LEVEL.

You can lock a table either at record level(Highly recommended) or at table level(this will lock the entire table & wont allow modifications to any records).

So in the 1st program lock only the record which you are inserting/modifying.

2nd program while trying to modify another record of same table would be succesfull.

2nd program while tyring to modify the same record which program 1 is modifying would result into an error message in 2nd program.

Once the modification is done, you need to release the lock. Sequence is as follows:

ENQUEUE_....
modify/insert/update
DEQUEUE_....
or DEQUEUE_ALL

Best regards,

Prashant

Read only

Former Member
0 Likes
590

Thanks All