# Delete physical reservation from x++

**URL:** <https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502>\
**Category:** Developer Forum\
**Created:** [June 13, 2013, 8:34am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502 "2013-06-13T08:34:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lutador](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lutador](https://www.dynamicsuser.net/u/lutador)\
**Post date:** [June 13, 2013, 8:34am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/1 "2013-06-13T08:34:12Z")

</div>

hi,

I use AX 2009. I would like to delete physical reservation from SalesLine. I use below code but it doesn’t remove transaction. After executed it transaction with physical reservation still exist. Why?

salesLine = SalesLine::find(“ZS/BOK/2013/007553”, 0, true);  
movement = InventMovement::construct(salesLine);  
upd = InventUpd\_Reservation::newMovement(movement, 0, true);  
upd.updateNow();

---

<div class="post-metadata">

**Author:** ![kranthi](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@kranthi](https://www.dynamicsuser.net/u/kranthi)\
**Post date:** [June 13, 2013, 8:52am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/2 "2013-06-13T08:52:14Z")

</div>

To un reserve

InventUpd\_Reservation::updateReserveBuffer(salesLine, salesLine.QtyOrdered);

To reserve

InventUpd\_Reservation::updateReserveBuffer(salesLine, -salesLine.QtyOrdered);

---

<div class="post-metadata">

**Author:** ![lutador](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lutador](https://www.dynamicsuser.net/u/lutador)\
**Post date:** [June 13, 2013, 10:06am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/3 "2013-06-13T10:06:04Z")

</div>

Still nothing 😕

In my opinion yout method do the same thing like my method.

Your method:

inventMovement = InventMovement::constructNoThrow(\_buffer,\_inventMovSubType);

if (inventMovement)  
{  
reservation = InventUpd\_Reservation::newMovement(inventMovement,\_reserveQty,true);  
reservation.updateNow();  
}

---

<div class="post-metadata">

**Author:** ![kranthi](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@kranthi](https://www.dynamicsuser.net/u/kranthi)\
**Post date:** [June 13, 2013, 12:02pm UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/4 "2013-06-13T12:02:05Z")

</div>

Yes, i used an existing API, InventUpd\_Reservation::updateReserveBuffer

It is working in my case.

---

<div class="post-metadata">

**Author:** ![EnriqueKevin06](https://avatars.discourse-cdn.com/v4/letter/e/2acd7d/32.png) [@EnriqueKevin06](https://www.dynamicsuser.net/u/EnriqueKevin06)\
**Post date:** [June 13, 2013, 4:06pm UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/5 "2013-06-13T16:06:12Z")

</div>

Hi Jacek,

I also faced the same issue. All i missed is the trans id is not updated in the sales line and unreserve is not happening. just use the below code and check the conditions given below :

inveMovement = InventTrans::findTransId(salesLine.InventTransId).inventMovement(true);

InventUpd\_Reservation = InventUpd\_Reservation::newInventDim(inveMovement,inventDim,InventSum::find(SalesLine.ItemId,inventDim.inventDimId).PhysicalInvent,true);

inventUpd\_Reservation.updatenow();

Here, if it was not still unreserving, just debug and see whether qty is in -ve or +ve . also kindly check that the trans id is matching with the respective sales line with the Invent trans dimid and sales line dim id…

Thanks and Regards,

Kevin

---

<div class="post-metadata">

**Author:** ![pavilion](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@pavilion](https://www.dynamicsuser.net/u/pavilion)\
**Post date:** [October 28, 2013, 10:58am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/6 "2013-10-28T10:58:36Z")

</div>

Is it work for Dynamics Ax 2012 R2

---

<div class="post-metadata">

**Author:** ![EnriqueKevin06](https://avatars.discourse-cdn.com/v4/letter/e/2acd7d/32.png) [@EnriqueKevin06](https://www.dynamicsuser.net/u/EnriqueKevin06)\
**Post date:** [November 12, 2013, 5:02am UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/7 "2013-11-12T05:02:28Z")

</div>

what is the code for ax 2012 R2 to unreserved the qty??

---

<div class="post-metadata">

**Author:** ![tahaora](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tahaora](https://www.dynamicsuser.net/u/tahaora)\
**Post date:** [January 17, 2014, 11:31pm UTC](https://www.dynamicsuser.net/t/delete-physical-reservation-from-x/46502/8 "2014-01-17T23:31:09Z")

</div>

what is the code for ax 2012 R2 to unreserved the qty??
