---
id: object/codeunit/99000773
type: object
title: Codeunit 99000773 "Calculate Prod. Order"
summary: Codeunit 99000773 "Calculate Prod. Order" in Base Application (Microsoft.Manufacturing.Document). 15 public procedures, 59 events. Present since at least BC23, still in BC30, changed in BC25-28.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "28"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 4c2faf1183deaff961ff5ac03699091457f75be10218ee8d8d3b7420b017dcde
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al
    title: src/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9118
object_type: codeunit
object_id: 99000773
name: Calculate Prod. Order
namespace: Microsoft.Manufacturing.Document
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "26"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 90
  events: 59
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 6
  calls: 10
  called_by: 4
  implements: 0
---

# Codeunit 99000773 "Calculate Prod. Order"

> Codeunit 99000773 "Calculate Prod. Order" in Base Application (Microsoft.Manufacturing.Document). 15 public procedures, 59 events. Present since at least BC23, still in BC30, changed in BC25-28.

Base Application · Microsoft.Manufacturing.Document · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | TableData Item = r, TableData "Prod. Order Line" = rimd, TableData "Prod. Order Component" = rimd, TableData "Manufacturing Setup" = r, TableData "Production BOM Line" = rimd, TableData "Production BOM Comment Line" = rimd, TableData "Production Order" = rimd, TableData "Prod. Order Comp. Cmt Line" ... |

## Events published

- `OnAfterCalculate(ProdOrderLine: Record "Prod. Order Line"; var ErrorOccured: Boolean)` (integration)
  - subscribers: [Codeunit 6254 "Sust. Manufacturing Subscriber"](../codeunit/6254.md) OnAfterCalculate
- `OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnAfterTransferBOM(ProdOrder: Record "Production Order"; ProdOrderLine: Record "Prod. Order Line"; ProdBOMNo: Code[20]; Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; Blocked: Boolean; var ErrorOccured: Boolean)` (integration)
- `OnAfterTransferTaskInfo(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; VersionCode: Code[20])` (integration)
- `OnAfterTransferRouting(var ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnAfterTransferRoutingLine(var ProdOrderLine: Record "Prod. Order Line"; var RoutingLine: Record "Routing Line"; var ProdOrderRoutingLine: Record "Prod. Order Routing Line")` (integration)
  - subscribers: [Codeunit 20517 "Subc. Calc. Prod. Order Ext."](../codeunit/20517.md) OnAfterTransferRoutingLine, [Codeunit 6254 "Sust. Manufacturing Subscriber"](../codeunit/6254.md) OnAfterTransferRoutingLine
- `OnAfterTransferBOMComponent(var ProdOrderLine: Record "Prod. Order Line"; var ProductionBOMLine: Record "Production BOM Line"; var ProdOrderComponent: Record "Prod. Order Component"; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal)` (integration)
  - subscribers: [Codeunit 20517 "Subc. Calc. Prod. Order Ext."](../codeunit/20517.md) OnAfterTransferBOMComponent, [Codeunit 6254 "Sust. Manufacturing Subscriber"](../codeunit/6254.md) OnAfterTransferBOMComponent
- `OnAfterProdOrderCompFilter(var ProdOrderComp: Record "Prod. Order Component"; ProdBOMLine: Record "Production BOM Line")` (integration)
- `OnAfterProdOrderCompInsert(var ProdOrderComponent: Record "Prod. Order Component"; ProductionBOMLine: Record "Production BOM Line")` (integration)
- `OnBeforeAssignProdOrderLineBinCodeFromProdRtngLineMachineCenter(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; var MachineCenter: Record "Machine Center"; var IsHandled: Boolean)` (integration)
- `OnBeforeCalculate(var ItemLedgerEntry: Record "Item Ledger Entry"; var CapacityLedgerEntry: Record "Capacity Ledger Entry"; Direction: Option Forward,Backward; CalcRouting: Boolean; CalcComponents: Boolean; var DeleteRelations: Boolean; LetDueDateDecrease: Boolean; var IsHandled: Boolean; var ProdOrderLine: Record "Prod. Order Line"; var ErrorOccured: Boolean)` (integration)
- `OnBeforeCalculateRoutingFromActual(ProdOrderRoutingLine: Record "Prod. Order Routing Line"; Direction: Option; CalcStartEndDate: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeCalculateProdOrderDates(var ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnBeforeCopyProdBOMComments(var ProductionBOMCommentLine: Record "Production BOM Comment Line"; var ProductionBOMLine: Record "Production BOM Line"; var IsHandled: Boolean)` (integration)
- `OnBeforeProdOrderCompModify(var ProdOrderComp: Record "Prod. Order Component"; var ProdBOMLine: Record "Production BOM Line"; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal)` (integration)
  - subscribers: [Codeunit 6254 "Sust. Manufacturing Subscriber"](../codeunit/6254.md) OnBeforeProdOrderCompModify
