Saturday, 26 September 2015

RA_ADDRESS_ALL Replacement in R12 -- Oracle Apps

SELECT DISTINCT  HCA.CUST_ACCOUNT_ID CUSTOMER_ID,
         HCA.ACCOUNT_NUMBER CUSTOMER_NUMBER,
         HP.PARTY_NAME CUSTOMER_NAME,
         HCSU.CUST_ACCT_SITE_ID ADDRESS_ID,
         HL.ADDRESS1,
         HL.ADDRESS2,
         HL.ADDRESS3,
         HL.ADDRESS4,
         HL.CITY,
         HL.POSTAL_CODE,
         UPPER(HL.STATE) STATE,
         DECODE(NVL(HCSA.SHIP_TO_FLAG,'N'),'P','P','Y','Y','N') SHIP_TO_FLAG,
         DECODE(NVL(HCSA.BILL_TO_FLAG,'N'),'P','Y','Y','Y','N') BILL_TO_FLAG
FROM APPS.HZ_PARTIES HP,
APPS.HZ_PARTY_SITES HPS,
APPS.HZ_LOCATIONS HL,
APPS.HZ_CUST_ACCOUNTS_ALL HCA,
APPS.HZ_CUST_ACCT_SITES_ALL HCSA,
APPS.HZ_CUST_SITE_USES_ALL HCSU
WHERE HP.PARTY_ID = HPS.PARTY_ID
AND HPS.LOCATION_ID = HL.LOCATION_ID
AND HP.PARTY_ID = HCA.PARTY_ID
AND HCSA.PARTY_SITE_ID = HPS.PARTY_SITE_ID
AND HCSU.CUST_ACCT_SITE_ID = HCSA.CUST_ACCT_SITE_ID
AND HCA.CUST_ACCOUNT_ID = HCSA.CUST_ACCOUNT_ID
--AND TO_DATE(TO_CHAR(HCSA.CREATION_DATE,'DD-MON-YYYY'),'DD-MON-YYYY') >= '28-JUN-2010'
AND (HCA.CUSTOMER_CLASS_CODE = 'WEB DISTRIBUTORS' OR HCA.SALES_CHANNEL_CODE = 'KEY WEB CUSTOMERS')
ORDER BY HL.ADDRESS1 --,HCSA.CREATION_DATE

No comments:

Post a Comment