MAC-PAC Homecontact ussupport login 
Documentation > MAC-PAC Technical Library > Distribution > Order Processing > Programs > Sales Order Availability Checking - Purpose

Sales Order Availability Checking - Purpose

AVLCHK

The Sales Order Availability Checking program (AVLCHK) checks inventory balances and calculates back order and reservation quantities.  It also determines the ship type for the sales order line.  If the items of the sales order line are going to be remote sourced, AVLCHK creates a purchase order requisition.  As long as the requisition is not covered by a purchase order (cover flag must be 'N' on PO160M1), the program maintains (updating/closing) the requisition related to changes entered for the sales order line.  This program is called from OP100E3 (Sales Order Line Maintenance), from OP180E (Quote Order Conversion), and from OP630E (Automatic Order Release).  Externally described data structures are used for passing parameters between the calling program and AVLCHK.

Depending on the relief code, the appropriate availability checking subroutines calculates inventory availability for a specific part/company/warehouse combination.  The calculation also depends on the ship type entered for the sales order line.  If the ship type is left blank, it will be defaulted to warehouse ship ('W') in the calling program before AVLCHK is called.  By doing this, inventory for this warehouse is checked.  A blank ship type also indicates that AVLCHK should determine the ship type.  Therefore, the current screen value of the ship type is also passed to this program.  It returns the necessary values to update the sourcing warehouse balance record for the line, and the sales order line record.  For blanket and backorder releases, the availability checking subroutine returns values to update the warehouse balance record for the parent and the parent sales order line.

This availability checking routine is also used by the Blanket and Backorder Release program (OP110E).  The Blanket and Backorder Release program deals with only two types of orders:  blanket releases and backorder releases.  Therefore, its version of the availability checking subroutine does not process regular, standing, or blanket orders.

For lot-assignable items, inventory is reserved at the lot level before this routine is invoked.  The sum of the reserved quantities at the lot level is passed here as the new release quantity.

Three options are available to control availability checking processing.  Two of these options are set up at the warehouse level on the Warehouse Description file (IC170M).  The first option is the Include Backorder Quantity in the Quantity Available Calculation option.  If this option is set to yes, the quantity available calculation for all new orders will include the backorder quantity:

Available Qty = Distribution Qty (on hand) - Reserved Qty - Backordered Qty

If the option is set to no or if the order is a backorder, the available quantity is calculated as follows:

Available Qty = Distribution Qty (on hand) - Reserved Qty

The second option is the Future Order Reservation option.  If this option is set to yes, inventory is not reserved for future orders until the promised ship dates fall within the reservation window.  The reservation window is calculated by adding to the current date the number of days specified by the user on the Warehouse Description file.  If the order line promised ship date is within the window, inventory is reserved.

The third option is the Allow Inventory Over-Reservation Flag.  This flag is maintained in Reference File category 412 (OP System Defaults) and has an impact on the availability checking processing if the order line quantity will be filled from a distribution balance (Relief Code of 'D').  If this flag is set to 'No' for the company/location, over-reservation of inventory is not allowed.  If the order quantity is greater than the available quantity, only the available quantity is reserved, and in the case of a warehouse shipment the remaining quantity is backordered.  If this flag is set to 'Yes', even for a warehouse shipment, the whole order quantity is reserved, regardless whether quantity is available or not.  The backorder quantity will be always zero and therefore AVLCHK will not determine that a purchase order requisition should be checked automatically for quantity that can not be sourced from this warehouse.  If the sourcing warehouse is a stock location reservation warehouse, over-reservation is not allowed for lot controlled parts.

If the purchasing module is installed, the sales order is not a configured order, not standing, blanket, blanket release or backorder release, the part is not a bundle part, a bundle component, a reference part, or a lot assignable part, and the sales order line is not already attached to a purchase order line, AVLCHK will determine the sales order line ship type and if necessary will create, update or close a purchase order requisition. 

The vendor ID or the sales order line record (OP100M2) indicates whether a requisition has already been created and is passed as old vendor ID (OVNDID) to AVLCHK.  The vendor ID on the line detail screen in sales order maintenance specifies whether a requisition should be created or changed (vendor ID has been entered), or the program itself should determine the action that needs to be taken (no vendor ID has been entered), or the existing requisition should be closed (vendor ID was blanked out). 

If a requisition should be created or updated, and the vendor is not entered, the default vendor is retrieved from Warehouse Description file (IC140M).  If the part's record on the file doesn't have a default vendor, no requisition can be created. 

The allow remote sourcing flag for the ship-to customer (on customer address file) and for the part (on warehouse balance file) is validated.  The default direct distribution flag for the ship-to customer (on customer address file) and for the vendor (on vendor master file) is checked.  The remote sourcing is allowed and a ship type of 'D' has been entered as a ship type for warehouse ship has been entered and there is backordered quantity for that line, a requisition is created or updated.  If no ship type has been entered, remote sourcing is allowed, direct distribution should be defaulted and there is backorder quantity the program will set the ship-type for that line to 'D'.  Since the ship type was 'W' the first time availability was checked, the program runs through the availability checking subroutine using the new ship type in order to perform the calculation for a direct ship type. 

If a requisition is created, the requisition number (from reference category 468) is defaulted to the sales order line requisition number field.  Every time the program closes a requisition the requisition number is deleted from the sales order line.

Note:  The files that are used by this program, with the exception of REFERP, are only accessed if you are performing remote sourcing.  If you are only using this program for availability checking, only file REFERP is accessed.

AVLCHK Program Menu