---
id: object/codeunit/5530
type: object
title: Codeunit 5530 "Calc. Item Availability"
summary: Codeunit 5530 "Calc. Item Availability" in Base Application (Microsoft.Inventory.Availability). 9 public procedures, 33 events. Present since at least BC23, still in BC30, changed in BC25, BC27, BC30.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "30"
  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: 7db5e479d4b37e55bb08712a7b4a5f41e5988ef3a91a6bd90f7b0aaba4f05b01
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/Availability/CalcItemAvailability.Codeunit.al
    title: src/Layers/W1/BaseApp/Inventory/Availability/CalcItemAvailability.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/12066
object_type: codeunit
object_id: 5530
name: Calc. Item Availability
namespace: Microsoft.Inventory.Availability
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "27"
  - "30"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 65
  events: 33
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 12
  calls: 26
  called_by: 5
  implements: 0
---

# Codeunit 5530 "Calc. Item Availability"

> Codeunit 5530 "Calc. Item Availability" in Base Application (Microsoft.Inventory.Availability). 9 public procedures, 33 events. Present since at least BC23, still in BC30, changed in BC25, BC27, BC30.

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

## Events published

- `OnAfterGetDocumentEntries(var InvtEventBuf: Record "Inventory Event Buffer"; var Item: Record Item; var CurrEntryNo: Integer)` (integration)
  - subscribers: [Codeunit 6452 "Serv. Availability Mgt."](../codeunit/6452.md) OnAfterGetDocumentEntries, [Codeunit 99000871 "Job Planning Availability Mgt."](../codeunit/99000871.md) OnAfterGetDocumentEntries, [Codeunit 99000874 "Assembly Availability Mgt."](../codeunit/99000874.md) OnAfterGetDocumentEntries, [Codeunit 99000875 "Prod. Order Availability Mgt."](../codeunit/99000875.md) OnAfterGetDocumentEntries
- `OnBeforeGetDocumentEntries(var InventoryEventBuffer: Record "Inventory Event Buffer"; var Item: Record Item)` (integration)
- `OnAfterGetAnticipatedDemand(var InvtEventBuf: Record "Inventory Event Buffer"; var Item: Record Item; ForecastName: Code[10]; ExcludeForecastBefore: Date; IncludeBlanketOrders: Boolean; EntryNo: Integer)` (integration)
- `OnAfterGetPlanningLines(var InvtEventBuf: Record "Inventory Event Buffer"; Item: Record "Item"; ReqLine: Record "Requisition Line"; FromRecRef: RecordRef)` (integration)
- `OnAfterGetSourceReferences(FromRecordID: RecordID; TransferDirection: Enum "Transfer Direction"; var SourceType: Integer; var SourceSubtype: Integer; var SourceID: Code[20]; var SourceBatchName: Code[10]; var SourceProdOrderLine: Integer; var SourceRefNo: Integer; var IsHandled: Boolean; RecRef: RecordRef)` (integration)
  - subscribers: [Codeunit 6452 "Serv. Availability Mgt."](../codeunit/6452.md) OnAfterGetSourceReferences, [Codeunit 99000871 "Job Planning Availability Mgt."](../codeunit/99000871.md) OnAfterGetSourceReferences, [Codeunit 99000874 "Assembly Availability Mgt."](../codeunit/99000874.md) OnAfterGetSourceReferences, [Codeunit 99000875 "Prod. Order Availability Mgt."](../codeunit/99000875.md) OnAfterGetSourceReferences
- `OnAfterShowDocument(RecordID: RecordID; var IsHandled: Boolean; RecRef: RecordRef)` (integration)
  - subscribers: [Codeunit 6452 "Serv. Availability Mgt."](../codeunit/6452.md) OnAfterShowDocument, [Codeunit 99000874 "Assembly Availability Mgt."](../codeunit/99000874.md) OnAfterShowDocument, [Codeunit 99000875 "Prod. Order Availability Mgt."](../codeunit/99000875.md) OnAfterShowDocument
