CM_PERR_SUM_VW(SQL View) |
Index Back |
---|---|
Perpavg cost w/o cost element10/08/02 lee: Initial create. This view gets the latest perpavg records for a bu/book/item. It sums the cost, by book, lacking cost element granularity. |
SELECT A.BUSINESS_UNIT , A.CM_BOOK , A.INV_ITEM_ID , A.DT_TIMESTAMP , A.SEQ_NBR , A.TRANSACTION_DT , SUM(A.CM_UNIT_COST) , A.CURRENCY_CD FROM PS_CM_PERRAVG_COST A WHERE A.CM_DUMMY_FLG='N' AND A.DT_TIMESTAMP = ( SELECT MAX(B.DT_TIMESTAMP) FROM PS_CM_PERRAVG_COST B WHERE B.BUSINESS_UNIT = A.BUSINESS_UNIT AND B.INV_ITEM_ID = A.INV_ITEM_ID AND B.CM_BOOK = A.CM_BOOK AND B.CM_DUMMY_FLG = 'N' ) AND A.SEQ_NBR = ( SELECT MAX(C.SEQ_NBR) FROM PS_CM_PERRAVG_COST C WHERE C.BUSINESS_UNIT = A.BUSINESS_UNIT AND C.INV_ITEM_ID = A.INV_ITEM_ID AND C.CM_BOOK = A.CM_BOOK AND C.DT_TIMESTAMP = A.DT_TIMESTAMP AND C.CM_DUMMY_FLG='N' ) GROUP BY A.BUSINESS_UNIT , A.CM_BOOK, A.INV_ITEM_ID , A.DT_TIMESTAMP , A.SEQ_NBR , A.TRANSACTION_DT , A.CM_COST_SOURCE , A.CURRENCY_CD |
# | 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 | DT_TIMESTAMP | DateTime(26) | TIMESTAMP | Date Timestamp |
5 | SEQ_NBR | Number(15,0) | DECIMAL(15) NOT NULL | Sequence Number |
6 | TRANSACTION_DT | Date(10) | DATE | Transaction date (often used as trade date) |
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 |