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

z-table updating

Former Member
0 Likes
1,778

Dear Experts,

I have a z-table. A z-program selects data from SAP tables and updates this table via batch jobs with selection criteria.

If i run 2 or more such batch jobs with different or overlapping selections, what happens if

the z-program uses a simple "Update" command without FM ENQUEUE_E_TABLEE to lock the table and FM DEQUEUE_E_TABLEE to unlock table?

By default, when abap command updates a table with "update" , without the above 2 FMs, does it lock the z-table?

If not, how is data being updated in the table :

1. overlapping data selection.

2. disjoint data selection.

I cannot understand how can the server update concurrently when everything is sequential?

So, when there are 2 updates at the same time, is it not sequentially done , 1 after the other ? How can both updates be updated at exactly the same time when there is assuming a single disk written using a single write mechanism at any point in time?

regards

Bass

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,390

Hi

The fm ENQUEUE_E_TABLEE and FM DEQUEUE_E_TABLEE manages a logical lock only, this lock can be used to avoid several processes use the same object together.

That means the lock above has to be managed programmatically only: after checking the result of these function you need to decide if to update or not to update the table. (or to abort the process).

If nobody prevents several processes update the same table: the database places all processes in a queue and the last one overwrites all prevoius modifications (for the records with same key of course).

Max

5 REPLIES 5
Read only

Former Member
0 Likes
1,391

Hi

The fm ENQUEUE_E_TABLEE and FM DEQUEUE_E_TABLEE manages a logical lock only, this lock can be used to avoid several processes use the same object together.

That means the lock above has to be managed programmatically only: after checking the result of these function you need to decide if to update or not to update the table. (or to abort the process).

If nobody prevents several processes update the same table: the database places all processes in a queue and the last one overwrites all prevoius modifications (for the records with same key of course).

Max

Read only

former_member201275
Active Contributor
0 Likes
1,390

SAP database will automatically lock the table for you. So whichever batch hits the database first this will update the table then when that batch finishes the next will be allowed to write to the table.

Read only

Former Member
0 Likes
1,390

Seeing two different answers here i want to point you to Max´s Answer as it is the correct one.

Read only

0 Likes
1,390

Thank you very much Florian,

I am also confused by the 2 types of answers.

Both to me sounds right.

I have also asked some colleagues who said the database handles this sort of thing by default.

If so, why the Enqueue and DeQueue functions exist?

So, I have to go with you and adopt Max's advise while also considering Gemini's .

regards

Bass

Read only

matt
Active Contributor
0 Likes
1,390

Gemini's answer is wrong and shows a complete lack of understanding of how locking is to be applied in SAP. Your colleagues who agree with Gemini are also wrong.

The database does have its own locking mechanism, but it must not be relied on or utilised for ABAP applications.

Edited by: Matt on Sep 5, 2011 6:55 AM