---
id: object/codeunit/5836
type: object
title: Codeunit 5836 "Cost Calculation Management"
summary: Codeunit 5836 "Cost Calculation Management" in Base Application (Microsoft.Inventory.Costing). 25 public procedures, 7 events. Present since at least BC23, still in BC30, changed in BC24-29.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "29"
  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: f972990a0b13edc6bd8562d41b9c75a65168176a2db39bd2fbd2975ada23ce17
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/Costing/CostCalculationManagement.Codeunit.al
    title: src/Layers/W1/BaseApp/Inventory/Costing/CostCalculationManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 5836
name: Cost Calculation Management
namespace: Microsoft.Inventory.Costing
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 36
  events: 7
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 1
  calls: 1
  called_by: 20
  implements: 0
---

# Codeunit 5836 "Cost Calculation Management"

> Codeunit 5836 "Cost Calculation Management" in Base Application (Microsoft.Inventory.Costing). 25 public procedures, 7 events. Present since at least BC23, still in BC30, changed in BC24-29.

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

## Properties

| Property | Value |
|---|---|
| SingleInstance | true |
| Permissions | TableData "Item Ledger Entry" = r, TableData "Value Entry" = r |

## Events published

- `OnBeforeCalcSalesLineCostLCY(SalesLine: Record "Sales Line"; QtyType: Option General,Invoicing; var IsHandled: Boolean; var TotalAdjCostLCY: Decimal)` (integration)
- `OnCalcSalesLineShptAdjCostLCYBeforeSalesShptLineFind(var SalesShptLine: Record "Sales Shipment Line"; var SalesLine: Record "Sales Line")` (integration)
- `OnCalcCustActualCostLCYOnAfterFilterValueEntry(var Customer: Record Customer; var ValueEntry: Record "Value Entry")` (integration)
- `OnCalcCustActualCostLCYOnAfterFilterResLedgerEntry(var Customer: Record Customer; var ResLedgerEntry: Record "Res. Ledger Entry")` (integration)
- `OnBeforeRelatedReturnReceiptExists(var SalesShptLine: Record "Sales Shipment Line"; var ReturnRcptLine: Record "Return Receipt Line"; var IsHandled: Boolean)` (integration)
- `OnBeforeSetFiltersRelatedReturnReceiptExists(var SalesShptLine: Record "Sales Shipment Line"; var ReturnRcptLine: Record "Return Receipt Line"; var ReturnValue: Boolean; var IsHandled: Boolean)` (integration)
- `OnCanIncNonInvCostIntoProductionItem(var Result: Boolean)` (integration)
  - subscribers: [Codeunit 99000758 "Mfg. Cost Calculation Mgt."](../codeunit/99000758.md) OnCanIncNonInvCostIntoProductionItem

## Procedures

- `ResourceCostPerUnit(No: Code[20]; var DirUnitCost: Decimal; var IndirCostPct: Decimal; var OvhdRate: Decimal; var UnitCost: Decimal)`
- `CalcDirCost(Cost: Decimal; OvhdCost: Decimal; VarPurchCost: Decimal): Decimal`
- `CalcDirUnitCost(UnitCost: Decimal; OvhdRate: Decimal; IndirCostPct: Decimal): Decimal`
- `CalcOvhdCost(DirCost: Decimal; IndirCostPct: Decimal; OvhdRate: Decimal; QtyBase: Decimal): Decimal`
- `CalcUnitCost(DirCost: Decimal; IndirCostPct: Decimal; OvhdRate: Decimal; RndgPrec: Decimal): Decimal`
- `GetRndgSetup(var GLSetup: Record "General Ledger Setup"; var Currency: Record Currency; var RndgSetupRead: Boolean)`
- `TransferCost(var Cost: Decimal; var UnitCost: Decimal; SrcCost: Decimal; Qty: Decimal; UnitAmtRndgPrec: Decimal)`
- `SplitItemLedgerEntriesExist(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; QtyBase: Decimal; ItemLedgEntryNo: Integer): Boolean`
- `CalcSalesLineCostLCY(SalesLine: Record "Sales Line"; QtyType: Option General,Invoicing): Decimal`
- `CalcSalesLineShptAdjCostLCY(SalesLine: Record "Sales Line"; QtyType: Option General,Invoicing; var TotalAdjCostLCY: Decimal; var PostedQtyBase: Decimal; var RemQtyToCalcBase: Decimal)`
- `CalcSalesLineRcptAdjCostLCY(SalesLine: Record "Sales Line"; QtyType: Option General,Invoicing; var TotalAdjCostLCY: Decimal; var PostedQtyBase: Decimal; var RemQtyToCalcBase: Decimal)`
- `CalcPostedDocLineCostLCY(var ItemLedgEntry: Record "Item Ledger Entry"; QtyType: Option General,Invoicing,Shipping,Consuming): Decimal`
- `CalcSalesInvLineCostLCY(SalesInvLine: Record "Sales Invoice Line"): Decimal`
- `CalcSalesInvLineNonInvtblCostAmt(SalesInvoiceLine: Record "Sales Invoice Line"): Decimal`
- `CalcSalesCrMemoLineCostLCY(SalesCrMemoLine: Record "Sales Cr.Memo Line"): Decimal`
- `CalcSalesCrMemoLineNonInvtblCostAmt(SalesCrMemoLine: Record "Sales Cr.Memo Line"): Decimal`
- `CalcCustLedgAdjmtCostLCY(CustLedgEntry: Record "Cust. Ledger Entry"): Decimal`
- `CalcCustAdjmtCostLCY(var Customer: Record Customer): Decimal`
- `CalcCustLedgActualCostLCY(CustLedgEntry: Record "Cust. Ledger Entry"): Decimal`
- `CalcCustActualCostLCY(var Customer: Record Customer): Decimal`
- `NonInvtblCostAmt(var Customer: Record Customer): Decimal`
- `SumValueEntriesCostAmt(var ValueEntry: Record "Value Entry"): Decimal`
- `GetDocType(TableNo: Integer): Integer`
- `AdjustForRevNegCon(var ActMatCost: Decimal; var ActMatCostCostACY: Decimal; var ItemLedgEntry: Record "Item Ledger Entry")`
- `CanIncNonInvCostIntoProductionItem(): Boolean`

