CM_PAV4_COST_VW

(SQL View)
Index Back

Latest Pavg by cst element

8/02 LEE: S-MERENDA88 : initial create. This view sums the unit cost, for the default cost book. This view gets the latest-dated and highest-sequence numbered record. 07/03 with cost element - include cost category

SELECT A.BUSINESS_UNIT , A.INV_ITEM_ID , A.DT_TIMESTAMP , A.SEQ_NBR , A.TRANSACTION_DT , A.CM_COST_SOURCE , A.CM_UNIT_COST , A.CURRENCY_CD , A.COST_ELEMENT , C.SETID , D.COST_CATEGORY FROM PS_CM_PERPAVG_COST A , PS_CM_INQ_BOOK_VW B , PS_SET_CNTRL_REC C , PS_CM_ELEMENT D WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.CM_BOOK = B.CM_BOOK AND A.DT_TIMESTAMP = ( SELECT MAX(A1.DT_TIMESTAMP) FROM PS_CM_PERPAVG_COST A1 WHERE A.BUSINESS_UNIT = A1.BUSINESS_UNIT AND A.INV_ITEM_ID = A1.INV_ITEM_ID ) AND A.SEQ_NBR = ( SELECT MAX(A2.SEQ_NBR) FROM PS_CM_PERPAVG_COST A2 WHERE A.BUSINESS_UNIT = A2.BUSINESS_UNIT AND A.INV_ITEM_ID = A2.INV_ITEM_ID AND A.DT_TIMESTAMP = A2.DT_TIMESTAMP ) AND A.BUSINESS_UNIT = C.SETCNTRLVALUE AND C.RECNAME = 'CM_ELEMENT' AND C.SETID = D.SETID AND A.COST_ELEMENT = D.COST_ELEMENT

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit
2 INV_ITEM_ID Character(18) VARCHAR2(18) NOT NULL Item ID
3 DT_TIMESTAMP DateTime(26) TIMESTAMP Date Timestamp
4 SEQ_NBR Number(15,0) DECIMAL(15) NOT NULL Sequence Number
5 TRANSACTION_DT Date(10) DATE Transaction date (often used as trade date)
6 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
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 COST_ELEMENT Character(4) VARCHAR2(4) NOT NULL Cost Element
10 SETID Character(5) VARCHAR2(5) NOT NULL SetID
11 COST_CATEGORY Character(3) VARCHAR2(3) NOT NULL 1/12/99 ebn CN#CM800-2.0 : Added Landed Cost translate value
ATC=Addl Trans
COH=Con Ovhd
CON=Conversion
INB=Inbound
LND=Landed
MAT=Material
OTH=Other
OUB=Outbound