Skip to main content

Hello Community. I am working on a project to create shipment receipts through code and running into the error message “SO Error: Order RM 3034042 does not contain any items planned for receipt on '9/20/2024 12:00:00 AM'.” This only happens when calling the code, I can click the “Create Shipment Receipt” button from the front end without the same error. Below is how I am calling “CreateShipmentReceipt”. Any ideas?

orderEntry.Document.Current = orderEntry.Document.Search<SOOrder.orderNbr>(s.OrderNbr, s.OrderType);
orderEntry.Transactions.Current = s;
adapter = new PXAdapter(new PXView(orderEntry, false, orderEntry.Document.View.BqlSelect));
PXTrace.WriteInformation("Receipt 1.1: Checking if line needs receipt created");
if (s.ShippedQty != s.OrderQty)
{
PXTrace.WriteInformation("Receipt 1.2: Begin receipt line creation");


orderEntry.Document.Current.ShipDate = filter.TransactionDate;
orderEntry.CreateShipmentReceipt(adapter, filter.TransactionDate, s.SiteID);
orderEntry.Document.Current = orderEntry.Document.Search<SOOrder.orderNbr>(s.OrderNbr, s.OrderType);
shipNo = orderEntry.shipmentlist.Current.ShipmentNbr;

 

A bit more information that I just realized. I am selecting RMA 3034102 but the adapter is selecting a different sales order entirely. I believe I have my adapter line set wrong. But my orderEntry graph is set to the correct order. 


I figured this out in the end, I ended up manually building a select statement to pass along with the adapter as the orderentry.document.view.bqlselect returned all sales orders. 

PXSelectBase<SOOrder> cmd = new PXSelect<SOOrder,
Where<SOOrder.orderNbr, Equal<Current<SOLine.orderNbr>>,
And<SOOrder.orderType, Equal<Current<SOLine.orderType>>>>>(orderEntry);

adapter = new PXAdapter(new PXView(orderEntry, false, cmd.View.BqlSelect));

 


Thank you for sharing your solution with the community @AJohnson!


Reply