CostingProcessWhereUsed

Costing Process Where Used

Major Business Rule

Object Name: B3001640

Parent DLL: CMFGBASE

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
The purpose of this function is to read through Cache memory for all CoByProducts that exist for a 
process item and apportion the Ingredient costs to the appropriate CoByProducts.


1.2Setup Notes and Prerequisites

This function is called from BF 3000680.C UpdateTotalCostInformation.  UpdateTotalCostInformation 
processes all where used logic for discrete manufacturing.  Therefore, at the point this business 

function is called, the cost of the ingredient is already rolled up into the cost of the Process.  This 

function performs the last Process task and approtions the ingredient cost across all CoByProducts.


1.3Special Logic

This function will read through Cache memory in a loop, and within that main loop, it will read 
through the same Cache memory for specific cache records that match the operation sequence of the main 

loop.  The function must be able to pick back up where it left off in the main Cache loop.


2.Technical Specifications


2.4 Processing 
This business function comprises the logic from P30820 subroutines S010X, S010Y and S010Z.  The basic 
functionality for this function is to Apportion the ingredient cost for the process to the CoBy 

Products.  Each CoByProduct that comes out after the ingredient has been used, is given a portion of the 

ingredient cost.  The F30026 file is updated for the CoByProduct.  Fixed CoByProduct Costs are also 

taken care of in this function.



Work Fields

TotalCostDistributedMN29D9
TotalCostMN29D9

CoByCostMN29D9

WK SaveOperationSequenceOPSQ

WK ProcessTransQtyQNTY

WK UnitCostMN29D9



LinkList/Cache/WorkFile Variables

COBYCoByProductAS/400 @CB
KITCoByProduct ItemAS/400 @CK

KITLCoByProduct Item2ndAS/400 @C2

KITACoByProduct Item3rdAS/400 @C3

BQTYCoByProduct QuantityPrimary?

BQTY CoByProduct QuantityTranactionAS/400 @CQ

CONVConversionFactorAS/400 @CU

MMCUCoByProduct BranchAS/400 @CM

OPSQOperationSequenceAS/400 @CO

F$RPFeatureCostPercentAS/400 @CF

F$RPCoByProductCostPercent.AS/400 @CC

F$RPCoByProduct%RateAS/400 @CE

XSMCCoByTotB1-C4AS/400 @CL

XSMCCoBy%B1-C4AS/400 @CP




0.0 Initalize WK TotalCostDistributed = 0, WK CoByCost = 0, WK TotalCost = DS IngredientCost


1. Read each CoByProduct from cache sequentially, using BF 3001650, '0' keys, but must use DS JOBS 

to get the right cache for the cost rollup run. (LOOP)

Ingredient must be used before CoByProduct  comes out.

2.0 If DS OperationSequence LE Cache OperationSequence and DS OperationSequence NE 0

2.1 If WK SaveOperationSequence NE Cache OperationSequence (new operation step)
2.1.2 Set WK SaveOperationSequence = Cache OperationSequence
2.1.3 Check to see if there are any fixed CoByProducts for this operation step.

If DS CostType = 'A1'
Save Cache key fields:  Process Branch, Process, CoByProduct, OperationSequence, 
and CoByProductLineNumber

Call internal function: Check for Fixed CoBy Products

Re-load Cache key fields, call BF 3001650 in mode '5', keys '5', retrieve Cache.

2.1.4  WK TotalCost = WK TotalCost - WK TotalCostDistributed  (can't distribute 
what has already been apportioned)

2.1.5  WK TotalCostDistributed = 0 (re-set)
2.3 If WK TotalCost != 0 (there is still cost to distribute)
2.3.1 If Cache FeatureCostPercent != 0
2.3.1.1 Fetch F30026 for CoBy, Set F30026 index with:
F30026 Item Number = Cache CoByProduct
F30026 Branch = Cache CoByProductBranch

F30026 Location and Lot = Blanks

F30026 Cost Method = DS Cost Method

F30026 Cost Type = DS Cost Type

2.3.1.2 WK CoByCost = 0
2.3.1.3 WK CoByCost = WK TotalCost x (Cache FeatureCostPercent / 100)

