Announcements
I'm looking to automate the creation of a costing version. I'm able to create a costing version and "Copy Last Cost" but unable to perform the "Calculation" process. Can anyone assists?
*This post is locked for comments
I'm not getting any errors. This is what I did to achieve my task.
//Create new costing version record
costingVersion = null;
costingVersion.initValue();
costingVersion.BlockActivation = NoYesCombo::Yes;
costingVersion.AllowPurch = NoYes::No;
costingVersion.AllowSales = NoYes::No;
costingVersion.BOMCostPriceModel = BOMCostPriceModel::ItemCostPrice;
costingVersion.BOMCalcRun = NoYes::Yes;
costingVersion.LastUpdate = today();
costingVersion.InventSiteId = strUpr(curext());
costingVersion.PurchCalcRun = NoYes::No;
costingVersion.PurchPriceModel = PurchPriceModel::PurchPrice;
costingVersion.Name = strName;
costingVersion.VersionId = strVersionId;
costingVersion.insert();
//Add items to new costing version
psd_AddtoCostVersion = new PSD_AddtoCostVersion();
psd_AddtoCostVersion.parmCostVersion(strVersionId);
psd_AddtoCostVersion.parmEffectivityDate(today());
psd_AddtoCostVersion.run();
//Calculating the costing version
costingVersion = null;
select firstOnly costingVersion where costingVersion.VersionId == strVersionId;
bomCalc = BOMCalcJob::newAll(costingVersion);
bomCalc.parmBOMCalcExplosionMode(BOMCalcExplosionMode::MultiLevel);
bomCalc.parmCostPriceTransfer(NoYes::Yes);
bomCalc.parmCalcDate(today());
bomCalc.run();
Please update if you are getting any error...
I suggest if you can review the copied costing version if its having any difference with Costing version which gets calculation done with out any error..
Please verify and let us know with your findings...
Hi Joe,
My task was to automate the process for creating a new costing version.
I was able to accomplish this by creating a new costing version via x++ and using a couple of classes to copy and calculate items to the new costing version.
Hi Derrick,
Can you give me a little more information about what you're trying to accomplish? Are you looking for a way for AX to automatically run the Calculation for the costing version? Or are you just having troubles with running a cost calculation? Thanks!
Joe
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,807 Super User 2024 Season 2
Martin Dráb 229,135 Most Valuable Professional
nmaenpaa 101,156