CheckQuantityOverAvailable

Check Quantity Over Available

Minor Business Rule

Object Name: B4100420

Parent DLL: COPBASE

Location: Client/Server

Language: C

Functional Description

Purpose
Use this function to see if the quantity being processed is greater than the quantity available.  
This function also checks to make sure the combo itm, cmu, locn , lotn & qty are not on any other lines 

of the grid.  If it's unique, add the qty to the link list.


Setup Notes and Prerequisites

This function should only be called if a check should be made to ensure that quantity is not being
processed that will make quantity available drop below zero.  Each line will be checked as it is 

processed against itself and any other previously written for the same item number.

All parameters for C4102a1 need to be passed in, as C4102a1 is called from this business function.

Do not call this business function if IBCKAV is an 'N' for the Item and Branch you are processing.


Special Logic

Create a link list wtih ITM, MCU, LOCN, LOTN, QTY.

Technical Specifications

Parameters

Data Item     Data Structure Description     I/O     Required     Notes
ITM           Short Item Number               I         Y         
MCU           Branch/Plant                    I         Y

LOCN          Location                        I         N

LOTN          Lot Number                      I         N

TQOH      Primary Transaction Quantity    I         N

PQOH  Quantity on Hand                I         N

PREQ          Quantity on PO Receipt          I         N

PBCK          Quantity on Backorder           I         N

PCOM          Quantity - Soft Commit          I         N

HCOM          Quantity - SO Hard Commit       I         N

FCOM          Quantity - Future Commit        I         N

QOWO          Quantity - WO Hard Commit       I         N

QTTR          Quantity - In Transit           I         N

QTIN          Quantity - In Inspection        I         N

QT01          Quantity - In Operation 1       I         N

QT02          Quantity - In Operation 2       I         N

OT1P          Quantity - SO Other 1           I         N

OT2P          Quantity - SO Other 2           I         N

OT1A          Quantity - PO Other 1           I         N

SAFE          Safety Stock                    I         N

QAVAL         Quantity Available              O         N

PBIN          Primary Bin                     I         Y

LOTS          Lot Status                      I         N

ERRC          Error Code                      I         N

FRMP          From Potency                    I         N

THRP          Thur Potency                    I         N

FRGD          From Grade                      I         N

THGD          Thru Grade                      I         N

EXDP          Days Before Expired             I         N

OT1Y          Potency Control                 I         N

OT2Y          Grade Control                   I         N

LOTG          Lot Grade                       I         N

LOTP          Lot Potency                     I         N

MMEJ          Expiration date                 I         N

UOM1          Primary UOM                     I         Y

UOM2          Secondary UOM                   I         N

GENLNG        Internal Pointer to Link List   I         Y

EV01          Destroy Link List               I         N         '1' = Destroy Link List   


Related Tables

Related Business Functions

Calculate Quantity Available - C4102a1

Processing

Call CalculateQuantityAvailable(C4102a1).
Move blanks to work field $FOUND (one character).

Take QAVAL add TQOH, resulting in a workfield $QTY.

Check to make sure the item is not on any other lines of subfile.

If it is, add the quantity from this line to the total quantity for the item before checking 

availability.

Need to store the transactions being processed in a link list.




Data Structure

D4100420 - Check Quantity Over Available

Parameters

Data Item     Data Structure Description     I/O     Required     Notes
ITM           Short Item Number               I         Y         
MCU           Branch/Plant                    I         Y

LOCN          Location                        I         N

LOTN          Lot Number                      I         N

TQOH      Primary Transaction Quantity    I         N

PQOH  Quantity on Hand                I         N

PREQ          Quantity on PO Receipt          I         N

PBCK          Quantity on Backorder           I         N

PCOM          Quantity - Soft Commit          I         N

HCOM          Quantity - SO Hard Commit       I         N

FCOM          Quantity - Future Commit        I         N

QOWO          Quantity - WO Hard Commit       I         N

QTTR          Quantity - In Transit           I         N

QTIN          Quantity - In Inspection        I         N

QT01          Quantity - In Operation 1       I         N

QT02          Quantity - In Operation 2       I         N

OT1P          Quantity - SO Other 1           I         N

OT2P          Quantity - SO Other 2           I         N

OT1A          Quantity - PO Other 1           I         N

SAFE          Safety Stock                    I         N

QAVAL         Quantity Available              O         N