- `OnBeforeSetProdOrderLineBinCode(var ProdOrderLine: Record "Prod. Order Line"; ParentBinCode: Code[20]; ParentLocationCode: Code[10]; var IsHandled: Boolean)` (integration)
- `OnBeforeTransferBOM(var ProdOrder: Record "Production Order"; var ProdOrderLine: Record "Prod. Order Line"; ProdBOMNo: Code[20]; Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; Blocked: Boolean; var ErrorOccured: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeTransferBOMComponent(ProdOrder: Record "Production Order"; ProdOrderLine: Record "Prod. Order Line"; var ProdBOMLine: Record "Production BOM Line"; var ErrorOccured: Boolean; var IsHandled: Boolean; Level: Integer)` (integration)
- `OnBeforeTransferRouting(var ProdOrder: Record "Production Order"; var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnBeforeUpdateProdOrderDates(var ProductionOrder: Record "Production Order"; var ProdOrderLine: Record "Prod. Order Line"; var ProdOrderModify: Boolean)` (integration)
- `OnCalculateOnAfterGetpLanningParameterAtSKUCalcComponents(var ProdOrderLine: Record "Prod. Order Line"; var SKU: Record "Stockkeeping Unit")` (integration)
- `OnCalculateOnAfterCalcShouldCheckIfEntriesExist(var ProdOrderLine: Record "Prod. Order Line"; var CalcRouting: Boolean; var ShouldCheckIfEntriesExist: Boolean)` (integration)
- `OnCalculateOnAfterItemLedgEntrySetFilters(ProdOrderLine: Record "Prod. Order Line"; var ItemLedgerEntry: Record "Item Ledger Entry")` (integration)
- `OnCalculateOnBeforeCheckNextOperation(ProdOrder: Record "Production Order"; ProdOrderLine2: Record "Prod. Order Line"; var ProdOrderRoutingLine3: Record "Prod. Order Routing Line"; var IsHandled: Boolean)` (integration)
- `OnCalculateOnBeforeCheckPrevOperation(ProdOrder: Record "Production Order"; ProdOrderLine2: Record "Prod. Order Line"; var ProdOrderRoutingLine3: Record "Prod. Order Routing Line"; var IsHandled: Boolean)` (integration)
- `OnCalculateComponentsOnBeforeUpdateRoutingLinkCode(var ProdOrderComp: Record "Prod. Order Component"; ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnCalculateProdOrderDatesOnAfterSetFilters(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProductionOrder: Record "Production Order"; ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnCalculateProdOrderDatesOnSetBeforeDueDate(var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnCalculateProdOrderDatesOnBeforeUpdateDatetime(var ProdOrderLine: Record "Prod. Order Line"; NewDueDate: Date; LetDueDateDecreate: Boolean)` (integration)
- `OnCalculateRoutingFromActualOnAfterSetProdOrderRoutingLineFilters(var ProdOrderRoutingLine: Record "Prod. Order Routing Line")` (integration)
- `OnCalculateRoutingFromActualOnBeforeCalcStartEndDate(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; var CalcStartEndDate: Boolean)` (integration)
- `OnCopyRoutingToolsOnAfterRoutingToolSetFilters(var RoutingTool: Record "Routing Tool"; ProdOrderRoutingLine: Record "Prod. Order Routing Line"; VersionCode: Code[20])` (integration)
- `OnTransferBOMOnAfterCalcReqQty(ProductionBOMLine: Record "Production BOM Line"; ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderLine: Record "Prod. Order Line"; var ReqQty: Decimal; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal)` (integration)
- `OnTransferBOMOnAfterSetFiltersProdBOMLine(var ProdBOMLine: Record "Production BOM Line"; ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnTransferBOMOnBeforeProcessItem(ProdBOMLine: Record "Production BOM Line"; ReqQty: Decimal; var SkipTransfer: Boolean)` (integration)
- `OnTransferBOMOnBeforeProcessProdBOM(ProdBOMLine: Record "Production BOM Line"; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ReqQty: Decimal; var ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnTransferBOMOnAfterProcessProdBOM(var ProductionBOMLine: Record "Production BOM Line"; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ReqQty: Decimal; ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnTransferBOMOnBeforeTransferNestedProdBOM(ProductionBOMLine: Record "Production BOM Line"; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ReqQty: Decimal; var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnTransferBOMProcessItemOnAfterGetPlanningParameters(var ProdOrderLine: Record "Prod. Order Line"; var ComponentSKU: Record "Stockkeeping Unit")` (integration)
- `OnTransferBOMProcessItemOnBeforeGetPlanningParameters(var ProdOrderComponent: Record "Prod. Order Component"; ProductionBOMLine: Record "Production BOM Line"; StockkeepingUnit: Record "Stockkeeping Unit")` (integration)
- `OnTransferRoutingOnbeforeValidateDirectUnitCost(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderLine: Record "Prod. Order Line"; RoutingLine: Record "Routing Line")` (integration)
- `OnTransferRoutingOnBeforeCalcRoutingCostPerUnit(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderLine: Record "Prod. Order Line"; RoutingLine: Record "Routing Line")` (integration)
- `OnCalculateRoutingOnBeforeSetLeadTime(var ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnAfterCalculateComponents(ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnBeforeRecalculate(var ProdOrderLine: Record "Prod. Order Line"; CalcRouting: Boolean; CalcComponents: Boolean)` (integration)
- `OnAfterRecalculate(var ProdOrderLine: Record "Prod. Order Line"; CalcRouting: Boolean; CalcComponents: Boolean)` (integration)
- `OnAfterRecalculateProcedure(var ProdOrderLine: Record "Prod. Order Line")` (integration)
- `OnRecalculateOnBeforeCalculateRouting(var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnTransferBOMProcessItemOnBeforeSetFlushingMethod(var ProdOrderLine: Record "Prod. Order Line"; var ComponentSKU: Record "Stockkeeping Unit"; var ProdOrderComp: Record "Prod. Order Component"; ProdBOMLine: Record "Production BOM Line"; var IsHandled: Boolean)` (integration)
- `OnAfterSetPlanningLevelCode(var ProdOrderComponent: Record "Prod. Order Component"; var ProductionBOMLine: Record "Production BOM Line"; var SKU: Record "Stockkeeping Unit"; var ComponentSKU: Record "Stockkeeping Unit"; var Result: Boolean)` (integration)
- `OnBeforeProcessRoutingLine(var RoutingLine: Record "Routing Line"; var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderLine: Record "Prod. Order Line"; ProductionOrder: Record "Production Order"; var IsHandled: Boolean)` (integration)
- `OnBeforeCopyRoutingComments(var RoutingCommentLine: Record "Routing Comment Line"; ProdOrderRoutingLine: Record "Prod. Order Routing Line"; VersionCode: Code[20]; var IsHandled: Boolean)` (integration)
- `OnCalculateRoutingOnBeforeUpdateProdOrderRoutingLineDates(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnBeforeCheckProdOrderLineQuantity(ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)` (integration)
- `OnCalculateOnBeforeCalcComponents(ProdOrderLine: Record "Prod. Order Line"; CalcComponents: Boolean; var SkipCalcComponents: Boolean)` (integration)
- `OnCalculateOnAfterCapLedgEntrySetFilters(var ProdOrderLine: Record "Prod. Order Line"; var CapacityLedgerEntry: Record "Capacity Ledger Entry")` (integration)
- `OnBeforeGetDefaultBin(var ProdOrderComponent: Record "Prod. Order Component"; var Location: Record Location; var Item: Record Item; var ProdOrderWarehouseMgt: Codeunit "Prod. Order Warehouse Mgt."; var BinCode: Code[20]; var IsHandled: Boolean)` (integration)
- `OnBeforeFindProdOrderRoutingLine(var ProdOrderLine: Record "Prod. Order Line"; var ProductionBOMLine: Record "Production BOM Line"; var IsHandled: Boolean; var ReqQty: Decimal)` (integration)
- `OnCalculateRoutingFromActualOnAfterCalculateRoutingLine(var ProdOrderRoutingLine: Record "Prod. Order Routing Line")` (integration)