2.3.1.4 WK TotalCostDistributed = WK TotalCostDistributed + WK CoByCost. 2.3.1.5 

Get WK CoByCost in 15.0

2.3.2 If Cache FeatureCostPercent != 0 and WK CoByCost != 0,Do Further Calc. on Cost
2.3.2.1.If Cache CoByProductCostPercent != 1.00
WK CoByCost = WK CoByCost x Cache CoByProductCostPercent
2.3.2.2.Set WK ProcessTransQty = DS ProcessBatchQty
If WK ProcessTransQty = 0 Set WK ProcessTransQty = 1
WK ProcessTransQty = WK ProcessTransQty x DS CONV

2.3.2.3.WK CoByCost = WK CoByCost x WK ProcessTransQty
sar? code used to be GT 1.

2.3.2.4.If Cache ConversionFactor NE zero

WK CoByCost = WK CoByCost / Cache ConversionFactor
2.3.2.5.If Cache CoByProductQuantityTransaction NE zero 
WK CoByCost = WK CoByCost / Cache CoByProductQuantityTransaction
2.3.2.6.Get WK CoByCost from 29.9 into 15.0 decimal postions.  You must round up as 
you go.

2.3.2.7.If DS CostType = 'A2'

F30026 ManfucaturedCost - Simulated(XSMC) = F30026 ManufacturedCost - 
Simulated(XSMC) + WK CoByCost

else

F30026 Cost Rollup -Simulated(XSCR) = F30026 Cost Rollup -Simulated(XSCR) + 

WK CoByCost

2.3.2.8Get Audit Information
2.3.2.9.If F30026 record was found, move Cache CoByProductItem2nd to F30026 LITM, 

move Cache CoByProductItem3rd to F30026 AITM and update F30026.  If F30026 record was 

not found, then Write F30026.



Check for Fixed CoBy Products

1.0 Read CoByProducts from cache using BF 3001650, keys '3' , mode '4'. (LOOP)

1.1 If Cache OperationSequence != zeros and Cache FeatureCostPercent = Zeros
1.1.1 Fetch F30026 for CoBy, Set F30026 index with:
F30026 ItemNumber = Cache CoByProduct
F30026 Branch = Cache CoByProductBranch

F30026 Location and Lot = Blanks

F30026 Cost Method = DS Cost Method

F30026 Cost Type = DS Cost Type

1.1.2. Initialize WK CoByCost = 0
1.1.3. If F30026 Cost Rollup - Simulated(XSCR) = zeros

Call BF F4101 Get Item Master Row By Short Item with:
ItemNumber = Cache CoByProduct
ReturnPointer = '1'

SuppressErrorMsg = '1'

Get Genlng-F4101Pointer

Call BF F4101 Get Item Manufacturing Information with:
Genlng = Genlng- F4101Pointer
Get F4101-ItemCostLevel, and Call BF free ptr to data structure

If F4101-ItemCostLevel = '3' Call BF F41021 Get Item Location Row with:
Branch = Cache CoByProductBranch
Item Number = Cache CoByProduct

Index = '4'

Keys = '3'

Call Type '1'

Get F41021-Location and F41021-Lot

Call BF XF4105 Get Item Cost with:
Cost Method = DS Cost Method
Item Number = Cache CoByProduct

Branch = Cache CoByProductBranch

Location = F41021-Location

Lot = F41021-Lot

Cost Level = F4101-ItemCostLevel

Call Type = '1'

Return Pointer = '1'

Get F4105- Error Code

Get F4105Pointer

If F4105 - Error Code != 0

set WK UnitCost = zeros
else
Call BF XF4105 Get Item Cost Information with:
Genlng = F4105Pointer

Get Unit Cost, and Call BF free ptr to data structure

Set WK Unit Cost = F4105 Unit Cost in 29.9 decimals

If WK UnitCost NE zeros
Set WK ProcessTransQty = DS ProcessBatchQty
If WK Process TransQty = 0, Set WK ProcessTransQty = 1

WK ProcessTransQty = WK ProcessTransQty x DS CONV
WK Unit Cost = WK Unit Cost / WK ProcessTransQty
sar? code used to be GT 1.

If Cache ConversionFactor NE zero

