Enhanced Planning Pack Integration Events

Skip to main content

Enhanced Planning Pack Integration Events

You are here:

Enhanced Forecasting Worksheet Integration Events

Enhanced Forecasting Worksheet provides integration events for extending the collection of historical data, preparation of forecast data, execution of forecasting, and calculation of planning values.

Unless otherwise specified, these events are published by Codeunit 23044460 “IWXEPP Item Forecast”.

OnBeforePopulateItemForecastBuffer

Raised before Item Ledger Entries are converted into the temporary Time Series Forecast records used as input to the forecasting engine.

Use this event to:

  • Change filters on the Item Ledger Entry data.
  • Add or replace the records supplied to the forecasting engine.
  • Completely replace the standard historical-data population logic.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforePopulateItemForecastBuffer(
    var ptrecTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var precItemLedgerEntry: Record "Item Ledger Entry";
    var pbHandled: Boolean)

Parameters

  • ptrecTimeSeriesForecast
    Temporary Time Series Forecast buffer that will be supplied to Business Central’s forecasting engine. A subscriber that handles the event can populate this table directly.
  • precItemLedgerEntry
    Item Ledger Entry record containing the filters selected by Enhanced Forecasting Worksheet. Modify its filters to change which historical transactions are included.
  • pbHandled
    Set to true to prevent Enhanced Forecasting Worksheet from performing its standard Item Ledger Entry-to-Time Series Forecast population logic.

OnAfterPopulateItemForecastBuffer

Raised after historical Item Ledger Entries have been converted into the temporary Time Series Forecast buffer.

Use this event to add, remove, or modify historical forecast input records before they are prepared for forecasting.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterPopulateItemForecastBuffer(
    var ptrecTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var precItemLedgerEntry: Record "Item Ledger Entry")

Parameters

  • ptrecTimeSeriesForecast
    Temporary forecast input buffer populated by Enhanced Forecasting Worksheet. Subscribers can modify the records before they are processed by the forecasting engine.
  • precItemLedgerEntry
    The filtered Item Ledger Entry record that was used to create the buffer. This can be useful for examining the filters or obtaining additional related historical data.

OnBeforePrepareData

Raised immediately before the standard Business Central Time Series Management.PrepareData call.

Use this event to modify the forecast input, change forecast parameters, or replace the standard data-preparation process.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforePrepareData(
    var ptrecTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var pePeriodType: enum "IWXEPP Forecast Period Type";
    var pdtAsOfDate: date;
    var piNumberOfPastPeriods: Integer;
    var pcuTimeSeriesMgmt: Codeunit "Time Series Management";
    var pbPrepareDataHandled: Boolean)

Parameters

  • ptrecTimeSeriesForecast
    Historical time-series records that are about to be prepared for forecasting.
  • pePeriodType
    Forecast period selected by the user, such as weekly, monthly, quarterly, or yearly.
  • pdtAsOfDate
    Date used as the cutoff between historical data and forecast periods.
  • piNumberOfPastPeriods
    Number of historical periods that will be used by the forecasting engine.
  • pcuTimeSeriesMgmt
    Business Central Time Series Management codeunit instance being used for this forecast. This allows a subscriber to interact directly with the same forecasting engine instance.
  • pbPrepareDataHandled
    Set to true to prevent Enhanced Forecasting Worksheet from calling the standard PrepareData method.

OnBeforeForecast

Raised after the historical data has been prepared but immediately before the standard forecast is generated.

Use this event to adjust forecasting parameters or replace the forecast operation.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeForecast(
    var ptrecTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var piNumberOfForecastPeriods: Integer;
    var pePeriodType: enum "IWXEPP Forecast Period Type";
    var piNumberOfPastPeriods: Integer;
    var pcuTimeSeriesMgmt: Codeunit "Time Series Management";
    var pbForecastHandled: Boolean)

Parameters

  • ptrecTimeSeriesForecast
    Time-series data that has been prepared for forecasting.
  • piNumberOfForecastPeriods
    Number of future periods to calculate.
  • pePeriodType
    Period type used by the forecast.
  • piNumberOfPastPeriods
    Number of historical periods being considered.
  • pcuTimeSeriesMgmt
    The active Business Central Time Series Management codeunit instance.
  • pbForecastHandled
    Set to true if the subscriber generated the forecast and the standard forecast call should be skipped.

OnAfterForecast

Raised after Business Central has generated the forecast and the forecast results have been retrieved.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterForecast(
    var ptrecTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var piNumberOfForecastPeriods: Integer;
    var pePeriodType: enum "IWXEPP Forecast Period Type";
    var piNumberOfPastPeriods: Integer;
    var pcuTimeSeriesMgmt: Codeunit "Time Series Management")

Parameters

  • ptrecTimeSeriesForecast
    Temporary buffer containing the resulting forecast.
  • piNumberOfForecastPeriods
    Number of forecast periods requested.
  • pePeriodType
    Period type used for the forecast.
  • piNumberOfPastPeriods
    Number of historical periods used.
  • pcuTimeSeriesMgmt
    Time Series Management instance that generated the forecast.

OnBeforeSetItemPlanningCalculationData

Raised before Enhanced Forecasting Worksheet converts a forecast result into an "IWXEPP Time Series Buffer" row containing planning calculations.

Use this event to replace the standard calculation of values such as average usage, average forecast, forecast quantity, reorder point, reorder quantity, safety stock, and maximum inventory.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeSetItemPlanningCalculationData(
    var ptrecForecastInOutTimeSeriesBuffer: Record "IWXEPP Time Series Buffer" temporary;
    var ptrecInputBaseTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var pePeriod: enum "IWXEPP Forecast Period Type";
    var piPastPeriods: integer;
    var pdtAsOfDate: date;
    var pbHandled: Boolean)

