STMT_LAST_VW

(SQL View)
Index Back

Last Customer Statement


SELECT DISTINCT C.CRSPD_SETID , C.CRSPD_CUST_ID , C.ST_ID_NUM , CASE WHEN D.BUSINESS_UNIT IS NOT NULL THEN D.BUSINESS_UNIT ELSE B.BUSINESS_UNIT END , CASE WHEN D.CUST_ID IS NOT NULL THEN D.CUST_ID ELSE B.CUST_ID END FROM PS_STMT_CUST C , PS_STMT_CUST_DTL D , PS_STMT_CUST_BFWD B WHERE C.CRSPD_SETID = D.CRSPD_SETID (+) AND C.CRSPD_CUST_ID = D.CRSPD_CUST_ID (+) AND C.ST_ID_NUM = D.ST_ID_NUM (+) AND C.CRSPD_SETID = B.CRSPD_SETID (+) AND C.CRSPD_CUST_ID = B.CRSPD_CUST_ID (+) AND C.ST_ID_NUM = B.ST_ID_NUM (+) AND C.ST_STATUS <> 'I' AND C.ST_ID_NUM = ( SELECT MAX(C2.ST_ID_NUM) FROM PS_STMT_CUST C2 WHERE C2.CRSPD_SETID = C.CRSPD_SETID AND C2.CRSPD_CUST_ID = C.CRSPD_CUST_ID AND C2.ST_STATUS <> 'I') ORDER BY C.CRSPD_SETID, C.CRSPD_CUST_ID

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 CRSPD_SETID Character(5) VARCHAR2(5) NOT NULL SetID

Default Value: OPR_DEF_TBL_FS.SETID

Prompt Table: SP_SETCS_NONVW

2 CRSPD_CUST_ID Character(15) VARCHAR2(15) NOT NULL Correspondence Customer

Prompt Table: CRSPD_CUST_D_VW

3 ST_ID_NUM Number(8,0) INTEGER NOT NULL Statement Number
4 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit

Prompt Table: SP_BUARDS_NONVW
Set Control Field: BUSINESS_UNIT

5 CUST_ID Character(15) VARCHAR2(15) NOT NULL Uniquely identifies an organizational entity that purchases goods or services from the enterprise. Represents the sold-to customer which is the customer organization that places orders. The CUST_ID may or may not be the same as the identifiers for the bill-to and ship-to locations.