Identify production quantity including route scrap before posting


  • Allow back-flushing of 92Kg of ingredient, even though only 90Kg are available; No negative stock allowed.
  • I did this by modifying the production order before reporting as finished.
  • For this I needed a way to find out how much the system will back-flush (e.g. 92Kg). The difficulty is that we use phantom BOMs and Routes, which makes the calculation rather complicated.
  • NOTE: Activating the production parameter "Physical reduction" (Journals tab), also reduces the quantity automatically to depleat only available stock. But we wanted more controll over this process.


  • Access the functionality used by Dynamics Ax for this calculation.
  • Note: The production must be started for the phantoms to be exploded.

//bw start
//Changed on 22 May 2007 by TW
/* Description:
Get the expected BOM line qty to be used
Production must be started to take Phantom BOM/Routes into account
static public Qty prodItemQty(ProdBOM _prodBom, Qty _seriesSize=0)
    ProdTable           prodTable = ProdTable::find(_prodBom.BOMId);
    BOMCalcData         bomCalcData;
    BOMCalcConsumption  itemCalcLine;
    UnitQty             bomProposal;
    InventQty           inventProposal;
    Qty                 seriesSize = _seriesSize;
    if (!seriesSize)
            seriesSize = prodTable.QtyStUp-(prodTable.reportedFinishedGood()+prodTable.reportedFinishedError());
            seriesSize = prodTable.QtySched;
    bomCalcData = BOMCalcData::newProdTable(seriesSize,_prodTable);
    itemCalcLine = BOMCalcConsumption::construct(_prodBom.Formula,bomCalcData);
    bomProposal = itemCalcLine.calcConsumption(_prodBom,
    inventProposal = UnitConvert::qty(

    return inventProposal;
//bw end


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s