Parameters

  • ptrecForecastInOutTimeSeriesBuffer
    Enhanced Forecasting Worksheet output buffer being populated. Modify this record when supplying custom calculated planning values.
  • ptrecInputBaseTimeSeriesForecast
    Forecast result being converted into an Enhanced Forecasting Worksheet row.
  • pePeriod
    Forecast period type.
  • piPastPeriods
    Number of historical periods used for calculations.
  • pdtAsOfDate
    Forecast cutoff date.
  • pbHandled
    Set to true when the subscriber has populated the output buffer and the standard calculation should be skipped.

OnAfterSetItemPlanningCalculationData

Raised after the standard planning values have been calculated for an Enhanced Forecasting Worksheet row.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterSetItemPlanningCalculationData(
    var ptrecForecastInOutTimeSeriesBuffer: Record "IWXEPP Time Series Buffer" temporary;
    var ptrecInputBaseTimeSeriesForecast: Record "Time Series Forecast" temporary;
    var pePeriod: enum "IWXEPP Forecast Period Type";
    var piPastPeriods: integer;
    var pdtAsOfDate: date)

Parameters

  • ptrecForecastInOutTimeSeriesBuffer
    Completed Enhanced Forecasting Worksheet output record. Modify this record to supplement or adjust standard calculations.
  • ptrecInputBaseTimeSeriesForecast
    Forecast result from which the planning values were calculated.
  • pePeriod
    Forecast period type.
  • piPastPeriods
    Number of historical periods used.
  • pdtAsOfDate
    Forecast cutoff date.

Item Planning Review Integration Events

Item Planning Review provides an event for extending which Item, Location, and Variant combinations are included when average usage is calculated.

The event is published by Codeunit 23044450 “IWXEPP Item Planning Calc.”.

OnCalcAvgUsageOnAfterSetFilters

Raised after Item Planning Review has applied the filters supplied by the user but before it begins iterating through Items, Locations, and Item Variants.

Use this event to apply additional filters based on custom fields or business rules.

For example, a PTE could filter Item Planning Review by a custom manufacturer, product family, inventory classification, or other item field.

Signature

[IntegrationEvent(false, false)]
local procedure OnCalcAvgUsageOnAfterSetFilters(
    var precItem: Record "Item";
    var precLocation: Record "Location";
    var precItemVariant: Record "Item Variant")

Parameters

  • precItem
    Item record containing the filters that will determine which items are included in Item Planning Review. Add or modify filters on this record.
  • precLocation
    Location record containing the locations that will be evaluated.
  • precItemVariant
    Item Variant record used when Item Planning Review generates item/location/variant combinations.

Multi-Level BOM Viewer Integration Events

Multi-Level BOM Viewer exposes events for extending supply and demand calculations and BOM-line editing.

Supply and Demand Calculation Events

The following events are published by Codeunit 23044431 “IWXEPP Multi-Level BOM Hooks”.

OnBeforeCalculateSupplyDemandNet

Raised before Multi-Level BOM Viewer performs its standard supply and demand calculation for the current row.

Use this event to change the inputs or completely replace the standard calculation.

Signature

[IntegrationEvent(false, false)]
procedure OnBeforeCalculateSupplyDemandNet(
    var ptrecIWXEPPMultiLevelBuffer: record "IWXEPP Multi-Level Buffer" temporary;
    var precItem: record "Item";
    var ptxtType: Text;
    var pdQtyOnTransferReceipt: Decimal;
    var pdQtyOnTransferShipment: Decimal;
    var pdSupplyNet: Decimal;
    var pdDemandNet: Decimal;
    var pbSupplyWarning: Boolean;
    var pbCertified: Boolean;
    var pbHandled: Boolean)

Parameters

  • ptrecIWXEPPMultiLevelBuffer
    Current Multi-Level BOM buffer row.
  • precItem
    Item associated with the current row. Subscribers can modify filters or other record state used by custom calculations.
  • ptxtType
    Display text representing the type of the current Multi-Level BOM row.
  • pdQtyOnTransferReceipt
    Quantity expected from transfer receipts. May be populated by a subscriber that replaces or supplements supply calculations.
  • pdQtyOnTransferShipment
    Quantity committed to transfer shipments.
  • pdSupplyNet
    Total calculated supply displayed by Multi-Level BOM Viewer.
  • pdDemandNet
    Total calculated demand displayed by Multi-Level BOM Viewer.
  • pbSupplyWarning
    Controls whether the row displays a supply shortage warning.
  • pbCertified
    Indicates whether the associated Production BOM is considered certified for display purposes.
  • pbHandled
    Set to true to skip the standard Multi-Level BOM supply and demand calculation.

OnAfterCalculateSupplyDemandNet

Raised after the standard supply and demand calculation.

Use this event to supplement or adjust the resulting values.

Signature

[IntegrationEvent(false, false)]
procedure OnAfterCalculateSupplyDemandNet(
    var ptrecIWXEPPMultiLevelBuffer: record "IWXEPP Multi-Level Buffer" temporary;
    var precItem: record "Item";
    var precProductionBOMHeader: record "Production BOM Header";
    var ptxtType: Text;
    var pdQtyOnTransferReceipt: Decimal;
    var pdQtyOnTransferShipment: Decimal;
    var pdSupplyNet: Decimal;
    var pdDemandNet: Decimal;
    var pbSupplyWarning: Boolean;
    var pbCertified: Boolean
    )

