Thursday, May 1, 2014

Query for AR Customer Details

AR Customer

SELECT rc.customer_number,
       rc.customer_name,
       hp.party_id,
       hp.party_type,
       rc.tax_reference,
       hca.cust_account_id,
       hca.payment_term_id,
       hps.location_id,
       hcsu.LOCATION,
       hcsu.site_use_code,
       hcsa.bill_to_flag,
       hcsu.gl_id_rec receiving_acc_ccid,
       hl.address1,
       hl.address2,
       hl.address3,
       hl.city,hl.state,
       hl.country,
       hl.postal_code
  FROM ra_customers rc,
       hz_parties hp,
       hz_party_sites hps,
       hz_locations hl,
       hz_cust_accounts_all hca,
       hz_cust_acct_sites_all hcsa,
       hz_cust_site_uses_all hcsu
 WHERE rc.party_id = hp.party_id
   AND 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 rc.customer_number = '&Customer_Number';