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

Programaticaly Unlocking the locked material

Former Member
0 Likes
2,035

Hi all,

I have a requirement to Unlock the material before executing BDC as i get error that the material is locked when BDC is executed.can anybody guide me how to unlock material.

Thanks.

Edited by: sanjivrd on Aug 21, 2009 3:27 PM

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,027

Which transaction is calling the BDC, call SM12 and look at the lock entries, double-click on entries to find the enqueue object and keys, then in you report use the DEQUEUE_<object> FM to release the lock.

Some lock objects with MATNR

EMMARAE Lock MARA and MARM/MAKT exclusively

EMMARAS Lock MARA and MARM/MAKT: shared

EMMARCE Lock plant data (incl. stocks, consumption, forecast data)

EMMARCS Locking of Plant Data (Incl. Stocks, Consumption) Shared

EMMARME Lock Base Unit of Measure (Exclusive)

EMMARMS Lock Base Unit of Measure (Shared)

But it is not ever advisable to release locks in the middle of a transaction, try some other solution like submit the execution of the batch input via a CALL FUNCTION IN BACKGROUND TASK which will execute after the COMMIT WORK submitted update tasks are ended and locks released.

Regards,

Raymond

3 REPLIES 3
Read only

jaideepsharma
Active Contributor
0 Likes
1,027

Hi,

Try using FM DEQUEUE_EMMARAS and DEQUEUE_EMMARAE passing material number.

KR Jaideep,

Read only

Former Member
0 Likes
1,027

Hi,

I may be misunderstanding your requirement, but I don't think you can go removing locks just because you want to update a material.

If a material is locked it means another process is changing it, if you remove that lock to make your update then there will be two (potentially conflicting) updates. When these are both applied what will be the end result for the data? What if your BDC has the lock first then some other process comes along and removes it?

Before your BDC runs check the lock, if it is set then wait and retry, or issue an error and reprocess the material later.

Regards,

Nick

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,028

Which transaction is calling the BDC, call SM12 and look at the lock entries, double-click on entries to find the enqueue object and keys, then in you report use the DEQUEUE_<object> FM to release the lock.

Some lock objects with MATNR

EMMARAE Lock MARA and MARM/MAKT exclusively

EMMARAS Lock MARA and MARM/MAKT: shared

EMMARCE Lock plant data (incl. stocks, consumption, forecast data)

EMMARCS Locking of Plant Data (Incl. Stocks, Consumption) Shared

EMMARME Lock Base Unit of Measure (Exclusive)

EMMARMS Lock Base Unit of Measure (Shared)

But it is not ever advisable to release locks in the middle of a transaction, try some other solution like submit the execution of the batch input via a CALL FUNCTION IN BACKGROUND TASK which will execute after the COMMIT WORK submitted update tasks are ended and locks released.

Regards,

Raymond