giovedì 9 ottobre 2014

HOWTO: Create transfer order by code X++

NumberSeq numberSeq;
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
;

ttsbegin;
numberSeq = NumberSeq::newGetNum(InventParameters::numRefTransferId());

inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = numberSeq.num();
numberSeq.used();

inventTransferTable.InventLocationIdFrom = _inventLocationIdFrom;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = _inventLocationIdTo;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.insert();

inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.ItemId = _itemId;
inventTransferLine.initFromInventTable(InventTable::find(_itemId));
inventTransFerLine.LineNum = InventTransferLine::lastLineNum(inventTransferTable.TransferId) + 1;
inventTransferLine.QtyTransfer = _qty;
inventTransferLine.QtyRemainReceive = _qty;
inventTransferLine.QtyRemainShip = _qty;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventDim = inventTransferLine.inventDim();
inventDim.InventSiteId = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventSiteId;
inventDim.InventLocationId = inventTransferTable.InventLocationIdFrom;
inventTransferLine.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.insert();
ttscommit;

Nessun commento:

Posta un commento

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...