UseabilityGetWhereUsed

Useability - Get Where Used

Major Business Rule

Object Name: B3001690

Parent DLL: CMFGBASE

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose

This function gets useability where used.


1.2Setup Notes and Prerequisites

• Convert Requested Qty to primary UOM prior to calling this business function.
• The calling application/function must pass a Job Number (JOBS) which uniquely identifies a cache 
being used for this inquiry session;  this Job Number is retrieved by the Component Usability application 

(P30212) from the Next Numbers table (F0010 - System 30, index 1).



1.3Special Logic


2.Technical Specifications


2.4 Processing 

WorkFields

WK CurrentLowLevelCode

WK NextLowLevelCode

WK CurrentBranch

WK CurrentItem

WK CurrentType

WK CurrentBatchQty

WK CurrentUOM

WK Select

WK RejectedForGrade

WK RejectedForPotency

WK ParentStockingType

WK PurchasedManufactured

WK ProcessItem

WK Fixed Qty

WK VariableQty

WK RequiredQtyPrimary

WK ScrapQty

WK YieldQty

WK PrevLevelVariableQty

WK PrevLevelFixedQty


1.0. Determine the low level code of the component requested.

Call Internal Function Retrieve low level code using DS RequestedBranch and DS 
RequestedComponent.  Return the WK CurrentLowLevelCode.


2.0. Set Key fields to retrieve where used records from the Bill of Material Table (F3002).
WK CurrentBranch = DS RequestedBranch
WK CurrentItem = DS RequestedItem

WK CurrentType = DS RequestedType. 

WK CurrentBatchQTy = 0

WK CurrentBatchUOM = blank


3.0.  Set WK RejectedForGrade = '0'.

Set WK RejectedForPotency = '0'.
Set WK PrevLevelVariableQty = '0'

Set WK PrevLevelFixedQty = '0'.

Set WK NextLowLevelCode = 0.


4.0. Call Internal Function to Retrieve records from Bill of Material Table based on requested item.
Internal Function - RetrieveWhereUsed


5.0. Dowhile WK NextLowLevelCode is not > 0.

5.1.  Assign WK Current LowLevel = WK NextLowLevel.
5.2.  Wk NextLowLevel = WK NextLowLevel - 1.

5.3.Retrieve records from cache where ParentLowLevelCode is equal to WK CurrentLowLevelCode until 
fetch fails BF B3001680 Cache, ProcessPartUseability .

5.3.1.  If Cache ImplosionComplete is equal to '1', read next record.  
5.3.2.  Update cache record that was just fetched.  Assign Cache ImplosionComplete = '1'.

5.3.3. WK CurrentBranch = Cache ParentBranch.

5.3.4. WK CurrentItem = Cache ParentItem
5.3.5. WK CurrentType = CacheParentType

5.3.6. WK CurrentBatchQty = CacheParentBatchQty

5.3.7. WK CurrentBatchUOM = CacheParentUOM

5.3.5. WK PrevLevelVariableQty = Cache VariableQty
5.3.6. WK PrevLevelFixedQty = Cache FixedQty

5.3.7. Call Internal Function RetrieveWhereUsedRecords


Internal Functions

RetrieveLowLevelCode

1.Retrieve the low level code from the Item Branch Table using the Item (ITM) and Branch (MCU).  
Return Low Level Code (LLX) and Stocking Type (STKT).



RetrieveWhereUsedRecords


1.0. Retrieve Records from Bill of Material Table until fetch fails.
Index:  

Where:  CMCU = WK CurrentBranch

ITM = WK CurrentItem

Return:   COBY, EFFF, EFFT, FRGD, THGD, FRMP, THRP, TBM, CMCU, ITM, MMCU, KIT, BQTY, TBM, CPNT, 
QNTY, FORQ, SCRP, STPP, UOM.


1.1.  Set WK Select = '1'.

Set WK PurchasedManufactured = 'M'.
Set WK ProcessItem = '0'.

Set WK FixedQty = 0

Set WK VariableQty = 0


1.2. Validate that record retrieved is not a Co-Product, By-Product, or Intermediate Item.