## Procedures

- `InitProdOrderRoutingLine(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; RoutingLine: Record "Routing Line")`
- `TransferTaskInfo(var FromProdOrderRoutingLine: Record "Prod. Order Routing Line"; VersionCode: Code[20])`
- `TransferBOM(ProdBOMNo: Code[20]; Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal): Boolean`
- `CalculateComponents()`
- `CalculateRoutingFromActual(ProdOrderRoutingLine: Record "Prod. Order Routing Line"; Direction: Option Forward,Backward; CalcStartEndDate: Boolean)`
- `CalculateProdOrderDates(var ProdOrderLine: Record "Prod. Order Line"; LetDueDateDecrease: Boolean)`
- `Calculate(ProdOrderLine2: Record "Prod. Order Line"; Direction: Option Forward,Backward; CalcRouting: Boolean; CalcComponents: Boolean; DeleteRelations: Boolean; LetDueDateDecrease: Boolean): Boolean`
- `Recalculate(var ProdOrderLine2: Record "Prod. Order Line"; Direction: Option Forward,Backward; LetDueDateDecrease: Boolean)`
- `BlockDynamicTracking(SetBlock: Boolean)`
- `SetParameter(NewProdOrderModify: Boolean)`
- `SetProdOrderLineBinCodeFromRoute(var ProdOrderLine: Record "Prod. Order Line"; ParentLocationCode: Code[10]; RoutingNo: Code[20])`
- `SetProdOrderLineBinCodeFromProdRtngLines(var ProdOrderLine: Record "Prod. Order Line")`
- `SetProdOrderLineBinCodeFromPlanningRtngLines(var ProdOrderLine: Record "Prod. Order Line"; ReqLine: Record "Requisition Line")`
- `FindAndSetProdOrderLineBinCodeFromProdRoutingLines(ProdOrderStatus: Enum "Production Order Status"; ProdOrderNo: Code[20]; ProdOrderLineNo: Integer)`
- `AssignProdOrderLineBinCodeFromProdRtngLineMachineCenter(var ProdOrderRoutingLine: Record "Prod. Order Routing Line")`

