Table of Contents

KVSKBAInvProfileOffsetting

Summary: Handles Business Central events for Inv Profile Offsetting, including Calculate Plan From Req Tracing, Check Forecast Exist, and Find Replishment Location.

Procedures

CalculatePlanFromReqTracing(Record Item, Date, Date, Record Inventory Profile, Record Stockkeeping Unit) :

Summary: Calculates inventory planning from requisition tracing for a specific item and date range.

procedure CalculatePlanFromReqTracing(var Item: Record "Item"; OrderDate: Date; ToDate: Date; var TempInventoryProfile: Record "Inventory Profile"; var TempStockkeepingUnit: Record "Stockkeeping Unit"): 

Parameters:

  • Item: Item record to calculate planning for
  • OrderDate: Starting date for planning calculations
  • ToDate: End date for planning calculations
  • TempInventoryProfile: Temporary inventory profile table to store calculated results
  • TempStockkeepingUnit: Temporary stockkeeping unit table to store SKU combinations

Remarks: Generates demand and supply profiles, processes forecasts, and creates planning combinations for the specified item and timeframe

CheckForecastExist(Record Production Forecast Entry, Date, Date) : Boolean

Summary: Checks if forecast entries exist within the specified date range for planning purposes.

procedure CheckForecastExist(var ForecastEntry: Record "Production Forecast Entry"; OrderDate: Date; ToDate: Date): Boolean

Parameters:

  • ForecastEntry: Production forecast entry record with applied filters
  • OrderDate: Order date to check forecast from
  • ToDate: End date to check forecast until

Returns: Boolean indicating whether forecast entries with non-zero quantities exist in the date range

FindReplishmentLocation(Code[10], Record Item) : Boolean

Summary: Finds a replenishment location for an item based on stockkeeping unit setup.

procedure FindReplishmentLocation(var ReplenishmentLocation: Code[10]; var Item: Record "Item"): Boolean

Parameters:

  • ReplenishmentLocation: Variable to store the found replenishment location code
  • Item: Item record to find replenishment location for

Returns: Boolean indicating whether a unique replenishment location was found

Remarks: Returns true only if exactly one SKU with replenishment system and reordering policy is found

ForecastInitDemand(Record Inventory Profile, Record Production Forecast Entry, Code[20], Code[10], Decimal) :

Summary: Initializes demand inventory profile for forecast consumption calculations.

procedure ForecastInitDemand(var InventoryProfile: Record "Inventory Profile"; ProductionForecastEntry: Record "Production Forecast Entry"; ItemNo: Code[20]; LocationCode: Code[10]; TotalForecastQty: Decimal): 

Parameters:

  • InventoryProfile: Inventory profile record to initialize
  • ProductionForecastEntry: Source production forecast entry
  • ItemNo: Item number for the demand
  • LocationCode: Location code for the demand
  • TotalForecastQty: Total forecast quantity to set as remaining quantity

GetReqLines(Record Inventory Profile, Record Item, Date) :

Summary: Retrieves requisition lines for planning and converts them to inventory profiles.

procedure GetReqLines(var InventoryProfile: Record "Inventory Profile"; var Item: Record "Item"; ToDate: Date): 

Parameters:

  • InventoryProfile: Inventory profile table to insert requisition line profiles
  • Item: Item record to find requisition lines for
  • ToDate: End date filter for requisition lines

SetParm(Code[10], Date, Option) :

Summary: Sets global parameters for forecast and planning calculations.

procedure SetParm(Forecast: Code[10]; ExclBefore: Date; WorksheetType: Option): 

Parameters:

  • Forecast: Forecast code to use for planning
  • ExclBefore: Date to exclude forecast entries before
  • WorksheetType: Type of worksheet (Requisition or Planning)

Events

OnAfterDemandToInvProfile(Record Inventory Profile, Record Item, Record Reservation Entry, Integer) :

Summary: Integration event that fires after transferring demand to inventory profile.

[IntegrationEvent(false, false)]
local procedure OnAfterDemandToInvProfile(var InventoryProfile: Record "Inventory Profile"; var Item: Record "Item"; var ReservEntry: Record "Reservation Entry"; var NextLineNo: Integer): 

Parameters:

  • InventoryProfile: Inventory profile table with demand entries
  • Item: Item record being processed
  • ReservEntry: Reservation entry table for item tracking
  • NextLineNo: Current line number counter

Remarks: Use this event to add custom demand sources or modify existing demand profiles

