D365FO – AX – Create Planned Transfer Order in X++

This is a simple job to create a planned Transfer order througth X++ static void PlannedTransferOrder(Args _args) {    ReqPo       ReqPo;    InventDim   inventDim;    InventDim   inventDimLocal;    ReqPlan                                 reqPlan;    ReqPlanData     reqPlanData;    ReqPlanId       reqPlanId = 'Piano Generale'; //Here you put your preferred ReqPlanId    reqPlanData = ReqPlanData::newReqPlanId(reqPlanId);    ReqPo.clear();    ReqPo.initValue();    ReqPo.initReqPOType(reqPlanData.parmReqPlanVersionRefRecId(),reqPoType::Transfer);    ReqPo.initFromItemId ("440440"); //Here you put your ItemId    ReqPo.Qty = 11; //Here you put your … Continue reading D365FO – AX – Create Planned Transfer Order in X++

D365FO – AX – Posting a Transfer Order using X++

While working with unit testing in AX, I came across the need to generate a transfer order and post it to generate the associated tables. I have used the FormLetter classes for posting Sales Orders & Purchase Orders in the past so I started looking for a similar process for Transfer Orders. I started by … Continue reading D365FO – AX – Posting a Transfer Order using X++

D365FO – AX – Creating transfer order through X++ code

To create a transfer oder via a code: inventTransferTable.clear();inventTransferTable.initValue();numberSequenceReference = InventParameters::numRefTransferId();numberSeq =numberSeq::newGetNumFromCode(numberSequenceReference.NumberSequence);inventTransferTable.TransferId = numberSeq.num();inventTransferTable.InventLocationIdFrom = fromloc;inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));inventTransferTable.InventLocationIdTo = toloc;inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));inventTransferTable.TransferStatus = InventTransferStatus::Created;inventTransferTable.insert(); inventTransferLine.clear();inventTransferLine.initFromInventTransferTable(inventTransferTable,NoYes::Yes);nventTransferLine.ItemId = item;inventTransferLine.initFromInventTable(InventTable::find(item));inventTransferLine.QtyTransfer = qty_ship;inventTransferLine.QtyShipNow = 0;inventTransferLine.QtyReceiveNow = 0; inventTransferLine.QtyRemainReceive = qty_ship ; inventTransferLine.QtyRemainShip = qty_ship ; inventTransferLine.insert(); Also set the two fields:QtyRemainShip and QtyRemainReceive to the value of QtyTransfer when you create the line.