AX / D365FO – Copy data from Regular table to Temporary table in X++

To populate a temporary table with data from a persisted table, use the setTmp() and data() method. The following code example copies all invent items in Toronto to the temporary table.

InventTable inventTable;
InventTable inventTableTmp;
inventTableTmp.setTmp();
while select inventTable
{
   inventTableTmp.data(inventTable.data());
   inventTableTmp.doInsert();
}

Leave a comment