- `OnBeforeRunSalesHeaderPage(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeRunPurchHeaderPage(var PurchHeader: Record "Purchase Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeRunProductionOrderPage(var ProductionOrder: Record Microsoft.Manufacturing.Document."Production Order"; var IsHandled: Boolean)` (integration, obsolete 27.0)
- `OnBeforeTryGetQtyOnInventory(var InvtEventBuf: Record "Inventory Event Buffer"; var Item: Record Item; var Result: Boolean; var IsHandled: Boolean)` (integration)
- `OnGetBlanketSalesOrdersOnAfterAssignQtyReleased(BlanketSalesLine: Record "Sales Line"; QtyReleased: Decimal)` (integration)
- `OnGetBlanketSalesOrdersOnAfterTransferFromSalesBlanketOrder(BlanketSalesLine: Record "Sales Line"; var InventoryEventBuffer: Record "Inventory Event Buffer")` (integration)
- `OnGetBlanketSalesOrdersOnAfterAdjustQtyReleasedFromInvtEventBuf(InventoryEventBuffer: Record "Inventory Event Buffer")` (integration)
- `OnGetPlanningLinesOnAfterReqLineSetFilters(var ReqLine: record "Requisition Line"; var Item: record Item)` (integration)
- `OnGetRemainingForecastOnAfterSetItemFilters(var Item: Record Item; ProductionForecastEntry: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry")` (integration)
- `OnGetRemainingForecastOAfterInvtEventBufSetFilters(var InventoryEventBuffer: Record "Inventory Event Buffer"; ProductionForecastEntry: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry")` (integration)
- `OnGetRemainingForecastOAfterInsertEntry(var InventoryEventBuffer: Record "Inventory Event Buffer"; var Item: Record Item; ProductionForecastEntry: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry")` (integration)
- `OnGetRemainingForecastOnBeforeCalcForecastQuantityBase(var ProductionForecastEntry: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry")` (integration)
- `OnGetRemainingForecastOnBeforeLoopOnAfterSetItemFilters(var Item: Record Item; ProductionForecastEntry: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry"; ProductionForecastEntry2: Record Microsoft.Manufacturing.Forecast."Production Forecast Entry")` (integration)
- `OnTryGetQtyOnInventoryOnBeforeInsertEntry(var InvtEventBuf: Record "Inventory Event Buffer"; var ItemLedgerEntry: Record "Item Ledger Entry")` (integration)
- `OnBeforeShowDocument(var RecRef: RecordRef)` (integration)
- `OnBeforeShowSalesShipmentHeader(SalesShptHeader: Record "Sales Shipment Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowSalesInvoiceHeader(SalesInvHeader: Record "Sales Invoice Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowSalesCrMemoHeader(SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowPurchRcptHeader(PurchRcptHeader: Record "Purch. Rcpt. Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowPurchInvHeader(PurchInvHeader: Record "Purch. Inv. Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowPurchCrMemoHdr(PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; var IsHandled: Boolean)` (integration)
- `OnBeforeShowReturnRcptHeader(ReturnRcptHeader: Record "Return Receipt Header"; var IsHandled: Boolean)` (integration)
- `OnBeforeShowReturnShptHeader(ReturnShptHeader: Record "Return Shipment Header"; var IsHandled: Boolean)` (integration)
- `OnTryGetPurchOrderSupplyEntriesOnBeforeInsertEntry(var PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)` (integration)
- `OnGetPlanningTransDemandOnAfterTransferReqLineSetFilters(var RequisitionLine: Record "Requisition Line"; var Item: Record Item)` (integration)
- `OnParentIsInPlanningOnAfterReqLineSetFilters(var RequisitionLine: Record "Requisition Line"; var ProdOrderComp: Record Microsoft.Manufacturing.Document."Prod. Order Component")` (integration, obsolete 27.0)
- `OnParentIsInPlanning(InvtEventBuf: Record "Inventory Event Buffer"; var ParentActionMessage: Enum "Action Message Type"; var Result: Boolean)` (integration)
  - subscribers: [Codeunit 99000875 "Prod. Order Availability Mgt."](../codeunit/99000875.md) OnParentIsInPlanning

## Procedures

- `CalcNewInvtEventBuf(var Item: Record Item; ForecastName: Code[10]; IncludeBlanketOrders: Boolean; ExcludeForecastBefore: Date; IncludePlan: Boolean)`
- `GetInvEventBuffer(var RequestInvtEventBuf: Record "Inventory Event Buffer")`
- `GetDocumentEntries(var InvtEventBuf: Record "Inventory Event Buffer"; var Item: Record Item)`
- `InsertEntry(var NewInvtEventBuffer: Record "Inventory Event Buffer")`
- `NextEntryNo(): Integer`
- `GetSourceReferences(FromRecordID: RecordID; TransferDirection: Enum "Transfer Direction"; var SourceType: Integer; var SourceSubtype: Integer; var SourceID: Code[20]; var SourceBatchName: Code[10]; var SourceProdOrderLine: Integer; var SourceRefNo: Integer): Boolean`
- `ShowDocument(RecordID: RecordID)`
- `RunOnBeforeRunProductionOrderPage(var ProductionOrder: Record Microsoft.Manufacturing.Document."Production Order"; var IsHandled: Boolean)` (internal)
- `RunOnParentIsInPlanningOnAfterReqLineSetFilters(var RequisitionLine: Record "Requisition Line"; var ProdOrderComp: Record Microsoft.Manufacturing.Document."Prod. Order Component")` (internal)