WK UnitCost = WK Unit Cost / Cache ConversionFactor
If Cache CoByProductQuantityTransactio NE zero
WK UnitCost = WK Unit Cost x Cache CoByProductQuantityTransaction
Get WK Unit Cost from 29.9 to 15.0 decimals, round as you go.
WK TotalCostDistributed = WK TotalCostDistributed + WK UnitCost
Set F30026 Cost Roll-Sim(XSCR) = F30026 Cost Roll-Sim(XSCR) + WK Unit Cost.

Get Audit information

If F30026 record was found, move Cache CoByProductItem2nd to F30026 LITM, move Cache 

CoByProductItem3rd to F30026 AITM and update F30026.  If F30026 record was not found, then Write F30026.

^

Data Structure

D3001640 - Costing Process Where Used

Parameter NameData ItemData TypeReq/OptI/O/Both
mnOperationSequenceOPSQMATH_NUMERICNONENONE

A number used to indicate an order of succession. In routing instructions, a number that sequences the fabrication or assembly steps in the 
manufacture of an item. You can track costs and charge time by operation. In bills of material, a number that designates the routing step in the 
fabrication or assembly process that requires a specified component part. You define the operation sequence after you create the routing 
instructions for the item. The Shop Floor Management system uses this number in the backflush/preflush by operation process. In engineering 
change orders, a number that sequences the assembly steps for the engineering change. For repetitive manufacturing, a number that 
identifies the sequence in which an item is scheduled to be produced. Skip To fields allow you to enter an operation sequence that you want to begin 
the display of information. You can use decimals to add steps between existing steps. For example, use 12.5 to add a step between steps 
12 and 13.

szCostMethodLEDGcharNONENONE

A user defined code (40/CM) that specifies the basis for calculating item costs. Cost methods 01 through 19 are reserved for J.D. Edwards 
use.

mnIngredientCostMN29D9MATH_NUMERICNONENONE

This is a generic field used as a work field in Everest.

szCostTypeCOSTcharNONENONE

A code that designates each element of cost for an item. Examples of the cost object types are:   o  A1  Purchased raw material   o  B1  
Direct labor routing rollup   o  B2  Setup labor routing rollup   o  C1  Variable burden routing rollup   o  C2  Fixed burden routing rollup   o  Dx  Outside 
operation routing rollup   o  Xx  Extra add-ons, such as electricity and water  The optional add-on computations usually operate with the type 
Xx extra add-ons. This cost structure allows you to use an unlimited number of cost components to calculate alternative cost rollups. The 
system then associates these cost components with one of six user defined summary cost buckets.

mnProcessBatchQtyBQTYMATH_NUMERICNONENONE

The quantity of finished units that you expect this bill of material or routing to produce. You can specify varying quantities of components 
based on the amount of finished goods produced. For example, 1 ounce of solvent is required per unit up to 100 units of finished product. 
However, if 200 units of finished product is produced, 2 ounces of solvent are required per finished unit. In this example, you would set up batch 
quantities for 100 and 200 units of finished product, specifying the proper amount of solvent per unit.

mnUOMConversionFactorCONVMATH_NUMERICNONENONE

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

cSuppressErrorMessagesEV01charNONENONE

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

szErrorMessageIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

szProgramIDPIDcharNONENONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

mnJobNumberJOBSMATH_NUMERICNONENONE

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

cCostByWCCWCcharOPTNONE

A code, maintained in the Manufacturing Constants program (P3009), that indicates whether the system tracks cost variances for discrete 
and process items on a summarized level in the Item Cost Component Add-Ons table (F30026) or on a detailed level in the Item Cost 
Component Detail table (F300261). Valid values are: Y Yes. Maintain costs on a detailed level by cost component and work center. N No. Maintain costs 
on a summarized level by cost component only.

szWorkCenterMCUcharOPTNONE

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.

Related Functions

B3001200 Get BOM Mfg Info
B3001650 Cache, Process CoBy Product
B9800100 Get Audit Information
X4101 Validate and Retrieve Item Master
XF41021 Update F41021 Locations
XF4105 Item Cost I/O

Related Tables

F30026 Item Cost Component Add-Ons
F300261 Item Cost Component Detail