UpdateAverageCostsBrazil

Update Average Costs - BRA - 43A

Major Business Rule

Object Name: B7602030

Parent DLL: CLOC

Location: Client/Server

Language: C

Business Function Specification

Source NameB7602030DesignerMiriam Kato
Data Structure 
D7602030ProgrammerMiriam Kato
Function Name
 Update Average CostSystem Code76
Function CategoryUpdate
Function UseUPD

Revisions Log 
DateProgrammerSAR NumberDescription
06/17/98Miriam Kato1844117Created



1.Functional Description

1.1Purpose
This Business Function updates the Cost Ledger, Average Cost for the a given amount passed as parameter.

1.2Setup Notes and Prerequisites


1.3Special Logic


Technical Specifications

2.1 Parameters:

Data Item Data Structure DescriptionI/ORequiredNotes
IVI      cInventoryInterfaceIYFrom F40205, used to define if calculate Costs or not

ITMmnShortItem          IYFrom F43121 or other file, key field

LOCNszLocation                             IYFrom F43121 or other file, key field

LOTNszLotNumber                IYFrom F43121 or other file, key field

MCUszBusinessUnitIYFrom F43121 or other file, key field

AAszInventoryAmountIYAmount for costing

UOMszUnitOfMeasureIYFrom F43121 or other file, for UOM Conversion

UOM3szUnitOfMeasurePOIYFrom F43121 or other file, for UOM Conversion

UOPNmnUnitsOpenQuantityIYFrom F43121 or other file, for Average Costing

URECmnUnitsReceivedIYFrom F43121 or other file, for Average Costing

PIDszProgramID       IYCalling Program Name, to check in 40/AV

LOTPmnLotPotency       IYFrom F43121 or other file; used for UOM Conversion

ARECmnAmountReceivedIYFrom F43121 or other file, for Last-In Cost

ECSTmnExtendedCostsIYFrom F43121 or other file, for Last-In Cost

CRYRcCurrencyConverYNARIYFrom initialization

CNVcCurrencyConversionFlagIYFrom initialization

CRCDszCurrencyCodeIYFrom report initialization, for X4181 (Update Average Cost) and X4078 (Update Base Price for 

Margin)

EV01cReturnStatus       Oif 1, error; otherwise, no error



2.2Related Tables 

Table Table Description


2.3Related Business Functions

Source NameFunction Name
X4101                F4101 Get Item Master Row

XF4105                F4105 Get Item Cost / Update Item Cost

B4100210Get Item Branch Row

B4000520F41002 Get Item UOM Conversion

X4181                Calculate Average Cost

X4078                Update Base Price for Margin




2.4Processing 

General Logic - Flow

Main


// Bypass updates if additional costs are zero or if not full inventory interface

If LFIVI <> Y

Return
Endif

//Get Average Cost Flag in 40/AV, key = PID


//Get Item Master Row X4101

Call "F4101 Get Item Master Row" to read Inventory Cost Level CLEV (for X4105) and Price Level PLEV (for Price Recalculation if Margin Maintenance) , 

LITM and AITM (for Update Cost XF4105)


//Retrieve Inventory Costing Method

Call "Get Item Cost" (XF4105) to read Cost Method LEDG (for Price Recalculation if Margin Maintenance and Update Item Cost) and get the Item Cost 

Row 
(for Update Item Cost)

// Retrieve Item Branch Information

Call "Get Item Branch Row" (B4100210) to read Potency Control OT1Y , Standard Potency STDP  (for Perform Unit of Measure Conversion) and Margin 

Maintenance MMPC (for Price Recalculation if MM)


//Perform Unit of Measure Conversion

If (Quantity Open not equal zero)

Call "F41002 Get Item UOM Conversion" (B4000520) to read Quantity in Primary UoM (for Extended Cost), Conversion PO to Primary (for 
Primary Unit Cost) and Conversion Transaction to Primary for Quantity Open (UOPN)

Else

Quantity in Primary UoM, Conversion PO to Primary, Conversion Transaction to Primary = 1.0
Endif


//Calculate Additional Unit Cost

Unit Cost = Inventory Amount / Qty Received (PRUREC)

If (Conversion PO to Primary not zero)

Unit Cost in Primary = Unit Cost / Conversion PO to Primary
Endif


//Calculate Extended Cost

If (Average Cost Flag equal to 1) 

Extended Cost (ECST) = Qty Open in Primary UoM *Unit Cost
// Write Average Cost Transaction

If ((Margin Maintenance IBMMPC not equal zero) and (Price Level IMPLEV equal Cost Level IMCLEV) and (Cost Method is equal to 02))

Margin Maintenance = 'Y'
Else
Margin Maintenance = 'N'
Endif
Call "Update Average Cost" (XF4181) to update Costs

Endif



//Perform Unit of Measure Conversion

If (Quantity Received not equal zero)

Call "F41002 Get Item UOM Conversion" (B4000520) to read Quantity in Primary UoM (for Last In  Cost), Conversion PO to Primary (for Primary 
Unit Cost) and Conversion Transaction to Primary for Quantity Received (UREC) using Lot Potency from F43121

Endif


//Calculate new Last-In Cost (Add additional cost to amount received and taxes)

Amount Unit Cost (CSTL) = (PRAREC + PRECST)/Qty Received in Primary Uom + Unit Cost


//If margin maintenance, recalculate unit price; perform change if Cost Level = Price Level and the Cost Method is type 1 or 6

If ( (Margin Maintenance IBMMPC not equal zero) and (Price Level IMPLEV equal to Cost Level IMCLEV) )

If ( Cost Method equal 01 or 06)
Call "Update Base Price for Margin" (X4078)
Endif
Endif


