CM_PERRCUR2_VW

(SQL View)
Index Back

Current Weighted Average Cost

10/10/02 lee: add cm_book and cost_element, as keys. Note: this view selects the latest perpavg records, for an item and bu and book . The records have book and cost element granularity. 08/03 SAME AS perrcur_vw except for the dummy rows included and cumulative qty added to view

SELECT A.BUSINESS_UNIT , A.CM_BOOK , A.INV_ITEM_ID , A.COST_ELEMENT , A.DT_TIMESTAMP , A.SEQ_NBR , A.CM_UNIT_COST , A.CURRENCY_CD , A.CUMULATIVE_QTY , A.CM_COST_SOURCE FROM PS_CM_PERRAVG_COST A WHERE A.DT_TIMESTAMP = ( SELECT MAX(B.DT_TIMESTAMP) FROM PS_CM_PERRAVG_COST B WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.INV_ITEM_ID = B.INV_ITEM_ID AND A.CM_BOOK = B.CM_BOOK ) AND A.SEQ_NBR = ( SELECT MAX(C.SEQ_NBR) FROM PS_CM_PERRAVG_COST C WHERE A.BUSINESS_UNIT = C.BUSINESS_UNIT AND A.INV_ITEM_ID = C.INV_ITEM_ID AND A.CM_BOOK = C.CM_BOOK AND A.DT_TIMESTAMP = C.DT_TIMESTAMP )

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit
2 CM_BOOK Character(10) VARCHAR2(10) NOT NULL Cost Book
3 INV_ITEM_ID Character(18) VARCHAR2(18) NOT NULL Item ID
4 COST_ELEMENT Character(4) VARCHAR2(4) NOT NULL Cost Element
5 DT_TIMESTAMP DateTime(26) TIMESTAMP Date Timestamp
6 SEQ_NBR Number(15,0) DECIMAL(15) NOT NULL Sequence Number
7 CM_UNIT_COST Signed Number(27,15) DECIMAL(25,15) NOT NULL 07/99 GMG CN800-9.0:
8 CURRENCY_CD Character(3) VARCHAR2(3) NOT NULL Currency Code
9 CUMULATIVE_QTY Signed Number(17,4) DECIMAL(15,4) NOT NULL Quantity Details
10 CM_COST_SOURCE Character(1) VARCHAR2(1) NOT NULL 12/29/2005 dbe ICE 1379942000 - Added "U" Xlat.
0=Depletion
1=PO Receipt
2=Expr Ptway
3=IUTransfer
4=AP Matched
5=User Adj
6=Qty Adjs.
7=Bin to Bin
8=Prelim Cst
9=Prdn Compl
C=NegQty
R=Return
S=Split from
U=75 Upgrade