CalculateQtyOnHand

Accumulate Quantities for F41021

Major Business Rule

Object Name: B41021

Parent DLL: COPBASE

Location: Client/Server

Language: C


Functional Description


Purpose

For a given combination of Item, Branch, Location and Lot,  all Item Location records (F41021) are 

retrieved and the  totals for quantity on hand, quantity soft committed, quantity hard committed, 

quantity on work order, quantity on purchase order and quantity on receipt are calculated.  Also calculated 

is the Extended Cost of the total quantity on hand based on the costing method.


Setup Notes and Prerequisites

The Item Number (ITM), Branch (MCU), Index (CDL) and Keys (CDL) are required input parameters.


Determine which Index and Keys for Item Location Table (F41021) you wish to use:


Index = 1: ( ITM, MCU, LOCN, LOTN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Location.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Location, and Lot.


Index = 2:(ITM, MCU, LOTN, LOCN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Lot.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Lot, and Location.


Index = 3:(MCU, LOCN, ITM, LOTN)

Keys = 1 : Fetch on Branch/Plant only.

Keys = 2 : Fetch on Branch/Plant and Location

Keys = 3 : Fetch on Branch/Plant, Location, and Short Item Number.

Keys = 4 : Fetch on Branch/Plant, Location, Short Item Number, and Lot.


Index = 5:(LOTN, ITM, MCU)

Keys = 1 : Fetch on Lot only.

Keys = 2 : Fetch on Lot and Short Item Number

Keys = 3 : Fetch on Lot, Short Item Number, and Branch/Plant.


Special Logic



 

Technical Specification


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

GENLNG        Item Master Record              I          N        If not passed in, 

GetItemMasterByShort (XF4101) will 

be

called to get CLEV.

PQOH          Quantity On Hand                O          N

PAID          Extended Cost                   O          N        Accumulate

F41021::PQOH*F4105::UNCS

for all records based on Index and

Keys passed in.

PCOM          Quantity Soft Committed         O          N

HCOM          Quantity Hard Committed         O          N

QOWO          Quantity On Work Order          O          N

PREQ          Quantity On Purchase Order      O          N

QWBO          Quantity On Receipt             O          N

EV01          Index                           I          Y

EV01          Keys                            I          Y


Related  Tables

F4101 - Item Master

F41021 - Item Location

F4105 - Item Cost


Related Business Functions

XF4105 - Get Item Cost


Processing

This function retrieves the Item Location records for the keys passed in.  The quantity on hand is 

accumulated for each record read.  The Item Cost is retrieved based on the inventory costing method.  

The unit cost is used to calculate the extended cost for all the records total quantity on hand.


Determine which Index and Keys for Item Location Table (F41021).

Index = 1: ( ITM, MCU, LOCN, LOTN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Location.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Location, and Lot.


Index = 2:(ITM, MCU, LOTN, LOCN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Lot.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Lot, and Location.


Index = 3:(MCU, LOCN, ITM, LOTN)

Keys = 1 : Fetch on Branch/Plant only.

Keys = 2 : Fetch on Branch/Plant and Location

Keys = 3 : Fetch on Branch/Plant, Location, and Short Item Number.

Keys = 4 : Fetch on Branch/Plant, Location, Short Item Number, and Lot.


Index = 5:(LOTN, ITM, MCU)

Keys = 1 : Fetch on Lot only.

Keys = 2 : Fetch on Lot and Short Item Number

Keys = 3 : Fetch on Lot, Short Item Number, and Branch/Plant.



Need to retrieve the Item Balance records (F41021) based on how many pieces of the key are sent.

If any piece of the key is equal to NULL that means you will not use it or any piece after

it. (i.e. If the Location field is equal to NULL you will only use Item Number and Branch as

your key when you fetch to the file. You will then 'spit and chew' on the Lot Number

if it is not equal to NULL.


Read all records that are equal to that key adding up the primary quantity on hand(PQOH) for each

of them.


Call the business function GetItemCost (XF4105.C) to retrieve the cost for the location passing

the following as parameters:

Costing Selection Inventory = I

Item Number = ITM from the F41021 record you just read

Branch = MCU from the F41021 record you just read

Location = LOCN from the F41021 record you just read

Lot = LOTN from the F41021 record you just read

Cost Level = the Level Inventory Cost field from the Item Master(F4101) record for the Item

Address to F4105 Record = Will be returned


Using the Cost (UNCS) in F4105 record returned, calculate the extended cost for each F41021

record you have read by multipying the Cost(UNCS) times the primary quantity on hand (PQOH).

If F41021::PQOH >= 0

Extended Cost = Extended Cost + (F4105::UNCS*F4102::PQOH)

End if

 

The following fields are returned:

The total primary quantity on hand is returned.  If this number is less than zero, zero is returned.

Total extended cost for all locations read.

Total quantity soft committed for all locations read.

Total quantity hard committed for all locations read.

Total quantity on work order for all locations read.

Total quantity on purchase order for all locations read.

Total quantity on receipt for all locations read.



Data Structure

D41021A - Calculate Quantity On Hand

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

GENLNG        Item Master Record              I          N        If not passed in, 

GetItemMasterByShort (XF4101) will 

be

called to get CLEV.

PQOH          Quantity On Hand                O          N

PAID          Extended Cost                   O          N        Accumulate

F41021::PQOH*F4105::UNCS

for all records based on Index and

Keys passed in.

PCOM          Quantity Soft Committed         O          N

HCOM          Quantity Hard Committed         O          N

QOWO          Quantity On Work Order          O          N

PREQ          Quantity On Purchase Order      O          N

QWBO          Quantity On Receipt             O          N

EV01          Index                           I          Y

EV01          Keys                            I          Y


Determine which Index and Keys for Item Location Table (F41021) you wish to use:


Index = 1: ( ITM, MCU, LOCN, LOTN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Location.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Location, and Lot.


Index = 2:(ITM, MCU, LOTN, LOCN)

Keys = 1 : Fetch on Short Item Number only.

Keys = 2 : Fetch on Short Item Number and Branch/Plant

Keys = 3 : Fetch on Short Item Number, Branch/Plant, and Lot.

Keys = 4 : Fetch on Short Item Number, Branch/Plant, Lot, and Location.


Index = 3:(MCU, LOCN, ITM, LOTN)

Keys = 1 : Fetch on Branch/Plant only.

Keys = 2 : Fetch on Branch/Plant and Location

Keys = 3 : Fetch on Branch/Plant, Location, and Short Item Number.

Keys = 4 : Fetch on Branch/Plant, Location, Short Item Number, and Lot.


Index = 5:(LOTN, ITM, MCU)

Keys = 1 : Fetch on Lot only.

Keys = 2 : Fetch on Lot and Short Item Number

Keys = 3 : Fetch on Lot, Short Item Number, and Branch/Plant.



^

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.

szLotLOTNcharNONENONE

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

idItemMasterRecordGENLNGIDNONENONE

Parameters
Data Item
     Data Structure Description     I/O     Required     Notes
GENLNG        Item Master Record              I          N        If not passed in, 
ab  ab  ab  ab  ab  ab  ab  ab  ab  ab  ab GetItemMasterByShort (XF4101) will be

ab  ab  ab  ab  ab  ab  ab  ab  ab  ab  ab called to get CLEV.


^

mnQuantityOnHandPQOHMATH_NUMERICNONENONE

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

mnExtendedCostPAIDMATH_NUMERICNONENONE

Parameters
Data Item
     Data Structure Description     I/O     Required     Notes
PAID          Extended Cost                   O          N        Accumulate
ab  ab  ab  ab  ab  ab  ab  ab  ab  ab  ab F41021::PQOH*F4105::UNCS

ab  ab  ab  ab  ab  ab  ab  ab  ab  ab  ab for all records based on Index and

ab  ab  ab  ab  ab  ab  ab  ab  ab  ab  ab Keys passed in.


^

mnQuantitySoftCommittedPCOMMATH_NUMERICNONENONE

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

mnQuantityHardCommittedHCOMMATH_NUMERICNONENONE

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

mnQuantityOnWorkOrderQOWOMATH_NUMERICNONENONE

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

mnQuantityOnPurchaseOrderPREQMATH_NUMERICNONENONE

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

mnQuantityOnReceiptQWBOMATH_NUMERICNONENONE

The number of units on work orders in primary units of measure.

cIndexEV01charNONENONE

Determine which Index and Keys for Item Location Table (F41021) you wish to use:

Index = 1:  ab ( ITM, MCU, LOCN, LOTN)

ab Keys = 1 : Fetch on Short Item Number only.

ab Keys = 2 : Fetch on Short Item Number and  ab  ab Branch/Plant

ab Keys = 3 : Fetch on Short Item Number,  ab  ab Branch/Plant, and Location.

ab Keys = 4 : Fetch on Short Item Number,  ab  ab Branch/Plant, Location, and Lot.

ab 

Index =  2:ab (ITM, MCU, LOTN, LOCN)

ab Keys = 1 : Fetch on Short Item Number only.

ab Keys = 2 : Fetch on Short Item Number and  ab  ab  Branch/Plantab 

ab Keys = 3 : Fetch on Short Item Number, Branch/Plant,  ab  ab and Lot.

ab Keys = 4 : Fetch on Short Item Number, Branch/Plant,  ab  ab Lot, and Location.


Index =  3:ab (MCU, LOCN, ITM, LOTN)

ab Keys = 1 : Fetch on Branch/Plant only.

ab Keys = 2 : Fetch on Branch/Plant and  Locationab 

ab Keys = 3 : Fetch on Branch/Plant, Location, and Short  ab  ab Item Number.

ab Keys = 4 : Fetch on Branch/Plant, Location, Short Item  ab  ab Number, and Lot.


Index =  5:ab (LOTN, ITM, MCU)

ab Keys = 1 : Fetch on Lot only.

ab Keys = 2 : Fetch on Lot and Short Item  Numberab 

ab Keys = 3 : Fetch on Lot, Short Item Number, and  ab  ab Branch/Plant.




^

cKeysEV02charNONENONE

Determine which Index and Keys for Item Location Table (F41021) you wish to use:

Index = 1:  ab ( ITM, MCU, LOCN, LOTN)

ab Keys = 1 : Fetch on Short Item Number only.

ab Keys = 2 : Fetch on Short Item Number and  ab  ab Branch/Plant

ab Keys = 3 : Fetch on Short Item Number,  ab  ab Branch/Plant, and Location.

ab Keys = 4 : Fetch on Short Item Number,  ab  ab Branch/Plant, Location, and Lot.

ab 

Index =  2:ab (ITM, MCU, LOTN, LOCN)

ab Keys = 1 : Fetch on Short Item Number only.

ab Keys = 2 : Fetch on Short Item Number and  ab  ab  Branch/Plantab 

ab Keys = 3 : Fetch on Short Item Number, Branch/Plant,  ab  ab and Lot.

ab Keys = 4 : Fetch on Short Item Number, Branch/Plant,  ab  ab Lot, and Location.


Index =  3:ab (MCU, LOCN, ITM, LOTN)

ab Keys = 1 : Fetch on Branch/Plant only.

ab Keys = 2 : Fetch on Branch/Plant and  Locationab 

ab Keys = 3 : Fetch on Branch/Plant, Location, and Short  ab  ab Item Number.

ab Keys = 4 : Fetch on Branch/Plant, Location, Short Item  ab  ab Number, and Lot.


Index =  5:ab (LOTN, ITM, MCU)

ab Keys = 1 : Fetch on Lot only.

ab Keys = 2 : Fetch on Lot and Short Item  Numberab 

ab Keys = 3 : Fetch on Lot, Short Item Number, and  ab  ab Branch/Plant.



^

mnProjectHardCommittedPJCMMATH_NUMERICOPTNONE

The number of units committed to a specified location and lot for a project.

mnSecondaryQtyOnHandSQOHMATH_NUMERICOPTNONE

The number of units on hand in secondary units of measure.

mnSecondaryQtySoftCommittedSCMSMATH_NUMERICOPTNONE

The number of units (expressed in the secondary unit of measure) that are soft-committed to sales orders or work orders.

mnSecondaryQtyHardCommittedHCMSMATH_NUMERICOPTNONE

The number of units (expressed in the secondary unit of measure) that are hard-committed to a specific location and lot.

mnSecondaryQtyWOHardCommittedSWHCMATH_NUMERICOPTNONE

The number of units, expressed in the secondary unit of measure, that are hard-committed to work orders.

mnSecondaryQtyOnPurchaseOrderSREQMATH_NUMERICOPTNONE

The number of units, expressed in the secondary unit of measure, that are specified on the purchase order.

mnSecondaryQtyOnWOReceiptSQWOMATH_NUMERICOPTNONE

The number of units, expressed in the secondary unit of measure, that are specified on the work order.

mnSecondaryProjectHardCommitPJDMMATH_NUMERICOPTNONE

The number of units committed to a specified location and lot for a project.

Related Functions

X4101 Validate and Retrieve Item Master

Related Tables

F4101 Item Master
F41021 Item Location File
F4105 Item Cost File