‎2009 Aug 21 2:27 PM
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
‎2009 Aug 21 2:36 PM
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
‎2009 Aug 21 2:34 PM
Hi,
Try using FM DEQUEUE_EMMARAS and DEQUEUE_EMMARAE passing material number.
KR Jaideep,
‎2009 Aug 21 2:35 PM
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
‎2009 Aug 21 2:36 PM
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