PBIN          Primary Bin                     I         Y

LOTS          Lot Status                      I         N

ERRC          Error Code                      I         N

FRMP          From Potency                    I         N

THRP          Thur Potency                    I         N

FRGD          From Grade                      I         N

THGD          Thru Grade                      I         N

EXDP          Days Before Expired             I         N

OT1Y          Potency Control                 I         N

OT2Y          Grade Control                   I         N

LOTG          Lot Grade                       I         N

LOTP          Lot Potency                     I         N

MMEJ          Expiration date                 I         N

UOM1          Primary UOM                     I         Y

UOM2          Secondary UOM                   I         N

GENLNG        Internal Pointer to Link List   I         Y

EV01          Destroy Link List               I         N         '1' = Destroy Link List   


^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnShortItemNumberITMMATH_NUMERICNONENONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

szBranchPlantMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

szLocationLOCNcharNONENONE

The storage location from which goods will be moved.

szLotNumberLOTNcharNONENONE

A number that identifies a lot or a serial number. A lot is a group of items with similar characteristics.

mnPrimaryQtyQCOMMMATH_NUMERICNONENONE

The total quantity that is committed to a specific location. The total quantity is the sum of all quantities that have been sold or committed 
from the following:     o Soft Committed to Sales Orders     o Hard Committed to Sales Orders     o Soft Committed to Work Orders     o Hard 
Committed to Work Orders 

mnQtyOnHandPQOHMATH_NUMERICNONENONE

The number of units that are physically in stock. The system displays the quantity on-hand in the primary unit of measure.

mnQtyOnPOReceiptPREQMATH_NUMERICNONENONE

The number of units specified on the purchase order in primary units of measure.

mnQtyOnBackOrderPBCKMATH_NUMERICNONENONE

The number of units backordered in primary units of measure.

mnQtySoftCommittedPCOMMATH_NUMERICNONENONE

The number of units soft committed to sales orders or work orders in the primary units of measure.

mnQtySOHardCommittedHCOMMATH_NUMERICNONENONE

The number of units committed to a specific location and lot.

mnQtyFutureCommitFCOMMATH_NUMERICNONENONE

The quantity on sales order whose requested shipment date is beyond the standard commitment period that has been specified in the 
Inventory Constants for that branch.  As an example, if you normally ship most orders within 90  days, then an order for an item with a requested 
ship date a year from now would have its quantity reflected in this field.

mnQtyWOHardCommitQOWOMATH_NUMERICNONENONE

The number of units hard committed to work orders in the primary unit of measure.

mnQtyInTransitQTTRMATH_NUMERICNONENONE

The quantity currently in transit from the supplier.

mnQtyInInspectionQTINMATH_NUMERICNONENONE

The quantity currently being inspected.  This quantity has been received, but is not considered on hand.

mnQtyInOperation1QTO1MATH_NUMERICNONENONE

The quantity which is currently at a user-defined operation within the dock-to-stock process.  The quantity has been received, but may or 
may not be considered to be on hand.

mnQtyInOperation2QTO2MATH_NUMERICNONENONE

The quantity which is currently at a user-defined operation within the dock-to-stock process.  The quantity has been received, but may or 
may not be considered to be on hand.

mnQtySOOther1OT1PMATH_NUMERICNONENONE

The first of two quantities that can be specified as additional offsets (subtractions from on-hand) in the determination of quantities available 
for sale.  (Primary unit of measure)

mnQtySOOther2OT2PMATH_NUMERICNONENONE

The second of two quantities that can be specified as additional offsets (subtractions from on-hand) in the determination of quantities 
available for sale.  (Primary unit of measure)

mnQtyPOOther1OT1AMATH_NUMERICNONENONE

The quantity that appears on documents such as bid requests, which are not formal commitments to buy on the part of your organization.

mnSafetyStockSAFEMATH_NUMERICNONENONE

The quantity of stock kept on hand to cover high-side variations in demand.

mnQuantityAvailableQAVALMATH_NUMERICNONENONE

A number that indicates the quantity that is available. For example, the available quantity might consist of the on-hand quantity minus 
commitments, reservations, and backorders.  Availability is user defined. You can set up availability in the Branch/Plant Constants program (P41001).  

cPrimaryBinPBINcharNONENONE