Plus 16 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 5404 "Lead-Time Management"](../codeunit/5404.md) (6 calls: `CalculateLeadTime → GetPlannedEndingDate`, `CalculateLeadTime → GetPlannedStartingDate`, `CalculateLeadTime → ManufacturingLeadTime`, …)
- [Codeunit 5996 "Prod. Order Warehouse Mgt."](../codeunit/5996.md) (5 calls: `GetDefaultBin → GetDefaultBin`, `SetProdOrderLineBinCode → GetDefaultBin`, `SetProdOrderLineBinCodeFromPlanningRtngLines → GetPlanningRtngLastOperationFromBinCode`, …)
- [Codeunit 99000772 "Prod. Order Route Management"](../codeunit/99000772.md) (5 calls: `Calculate → UpdateComponentsBin`, `CalculateRouting → Calculate`, `CalculateRouting → NeedsCalculation`, …)
- [Codeunit 5402 "Unit of Measure Management"](../codeunit/5402.md) (3 calls: `Calculate → GetQtyPerUnitOfMeasure`, `TransferBOMProcessItem → GetQtyRoundingPrecision`, `TransferBOMProcessItem → QtyRndPrecision`)
- [Codeunit 99000756 "VersionManagement"](../codeunit/99000756.md) (2 calls: `Calculate → GetBOMUnitOfMeasure`, `TransferBOM → GetBOMVersion`)
- [Codeunit 99000855 "Planning-Get Parameters"](../codeunit/99000855.md) (2 calls: `Calculate → AtSKU`, `TransferBOMProcessItem → AtSKU`)
- [Codeunit 99000755 "Shop Calendar Management"](../codeunit/99000755.md) (1 call: `CalculateRoutingFromActual → GetMaxDate`)
- [Codeunit 99000758 "Mfg. Cost Calculation Mgt."](../codeunit/99000758.md) (1 call: `InitProdOrderRoutingLine → CalcRoutingCostPerUnit`)
- [Codeunit 99000774 "Calculate Routing Line"](../codeunit/99000774.md) (1 call: `CalculateRoutingFromActual → CalculateRoutingLine`)
- [Page 99000761 "Machine Center List"](../page/99000761.md) (1 call: `AssignProdOrderLineBinCodeFromProdRtngLineMachineCenter → (object)`)

## Called by

- [Codeunit 99000787 "Create Prod. Order Lines"](../codeunit/99000787.md) (6 calls: `CheckMakeOrderLine → Calculate`, `CheckMakeOrderLine → Recalculate`, `InitProdOrderLine → SetProdOrderLineBinCodeFromRoute`, …)
- [Table 5409 "Prod. Order Routing Line"](../table/5409.md) (6 calls: `CalcStartingEndingDates → CalculateRoutingFromActual`, `CalculateRoutingBack → CalculateProdOrderDates`, `CalculateRoutingBack → CalculateRoutingFromActual`, …)
- [Table 5405 "Production Order"](../table/5405.md) (4 calls: `UpdateEndingDate → Recalculate`, `UpdateEndingDate → SetParameter`, `UpdateStartingEndingTime → Recalculate`, …)
- [Table 5406 "Prod. Order Line"](../table/5406.md) (2 calls: `BlockDynamicTracking → BlockDynamicTracking`, `ShowRouting → FindAndSetProdOrderLineBinCodeFromProdRoutingLines`)

## Recent changes

- 2026-07-07 [#9118 Bugs/master GitHub event batch 1745](../../changes/bcapps/9118.md) (main, BC30, fix)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25-28

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Calculate Prod. Order")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
