SELECT CA.BUSINESS_UNIT , PT.PTAI_KEY_VALUE , CA.DESCR , CA.SOLD_TO_CUST_ID , CUST.NAME1 , CA.CA_STATUS FROM PS_PTAI_CONTEXT PT , PS_PTAI_LIST PL , PS_CA_CONTR_HDR CA , PS_CUSTOMER CUST , PS_SET_CNTRL_REC REC WHERE PT.PTAI_LIST_ID = PL.PTAI_LIST_ID AND PT.FIELDNAME = 'CONTRACT_NUM' AND PT.RECNAME = 'CA_CONTR_HDR' AND PT.PTAI_KEY_VALUE <> ' ' AND PT.PTAI_LIST_ID LIKE 'CA_ENTRYLL%' AND PT.PTAI_KEY_VALUE = CA.CONTRACT_NUM AND CA.SOLD_TO_CUST_ID = CUST.CUST_ID AND CA.BUSINESS_UNIT = REC.SETCNTRLVALUE AND REC.RECNAME = 'CUSTOMER' AND REC.SETID = CUST.SETID
|