---
title: "Codeunit 5522 Order Planning Mgt."
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/5522-order-planning-mgt/
type: codeunit
id: 5522
name: "Order Planning Mgt."
app: "Base Application"
namespace: Microsoft.Inventory.Requisition
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/5522-order-planning-mgt/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 5522 Order Planning Mgt.

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/5522-order-planning-mgt/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Inventory.Requisition |
| Versions | 17-28 |
| Source file | Inventory/Requisition/OrderPlanningMgt.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| GetOrdersToPlan | (var Record Requisition Line) | - | public | 17-28 | - | - |
| PlanSpecificSalesOrder | (var Record Requisition Line, Code[20]) | - | public | 17-28 | - | - |
| PrepareRequisitionRecord | (var Record Requisition Line) | - | public | 17-28 | - | - |
| DeleteLine | () | Boolean | public | 17-28 | - | - |
| CalcNeededQty | (Decimal, Decimal) | Decimal | public | 17-28 | - | - |
| CalcATPQty | (Text[250], Text[250], Text[250], Date) | Decimal | public | 17-28 | - | - |
| CalcATPEarliestDate | (Text[250], Text[250], Text[250], Date, Decimal) | Date | public | 17-28 | - | - |
| SetSalesOrder | () | - | public | 17-27 | Pending 25.0 | Replaced by procedure SetDemandType() |
| SetProdOrder | () | - | public | 17-27 | Pending 25.0 | Replaced by procedure SetDemandType() |
| SetServOrder | () | - | public | 17-27 | Pending 25.0 | Replaced by procedure SetDemandType() |
| SetJobOrder | () | - | public | 17-27 | Pending 25.0 | Replaced by procedure SetDemandType() |
| SetAsmOrder | () | - | public | 17-27 | Pending 25.0 | Replaced by procedure SetDemandType() |
| InsertAltSupplySubstitution | (var Record Requisition Line) | - | public | 17-28 | - | - |
| SubstitutionPossible | (Record Requisition Line) | Boolean | public | 17-28 | - | - |
| InsertAltSupplyLocation | (var Record Requisition Line) | - | public | 17-28 | - | - |
| AvailQtyOnOtherLocations | (Record Requisition Line) | Decimal | public | 17-28 | - | - |
| PlanSpecificJob | (var Record Requisition Line, Code[20]) | - | public | 25-28 | - | - |
| SetTaskFilterOnReqLine | (var Record Requisition Line, Text) | - | public | 25-28 | - | - |
| SetDemandType | (Enum Demand Order Source Type) | - | public | 25-28 | - | - |
| RunOnBeforeReqLineModify | (var Record Requisition Line, Record Requisition Line, Record Prod. Order Component) | - | internal | 27-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterTransformUnplannedDemandToRequisitionLines | (var Record Requisition Line) | 17-28 | - | - |
| Integration event | OnAvailQtyOnOtherLocationsOnAfterLocationSetFilters | (Record Requisition Line, var Record Location) | 17-28 | - | - |
| Integration event | OnBeforeCalcNextLineNo | (var Integer, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeIncreaseReqLineNo | (var Record Unplanned Demand, var Record Requisition Line, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeReqLineModify | (var Record Requisition Line, Record Requisition Line, Record Prod. Order Component) | 17-28 | Pending 27.0 | Moved to codeunit MfgOrderPlanningMgt |
| Integration event | OnBeforeRunGetUnplannedDemand | (var Record Unplanned Demand, var Boolean) | 17-28 | - | - |
| Integration event | OnCalcATPQtyOnBeforeCalcQtyAvailabletoPromise | (var Record Item) | 17-28 | - | - |
| Integration event | OnInsertAltSupplyLocationOnBeforeTempReqLineInsert | (var Record Requisition Line) | 17-28 | - | - |
| Integration event | OnInsertDemandHeaderOnAfterReqLineInsert | (Record Unplanned Demand, var Record Requisition Line) | 17-28 | - | - |
| Integration event | OnInsertDemandHeaderOnBeforeReqLineInsert | (Record Unplanned Demand, var Record Requisition Line) | 17-28 | - | - |
| Integration event | OnInsertDemandLinesOnAfterReqLineInsert | (var Record Requisition Line, var Record Unplanned Demand) | 17-28 | - | - |
| Integration event | OnInsertDemandLinesOnBeforeReqLineInsert | (var Record Requisition Line, var Record Unplanned Demand, var Boolean) | 17-28 | - | - |
| Integration event | OnPrepareRequisitionRecordOnBeforeDeleteAll | (var Record Requisition Line) | 17-28 | - | - |
| Integration event | OnInsertDemandLinesOnBeforeFindUnplannedDemand | (var Record Unplanned Demand, var Record Requisition Line) | 24-28 | - | - |
| Integration event | OnInsertDemandLinesOnCopyItemTracking | (var Record Requisition Line, Record Unplanned Demand) | 25-28 | - | - |
| Integration event | OnInsertAltSupplyLocationOnAfterSelectSubstitution | (var Record Requisition Line, var Record Item Substitution) | 27-28 | - | - |
| Internal event | OnInsertAltSupplyLocationOnUpdateReqLine | (var Record Requisition Line, var Record Item Substitution) | 27-28 | - | - |
| Internal event | OnSubstitutionPossibleOnAfterCheckReqLine | (var Record Requisition Line, var Boolean) | 27-28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