OnAfterFindLinesWithItemToPlan(Record Sales Line, Boolean) :

Summary: Integration event that allows customization after finding sales lines with item to plan.

[IntegrationEvent(false, false)]
local procedure OnAfterFindLinesWithItemToPlan(var SalesLine: Record "Sales Line"; var IsHandled: Boolean): 

Parameters:

  • SalesLine: Sales line record that was found
  • IsHandled: Variable indicating whether the sales line processing has been handled by a subscriber

Remarks: Use this event to implement custom logic or skip standard processing for specific sales lines

OnAfterSupplyToInvProfile(Record Inventory Profile, Record Item, Date, Record Reservation Entry, Integer) :

Summary: Integration event that fires after transferring supply to inventory profile.

[IntegrationEvent(false, false)]
local procedure OnAfterSupplyToInvProfile(var InventoryProfile: Record "Inventory Profile"; var Item: Record "Item"; var ToDate: Date; var ReservEntry: Record "Reservation Entry"; var NextLineNo: Integer): 

Parameters:

  • InventoryProfile: Inventory profile table with supply entries
  • Item: Item record being processed
  • ToDate: End date for supply planning
  • ReservEntry: Reservation entry table for item tracking
  • NextLineNo: Current line number counter

Remarks: Use this event to add custom supply sources or modify existing supply profiles

OnAfterTransToChildInvProfile(Record Reservation Entry, Record Inventory Profile) :

Summary: Integration event that fires after transferring data to child inventory profile during item tracking unfolding.

[IntegrationEvent(false, false)]
local procedure OnAfterTransToChildInvProfile(var ReservEntry: Record "Reservation Entry"; var ChildInvtProfile: Record "Inventory Profile"): 

Parameters:

  • ReservEntry: Reservation entry with item tracking information
  • ChildInvtProfile: Child inventory profile that was created with tracking details

Remarks: Use this event to modify or extend child inventory profiles with additional tracking information

OnBeforeBlanketOrderConsumpFind(Record Sales Line) :

Summary: Integration event that allows customization of blanket sales line filtering before processing blanket order consumption.

[IntegrationEvent(false, false)]
local procedure OnBeforeBlanketOrderConsumpFind(var BlanketSalesLine: Record "Sales Line"): 

Parameters:

  • BlanketSalesLine: Blanket sales line record with applied filters

Remarks: Use this event to add additional filters to blanket sales lines before consumption calculations

OnBeforeDemandToInvProfile(Record Inventory Profile, Record Item, Boolean) :

Summary: Integration event that allows customization before transferring demand to inventory profile.

[IntegrationEvent(false, false)]
local procedure OnBeforeDemandToInvProfile(var InventoryProfile: Record "Inventory Profile"; var Item: Record "Item"; var IsHandled: Boolean): 

Parameters:

  • InventoryProfile: Inventory profile table to be populated with demand
  • Item: Item record being processed
  • IsHandled: Variable indicating whether demand transfer has been handled by a subscriber

Remarks: Use this event to implement completely custom demand calculation logic

OnBeforeForecastConsumption(Record Inventory Profile, Record Item, Date, Date, Date, Boolean, Code[10], Date, Boolean, Integer) :

Summary: Integration event that allows customization before processing forecast consumption.

[IntegrationEvent(false, false)]
local procedure OnBeforeForecastConsumption(var DemandInvtProfile: Record "Inventory Profile"; var Item: Record "Item"; OrderDate: Date; ToDate: Date; var UpdatedOrderDate: Date; var IsHandled: Boolean; var CurrForecast: Code[10]; var ExcludeForecastBefore: Date; var UseParm: Boolean; var LineNo: Integer): 

Parameters:

  • DemandInvtProfile: Demand inventory profile table
  • Item: Item record being processed
  • OrderDate: Order date for forecast processing
  • ToDate: End date for forecast processing
  • UpdatedOrderDate: Variable for updated order date (can be modified by subscribers)
  • IsHandled: Variable indicating whether forecast consumption has been handled by a subscriber
  • CurrForecast: Current forecast code
  • ExcludeForecastBefore: Date to exclude forecast entries before
  • UseParm: Boolean indicating whether to use global parameters
  • LineNo: Current line number counter

Remarks: Use this event to implement custom forecast consumption logic or modify forecast parameters

OnBeforeInsertInventoryProfile(Record Requisition Line, Boolean) :

Summary: Integration event that allows customization before inserting inventory profile from requisition line.

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