A code that indicates whether this is the primary or secondary location for this item within this stocking location. Valid values are:    P Primary 
storage location    S Secondary storage location  Note:  You can only have one storage area marked as primary within each branch or 
warehouse. In some cases, the system uses the primary storage area as the default.

cLotStatusLOTScharNONENONE

A user defined code (41/L) that indicates the status of the lot. If you leave this field blank, it indicates that the lot is approved. All other codes 
indicate that the lot is on hold. You can assign a different status code to each location in which a lot resides on Item/Location Information or 
Location Lot Status Change.

cErrorCodeERRCcharNONENONE

This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document 
Set Server program (XT4914).

mnFromPotencyFRMPMATH_NUMERICNONENONE

A number that indicates the minimum potency or percentage of active ingredients acceptable for an item. The system displays a warning 
message if you try to purchase or issue items that do not meet the minimum acceptable potency. The system does not allow you to sell items 
that do not meet the minimum acceptable potency.

mnThruPotencyTHRPMATH_NUMERICNONENONE

A number that indicates the maximum potency or percentage of active ingredients that is acceptable for an item. The system displays a 
warning message if you try to purchase or issue items that have a potency that exceeds the maximum potency acceptable. The system does 
not allow you to sell items that have a potency that exceeds the maximum potency acceptable.

szFromGradeFRGDcharNONENONE

A user defined code (40/LG) that indicates the minimum grade that is acceptable for an item. The system displays a warning message if 
you try to purchase or issue items with grades that do not meet the minimum grade acceptable. The system does not allow you to sell items 
with grades that do not meet the minimum acceptable level.

szThruGradeTHGDcharNONENONE

A user defined code (40/LG) that indicates the maximum grade that is acceptable for an item. The system displays a warning message if 
you try to purchase or issue items with grades that exceed the maximum grade acceptable. The system does not allow you to sell items with 
grades that exceed the maximum grade acceptable.

mnDaysBeforeExpiredEXDPMATH_NUMERICNONENONE

The number of days allowed before expiration for an item where it still can be used or sold to a specific customer.  When negative, this 
number indicates the number of days after expiration for an item where it still can be used or sold to a specific customer. For example, if the 
expiration date for item 1001 is 06/01/98:     o A value of 15 in Days Before Expiration means that this specific customer only accepts this item up to 
05/15/98.     o A value of -15 in Days Before Expiration means that this specific customer accepts this item up to 06/15/98.

cPotencyControlOT1YcharNONENONE

A code that indicates whether you control the item by potency.

cGradeControlOT2YcharNONENONE

A code that indicates whether you control the item by grade.

szLotGradeLOTGcharNONENONE

A code that indicates the grade of a lot. The grade is used to indicate the quality of the lot. Examples include the following:    A1   Premium 
grade    A2   Secondary grade  The grade for a lot is stored in the Lot Master table (F4108).

mnLotPotencyLOTPMATH_NUMERICNONENONE

A code that indicates the potency of the lot expressed as a percentage of active or useful material (for example, the percentage of alcohol 
in a solution). The actual potency of a lot is defined in the Lot Master table (F4108).

jdExpirationDateMMEJJDEDATENONENONE

The date on which a lot of items expires. The system automatically enters this date if you have specified the shelf life days for the item on 
Item Master Information or Item Branch/Plant Information. The system calculates the expiration date by adding the number of shelf life days to 
the date that you receive the item. You can commit inventory based on the lot expiration date for items. You choose how the system commits 
inventory for an item on Item Master Information or Item Branch/Plant Information.

szPrimaryUOMUOM1charNONENONE

A user defined code (00/UM) that identifies the unit of measure that the system uses to express the quantity of an item, for example, EA 
(each) or KG (kilogram).

szSecondaryUOMUOM2charNONENONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

idPtrToLinkListGENLNGIDNONENONE

General purpose ID variable.

cDestroyLinkListFlagEV01charNONENONE

Parameters
Data Item     Data Structure Description     I/O     Required     Notes
EV01          Destory Link List               I         N         '1' = Destory Link List
^

mnConversionFactorFromToPrimCONVMATH_NUMERICNONENONE

The factor that the system uses to convert one unit of measure to another unit of measure.

cCalculateQtyEV02charNONENONE

An option that specifies the type of processing for an event.

Related Functions

B4100010 Calculate Qty Available

Related Tables

F4102 Item Branch File