Data inserting to Table - AX2009

Dear All

Following scrip using for inserting one table to another table, at the time of running this script all the values shown properly (6 lines available in that table), but one line only inserted. give me your valuable suggestions.

public void insert_scandata(InventTransferId _TransferId)
{
int linenum;
;
linenum = 1;
info(strfmt(“TransferOrderNo - %1”,(_TransferId)));
while select TransferOrderBatchHistoryLoc
where TransferOrderBatchHistoryLoc.TransferId == _TransferId
{
ttsbegin;
select InventTableLoc
where InventTableLoc.ItemId == TransferOrderBatchHistoryLoc.ItemId;

InventTransferLine.TransferId = TransferOrderBatchHistoryLoc.TransferId;
InventTransferLine.LineNum = linenum;
InventTransferLine.ItemId = TransferOrderBatchHistoryLoc.ItemId;
InventTransferLine.InventDimId = TransferOrderBatchHistoryLoc.InventDimId;
InventTransferLine.QtyTransfer = TransferOrderBatchHistoryLoc.ScannedPackets;
InventTransferLine.QtyShipNow = TransferOrderBatchHistoryLoc.ScannedPackets;
InventTransferLine.ShipDate = today();
InventTransferLine.CurrencyCode_IN = ‘INR’;
InventTransferLine.UnitId = InventTableLoc.BOMUnitId;
InventTransferLine.Dimension_IN[1] = TransferOrderBatchHistoryLoc.InventSiteId;
InventTransferLine.Dimension_IN[2] = InventTableLoc.Dimension[2];
InventTransferLine.Dimension_IN[4] = InventTableLoc.Dimension[4];
InventTransferLine.insert();
linenum ++ ;
ttscommit;
info(strfmt(“Batch No - %1”,(TransferOrderBatchHistoryLoc.InventBatchId)));
info(strfmt(“Item ID - %1”,(TransferOrderBatchHistoryLoc.ItemId)));
}

}

Thanks

Saravanan.R

Foundout the solution, thanks to all

Insert this following line all the lines inserted

InventTransferLine.Create();