{"title":"Codeunit 5790 Available to Promise, procedures","url":"https://jonas-paprotka.de/ref/codeunit/5790-available-to-promise/procedures/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":5790,"name":"Available to Promise","app":"Base Application","versions":"17-29","url":"https://jonas-paprotka.de/ref/codeunit/5790-available-to-promise/","json":"https://jonas-paprotka.de/ref/codeunit/5790-available-to-promise.json"},"aspect":"procedures","total":30,"rows":[{"name":"QtyAvailabletoPromise","sig":"(var Record Item, var Decimal, var Decimal, Date, Option, DateFormula)","named":"(var Item: Record Item; var GrossRequirement: Decimal; var ScheduledReceipt: Decimal; AvailabilityDate: Date; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Decimal","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalcQtyAvailableToPromise()","tag":"20.0"},"range":"17-22","first":17,"last":22,"obsoleteSince":20,"spans":[{"from":17,"to":19,"named":"(var Item: Record Item; var GrossRequirement: Decimal; var ScheduledReceipt: Decimal; AvailabilityDate: Date; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null},{"from":20,"to":22,"named":"(var Item: Record Item; var GrossRequirement: Decimal; var ScheduledReceipt: Decimal; AvailabilityDate: Date; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Decimal","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalcQtyAvailableToPromise()","tag":"20.0"}}]},{"name":"CalcAvailableInventory","sig":"(var Record Item)","named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcGrossRequirement","sig":"(var Record Item)","named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcReservedRequirement","sig":"(var Record Item)","named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcScheduledReceipt","sig":"(var Record Item)","named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcReservedReceipt","sig":"(var Record Item)","named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"EarliestAvailabilityDate","sig":"(var Record Item, Decimal, Date, Decimal, Date, var Decimal, Option, DateFormula)","named":"(var Item: Record Item; NeededQty: Decimal; StartDate: Date; ExcludeQty: Decimal; ExcludeOnDate: Date; var AvailableQty: Decimal; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalcEarliestAvailabilityDate()","tag":"20.0"},"range":"17-22","first":17,"last":22,"obsoleteSince":20,"spans":[{"from":17,"to":19,"named":"(var Item: Record Item; NeededQty: Decimal; StartDate: Date; ExcludeQty: Decimal; ExcludeOnDate: Date; var AvailableQty: Decimal; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Date","kind":"procedure","access":"public","obsolete":null},{"from":20,"to":22,"named":"(var Item: Record Item; NeededQty: Decimal; StartDate: Date; ExcludeQty: Decimal; ExcludeOnDate: Date; var AvailableQty: Decimal; PeriodType: Option Day,Week,Month,Quarter,Year; LookaheadDateFormula: DateFormula)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalcEarliestAvailabilityDate()","tag":"20.0"}}]},{"name":"CalculateLookahead","sig":"(var Record Item, Option, Date, Date)","named":"(var Item: Record Item; PeriodType: Option Day,Week,Month,Quarter,Year; StartDate: Date; EndDate: Date)","returns":"Decimal","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalculateForward","tag":"20.0"},"range":"17-22","first":17,"last":22,"obsoleteSince":20,"spans":[{"from":17,"to":19,"named":"(var Item: Record Item; PeriodType: Option Day,Week,Month,Quarter,Year; StartDate: Date; EndDate: Date)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null},{"from":20,"to":22,"named":"(var Item: Record Item; PeriodType: Option Day,Week,Month,Quarter,Year; StartDate: Date; EndDate: Date)","returns":"Decimal","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by CalculateForward","tag":"20.0"}}]},{"name":"CalculateAvailability","sig":"(var Record Item, var Record Availability at Date)","named":"(var Item: Record Item; var AvailabilityAtDate: Record \"Availability at Date\")","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var Item: Record Item; var AvailabilityAtDate: Record \"Availability at Date\")","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"UpdateScheduledReceipt","sig":"(var Record Availability at Date, Date, Decimal)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; ReceiptDate: Date; ScheduledReceipt: Decimal)","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; ReceiptDate: Date; ScheduledReceipt: Decimal)","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"UpdateGrossRequirement","sig":"(var Record Availability at Date, Date, Decimal)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; ShipmentDate: Date; GrossRequirement: Decimal)","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; ShipmentDate: Date; GrossRequirement: Decimal)","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"GetLookAheadPeriodEndDate","sig":"(DateFormula, Option, Date)","named":"(LookaheadDateFormula: DateFormula; PeriodType: Option; StartDate: Date)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by GetForwardPeriodEndDate()","tag":"20.0"},"range":"17-22","first":17,"last":22,"obsoleteSince":20,"spans":[{"from":17,"to":19,"named":"(LookaheadDateFormula: DateFormula; PeriodType: Option; StartDate: Date)","returns":"Date","kind":"procedure","access":"public","obsolete":null},{"from":20,"to":22,"named":"(LookaheadDateFormula: DateFormula; PeriodType: Option; StartDate: Date)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by GetForwardPeriodEndDate()","tag":"20.0"}}]},{"name":"AdjustedEndingDate","sig":"(Date, Option)","named":"(PeriodEnd: Date; PeriodType: Option Day,Week,Month,Quarter,Year)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by GetPeriodEndingDate()","tag":"20.0"},"range":"17-22","first":17,"last":22,"obsoleteSince":20,"spans":[{"from":17,"to":19,"named":"(PeriodEnd: Date; PeriodType: Option Day,Week,Month,Quarter,Year)","returns":"Date","kind":"procedure","access":"public","obsolete":null},{"from":20,"to":22,"named":"(PeriodEnd: Date; PeriodType: Option Day,Week,Month,Quarter,Year)","returns":"Date","kind":"procedure","access":"public","obsolete":{"state":"Pending","reason":"Replaced by GetPeriodEndingDate()","tag":"20.0"}}]},{"name":"SetPromisingReqShipDate","sig":"(Record Order Promising Line)","named":"(OrderPromisingLine: Record \"Order Promising Line\")","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(OrderPromisingLine: Record \"Order Promising Line\")","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"SetOriginalShipmentDate","sig":"(Record Order Promising Line)","named":"(OrderPromisingLine: Record \"Order Promising Line\")","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(OrderPromisingLine: Record \"Order Promising Line\")","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"SetChangedSalesLine","sig":"(Record Sales Line)","named":"(SalesLine: Record \"Sales Line\")","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(SalesLine: Record \"Sales Line\")","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"SetChangedAsmLine","sig":"(Record Assembly Line)","named":"(AssemblyLine: Record \"Assembly Line\")","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"(AssemblyLine: Record \"Assembly Line\")","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"ResetItemNo","sig":"()","named":"()","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"17-29","first":17,"last":29,"obsoleteSince":null,"spans":[{"from":17,"to":29,"named":"()","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"GetRequiredShipmentDate","sig":"()","named":"()","returns":"Date","kind":"procedure","access":"public","obsolete":null,"range":"19-29","first":19,"last":29,"obsoleteSince":null,"spans":[{"from":19,"to":29,"named":"()","returns":"Date","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcQtyAvailableToPromise","sig":"(var Record Item, var Decimal, var Decimal, Date, Enum Analysis Period Type, DateFormula)","named":"(var Item: Record Item; var GrossRequirement: Decimal; var ScheduledReceipt: Decimal; AvailabilityDate: Date; PeriodType: Enum \"Analysis Period Type\"; LookaheadDateFormula: DateFormula)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"20-29","first":20,"last":29,"obsoleteSince":null,"spans":[{"from":20,"to":29,"named":"(var Item: Record Item; var GrossRequirement: Decimal; var ScheduledReceipt: Decimal; AvailabilityDate: Date; PeriodType: Enum \"Analysis Period Type\"; LookaheadDateFormula: DateFormula)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalcEarliestAvailabilityDate","sig":"(var Record Item, Decimal, Date, Decimal, Date, var Decimal, Enum Analysis Period Type, DateFormula)","named":"(var Item: Record Item; NeededQty: Decimal; StartDate: Date; ExcludeQty: Decimal; ExcludeOnDate: Date; var AvailableQty: Decimal; PeriodType: Enum \"Analysis Period Type\"; LookaheadDateFormula: DateFormula)","returns":"Date","kind":"procedure","access":"public","obsolete":null,"range":"20-29","first":20,"last":29,"obsoleteSince":null,"spans":[{"from":20,"to":29,"named":"(var Item: Record Item; NeededQty: Decimal; StartDate: Date; ExcludeQty: Decimal; ExcludeOnDate: Date; var AvailableQty: Decimal; PeriodType: Enum \"Analysis Period Type\"; LookaheadDateFormula: DateFormula)","returns":"Date","kind":"procedure","access":"public","obsolete":null}]},{"name":"CalculateForward","sig":"(var Record Item, Enum Analysis Period Type, Date, Date)","named":"(var Item: Record Item; PeriodType: Enum \"Analysis Period Type\"; StartDate: Date; EndDate: Date)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null,"range":"20-29","first":20,"last":29,"obsoleteSince":null,"spans":[{"from":20,"to":29,"named":"(var Item: Record Item; PeriodType: Enum \"Analysis Period Type\"; StartDate: Date; EndDate: Date)","returns":"Decimal","kind":"procedure","access":"public","obsolete":null}]},{"name":"GetForwardPeriodEndDate","sig":"(DateFormula, Enum Analysis Period Type, Date)","named":"(LookaheadDateFormula: DateFormula; PeriodType: Enum \"Analysis Period Type\"; StartDate: Date)","returns":"Date","kind":"procedure","access":"public","obsolete":null,"range":"20-29","first":20,"last":29,"obsoleteSince":null,"spans":[{"from":20,"to":29,"named":"(LookaheadDateFormula: DateFormula; PeriodType: Enum \"Analysis Period Type\"; StartDate: Date)","returns":"Date","kind":"procedure","access":"public","obsolete":null}]},{"name":"GetPeriodEndingDate","sig":"(Date, Enum Analysis Period Type)","named":"(PeriodEnd: Date; PeriodType: Enum \"Analysis Period Type\")","returns":"Date","kind":"procedure","access":"public","obsolete":null,"range":"20-29","first":20,"last":29,"obsoleteSince":null,"spans":[{"from":20,"to":29,"named":"(PeriodEnd: Date; PeriodType: Enum \"Analysis Period Type\")","returns":"Date","kind":"procedure","access":"public","obsolete":null}]},{"name":"SetRecalculateFields","sig":"()","named":"()","returns":"","kind":"procedure","access":"public","obsolete":null,"range":"24-29","first":24,"last":29,"obsoleteSince":null,"spans":[{"from":24,"to":29,"named":"()","returns":"","kind":"procedure","access":"public","obsolete":null}]},{"name":"RunOnBeforeUpdatePurchOrderAvail","sig":"(var Record Availability at Date, var Record Item, var Boolean)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null,"range":"25-27","first":25,"last":27,"obsoleteSince":null,"spans":[{"from":25,"to":27,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null}]},{"name":"RunOnBeforeUpdateSchedRcptAvail","sig":"(var Record Availability at Date, var Record Item, var Boolean)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null,"range":"25-27","first":25,"last":27,"obsoleteSince":null,"spans":[{"from":25,"to":27,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null}]},{"name":"RunOnBeforeUpdateSchedNeedAvail","sig":"(var Record Availability at Date, var Record Item, var Boolean)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null,"range":"25-27","first":25,"last":27,"obsoleteSince":null,"spans":[{"from":25,"to":27,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null}]},{"name":"RunOnBeforeUpdateServOrderAvail","sig":"(var Record Availability at Date, var Record Item, var Boolean)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null,"range":"25-27","first":25,"last":27,"obsoleteSince":null,"spans":[{"from":25,"to":27,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null}]},{"name":"RunOnBeforeUpdateJobOrderAvail","sig":"(var Record Availability at Date, var Record Item, var Boolean)","named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null,"range":"25-27","first":25,"last":27,"obsoleteSince":null,"spans":[{"from":25,"to":27,"named":"(var AvailabilityAtDate: Record \"Availability at Date\"; var Item: Record Item; var IsHandled: Boolean)","returns":"","kind":"procedure","access":"internal","obsolete":null}]}]}