Parameters

  • ptrecIWXEPPMultiLevelBuffer
    Current Multi-Level BOM buffer row.
  • precItem
    Item represented by the current row, when applicable.
  • precProductionBOMHeader
    Production BOM Header associated with the current row or item.
  • ptxtType
    Text displayed as the row type.
  • pdQtyOnTransferReceipt
    Calculated incoming transfer quantity.
  • pdQtyOnTransferShipment
    Calculated outgoing transfer quantity.
  • pdSupplyNet
    Calculated total supply.
  • pdDemandNet
    Calculated total demand.
  • pbSupplyWarning
    Whether the row should indicate insufficient supply.
  • pbCertified
    Whether the BOM is considered certified.

BOM Line Editing Event

The following event is published by Page 23044432 “IWXEPP Multi-Level BOM Viewer”.

OnApplyEditedLineValues

Raised while an edited Production BOM Line is being copied from the temporary edit buffer back to the actual Production BOM Line.

The standard fields supported by Multi-Level BOM Viewer have already been validated immediately before this event. Use this event to copy custom Production BOM Line fields added by a PTE.

Signature

[IntegrationEvent(false, false)]
local procedure OnApplyEditedLineValues(
    var precProductionBOMLine: Record "Production BOM Line";
    var ptrecModifiedProductionBOMLine: Record "Production BOM Line" temporary)

Parameters

  • precProductionBOMLine
    Actual Production BOM Line that will be modified and saved after the event.
  • ptrecModifiedProductionBOMLine
    Temporary Production BOM Line containing the values entered by the user in the editing page. Read custom values from this record and apply them to precProductionBOMLine.

Enhanced Planning Worksheet Integration Events

Enhanced Planning Worksheet exposes events in three main areas:

  1. Worksheet and Supply/Demand UI
  2. Purchase Plan Calculation
  3. Create Purchase Orders

Worksheet and Supply/Demand UI Events

These events are published by Codeunit 23044485 “IWXEPP Planning Wksht. Hooks”.

OnEnablePlanningControlsOnAfterGetParameters

Available on Business Central 19 and newer.

Raised after Business Central’s Planning-Get Parameters codeunit has populated a Planning Parameters record based on the current Reordering Policy and Include Inventory setting, but before Enhanced Planning Worksheet copies the resulting enabled/disabled values into its page controls.

Use this event to modify which planning fields are enabled.

Signature

[IntegrationEvent(false, false)]
internal procedure OnEnablePlanningControlsOnAfterGetParameters(
    var PlanningParameters: Record "Planning Parameters")

Parameters

  • PlanningParameters
    Business Central Planning Parameters record containing fields such as Time Bucket Enabled, Safety Stock Qty Enabled, Reorder Point Enabled, Reorder Quantity Enabled, and the other planning-control enablement flags. Modify these values to affect which controls are enabled on the planning card parts.

OnAfterEnablePlanningControls

Available on Business Central 19 and newer.

Raised after Enhanced Planning Worksheet has read the Planning Parameters values and assigned its internal page-control enablement variables.

This is primarily a notification event. Changes to PlanningParameters at this point do not automatically recopy those values into the page’s already-assigned Boolean variables.

Signature

[IntegrationEvent(true, false)]
internal procedure OnAfterEnablePlanningControls(
    var PlanningParameters: Record "Planning Parameters")

Parameters

  • PlanningParameters
    Planning Parameters record used to determine the enabled planning fields.

OnEnhancedPlanningWorksheetPageStart

Raised when Enhanced Planning Worksheet starts and provides the Requisition Line record being used by the worksheet.

Signature

[IntegrationEvent(true, false)]
procedure OnEnhancedPlanningWorksheetPageStart(
    var precRequisitionLine: Record "Requisition Line")

Parameters

  • precRequisitionLine
    Requisition Line record used by Enhanced Planning Worksheet. Subscribers can inspect or alter filters and record state used when the page initializes.

OnSupplyDemandPartBeforeUpdateItemSelection

Raised before the Supply/Demand FactBox rebuilds its temporary Item Ledger Entry buffer for the selected item.

Use this event to replace the standard Supply/Demand calculation.

Signature

[IntegrationEvent(false, false)]
procedure OnSupplyDemandPartBeforeUpdateItemSelection(
    var trecLedgerEntry: record "Item Ledger Entry" temporary;
    var pcodItemNo: Code[20];
    var pcodLocation: Code[10];
    var pcodVariant: Code[20];
    var pbIncludePlanLines: Boolean;
    var pbHandled: Boolean)

Parameters

  • trecLedgerEntry
    Temporary Item Ledger Entry buffer used to display supply and demand entries.
  • pcodItemNo
    Selected item number.
  • pcodLocation
    Location being analyzed.
  • pcodVariant
    Variant being analyzed.
  • pbIncludePlanLines
    Indicates whether planning/requisition lines should be represented in the Supply/Demand results.
  • pbHandled
    Set to true if the subscriber populated trecLedgerEntry and standard Supply/Demand processing should not run.

OnSupplyDemandPartAfterUpdateItemSelection

Raised after the Supply/Demand temporary buffer has been rebuilt.

Signature

[IntegrationEvent(false, false)]
procedure OnSupplyDemandPartAfterUpdateItemSelection(
    var trecLedgerEntry: record "Item Ledger Entry" temporary;
    var pcodItemNo: Code[20];
    var pcodLocation: Code[10];
    var pcodVariant: Code[20];
    var pbIncludePlanLines: Boolean)