Plus 23 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 99000872 "Sales Availability Mgt."](../codeunit/99000872.md) (3 calls: `GetBlanketSalesOrders → TransferFromSalesBlanketOrder`, `TryGetSalesOrdersDemandEntries → TransferFromSales`, `TryGetSalesRetOrderSupplyEntries → TransferFromSalesReturn`)
- [Codeunit 99000876 "Transfer Availability Mgt."](../codeunit/99000876.md) (3 calls: `GetPlanningTransDemand → TransferFromOutboundTransOrder`, `TryGetTransferOrderSupplyEntries → TransferFromInboundTransOrder`, `TryGetTransOrderDemandEntries → TransferFromOutboundTransOrder`)
- [Codeunit 99000879 "Req. Line Availability Mgt."](../codeunit/99000879.md) (3 calls: `GetPlanningComponents → TransferFromPlanProdComp`, `GetPlanningLines → TransferFromReqLine`, `GetPlanningTransDemand → TransferFromReqLineTransDemand`)
- [Codeunit 99000973 "Purch. Availability Mgt."](../codeunit/99000973.md) (2 calls: `TryGetPurchOrderSupplyEntries → TransferFromPurchase`, `TryGetPurchRetOrderDemandEntries → TransferFromPurchReturn`)
- [Page 130 "Posted Sales Shipment"](../page/130.md) (1 call: `ShowDocument → (object)`)
- [Page 132 "Posted Sales Invoice"](../page/132.md) (1 call: `ShowDocument → (object)`)
- [Page 134 "Posted Sales Credit Memo"](../page/134.md) (1 call: `ShowDocument → (object)`)
- [Page 136 "Posted Purchase Receipt"](../page/136.md) (1 call: `ShowDocument → (object)`)
- [Page 138 "Posted Purchase Invoice"](../page/138.md) (1 call: `ShowDocument → (object)`)
- [Page 140 "Posted Purchase Credit Memo"](../page/140.md) (1 call: `ShowDocument → (object)`)
- [Page 38 "Item Ledger Entries"](../page/38.md) (1 call: `ShowDocument → (object)`)
- [Page 42 "Sales Order"](../page/42.md) (1 call: `RunSalesHeaderPage → (object)`)
- [Page 43 "Sales Invoice"](../page/43.md) (1 call: `RunSalesHeaderPage → (object)`)
- [Page 44 "Sales Credit Memo"](../page/44.md) (1 call: `RunSalesHeaderPage → (object)`)
- [Page 50 "Purchase Order"](../page/50.md) (1 call: `RunPurchHeaderPage → (object)`)
- [Page 507 "Blanket Sales Order"](../page/507.md) (1 call: `RunSalesHeaderPage → (object)`)
- [Page 509 "Blanket Purchase Order"](../page/509.md) (1 call: `RunPurchHeaderPage → (object)`)
- [Page 51 "Purchase Invoice"](../page/51.md) (1 call: `RunPurchHeaderPage → (object)`)
- [Page 52 "Purchase Credit Memo"](../page/52.md) (1 call: `RunPurchHeaderPage → (object)`)
- [Page 5740 "Transfer Order"](../page/5740.md) (1 call: `ShowDocument → (object)`)
- [Page 5743 "Posted Transfer Shipment"](../page/5743.md) (1 call: `ShowDocument → (object)`)
- [Page 5745 "Posted Transfer Receipt"](../page/5745.md) (1 call: `ShowDocument → (object)`)
- [Page 6630 "Sales Return Order"](../page/6630.md) (1 call: `RunSalesHeaderPage → (object)`)
- [Page 6640 "Purchase Return Order"](../page/6640.md) (1 call: `RunPurchHeaderPage → (object)`)
- [Page 6650 "Posted Return Shipment"](../page/6650.md) (1 call: `ShowDocument → (object)`)
- [Page 6660 "Posted Return Receipt"](../page/6660.md) (1 call: `ShowDocument → (object)`)

## Called by

- [Codeunit 5531 "Calc. Inventory Page Data"](../codeunit/5531.md) (4 calls: `Initialize → CalcNewInvtEventBuf`, `Initialize → GetInvEventBuffer`, `ShowDocument → ShowDocument`, …)
- [Codeunit 99000874 "Assembly Availability Mgt."](../codeunit/99000874.md) (2 calls: `TryGetAsmOrderDemandEntries → InsertEntry`, `TryGetAsmOrderSupllyEntries → InsertEntry`)
- [Codeunit 99000875 "Prod. Order Availability Mgt."](../codeunit/99000875.md) (2 calls: `TryGetProdOrderCompDemandEntries → InsertEntry`, `TryGetProdOrderSupplyEntries → InsertEntry`)
- [Codeunit 6452 "Serv. Availability Mgt."](../codeunit/6452.md) (1 call: `TryGetServOrderDemandEntries → InsertEntry`)
- [Codeunit 99000871 "Job Planning Availability Mgt."](../codeunit/99000871.md) (1 call: `TryGetJobOrdersDemandEntries → InsertEntry`)

## Recent changes

- 2026-10-02 [#12066 Bugs/remove asm inv mfg clean27 tags for wave2 2026](../../changes/bcapps/12066.md) (main, BC30, obsoletion)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25, BC27, BC30

## Deprecations

- procedure RunOnBeforeRunProductionOrderPage: guarded (#if not CLEAN27)
- procedure RunOnParentIsInPlanningOnAfterReqLineSetFilters: guarded (#if not CLEAN27)
- procedure OnBeforeRunProductionOrderPage: Pending 27.0 (#if not CLEAN27), "Moved to codeunit ProdOrderAvailabilityMgt"
- procedure OnParentIsInPlanningOnAfterReqLineSetFilters: Pending 27.0 (#if not CLEAN27), "Moved to codeunit ProdOrderAvailabilityMgt"

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: "Calc. Item Availability")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