Plus 4 local procedures.

## 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 5402 "Unit of Measure Management"](../codeunit/5402.md) (2 calls: `CalcSalesLineRcptAdjCostLCY → QtyRndPrecision`, `CalcSalesLineShptAdjCostLCY → QtyRndPrecision`)

## Called by

- [Codeunit 5812 "Calculate Standard Cost"](../codeunit/5812.md) (6 calls: `CalcMfgItem → CalcOvhdCost`, `CalcMfgSKU → CalcOvhdCost`, `CalcRtngLineCostSKU → CalcOvhdCost`, …)
- [Codeunit 90 "Purch.-Post"](../codeunit/90.md) (4 calls: `PostItemChargePerRcpt → SplitItemLedgerEntriesExist`, `PostItemChargePerRetRcpt → SplitItemLedgerEntriesExist`, `PostItemChargePerRetShpt → SplitItemLedgerEntriesExist`, …)
- [Codeunit 5896 "Calc. Inventory Adjmt. - Order"](../codeunit/5896.md) (3 calls: `CalcActualMaterialCosts → CanIncNonInvCostIntoProductionItem`, `CalcActualOutputCosts → CanIncNonInvCostIntoProductionItem`, `UpdateOutputAdjmtBuf → CanIncNonInvCostIntoProductionItem`)
- [Codeunit 6476 "Serv. Cost Calculation Mgt."](../codeunit/6476.md) (3 calls: `CalcServCrMemoLineCostLCY → SumValueEntriesCostAmt`, `CalcServInvLineCostLCY → SumValueEntriesCostAmt`, `CalcServShptLineCostLCY → CalcPostedDocLineCostLCY`)
- [Codeunit 1302 "Customer Mgt."](../codeunit/1302.md) (2 calls: `CalculateStatisticsWithCurrentCustomerValues → CalcCustActualCostLCY`, `CalculateStatisticsWithCurrentCustomerValues → NonInvtblCostAmt`)
- [Codeunit 80 "Sales-Post"](../codeunit/80.md) (2 calls: `PostItemChargePerRetRcpt → SplitItemLedgerEntriesExist`, `PostItemChargePerShpt → SplitItemLedgerEntriesExist`)
- [Page 151 "Customer Statistics"](../page/151.md) (2 calls: `OnAfterGetRecord → CalcCustActualCostLCY`, `OnAfterGetRecord → NonInvtblCostAmt`)
- [Page 397 "Sales Invoice Statistics"](../page/397.md) (2 calls: `CalculateTotals → CalcSalesInvLineCostLCY`, `CalculateTotals → CalcSalesInvLineNonInvtblCostAmt`)
- [Page 398 "Sales Credit Memo Statistics"](../page/398.md) (2 calls: `CalculateTotals → CalcSalesCrMemoLineCostLCY`, `CalculateTotals → CalcSalesCrMemoLineNonInvtblCostAmt`)
- [Codeunit 22 "Item Jnl.-Post Line"](../codeunit/22.md) (1 call: `CalcPosShares → CalcOvhdCost`)
- [Codeunit 361 "MoveEntries"](../codeunit/361.md) (1 call: `MoveDocRelatedEntries → GetDocType`)
- [Codeunit 5802 "Inventory Posting To G/L"](../codeunit/5802.md) (1 call: `BufferOutputPosting → CanIncNonInvCostIntoProductionItem`)
- [Codeunit 5804 "ItemCostManagement"](../codeunit/5804.md) (1 call: `CalcUnitCostFromAverageCost → GetRndgSetup`)
- [Codeunit 6225 "Sust. Purchase Subscriber"](../codeunit/6225.md) (1 call: `GetDistributeItemCharge → SplitItemLedgerEntriesExist`)
- [Codeunit 912 "Calculate Assembly Cost"](../codeunit/912.md) (1 call: `GetResCost → CalcDirUnitCost`)
- [Codeunit 924 "Asm. Item Journal Mgt."](../codeunit/924.md) (1 call: `OnValidateCapUnitOfMeasureCodeOnCaseOrderTypeElse → ResourceCostPerUnit`)
- [Codeunit 99000758 "Mfg. Cost Calculation Mgt."](../codeunit/99000758.md) (1 call: `CalcProdOrderLineExpCost → CalcOvhdCost`)
- [Report 5872 "BOM Cost Share Distribution"](../report/5872.md) (1 call: `DeleteThisLine → CanIncNonInvCostIntoProductionItem`)
- [Table 83 "Item Journal Line"](../table/83.md) (1 call: `CalcUnitCost → CanIncNonInvCostIntoProductionItem`)
- [Table extension 99000751 "Mfg. Purchase Line"](../tableextension/99000751.md) (1 call: `TransferFromReqLineToPurchLine → GetRndgSetup`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-29

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: "Cost Calculation Management")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