Parameters

  • trecLedgerEntry
    Completed temporary Supply/Demand buffer. Add, modify, or remove entries here.
  • pcodItemNo
    Item being analyzed.
  • pcodLocation
    Location being analyzed.
  • pcodVariant
    Variant being analyzed.
  • pbIncludePlanLines
    Indicates whether planning lines are being included.

OnSupplyDemandPartBeforeAddRecordEntry

Raised before an individual source document is converted into an Item Ledger Entry-shaped temporary Supply/Demand record.

Use this event to replace creation of a specific entry.

Current Signature

[IntegrationEvent(false, false)]
procedure OnSupplyDemandPartBeforeAddRecordEntry(
    var precItemLedgerEntryBuffer: Record "Item Ledger Entry";
    var peEntryType: Enum "Item Ledger Entry Type";
    var pdtPostDate: Date;
    var pcodDocNo: Code[20];
    var pdQty: Decimal;
    var pcodLocationCode: Code[10];
    var pvarSourceRecord: Variant;
    var piGlobalCounter: Integer;
    var pbHandled: Boolean)

Parameters

  • precItemLedgerEntryBuffer
    Temporary buffer record that would normally be populated for the Supply/Demand entry.
  • peEntryType
    Item Ledger Entry Type that will be assigned to the temporary entry.
  • pdtPostDate
    Date associated with the supply or demand.
  • pcodDocNo
    Document number displayed on the temporary entry.
  • pdQty
    Supply or demand quantity represented by the entry.
  • pcodLocationCode
    Location associated with the entry.
  • pvarSourceRecord
    Original source record represented by the Supply/Demand entry. Because this is a Variant, the actual record type depends on the type of supply or demand being processed.
  • piGlobalCounter
    Counter used to generate unique entries in the temporary Item Ledger Entry buffer.
  • pbHandled
    Set to true when the subscriber has handled creation of the entry and standard processing should be skipped.

OnSupplyDemandPartAddRecordEntryOnBeforeInsert

Raised after the temporary Supply/Demand record has been populated but immediately before it is inserted.

Current Signature

[IntegrationEvent(false, false)]
procedure OnSupplyDemandPartAddRecordEntryOnBeforeInsert(
    var precItemLedgerEntryBuffer: Record "Item Ledger Entry";
    var peEntryType: Enum "Item Ledger Entry Type";
    var pdtPostDate: Date;
    var pcodDocNo: Code[20];
    var pdQty: Decimal;
    var pcodLocationCode: Code[10];
    var pvarSourceRecord: Variant;
    var piGlobalCounter: Integer)

Parameters

The parameters represent the same values described for OnSupplyDemandPartBeforeAddRecordEntry.

The main difference is timing: precItemLedgerEntryBuffer has already been populated and is about to be inserted, making this the preferred event for changing individual fields on the resulting temporary entry.


OnSupplyDemandPartAfterAddRecordEntry

Raised after a Supply/Demand temporary record has been added.

Current Signature

[IntegrationEvent(false, false)]
procedure OnSupplyDemandPartAfterAddRecordEntry(
    var precItemLedgerEntryBuffer: Record "Item Ledger Entry";
    var peEntryType: Enum "Item Ledger Entry Type";
    var pdtPostDate: Date;
    var pcodDocNo: Code[20];
    var pdQty: Decimal;
    var pcodLocationCode: Code[10];
    var pvarSourceRecord: Variant;
    var piGlobalCounter: Integer)

Parameters

  • precItemLedgerEntryBuffer
    Temporary entry that was just added.
  • peEntryType
    Entry type used for the temporary entry.
  • pdtPostDate
    Date represented by the entry.
  • pcodDocNo
    Document number represented by the entry.
  • pdQty
    Quantity represented by the entry.
  • pcodLocationCode
    Location associated with the entry.
  • pvarSourceRecord
    Original source document or record.
  • piGlobalCounter
    Counter used while constructing the temporary buffer.

OnSummaryFactboxBeforeUpdateItemSelection

Raised before the Summary FactBox calculates supply and demand totals for the selected item/location/variant.

Use this event to replace the standard Summary FactBox calculation.

Signature

[IntegrationEvent(false, false)]
procedure OnSummaryFactboxBeforeUpdateItemSelection(
    var precItem: Record "Item";
    var pcodItemNo: Code[20];
    var pcodLocation: Code[20];
    var pcodVariant: Code[10];
    var pdSupplyNet: Decimal;
    var pdDemandNet: Decimal;
    var pdSupplyDemandDiff: Decimal;
    var pdQtyOnPlanning: Decimal;
    var pdQtyOnTransferPlanning: Decimal;
    var pdQtyOnSales: Decimal;
    var pdQtyOnService: Decimal;
    var pdQtyOnPurch: Decimal;
    var pdQtyOnTransferReceipt: Decimal;
    var pdQtyOnTransferShipment: Decimal;
    var pdHistory: Decimal;
    var pbHandled: Boolean)

Parameters

  • precItem
    Item being summarized.
  • pcodItemNo
    Item number selected on the worksheet.
  • pcodLocation
    Location filter.
  • pcodVariant
    Variant filter.
  • pdSupplyNet
    Total calculated supply.
  • pdDemandNet
    Total calculated demand.
  • pdSupplyDemandDiff
    Difference between supply and demand.
  • pdQtyOnPlanning
    Quantity represented by planning lines.
  • pdQtyOnTransferPlanning
    Planned transfer quantity.
  • pdQtyOnSales
    Sales demand quantity.
  • pdQtyOnService
    Service demand quantity.
  • pdQtyOnPurch
    Purchase supply quantity.
  • pdQtyOnTransferReceipt
    Incoming transfer supply.
  • pdQtyOnTransferShipment
    Outgoing transfer demand.
  • pdHistory
    Historical quantity displayed by the FactBox.
  • pbHandled
    Set to true if the subscriber supplied the FactBox values and the standard calculation should be skipped.

