AX / D365FO – End/finish a production order through X++

Dynamics AX provides a framework, which can be used to update production orders to a specific status. In the example, a production order is ended/finished.

If you want to update several production orders at the same time, you must invoke the ProdMultiHistoricalCost.insert() method per production order and pass the respective record of ProdTable.

static void prodEnd(Args _args)

{
ProdTable prodTable;
ProdMultiHistoricalCost prodMultiHistoricalCost;

prodTable = ProdTable::find("PRD123456");

prodMultiHistoricalCost = ProdMultiHistoricalCost::construct(new Args());
RunBaseMultiParm::initParm(prodMultiHistoricalCost);
prodMultiHistoricalCost.insert(prodTable, prodMultiHistoricalCost.defaultParmBuffer());

prodMultiHistoricalCost.run();
}

Leave a comment