Calling Replenishment Engine Overview

This section describes the process of calling the Replenishment Engine using a macro to generate planned orders for an item and location combination from the specified start period and upto a specified horizon.

Pre-requisites:

The user must have access to the macro as well the replenishment engine defined for the current Cycle. Else, this error is displayed by the macro on execution:

Replenishment engine {0} is not accessible to user {1}

Data security rules are applicable for the current user executing the macro, when determining the item and the location elements to be passed to the Replenishment Engine for calculation. For example:

  • CallReplenishmentEngine ("Brand A", "US", "", "")
  • If the current user's data security does not allow the user to view Brand A or base items linked to BRAND A in the item hierarchy, the selected is not passed to the engine.
  • If the user can access a subset of base element linked to Brand A, the schedules are calculated for these items only.
  • If the user's data security does not allow the user to view US or base locations linked to US in the location hierarchy, the selected data is not passed to the engine.
  • If the user can access a subset of base locations linked to US in the location hierarchy, the schedules are calculated for these locations only.

Calling the Replenishment Engine

The basic sequence to call the replenishment engine using the CallReplenishmentEngine macro command is as follows:

  • Determine the replenishment engine defined for the current cycle.
  • Determine the items and the location for scheduling.
  • Process any other macro parameters

To call the replenishment engine:

  1. Select Configuration > Cycle > Macros. The Macro page is displayed.
  2. Create a new macro command CallReplenishmentEngine. See Creating macros
  3. Derive the Supply Allocation mapping measures and attributes for the engine configuration.
    Note: All supply allocation mappings are required and must be validated to ensure that the correct attributes are selected.
  4. Retrieve the Schedule Rule for all the item and location combinations to be scheduled using the Replenishment Engine’s Item and Location measure mappings. The Replenishment Engine processes all the item and location combinations in the macro call where Schedule Rule is displayed.
  5. Retrieve the Sequence ID for all item and location combinations for scheduling. Item and location combinations are sequenced and passed to the engine in the ascending order of the Sequence ID. This process ensures that all item and location combinations are processed to allow passing of the latest requirements through the supply network. For example, the planned orders of a warehouse generated by the engine is passed as Requirements to the production facility.
    Note: 
    • Based on the Sequence ID, prepare and sequence the individual item, location calls to the Replenishment Engine.
    • If no sequence ID is defined, the item and location combinations are sequenced accordingly. You may get unexpected results, if the connected item and location combination are not sequenced in an order.
  6. Validate the Default Source Method of the current item and location:
    • If the mapped default source method value is not 1, 2 or 3, the item and location combination is not considered. This error message is written to the engine discard log:
      Source Method {1} is invalid. Value must be 1, 2 or 3.
  7. Validate the Increment of the current item and location:
    • This parameter is mapped to a measure mapping linked to the corresponding Supply Allocation or Default Source Method:
      • 1 (Transfer) = Transfer Out Measure Mapping
      • 2 (Purchase) = Purchase Measure Mapping
      • 3 (Production, Manufacture) = Process Measure Mapping
      Note: If the mapped increment is null or </= 0, the item and location combination is not considered and this error message is written to the engine discard log:
      Increament {1} is not valid. The value must be > 0.
  8. Validate the Receiving Calendar ID of the current item and location. The possible scenarios:
    • If the mapped ID is not defined for an Engine Calendar Mapping of the current engine, the item and location combination is not considered and this error message is written to the engine discard log:
      Receiving Calendar ID {1} cannot be found.
    • If no value is mapped against the Receiving Calendar ID measure, the default calendar in the Engine Calendar Mapping of the current engine is used.
    • If default calendar is not defined, the item and location combination is not considered and this error message is written to the engine process discard log:
      Receiving Calendar ID {1} cannot be found.
  9. Validate the Schedule Rule of the current item and location. For Rule 1 or 2:
    1. Get Production Processes:
      1. Create an array of Production processes where the item is the outflow factor along with the Routing or Process ID:
        • Check for a non-zero value for the mapped Outflow Factor AND Formula_measure where the Formula_item = current item and Formula_location = current location.
        • If an allocation is found for each Outflow process in the array check for TUPLE, non-zero value, for Process_measure where Process_location = current location, Process_routing = current Outflow routing.
        • If no allocation is found, remove the Outflow process from the array.
      2. Create an array of production processes where the item is the inflow factor along with the Routing or Process ID:
        • Check for a non-zero value for the mapped Inflow Factor AND Formula_measure where the Formula_item = current item and Formula_location = current location.
        • If an allocation is found for each Inflow process in the array; check for TUPLE, non-zero value, for Process_measure where Process_location = current location, Process routing = current Inflow routing.
        • If no allocation is found, remove the Inflow process from the array.
    2. Delete existing Planned Orders:
      • Delete the order data records for the definitions mapped to the Engine’s Order Mapping for ‘Planned’ types:
        • Delete Planned Transfer Orders where TransferIn_Item = current item and TransferIn_Destination = current Inflow routing.
        • Delete Planned Purchased Orders where Purchases_item = Current_item and Purchases_location = current location.
      • Check, if Outflow processes exist for the current item and location. See, Step 9. a.
      • For each process in the Outflow process count:
        • Delete Planned Production Orders where Process_location = Current location and Process_routing = current Outflow_process routing.
        • If Order Start Offset > 0, delete the records for which the data record’s Delivery date >= Current planning period’s start date + Order Start Offset (days). Else delete mapped orders for all dates.
    3. Get the Default Order Elements for the given Default Source Method. The scenarios:
      • Source Method = 1 (Transfer):
        • Check for a TUPLE, non-zero value for TransferIn_measure where TransferIn_Item = current item, TransferIn_Destination = current location and Transfer_Source = TransferIn_Source value.
        • Check for a TUPLE, non-zero value for TransferOut_measure where TransferOut_Item = current item, TransferOut_Destination = current location and TranferOut_Source = Transfer Source.
        • Order item = Transfer In_TUPLE Item element, Order_destination = Transfers In_TUPLE Location element, Order_source = Transfers Out_TUPLE Location element.
      • Source Method = 2 (Purchase):
        • Check for a TUPLE, non-zero value for Purchase_measure where Purchase_item = current item, Purchase_location = current location, Order_item = Purchases_TUPLE Item element, Order Destination = Purchases_TUPLE Location element, Order_source = Purchases_TUPLE Location element.
      • Source Method = 3 (Production):
        • Where outflow process count > 0, Order_Item = ICONST, Order_destination = First Outflow process’ Location element, Order_Source = First Outflow process’ Location element. See Step 9.c.
        • If default TUPLE is not defined for the given source method, the item and location combination is not considered and this error is written to the engine process discard log:
          Source Location cannot be found for source method {1}.
    Note: 
    • For Rule = 1, call the engine based on the standard scheduling logic for the item and location combination.
    • For Rule = 2, call the engine based on ROP schedule logic item and location combination.
    • If the rule is other than 0, 1 or 2, the item and location combination is skipped and this error is registered in the engine process discard log:
      Schedule rule {1} is not valid. The value must be 0, 1 or 2. 
  10. Retrieve the required results from the replenishment engine result set based on the Replenishment Engine Order mapping and apply the results to the Order (transactional data) values:
    • The corresponding scenario values are synchronized for planned order mappings.
    • Engine results, based on the Order data are written to periods for the cycle period future horizon (based on the corresponding Order dates).
    • If the user accessed Engine has any data security rules on the period dimension which restricts the access to the entire future horizon, the results are saved for the allowed orders only.
  11. Retrieve the required results from the replenishment engine result set and apply the results to Scenario values (for other mapped item location output results) based on the Replenishment Engine measure mapping data. The engine results based on the mapped measures are written as a static value to PCONST.
  12. The result of the call to the replenishment engine are output to the job manager and audit log wherein:
    • A discard log is attached to the audit log message, if the Replenishment Engine call completes with errors.
    • The processing of valid combinations is not prevented by the Individual item, location errors.
    • Invalid item, location combinations from the schedule preparation, or returned form the engine rule logic with an error code are written to the discard log, with message detailing the error.