OnSummaryFactboxAfterUpdateItemSelection

Raised after the standard Summary FactBox calculation.

Signature

[IntegrationEvent(false, false)]
procedure OnSummaryFactboxAfterUpdateItemSelection(
    var precItem: Record "Item";
    var pcodItemNo: Code[20];
    var pcodLocation: Code[20];
    var pcodVariant: Code[10];
    var pdSupplyNet: Decimal;
    var pdDemandNet: Decimal;
    var pdSupplyDemandDiff: Decimal;
    var pdQtyOnPlanning: Decimal;
    var pdQtyOnTransferPlanning: Decimal;
    var pdQtyOnSales: Decimal;
    var pdQtyOnService: Decimal;
    var pdQtyOnPurch: Decimal;
    var pdQtyOnTransferReceipt: Decimal;
    var pdQtyOnTransferShipment: Decimal;
    var pdHistory: Decimal)

All parameters correspond to the calculated Summary FactBox values described for OnSummaryFactboxBeforeUpdateItemSelection. Because the calculated values are passed by reference, subscribers can adjust the standard results.

Purchase Plan Calculation Events

The following events are published by Codeunit 23044480 “IWXEPP Calculate Replenishment”, except where specifically noted.

OnBeforeRunPlan

Raised at the start of a purchase-plan run, before Enhanced Planning Worksheet initializes the planning run and iterates through SKUs.

Use this event to modify the plan parameters or replace the complete plan.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeRunPlan(
    var precStockkeepingUnit: Record "Stockkeeping Unit";
    var pbCalcWithDemandOnly: Boolean;
    var penumReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pcodPurchaserCode: Code[20];
    var pbIncludePlannedSupply: Boolean;
    var pbPurchaseToMax: Boolean;
    var pcodBatchName: Code[10];
    var pcodForecastName: Code[10];
    var pdtForecastEndDate: Date;
    var pbHandled: Boolean);

Parameters

  • precStockkeepingUnit
    SKU record containing the filters defining which SKUs will be planned.
  • pbCalcWithDemandOnly
    Indicates whether the run should initially restrict planning to SKUs with demand.
  • penumReplenishmentType
    Controls which replenishment systems are included, such as All, Transfer Only, Non-Transfer Only, or Purchase And Transfer Only.
  • pcodPurchaserCode
    Purchaser Code filter passed into the planning calculation.
  • pbIncludePlannedSupply
    Controls whether existing planning lines are considered as planned supply.
  • pbPurchaseToMax
    Indicates whether calculated purchase quantities should replenish up to the configured maximum.
  • pcodBatchName
    Requisition worksheet batch into which calculated planning lines will be written.
  • pcodForecastName
    Production Forecast Name used when forecast demand is included.
  • pdtForecastEndDate
    Ending date of the forecast range to consider.
  • pbHandled
    Set to true to prevent the standard plan from running.

OnAfterRunPlan

Raised after all SKU planning for the run has completed.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterRunPlan(
    var precStockkeepingUnit: Record "Stockkeeping Unit";
    var pbCalcWithDemandOnly: Boolean;
    var penumReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pcodPurchaserCode: Code[20];
    var pbIncludePlannedSupply: Boolean;
    var pbPurchaseToMax: Boolean;
    var pcodBatchName: Code[10];
    var pcodForecastName: Code[10];
    var pdtForecastEndDate: Date);

The parameters represent the filters and options used by the completed planning run.


OnBeforePlanSkus

Raised immediately before Enhanced Planning Worksheet iterates through the filtered SKU set.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforePlanSkus(
    var precItem: Record Item;
    var precStockKeepingUnit: Record "Stockkeeping Unit";
    var pcodSpecifiedPurchCode: Code[20];
    var pbPurchaseToMax: Boolean;
    var pbIncludePlannedSupply: Boolean;
    var peReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pbHandled: Boolean)

Parameters

  • precItem
    Item record used by the planning calculation.
  • precStockKeepingUnit
    Filtered SKU record that is about to be iterated.
  • pcodSpecifiedPurchCode
    Purchaser Code used for the run.
  • pbPurchaseToMax
    Purchase-to-maximum option.
  • pbIncludePlannedSupply
    Whether planning lines are included as supply.
  • peReplenishmentType
    Replenishment-system scope of the current pass.
  • pbHandled
    Set to true to prevent the standard SKU iteration from running.

OnAfterPlanSkus

Raised after the filtered SKU set has been processed.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterPlanSkus(
    var precItem: Record Item;
    var precStockKeepingUnit: Record "Stockkeeping Unit";
    var pcodSpecifiedPurchCode: Code[20];
    var pbPurchaseToMax: Boolean;
    var pbIncludePlannedSupply: Boolean;
    var peReplenishmentType: Enum "IWXEPP Replenishment Type")

The parameters describe the item/SKU state and options used during the completed planning pass.


OnCalcReplenishmentBeforeQuantityCalcs

Raised for each SKU before available quantity and replenishment quantity are calculated.

This is the replacement for the obsolete event with the same name in Codeunit 23044485 "IWXEPP Planning Wksht. Hooks".

All parameters are passed by reference so a PTE can adjust the calculation inputs.

Signature

[IntegrationEvent(false, false)]
local procedure OnCalcReplenishmentBeforeQuantityCalcs(
    var precItem: Record Item;
    var precSku: Record "Stockkeeping Unit";
    var pcodSpecifiedPurchCode: Code[20];
    var pbPurchaseToMax: Boolean;
    var pbIncludePlannedSupply: Boolean;
    var peReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pbSkipItem: Boolean)