//Update Lot Cost (Cost Level = 06)

If Cost Method == 06

Cost Level = 06
Call Get Item Cost depending on Cost Level IMCLEV

Update field UNCS = Amount Unit Cost (CSTL)

Call Update Item Cost depending on Cost Level IMCLEV

Endif


//Update Last In Cost (Cost Level = 01)

Cost Level = 01

Call Get Item Cost depending on Cost Level IMCLEV

Update field UNCS = Amount Unit Cost (CSTL)

Call Update Item Cost depending on Cost Level IMCLEV


================================================================================


Reminder:


H40/CL

Cost LevelItem Only (1)

Item/Branch Only (2)
Item/Branch/Location/Lot (3)


40/CM

Cost MethodLast In (01)

Lot (06)

Weighted Average (02)



^

Data Structure

D7602030 - Update Average Cost - Brazil                          - 43A

D7602030 - Update Average Cost - Brazil
Data Item Structure DescriptionI/ORequiredNotes

IVIcInventoryInterfaceIYFrom F40205, used to define if calculate Costs or not

ITMmnShortItem          IYFrom F43121 or other file, key field

LOCNszLocation                IYFrom F43121 or other file, key field

LOTNszLotNumber                IYFrom F43121 or other file, key field

MCUszBusinessUnitIYFrom F43121 or other file, key field

AAszInventoryAmountIYAmount for costing

UOM3szUnitOfMeasurePOIYFrom F43121 or other file, for UOM Conversion

UOPNmnUnitsOpenQuantityIYFrom F43121 or other file, for Average Costing

URECmnUnitsReceivedIYFrom F43121 or other file, for Average Costing

PIDszProgramID       IYCalling Program Name, to check in 40/AV

LOTPmnLotPotency       IYFrom F43121 or other file; used for UOM Conversion

ARECmnAmountReceivedIYFrom F43121 or other file, for Last-In Cost

ECSTmnExtendedCostsIYFrom F43121 or other file, for Last-In Cost

CRYRcCurrencyConverYNARIYFrom initialization

CNVcCurrencyConversionFlagIYFrom initialization

CRCDszCurrencyCodeIYFrom report initialization, for X4181 (Update Average Cost) and X4078 (Update Base Price for 

Margin)

EV01cReturnStatus       Oif 1, error; otherwise, no error

UOM1szUnitOfMeasurePrimaryIYFrom F43121 or other file, for UOM Conversion


^

Parameter NameData ItemData TypeReq/OptI/O/Both
cInventoryInterfaceIVIcharOPTINPUT

A code that identifies the type of interface to the Inventory Management system. Valid values are:    Y The dollar or unit value of any activity 
containing this line type will be reflected in inventory. The system also edits the item that you enter to ensure that it is a valid item. Y is the 
default.    A The system recognizes the number that you enter as a G/L account number. The system uses this code in purchasing only.    B The 
system performs edits when using format 4 in purchase order entry.        The system retrieves price data from the inventory tables, but does not 
update the quantity on the purchase order. This code is valid only when you have set the G/L Interface field to Y (yes). Budget checking is 
fully functional when you use this interface code.    D The item in this line is an inventory item that will not affect availability or quantities.    N The 
item is not an inventory item. To verify whether the item exists in the Item Master file, use Inventory Interface N in conjunction with the flag, Edit 
the Item Master for Non-Stock Items.

mnIdentifierShortItemITMMATH_NUMERICOPTINPUT

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

szLocationLOCNcharOPTINPUT

The storage location from which goods will be moved.

szLotLOTNcharOPTINPUT

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

szCostCenterMCUcharOPTINPUT

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.

mnAmountFieldAAMATH_NUMERICOPTINPUT

A number that identifies the amount that the system will add to the account balance of the associated account number.  Enter credits with a 
minus sign (-) either before or after the amount. 

szUnitOfMeasurePurchasUOM3charOPTINPUT

A code (table 00/UM) that identifies the unit of measure in which you usually purchase the item.

mnUnitsOpenQuantityUOPNMATH_NUMERICOPTINPUT

The original quantity for the order detail line, plus or minus any changes to that quantity, minus all quantities shipped, received, and 
vouchered to date.

mnUnitsLineItemQtyReURECMATH_NUMERICOPTINPUT

The original quantity of the order line, plus or minus any changes to that quantity, less all quantities shipped, received and/or vouchered to 
date. This number can also be the actual quantity received.

szProgramIdPIDcharOPTINPUT

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.

mnLotPotencyLOTPMATH_NUMERICOPTINPUT

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

mnAmountReceivedARECMATH_NUMERICOPTINPUT

The value of the goods received to date against the original order line.

mnAmountExtendedCostECSTMATH_NUMERICOPTINPUT

For accounts receivable and accounts payable, the invoice (gross) amount. For sales orders and purchase orders, the unit cost times the 
number of units.

cCurrencyConverYNARCRYRcharOPTINPUT

A code that specifies whether to use multi-currency accounting, and the method of multi-currency accounting to use: Codes are:    N Do not 
use multi-currency accounting. Use if you enter transactions in only one currency for all companies. The multi-currency fields will not appear 
on forms. The system supplies a value of N if you do not enter a value.    Y Activate multi-currency accounting and use multipliers to convert 
currency. The system multiplies the foreign amount by the exchange rate to calculate the domestic amount.    Z Activate multi-currency 
accounting and use divisors to convert currency. The system divides the foreign amount by the exchange rate to calculate the domestic amount.

cCurrencyConversionFlagEV01charOPTINPUT

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

cReturnStatusEV02charREQOUTPUT

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

szUnitOfMeasurePrimaryUOM1charOPTINPUT

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

Related Functions

None

Related Tables

None