Hi Friends,
The below X++ code can be used to start production orders in AX2012 R3 and R2 versions. I have not tested this in previous versions.
The values which we normally define on start screen can be assigned in the prodParmStartUp table buffer:
In the job I have set the automatic BOM and Route consumption as Never and have also turned off the post picking list and route card journal check boxes.
To use the code quickly here it is, the production order number and quantity are initialized in the _prodId and _qty variables:
static void prodStart(Args _args)
{
ProdParmStartUp prodParmStartUp;
ProdMultiStartUp prodMultiStartUp;
ProdId _prodId = "W000034";
Qty _qty = 10000;
ttsbegin;
prodMultiStartUp = ProdMultiStartUp::construct(null);
prodMultiStartUp.parmId(RunBaseMultiParm::getSysParmId());
prodMultiStartUp.getLast();
prodMultiStartUp.insert(ProdTable::find(_prodId), prodParmStartUp);
if (_qty)
{
prodParmStartUp.StartUpQty = _qty;
prodParmStartUp.PostNowBOM = NoYes::No;
prodParmStartUp.PostNowRoute = NoYes::No;
prodParmStartUp.BOMAutoConsump = BOMAutoConsump::Never;
prodParmStartUp.RouteAutoConsump = RouteAutoConsump::Never;
prodParmStartUp.update();
}
prodMultiStartUp.runOnServer();
info("Done");
ttsCommit;
}
Thanks for reading the blog.
The below X++ code can be used to start production orders in AX2012 R3 and R2 versions. I have not tested this in previous versions.
The values which we normally define on start screen can be assigned in the prodParmStartUp table buffer:
To use the code quickly here it is, the production order number and quantity are initialized in the _prodId and _qty variables:
static void prodStart(Args _args)
{
ProdParmStartUp prodParmStartUp;
ProdMultiStartUp prodMultiStartUp;
ProdId _prodId = "W000034";
Qty _qty = 10000;
ttsbegin;
prodMultiStartUp = ProdMultiStartUp::construct(null);
prodMultiStartUp.parmId(RunBaseMultiParm::getSysParmId());
prodMultiStartUp.getLast();
prodMultiStartUp.insert(ProdTable::find(_prodId), prodParmStartUp);
if (_qty)
{
prodParmStartUp.StartUpQty = _qty;
prodParmStartUp.PostNowBOM = NoYes::No;
prodParmStartUp.PostNowRoute = NoYes::No;
prodParmStartUp.BOMAutoConsump = BOMAutoConsump::Never;
prodParmStartUp.RouteAutoConsump = RouteAutoConsump::Never;
prodParmStartUp.update();
}
prodMultiStartUp.runOnServer();
info("Done");
ttsCommit;
}
Thanks for reading the blog.
So I have a problem and this is an old post but maybe you will see it. When I pass in "Never" for BOMAutoConsump or RouteAutoConsump via XML, AX changes it back to "Always" everytime. Any idea what causes this?
ReplyDelete