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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Problems While Creating a Production Order with X++ code in D365 FO

(0) ShareShare
ReportReport
Posted on by 607

HI  All,

I am using the following code to create a production Order : 

    ProdQty         qty     = 100;
    ItemId          item    = 'XXXX';
 
    ProdTable       prodtable;
    InventTable     inventTable;
    InventDim       inventDim;
    ;
 
    // Initialize InventTable
    inventTable = inventTable::find(item);
 
    // Initialize the base values
    prodtable.initValue();
    prodtable.initFromInventTable(inventTable);
 
    prodtable.ItemId                = inventTable.ItemId;
    prodtable.DlvDate               = today();
    prodtable.QtySched              = qty;
    prodtable.RemainInventPhysical  = qty;
 
    // Initialize InventDim (Obrigatory)
    inventDim.initValue();
 
    // Set the active BOM and Route
    prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,
                                             prodtable.BOMDate,
                                             prodtable.QtySched,
                                             inventDim).BOMId;
 
    prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,
                                                 prodtable.BOMDate,
                                                 prodtable.QtySched,
                                                 inventDim).RouteId;
 
    // Initialize BOMVersion
    prodtable.initBOMVersion();
    // Initialize RouteVersion
    prodtable.initRouteVersion();
 
    //Use ProdTableType class to create the production order
    prodtable.type().insert();
 
    // Inform Production Order Id
    setPrefix( 'Production Order');
    setPrefix( 'Production Order Number');
    info(prodtable.ProdId);


But the problem is in D365 FO, insert() is obselete, so i tried it with inserting() and Inserted() both, but still i am not able to create a production order sucessfully.

Can someone pls help!

Thanks i Advance

I have the same question (0)
  • Verified answer
    WillWU Profile Picture
    22,361 on at

    Hi AXBOY,

    ProdTableType.insert() is deprecated.

    You could use ProdTable.insert() to insert records.

  • AXBOY Profile Picture
    607 on at

    I tried ProdTable.insert() too, but i am getting the following error which i am not able to resolve : 

    pastedimage1589186975714v1.png

  • AXBOY Profile Picture
    607 on at

    OKay it worked, with keeping the code inside ttsbegin and ttscommit.

    Thanks

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans