CalculateFirstOpCostBuckets

Calculate First Op Cost Buckets

Major Business Rule

Object Name: B3000650

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose

This function will calculate costs for cost types A1 & A2.  The function will be called to calculate 

the costs for only one at a time.  The bucket that these costs are to be accumulated in will be 

returned as well as the cost.  Other cost types can be calculated as well as long as they are assigned to 

either cost bucket '1' or '2'.


1.2Setup Notes and Prerequisites

The following are parameters that need to be retrieved or values that need to be determined before 

calling the function:

• The Accounting Cost Quantity for the Parent Item and Branch from F4102.
• The mode of processing.  '1' for build arrays and '2' to free memory.
• Send in Frozen/Simulated mode.  '1' for Frozen and '0' for Simulated.
• The Cost Bucket for the Cost Type may to be sent in.  If it is not, the function will return the 
Cost Bucket for the Cost Type sent in.


1.3Special Logic

If this business function is called, ultimately it should be called a final time to clean up the 

memory.


2.Technical Specifications


2.4Processing 

A.If Mode = '1' (First time to load arrays)

      If DS CostBucket is blank

      Find Cost Bucket for DS COST and save in DS EV02.


If Cost Type is not A1 or A2, then Cost Bucket should be '1' or '2'


Using the values from the F3003 record, find the F3002 record for the same item, Branch, and       

Type of Routing (use for Type of Bill).  Use ACQ sent in as the Batch Quantity.  If no record       


      exists, look for a record with a zero Batch Quantity.  Return the Batch Quantity used in 

DS BQTY       and Unit of Measure as Input in DS UOM.

      

      Process as follows for all BOM records with same Item, Branch, Type of Bill, and Batch 

Quantity:


1.  Process records if IXCOBY is NE 'I' or IXSBNT EQ zeros.

2.  If an As of Date is sent in, check to see if the as of date falls between IXEFFF and  

    IXEFFT.

3. Get IMCLEV (Item Cost Level) from F4101 with IXITM and IXCMCU.  If IMCLEV =  
    '3' Get Location, Lot, and Primary Bin from F41021.

4. Initialize costworkfield to zero

5. Get F4105 with IXITM, and IXCMCU.  Retrieve IBSTKT.  Call X0005 GetUDC to determine 

the item's stocking type. 

6. Get Net Added cost from F30026 Item Cost Components file, if not found,  then use 

F4105 Cost Ledger for costs.

• 
Load IXITM to IEITM, IXCMCU to IEMMCU, blanks to IELOCN, and IELOTN, 'A1' to 
IECOST, and DS LEDG to IELEDG

• Fetch to F30026 with key previously set
• If DS FROZEN = '1' use IESTDC, else use IEXSMC for costworkfield.
4. Retrieve COUNCS from F4105 with key as follows:

If IMCLEV = 1use  IXITM


If IMCLEV = 2use  IXITM

       IXCMCU


If IMCLEV = 3use  IXTM

       IXCMCU

       LILOCN

       LILOTN

determine cost method to use.  If  IBSTKT = 'M' use
else
use 

              DSLEDG

move COUNCS retrieved to costworkfield.
5.  Retrieve IBSTDP (Standard Potency) and IBOT1Y (Potency Control) for IXITM  

    

(Component Item) and IXMMCU (Branch) from F4102 (Item Branch File).

6.  Call Calculate Component Quantity (B3000580) (result $$QNTY).

7.  Accumulate $$QNTY in array (@CC).  Also save IXOPSQ in array (@CO).

Determine Component Scrap Quantity

8.  If IXSCRP NE zeros and $$QNTY NE zeros

divide IXSCRP by 100 and multiply times $$QNTY.

save result in $$QNTY.

9.  If IXFORQ EQ 'V' or EQ ' ' or EQ '%' and IXBQTY NE zeros

multiply $$QNTY times DS TRQT

Accumulate this result in an array (@CS).


At this point three arrays have been loaded:

@CO-Contains the BOM records OPSQ #'s in order that they were read.

@CC-Each BOM record quantity calculated.

@CS-Each BOM record scrap quantity calculated.


B.  If DS COST = A1 or A2

1.  If the bucket for cost type A1 LE '2' 

the total of all of the elements of array @CO will be the cost retruned.

2.  If the bucket for cost type A2 LE '2'

the total of all of the elements of array @CS will be the cost returned.


C.  If DS COST = A1 or A2

1.  If the bucket for cost type A1 GT '2'

Look up in @CO for the first element equal to IROPSQ

While the elements are equal to IROPSQ

Add the same element @CC to a work field QNTY.

Add 1 to array index.

Return cost.

2.  If the bucket for cost type A2 GT '2'

Look up in @CO for the first element equal to IROPSQ

While the elements are equal to IROPSQ

Add the same element @CS to a work field QNTY.

Add 1 to array index.

Return cost.


D.  If DS COST NE A1 or A2 and Cost Bucket = '1' or '2'

1.  Retrieve record from F30026 (Item Cost Component Add-ons) using the following key:

IRKIT = IEITM

IRMMCU = IEMMCU

BLANKS = IELOCN

BLANKS = IELOTN

DS LEDG = IELEDG

DS COST = IECOST


2.  If record is found 

If EV01 = '1' multiply IESTDC times DS TRQT

If EV01 NE '1' multiply IESTDC times DS TRQT

Return calculated cost and cost bucket.




Data Structure

D3000650 - Calculate First Op Cost Buckets

Parameter NameData ItemData TypeReq/OptI/O/Both
idRoutingMasterPtrGENLNGIDNONENONE

General purpose ID variable.

mnAccountingCostQtyACQMATH_NUMERICNONENONE

An amount that the system uses in the Cost Rollup program to determine the allocation of setup costs. The system totals the setup costs 
and divides the sum by this quantity to determine a unit setup cost. The default is 1.

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.

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.

cModeMODEcharNONENONE

The processing mode used in Purchase Order Consolidator to signify when specific orders are being processed.

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.

cFrozenEV01charNONENONE

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

mnRequestedQuantityTRQTMATH_NUMERICNONENONE

A value that represents the available quantity, which might consist of the on-hand balance minus commitments, reservations, and 
backorders. You enter this value in the Branch/Plant Constants program (P41001).

cBucketEV02charNONENONE

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

mnReturnedCostB1EV1MATH_NUMERICNONENONE

Work Amount field for the Manufacturing System.

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

cSuppressErrorMessageEV03charNONENONE

A radio button that specifies the level at which trace/track result is to be displayed.  Select the Detail to display all transactions except IB, IX, 
and IZ types.  Or, select Derivative Lots Only to display only those transactions that may have created new derivative lot. 

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.

szUnitOfMeasureUOMcharNONENONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

szStandardUOMConversionTFLAcharNONENONE

Allows you to bypass the item-specific unit of measure and use the standard unit of measure. Valid values are:    blank Use the item-specific 
unit of measure    1       Bypass the item-specific unit of measure and use the standard unit of measure

szPOCostMethodLEDGcharNONENONE

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.

szParentPrimaryUOMUOMcharNONENONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

mnItemNumberOriginalKITMATH_NUMERICOPTNONE

The system provides for three separate item numbers.    1.   Item Number (short) - An eight-digit, computer assigned, completely 
non-significant item number.    2.   2nd Item Number - The 25-digit, free form, user defined alphanumeric item number.    3.   3rd Item Number - Another 
25-digit, free form, user defined alphanumeric item number.

idFirstOpListPtrGENLNGIDOPTNONE

General purpose ID variable.

Related Functions

B3000580 Calculate Component Quantity
B4000520 Get Item UoM Conversion Factor

Related Tables

F3002 Bill of Material Master File
F30026 Item Cost Component Add-Ons
F3003 Routing Master File
F4101 Item Master
F4102 Item Branch File
F41021 Item Location File
F4105 Item Cost File