If F3002 COBY is equal to 'C', 'B', or 'I', set WK Select = '0'. 


1..3. If DS AsOfDate is not equal to zero, validate date effectivity.

If DS AsOfDate is less than F3002 effective From or DS AsOfDate is greater than F3002 Effective 
Thru, set WK Select = '0'.


1.4.  If F3002 FromGrade (FRGD) and F3002 ThruGrade (THGD) are not equal to blanks, validate grade.

If DS LotGrade is less than F3002 FromGrade(FRGD) or DS LotGrade is greaterthan F3002 
ThruGrade(THGD), set WK Select = '0' and set WK RejectedforGrade = '1'.


1.5. If F3002 FromPotency (FRMP) and F3002 ThruPotency (THRP) are not equal to blanks, validate 
potency.

If DS LotPotency is less than F3002 FromPotency(FRMP) or DS LotPotency is greaterthan F3002 
ThruPotency (THRP), set WK Select = '0', and set WK RejectedforPotency = '1'.


1.6. If WK CurrentType is not equal to blanks or '*', validate type of bill.
If WK CurrentType is not equal to F3002 Type of Bill, set WK Select = '0'.

1.7. If WK Select is equal to '1', retrieve values to store in Cache.
1.7.1. Cache ComponentLowLevelCode = WK CurrentLowLevelCode
1.7.2. Cache Component = F3002 Item Number (ITM)

1.7.3. Cache ComponentBranch = F3002 Component Branch (CMCU)

1.7.4. Cache ParentItem = F3002 ParentItem (KIT)

1.7.5. Cache ParentBranch = F3002 ParentBranch (MMCU)

1.7.6. Cache ParentBatchQty = F3002 BatchQty (BQTY)

1.7.7. Cache ParentUOM = F3002 UOM

1.7.8. Cache ParentType = F3002 TypeofBill (TBM)

1.7.9. Cache CMP(Complete Implosion) = '0'

1.7.10. Retrieve Parent Low Level Code.  Call Internal Function RetrieveLowLevelCode usine 

F3002 Parent Item (KIT) and F3002 Parent Branch (MMCU).  Return Cache ParentLowLevelCode and WK 

ParentStockingType.

1.7.11. Determine if Manufactured or Purchased and if the item is a Process.

Use BF GetUDC to retrieve the 2nd description and Special Handling Code.

Cache PurchasedManufactured = first character of 2nd description from GetUDC

Cache ProcessItem = special handling code from GetUDC.

1.7.12. Cache ComponentBatchQty = WK CurrentBatchQty

Cache ComponentUOM = WK CurrentUOM
Cache ComponentType = WK  CurrentType

17.13  If the Parent's low level code is not = 1, then check if this parent is at the 
top-level (i.e. perform a where-used check against F3002).  If the parent is at the 

top-level, change the low level code in the cache data structure to 1.


17.14. Determine if add or update to cache will be performed.  Fetch record from cache
using (BF B3001680 Cache, ProcessPartUseability):
ParentLowLevelCode
ParentItemNumber

ParentBranch

ParentBatchQty

ParentType

ComponentLowLevelCode

Component

ComponentBranch

ComponentBatchQty

ComponentType

17.15. Calcuate Variable & Fixed Qty.  Call Internal Function CalculateQuantities.
Send :  F3002 Component (ITM)
F3002 ComponentBranch (CMCU)
F3002 Quantity Required (QNTY)

F3002 Batch Quantity (BQTY)

F3002 Scrap Percent (SCRP)

F3002 Yield Percent (STPP)

F3002 FixedorVariable (FORQ)

WK PrevLevelFixedQty

WK PrevLevelVariableQty

Return:  WK VariableQty
WK FixedQty
17.15.Add or Update record in cache.  If updating, add the WK Fixed Qty and WK Variable Qty to 
the existing quantities stored.  BF B3001680 Cache, ProcessPartUseability 

17.15.1. If Add, Cache FixedQtyRequired = WK FixedQty  and   Cache VariableQtyRequired 
= WK VariableQty.

• 
If the Parent's low level code is not = 1, then check if this parent is at the top-level 
(i.e. perform a where-used check against F3002).  If the parent is at the top-level, 

