Thursday, June 8, 2017

How to get Reserved Quantity for Sales Line in Ax 2012

If you want to get total of reserved quantity Sales line wise then you can do the following way. First you need to create view as per below picture.

Inventtrans view

Then you can try below code in job to get reserved quantity for sales line item.

  GOD_InventTransView GOD_InventTransView;  
   select sum(Qty) from GOD_InventTransView where GOD_InventTransView.ReferenceId==_salesline1.SalesId && GOD_InventTransView.ItemId==_salesline1.ItemId  
                          && GOD_InventTransView.InventTransId==_salesline1.InventTransId  
                          && GOD_InventTransView.StatusIssue == StatusIssue::ReservPhysical;