Dynamics Search Engine

Sunday, November 28, 2010

How to create an invent transfer order through X++ code in Dynamics AX

This article explains:
How to create an Invent Transfer Order through a job using X++ code.

Applied on:
Dynamics AX 2009 SP1

Create a job as mentioned below:

static void CreateTransferOrderLine(Args _args)
{

    InventTransferTable inventTransFerTable;
    InventTransferLine inventTransFerLine;
    InventTable inventTable;
    NumberSeq numberSeq;
;

    numberSeq = NumberSeq::newGetNumFromCode(Inventparameters::numRefTransferId().NumberSequence);
    inventTransferTable.TransferId = NumberSeq.num();
    inventTransferTable.InventLocationIdFrom = "FromLocation";
    inventTransferTable.InventLocationIdTo = "ToLocation";
    inventTransferTable.initFromAddress();
    inventTransferTable.initValue();
    inventTransferTable.initDeliveryMode();
    inventTransferTable.initToAddress();
    inventTransferTable.insert();
    inventTransferLine.clear();

    inventTransferLine.initFromInventTransferTable(inventTransferTable,NoYes::Yes);
    inventTransferLine.ItemId = "ItemId";
    inventTransFerLine.LineNum = InventTransferLine::lastLineNum(inventTransferTable.TransferId) + 1;
    inventTable = InventTable::find(InventTransferLine.ItemId);
    inventTransferLine.initFromInventTable(InventTable);
    inventTransferLine.QtyTransfer = 1.0;
inventTransferLine.QtyRemainReceive = 1.0;
    inventTransferLine.QtyRemainShip = 1.0;
    inventTransferLine.insert();
}



NOTE: Use at your own risk. There is no warranty on this article.

No comments:

Post a Comment