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

Lock specific number of records using ENQUEUE & DEQUEUE

Former Member
0 Likes
1,838

Hi,

Is it possible to lock a group of records in R/3?

My requirement is to update a set of records in VBAP table. I'm not using a BAPI here. Instead, I use a direct UPDATE.

In this case, i know i can lock individual records by passing VBELN and POSNR. But what if i have to lock 10 records?

Is this possible in any way?

Thanks in advance.

The current solution is:

1) LOOP at ITAB

2) LOCK each entry

3) UPDATE VBAP for that entry

4) UNLOCK the entry

5) Endloop

I thought this solution might work: (Assume 10 records are present in ITAB)

1) LOOP at ITAB (Lock all 10 entries)

2) LOCK that entry

3) ENDLOOP

4) UPDATE VBAP from ITAB (Updates all 10 entries in one databae access)

5) LOOP at ITAB(Unlock all 10 entries)

6) UNLOCK that entry

7) ENDLOOP

Any help will be appreciated.

Tabraiz.

4 REPLIES 4
Read only

Former Member
0 Likes
1,223

What field are you changing?

Rob

Read only

0 Likes
1,223

Field ARKTX. Not a key field. It is a description field.

Read only

0 Likes
1,223

I would also make sure it is not used in any secondary index tables.

Rob

Read only

Former Member
0 Likes
1,223

Hello,

Both of your solutions will work.

With solution 1 there will always be only 1 enqueue object created, because you always enqueue, perform the update and dequeue.

This means that in SM12 you will only see 1 enqueue entry on your user ID at the same time when your program runs.

Solution 2 is also possible but there you will have different enqueue objects that will be created, because you enqueue everything, then perform the updates and then dequeue everything.

In SM12 (lock entries) this will result in more enqueue records on your user ID the time your program runs.

You have to pay attention that lock entries (SM12) are stored in a queue that is limited, so make sure with solution 2 that you don't overflow the enqueue queue ! ! !

Via tcode RZ11 you can check parameter enque/table_size (Size of lock table).

Check the parameter value but also its documentation and you will understand why you should limit the number of open lock records.

Success.

Wim Van den Wyngaert