Parameters

  • precItem
    Item associated with the SKU currently being calculated.
  • precSku
    SKU being calculated. This record contains the planning parameters and FlowFields used by the standard calculation.
  • pcodSpecifiedPurchCode
    Purchaser Code supplied to the plan.
  • pbPurchaseToMax
    Purchase-to-maximum option.
  • pbIncludePlannedSupply
    Whether existing planning lines should affect available supply.
  • peReplenishmentType
    Current replenishment-system scope.
  • pbSkipItem
    Set to true to skip planning this SKU.

OnCalcReplenishmentAfterQuantityCalcs

Published by Codeunit 23044485 “IWXEPP Planning Wksht. Hooks”.

Raised after Enhanced Planning Worksheet has calculated net available quantity and the proposed reorder quantity.

Signature

[IntegrationEvent(false, false)]
procedure OnCalcReplenishmentAfterQuantityCalcs(
    precItem: Record Item;
    precSku: Record "Stockkeeping Unit";
    pcodSpecifiedPurchCode: Code[20];
    pbPurchaseToMax: Boolean;
    pbIncludePlannedSupply: Boolean;
    peReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pdNetAvailableQty: Decimal;
    var pdReorderQty: Decimal;
    var pbSkipItem: Boolean
    )

Parameters

  • precItem
    Item being planned.
  • precSku
    SKU being planned.
  • pcodSpecifiedPurchCode
    Purchaser Code used by the plan.
  • pbPurchaseToMax
    Purchase-to-maximum setting.
  • pbIncludePlannedSupply
    Whether planned supply is included.
  • peReplenishmentType
    Replenishment-system scope.
  • pdNetAvailableQty
    Calculated quantity available after supply and demand have been evaluated. Subscribers may modify it.
  • pdReorderQty
    Proposed replenishment quantity. Subscribers may replace or adjust it.
  • pbSkipItem
    Set to true to prevent creation of a planning line for this SKU.

OnBeforeReorderQtyCalcs

Published by Codeunit 23044485 “IWXEPP Planning Wksht. Hooks”.

Raised before the standard reorder-quantity formula is applied, after supply and demand quantities are available.

This event is useful when a customization needs to replace the standard reorder-quantity logic entirely.

Signature

[IntegrationEvent(false, false)]
procedure OnBeforeReorderQtyCalcs(
    var precItem: Record Item;
    var precSku: Record "Stockkeeping Unit";
    var pcodSpecifiedPurchCode: Code[20];
    var pbPurchaseToMax: Boolean;
    var pbIncludePlannedSupply: Boolean;
    var peReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pdNetAvailableQty: Decimal;
    var pdReorderQty: Decimal;
    var pbSkipItem: Boolean;
    var pdForecastDemand: Decimal;
    var pdActualDemand: Decimal;
    var pbIncludeConsumptionQty: Boolean;
    var pbHandled: Boolean
    )

Parameters

  • precItem
    Item being planned.
  • precSku
    SKU containing the planning parameters.
  • pcodSpecifiedPurchCode
    Purchaser Code for the run.
  • pbPurchaseToMax
    Purchase-to-maximum option.
  • pbIncludePlannedSupply
    Whether planned supply is included.
  • peReplenishmentType
    Replenishment-system scope.
  • pdNetAvailableQty
    Current calculated available quantity.
  • pdReorderQty
    Replenishment quantity that will be used.
  • pbSkipItem
    Can be set to skip the SKU.
  • pdForecastDemand
    Forecast demand calculated for the SKU.
  • pdActualDemand
    Actual demand calculated for the SKU.
  • pbIncludeConsumptionQty
    Indicates whether component/consumption demand is included.
  • pbHandled
    Set to true when the subscriber has calculated pdReorderQty and standard reorder-quantity logic should be skipped.

OnCalcReplenishmentBeforeCreateRequisitionLine

Published by Codeunit 23044485 “IWXEPP Planning Wksht. Hooks”.

Raised after the replenishment requirement has been calculated but before the resulting Requisition Line is inserted.

Signature

[IntegrationEvent(false, false)]
procedure OnCalcReplenishmentBeforeCreateRequisitionLine(
    var precRequisitionLine: Record "Requisition Line";
    precItem: Record Item;
    precSku: Record "Stockkeeping Unit";
    pcodSpecifiedPurchCode: Code[20];
    pbPurchaseToMax: Boolean;
    pbIncludePlannedSupply: Boolean;
    peReplenishmentType: Enum "IWXEPP Replenishment Type";
    var pbCancelRequisitionCreation: Boolean
    )

Parameters

  • precRequisitionLine
    Requisition Line that is about to be inserted. Modify fields here to customize the resulting planning line.
  • precItem
    Item responsible for the planning suggestion.
  • precSku
    SKU responsible for the planning suggestion.
  • pcodSpecifiedPurchCode
    Purchaser Code used by the planning run.
  • pbPurchaseToMax
    Purchase-to-maximum setting.
  • pbIncludePlannedSupply
    Whether existing planning lines were included as supply.
  • peReplenishmentType
    Replenishment-system scope.
  • pbCancelRequisitionCreation
    Set to true to prevent the proposed Requisition Line from being inserted.

OnCalcReplenishmentAfterCreateRequisitionLine

Published by Codeunit 23044485 “IWXEPP Planning Wksht. Hooks”.

Raised after the Requisition Line for a planning suggestion has been created.

Signature

