I am using the code from the following link to post the transfer order using X++ code:
I have a scenario to post a transfer order after the purchase order invoice is posted. I am taking the information from vendinvoicejour and vendinvoiceTrans tables to fill the transfer order header and line tables. But when I am calling the InventTransferUpd.Run method, I am getting the below error:
No lines for posting. Update has been cancelled.
Can anyone please let me know what I am missing here or if someone can share the exact code to post the transfer orders using code that would be great.
I think the issue depend from the UpdateType filed.
E.g., if it's set to PickingList, you have to create the Picking of the Transfer order before.
I have set the update type to shipment. Sorry forgot to mention this.
I am using the following code to post the transfer order:
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.EditLines = true;
inventTransferParmTable.AutoReceiveQty = true;
inventTransferParmTable.ExplodeLines = true;
inventTransferParmTable.UpdateType = InventTransferUpdateType::Shipment;
inventTransferParmTable.TransDate = systemDateGet();
inventTransferParmTable.ShipUpdateQty = InventTransferShipUpdateQty::All;
inventTransferUpd = InventTransferUpdShip::newParmBuffer(inventTransferParmTable);
For me it seems issue may because the Trasfer order is not getting save before posting it.
Please validate if you are doing all the process (creating and posting Transfer order ) in single ttsbegin and ttscommit
if yes i suggest you to have it in two different transaction.
Please verify and update us with your findings
I was creating the transfer with Transfer status shipped, so when I changed it to Created, I am no longer getting this error now. But now I am getting below errors:
Inventory dimension Site is mandatory and must be specified.
Inventory dimension Warehouse is mandatory and must be specified.
I have already set the InventDimId for InventTransferLine, but still getting this error. Do you have any idea what might be causing this error?
please verify if - InventDimId is updated with appropriate value or not.
If not then may be you need to review your logic the way you are creating Transfer order line
I was missing to set the transit warehouse on transfer order header. After setting this, the error is gone and transfer order posted successfully. But the error was very misleading and didn't specify that the transit warehouse is missing, even through it is mandatory on InventTransferTable.