Parameters:

  • RequisitionLine: Requisition line record to be processed
  • IsHandled: Variable indicating whether inventory profile insertion has been handled by a subscriber

Remarks: Use this event to skip or customize inventory profile creation from specific requisition lines

OnBeforeSupplyToInvProfile(Record Inventory Profile, Record Item, Date, Record Reservation Entry, Integer) :

Summary: Integration event that allows customization before transferring supply to inventory profile.

[IntegrationEvent(false, false)]
local procedure OnBeforeSupplyToInvProfile(var InventoryProfile: Record "Inventory Profile"; var Item: Record "Item"; var ToDate: Date; var ReservEntry: Record "Reservation Entry"; var NextLineNo: Integer): 

Parameters:

  • InventoryProfile: Inventory profile table to be populated with supply
  • Item: Item record being processed
  • ToDate: End date for supply planning
  • ReservEntry: Reservation entry table for item tracking
  • NextLineNo: Current line number counter

Remarks: Use this event to implement custom supply calculation logic or modify supply parameters

OnBeforeTempSKUInsert(Record Stockkeeping Unit, Codeunit Planning-Get Parameters) :

[IntegrationEvent(false, false)]
local procedure OnBeforeTempSKUInsert(var TempSKU: Record "Stockkeeping Unit"; var PlanningGetParameters: Codeunit "Planning-Get Parameters"): 

OnBeforeTempTransferSKUInsert(Record Stockkeeping Unit, Record Transfer Line) :

Summary: Integration event that fires before inserting temporary transfer SKU records.

[IntegrationEvent(false, false)]
local procedure OnBeforeTempTransferSKUInsert(var TempTransferSKU: Record "Stockkeeping Unit" temporary; TransferLine: Record "Transfer Line"): 

Parameters:

  • TempTransferSKU: Temporary transfer stockkeeping unit record to be inserted
  • TransferLine: Source transfer line record

Remarks: Use this event to modify transfer SKU data before it is stored for planning calculations

OnFindCombinationAfterAssignTempSKU(Record Stockkeeping Unit, Record Inventory Profile) :

Summary: Integration event that fires after assigning temporary SKU during combination finding.

[IntegrationEvent(false, false)]
local procedure OnFindCombinationAfterAssignTempSKU(var TempStockkeepingUnit: Record "Stockkeeping Unit" temporary; InventoryProfile: Record "Inventory Profile"): 

Parameters:

  • TempStockkeepingUnit: Temporary stockkeeping unit being processed
  • InventoryProfile: Inventory profile record used for assignment

Remarks: Use this event to modify SKU assignment logic during demand/supply combination finding

OnFindNextSKUOnAfterAssignTempSKU(Record Stockkeeping Unit, Record Inventory Profile) :

Summary: Integration event that fires after assigning temporary SKU when finding next SKU in sequence.

[IntegrationEvent(false, false)]
local procedure OnFindNextSKUOnAfterAssignTempSKU(var TempSKU: Record "Stockkeeping Unit" temporary; var InventoryProfile: Record "Inventory Profile"): 

Parameters:

  • TempSKU: Temporary stockkeeping unit being assigned
  • InventoryProfile: Inventory profile record used for assignment

Remarks: Use this event to customize SKU navigation logic during profile processing

OnFindReplishmentLocationOnBeforeFindSKU(Record Stockkeeping Unit) :

Summary: Integration event that allows customization of SKU filtering before finding replenishment location.

[IntegrationEvent(false, false)]
local procedure OnFindReplishmentLocationOnBeforeFindSKU(var StockkeepingUnit: Record "Stockkeeping Unit"): 

Parameters:

  • StockkeepingUnit: Stockkeeping unit record with applied filters

Remarks: Use this event to add additional filters when searching for replenishment locations

OnForecastConsumptionOnBeforeFindDemandInvtProfile(Record Inventory Profile, Boolean) :

Summary: Integration event that allows customization of demand inventory profile filtering during forecast consumption.

[IntegrationEvent(false, false)]
local procedure OnForecastConsumptionOnBeforeFindDemandInvtProfile(var DemandInventoryProfile: Record "Inventory Profile"; ComponentForecast: Boolean): 

Parameters:

  • DemandInventoryProfile: Demand inventory profile record with applied filters
  • ComponentForecast: Boolean indicating whether this is component forecast processing

Remarks: Use this event to modify demand profile filters based on forecast type (component vs. item forecast)