[IntegrationEvent(false, false)]
procedure OnCalcReplenishmentAfterCreateRequisitionLine(
    var precRequisitionLine: Record "Requisition Line";
    precItem: Record Item;
    precSku: Record "Stockkeeping Unit";
    pcodSpecifiedPurchCode: Code[20];
    pbPurchaseToMax: Boolean;
    pbIncludePlannedSupply: Boolean;
    peReplenishmentType: Enum "IWXEPP Replenishment Type")

Parameters

  • precRequisitionLine
    Requisition Line that was created.
  • precItem
    Item for which the line was generated.
  • precSku
    SKU for which the line was generated.
  • pcodSpecifiedPurchCode
    Purchaser Code used by the run.
  • pbPurchaseToMax
    Purchase-to-maximum setting.
  • pbIncludePlannedSupply
    Whether planned supply was considered.
  • peReplenishmentType
    Replenishment-system scope.

OnAfterGetInventoryCutoffDate

Raised after Enhanced Planning Worksheet calculates the inventory cutoff date from Enhanced Planning Setup.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterGetInventoryCutoffDate(
    var precEnhancedPlanningSetup: Record "IWXEPP Enhanced Planning Setup";
    var pdtInventoryCutoffDate: Date)

Parameters

  • precEnhancedPlanningSetup
    Enhanced Planning Setup record from which the cutoff behavior was determined.
  • pdtInventoryCutoffDate
    Calculated inventory cutoff date. Change this value to use a different date for the planning inventory calculation.

OnBeforeGetPlanningInventory

Raised before planning inventory is calculated for a SKU.

Use this event to supply a custom planning inventory value.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeGetPlanningInventory(
    var precSku: Record "Stockkeeping Unit";
    var precEnhancedPlanningSetup: Record "IWXEPP Enhanced Planning Setup";
    var pdtInventoryCutoffDate: Date;
    var pdPlanningInventory: Decimal;
    var pbHandled: Boolean)

Parameters

  • precSku
    SKU whose inventory is being calculated.
  • precEnhancedPlanningSetup
    Current Enhanced Planning Setup.
  • pdtInventoryCutoffDate
    Cutoff date being applied to inventory.
  • pdPlanningInventory
    Inventory quantity to use in planning.
  • pbHandled
    Set to true to use pdPlanningInventory and skip the standard calculation.

OnAfterGetPlanningInventory

Raised after the standard planning inventory calculation.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterGetPlanningInventory(
    var precSku: Record "Stockkeeping Unit";
    var precEnhancedPlanningSetup: Record "IWXEPP Enhanced Planning Setup";
    var pdtInventoryCutoffDate: Date;
    var pdPlanningInventory: Decimal)

Parameters

  • precSku
    SKU whose planning inventory was calculated.
  • precEnhancedPlanningSetup
    Enhanced Planning Setup used by the calculation.
  • pdtInventoryCutoffDate
    Inventory cutoff date used.
  • pdPlanningInventory
    Resulting planning inventory. Modify this value to add, subtract, or otherwise adjust the standard result.

Create Purchase Orders Events

The following events are published by Report 23044481 “IWXEPP Create Purchase Orders”.

This report is based on Business Central’s Carry Out Action Message planning logic and is used by Enhanced Planning Worksheet to convert accepted purchase planning suggestions into purchase orders.

OnBeforeRequisitionLineOnAfterGetRecord

Raised at the start of processing each Requisition Line in the report, before the standard processing for that planning line.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeRequisitionLineOnAfterGetRecord(
    var RequisitionLine: Record "Requisition Line";
    var CombineTransferOrders: Boolean)

Parameters

  • RequisitionLine
    Current planning line being processed. Modify it before the standard carry-out logic evaluates the line.
  • CombineTransferOrders
    Controls whether transfer orders are combined when transfer-order carry-out behavior is applicable.

OnBeforeCheckLine

Raised before the report performs its standard validation of a Requisition Line.

Use this event when custom planning lines require different validation.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeCheckLine(
    RequisitionLine: Record "Requisition Line";
    PurchOrderChoice: Option " ","Make Purch. Orders","Make Purch. Orders & Print","Copy to Req. Wksh";
    TransOrderChoice: Option " ","Make Trans. Orders","Make Trans. Orders & Print","Copy to Req. Wksh";
    var IsHandled: Boolean)

Parameters

  • RequisitionLine
    Planning line being validated.
  • PurchOrderChoice
    Selected purchase-order carry-out behavior.
  • TransOrderChoice
    Selected transfer-order carry-out behavior.
  • IsHandled
    Set to true when the subscriber has performed the required validation and the report should skip its standard line validation.

OnBeforeCheckSupplyFrom

Raised immediately before the report validates the Supply From value for purchase or transfer planning lines.

Use this event when a customization provides supply information differently from the standard Business Central planning fields.

Signature

[IntegrationEvent(true, false)]
local procedure OnBeforeCheckSupplyFrom(
    RequisitionLine: Record "Requisition Line";
    PurchOrderChoice: Option " ","Make Purch. Orders","Make Purch. Orders & Print","Copy to Req. Wksh";
    TransOrderChoice: Option " ","Make Trans. Orders","Make Trans. Orders & Print","Copy to Req. Wksh";
    var IsHandled: Boolean)

Parameters

  • RequisitionLine
    Planning line whose supply source is being validated.
  • PurchOrderChoice
    Selected purchase-order carry-out behavior.
  • TransOrderChoice
    Selected transfer-order carry-out behavior.
  • IsHandled
    Set to true to skip the standard Supply From validation.

OnAfterSetDemandOrder