change the low level code in the cache data structure to 1.

17.15.2. If Update, add WK FixedQty to Cache FixedQtyRequired.  Add WK VariableQty to 
Cache VariableQtyRequired.

17.15.3. On add or update, increment the Number of Records selected parameter to be 

passed back to calling program.

17.16. If WK NextLowLevelCode is less than ParentLowLevelCode, set WK NextLowLevelCode = 
ParentLowLevelCode.





CalculateQuantities

1.0. Set WK FixedQty = 0.  Set WK VariableQty = 0.
1.1. Retrieve the primary UOM for the Component Item from the Item Master Table (F4101) using the 

Component Item Number.

1.2. Retrieve the OT1Y and Standard Potency (STDP) from the Item Branch Table (F4102) using the 

Component Branch and Component Item.

1.3. If F3002 FixedOrVariable is equal to '%', divide the F3002 Quantity Required by 100 before 

converting to primary UOM.

1.4. Convert Quantity Required to Primary UOM.  OT1Y and STDP are parameters passed in the Unit of 

measure conversion program.  WK RequiredQtyPrimary

1.5. Set WK ScrapQty = 0.  Set WK YieldQty = 0.

1.6. If F3002 ScrapPercent is not equal to zero, WK ScrapQty  = WK RequiredQtyPrimary * (F3002 

ScrapPercent / 100).

1.7. If F3002 Yield Percent is not equal to zero, WK YieldQty  = WK RequiredQtyPrimary * (F3002 

YieldPercent / 100).

1.8. WK RequiredQtyPrimary = WK RequiredQtyPrimary + WK ScrapQty + WK YieldQty.

1.9. If F3002 FixedOrVariable = 'F' OR (F3002 FixedoRVariable = '%' and F3002 BatchQty not = 0)


WK Fixed Qty = WK PrevLevelFixedQty + WK RequiredQtyPrimary
WK VariableQty = WK PrevLevelVariableQty. 


Else


if WK PrevLevelVariableQty not Equal to  0








Data Structure

D3001690 - Useability - Get Where Used

Parameter NameData ItemData TypeReq/OptI/O/Both
szRequestedBranchCMCUcharNONENONE

A secondary or lower-level business unit. The system uses the value that you enter to indicate that a branch or plant contains several 
subordinate departments or jobs. For example, assume that the component branch is named MMCU. The structure of MMCU might be as follows:    
Branch/Plant - (MMCU)       Dept A - (MCU)       Dept B - (MCU)       Job 123 - (MCU)

mnRequestedComponentITMMATH_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

mnRequestedQtyPrimaryRQTE1MATH_NUMERICNONENONE

The number of parent items that you want to process. The system calculates lower level values in quantity per the number of parent items 
requested. For instance, if it takes 3 components per a parent item, then with a requested quantity of 10, the system would plan and cost for 30 
components.

jdAsOfDateASDE1JDEDATENONENONE

The date used for effectivity checking. Enter a specific date to display documents (orders, bills of material, routings, as applicable) that are 
effective on or after that date. The current system date is the default, but you can enter any future or past date.

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).

szRequestedTypeTBMcharNONENONE

A user defined code (40/TB) that designates the type of bill of material. You can define different types of bills of material for different uses. 
For example:    M     Standard manufacturing bill    RWK   Rework bill    SPR   Spare parts bill  The system enters bill type M in the work order 
header when you create a work order, unless you specify another bill type. The system reads the bill type code on the work order header to 
know which bill of material to use to create the work order parts list. MRP uses the bill type code to identify the bill of material to use when it 
attaches MRP messages. Batch bills of material must be type M for shop floor management, product costing, and MRP processing.

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).

mnJobnumberJOBSMATH_NUMERICNONENONE

The job number (work station ID) which executed the particular job.

Related Functions

B3001680 Cache - Process Part Useability
B4000520 Get Item UoM Conversion Factor
X0005 Get User Defined Codes

Related Tables

F0005 User Defined Codes
F3002 Bill of Material Master File
F4101 Item Master
F4102 Item Branch File