---
id: object/codeunit/5404
type: object
title: Codeunit 5404 "Lead-Time Management"
summary: Codeunit 5404 "Lead-Time Management" in Base Application (Microsoft.Inventory). 11 public procedures, 11 events. Present since at least BC23, still in BC30, changed in BC24-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: 13ff11802639457e2483bc1daa74a9c7c973e13dab70500f5d1be04a8bcc7c32
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/LeadTimeManagement.Codeunit.al
    title: src/Layers/W1/BaseApp/Inventory/LeadTimeManagement.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: 5404
name: Lead-Time Management
namespace: Microsoft.Inventory
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"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 27
  events: 11
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 2
  called_by: 12
  implements: 0
---

# Codeunit 5404 "Lead-Time Management"

> Codeunit 5404 "Lead-Time Management" in Base Application (Microsoft.Inventory). 11 public procedures, 11 events. Present since at least BC23, still in BC30, changed in BC24-28.

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

## Events published

- `OnBeforeGetPlannedDueDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; EndingDate: Date; VendorNo: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; var Result: Date; var IsHandled: Boolean)` (integration)
- `OnBeforeGetPlannedEndingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; DueDate: Date; VendorNo: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; var Result: Date; var IsHandled: Boolean)` (integration)
- `OnBeforeGetPlannedStartingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; VendorNo: Code[20]; var LeadTime: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; EndingDate: Date; var Result: Date; var IsHandled: Boolean)` (integration)
- `OnGetPlannedDueDateOnBeforeFormatDateFormula(var SKU: Record "Stockkeeping Unit"; RefOrderType: Enum "Requisition Ref. Order Type"; EndingDate: Date; ItemNo: Code[20]; LocationCode: Code[10])` (integration)
- `OnGetPlannedEndingDateOnBeforeFormatDateFormula(var SKU: Record "Stockkeeping Unit"; RefOrderType: Enum "Requisition Ref. Order Type"; ItemNo: code[20]; DueDate: Date)` (integration)
- `OnAfterManufacturingLeadTime(TempStockkeepingUnit: Record "Stockkeeping Unit" temporary; var Result: Code[20])` (integration)
- `OnAfterPurchaseLeadTime(ItemVend: Record "Item Vendor"; var Result: Code[20])` (integration)
- `OnAfterPlannedStartingDate(LeadTime: Code[20]; EndingDate: Date; CustomCalendarChange: array[2] of Record "Customized Calendar Change"; CheckBothCalendars: Boolean; var Result: Date)` (integration)
- `OnAfterSafetyLeadTime(TempStockkeepingUnit: Record "Stockkeeping Unit" temporary; var Result: Code[20])` (integration)
- `OnBeforeWhseInBoundHandlingTime(LocationCode: Code[10]; var InboundWhseHandlingTime: Code[10]; var IsHandled: Boolean)` (integration)
- `OnBeforeGetPlannedEndingDateCalculaterForwardFromStartingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; VendorNo: Code[20]; var LeadTime: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; var StartingDate: Date; var Result: Date; var IsHandled: Boolean)` (integration)

## Procedures

- `PurchaseLeadTime(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; VendorNo: Code[20]): Code[20]`
- `ManufacturingLeadTime(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]): Code[20]`
- `SetManualScheduling(NewManualScheduling: Boolean)`
- `WhseOutBoundHandlingTime(LocationCode: Code[10]): Code[10]`
- `WhseInBoundHandlingTime(LocationCode: Code[10]): Code[10]`
- `SafetyLeadTime(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]): Code[20]`
- `GetPlannedEndingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; DueDate: Date; VendorNo: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"): Date`
- `GetPlannedStartingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; VendorNo: Code[20]; LeadTime: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; EndingDate: Date): Date`
- `GetPlannedEndingDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; VendorNo: Code[20]; LeadTime: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"; StartingDate: Date): Date`
- `GetPlannedDueDate(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; EndingDate: Date; VendorNo: Code[20]; RefOrderType: Enum "Requisition Ref. Order Type"): Date`
- `CheckLeadTimeIsNotNegative(LeadTimeDateFormula: DateFormula)`

Plus 5 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 99000855 "Planning-Get Parameters"](../codeunit/99000855.md) (9 calls: `GetPlannedDueDate → AtSKU`, `GetPlannedDueDate → SetManualScheduling`, `GetPlannedEndingDate → AtSKU`, …)
- [Codeunit 7600 "Calendar Management"](../codeunit/7600.md) (3 calls: `GetPlannedDueDate → CalcDateBOC`, `GetPlannedEndingDate → CalcDateBOC2`, `GetPlannedStartingDate → CalcDateBOC2`)

## Called by

- [Table 246 "Requisition Line"](../table/246.md) (11 calls: `CalcEndingDate → GetPlannedEndingDate`, `CalcEndingDate → ManufacturingLeadTime`, `CalcEndingDate → PurchaseLeadTime`, …)
- [Codeunit 99000773 "Calculate Prod. Order"](../codeunit/99000773.md) (6 calls: `CalculateLeadTime → GetPlannedEndingDate`, `CalculateLeadTime → GetPlannedStartingDate`, `CalculateLeadTime → ManufacturingLeadTime`, …)
- [Table 900 "Assembly Header"](../table/900.md) (6 calls: `CalcDueDateFromEndDate → GetPlannedDueDate`, `CalcEndDateFromDueDate → GetPlannedEndingDate`, `CalcEndDateFromStartDate → GetPlannedEndingDate`, …)
- [Table 5405 "Production Order"](../table/5405.md) (5 calls: `InitRecord → GetPlannedEndingDate`, `UpdateEndingDate → GetPlannedEndingDate`, `UpdateEndingDate → SetManualScheduling`, …)
- [Codeunit 905 "Assembly Line Management"](../codeunit/905.md) (3 calls: `CalcEarliestDueDate → GetPlannedDueDate`, `CalcEarliestDueDate → GetPlannedEndingDate`, `CalcEarliestDueDate → ManufacturingLeadTime`)
- [Table 39 "Purchase Line"](../table/39.md) (2 calls: `UpdateLeadTimeFields → PurchaseLeadTime`, `UpdateLeadTimeFields → SafetyLeadTime`)
- [Codeunit 99000787 "Create Prod. Order Lines"](../codeunit/99000787.md) (1 call: `CopyFromSalesOrder → GetPlannedEndingDate`)
- [Codeunit 99000792 "Create Prod. Order from Sale"](../codeunit/99000792.md) (1 call: `CreateProductionOrder → GetPlannedEndingDate`)
- [Codeunit 99000809 "Planning Line Management"](../codeunit/99000809.md) (1 call: `RecalculateWithOptionalModify → GetPlannedDueDate`)
- [Codeunit 99000854 "Inventory Profile Offsetting"](../codeunit/99000854.md) (1 call: `AdjustPlanLine → GetPlannedEndingDate`)
- [Codeunit 99000886 "Capable to Promise"](../codeunit/99000886.md) (1 call: `CreateReqLine → GetPlannedEndingDate`)
- [Report 698 "Get Sales Orders"](../report/698.md) (1 call: `InsertReqWkshLine → GetPlannedEndingDate`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-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: "Lead-Time Management")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