Raised after the report has associated the current Requisition Line with its demand order and prepared the Requisition Line filters used to process the associated demand.

This is useful when a PTE introduces additional demand relationships that need to participate in carry-out processing.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterSetDemandOrder(
    var RequisitionLine: Record "Requisition Line";
    MfgUserTempl: Record "Manufacturing User Template";
    var ReqLineFilters: Record "Requisition Line")

Parameters

  • RequisitionLine
    Current planning line whose demand order has been resolved.
  • MfgUserTempl
    Manufacturing User Template being used by the carry-out process. It contains the user’s manufacturing planning defaults used when production-related action messages are handled.
  • ReqLineFilters
    Requisition Line record containing the filters used to find planning lines associated with the demand order. Modify these filters to include custom related planning lines.

OnAfterSetReqLineFilters

Raised after the report has applied its standard filters to determine which Requisition Lines will be processed.

Use this event to further restrict or extend the set of planning lines included by Create Purchase Orders.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterSetReqLineFilters(
    var RequisitionLine: Record "Requisition Line")

Parameters

  • RequisitionLine
    Requisition Line record containing the report’s completed filters. Add or alter filters here before the report begins processing the planning lines.

OnBeforePreReport

Raised from the report’s pre-report initialization before standard report processing continues.

Use this event for initialization that must occur before any planning lines are processed.

Signature

[IntegrationEvent(true, false)]
local procedure OnBeforePreReport()

This event has no parameters.


OnAfterInitReport

Raised after the report has initialized its internal processing state.

Use this event for additional initialization that depends on the report’s standard initialization having already completed.

Signature

[IntegrationEvent(true, false)]
local procedure OnAfterInitReport()

This event has no parameters.


Routing Analysis Integration Events

Routing Analysis exposes events for extending which routing operations are analyzed, replacing population of the analysis buffer, and replacing AI evaluation.

Routing Analysis Buffer Events

The following events are published by Codeunit 23044440 “IWXEPP Routing Analysis”.

OnBeforePopulateRoutingAnalysisBuffer

Raised before Routing Analysis builds the analysis buffer.

Use this event to modify the requested filters or completely replace buffer generation.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforePopulateRoutingAnalysisBuffer(
    var precEPPRoutingAnalysisBuffer: Record "IWXEPP Routing Analysis Buffer";
    var pdtStartDate: Date;
    var pdtEndDate: Date;
    var pcodRoutingNo: Code[20];
    var pcodVersionCode: Code[20];
    var pbHandled: Boolean)

Parameters

  • precEPPRoutingAnalysisBuffer
    Routing Analysis buffer that will contain the results.
  • pdtStartDate
    Beginning of the historical analysis period.
  • pdtEndDate
    End of the historical analysis period.
  • pcodRoutingNo
    Routing Number being analyzed.
  • pcodVersionCode
    Routing Version Code being analyzed.
  • pbHandled
    Set to true if the subscriber populated the buffer and the standard calculation should be skipped.

OnAfterSetRoutingLineFilter

Raised after Routing Analysis applies its standard filters to the Routing Line record but before the routing lines are processed.

Use this event to modify the Routing Line filters, including scenarios where related routings should be included.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterSetRoutingLineFilter(
    var precRoutingLine: Record "Routing Line";
    var pdtStartDate: Date;
    var pdtEndDate: Date;
    var pcodRoutingNo: Code[20];
    var pcodVersionCode: Code[20])

Parameters

  • precRoutingLine
    Routing Line record containing the standard Routing Analysis filters.
  • pdtStartDate
    Analysis start date.
  • pdtEndDate
    Analysis end date.
  • pcodRoutingNo
    Routing Number filter.
  • pcodVersionCode
    Routing Version filter.

OnAfterPopulateRoutingAnalysisBuffer

Raised after Routing Analysis has populated the buffer and calculated its standard metrics.

Signature

[IntegrationEvent(false, false)]
local procedure OnAfterPopulateRoutingAnalysisBuffer(
    var precEPPRoutingAnalysisBuffer: Record "IWXEPP Routing Analysis Buffer";
    var pdtStartDate: Date;
    var pdtEndDate: Date;
    var pcodRoutingNo: Code[20];
    var pcodVersionCode: Code[20])

Parameters

  • precEPPRoutingAnalysisBuffer
    Populated Routing Analysis buffer. Modify or supplement the results here.
  • pdtStartDate
    Analysis start date.
  • pdtEndDate
    Analysis end date.
  • pcodRoutingNo
    Routing being analyzed.
  • pcodVersionCode
    Routing version being analyzed.

Routing Analysis AI Integration Event

Available on Business Central 27 and newer.

The event is published by Codeunit 23044443 “IWXEPP RA AI Evaluation Mgt.”.

OnBeforeEvaluateWithAI

Raised immediately before Routing Analysis sends its generated analysis payload to Business Central’s Azure OpenAI infrastructure.

Use this event to replace the standard AI provider or provide custom evaluation logic.

Signature

[IntegrationEvent(false, false)]
local procedure OnBeforeEvaluateWithAI(
    ptxtPayload: Text;
    var ptxtAISummary: Text;
    var pbHandled: Boolean)

Parameters

  • ptxtPayload
    Text generated by Routing Analysis containing the selected routing operations and the calculated metrics that would normally be supplied to AI.
  • ptxtAISummary
    Set this to the summary generated by the custom AI implementation.
  • pbHandled
    Set to true after populating ptxtAISummary to prevent Routing Analysis from calling its standard Business Central Azure OpenAI implementation.
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Need help?

Leave A Comment

Table of Contents
Go to Top