web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Auto Calculate Costing Version

(0) ShareShare
ReportReport
Posted on by

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

  • Joe Tews Profile Picture
    10 on at

    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

  • Community Member Profile Picture
    on at

    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.

  • Suggested answer
    Community Member Profile Picture
    on at

    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...

  • Suggested answer
    Community Member Profile Picture
    on at

    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();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans