The below gives the details of a customer's Bill-To and Ship-To details along with the location/address details in Oracle Apps R12.1.3
SELECT hca_bill.cust_account_id bt_cust_account_id
,hca_bill.account_number bt_cust_account_num
,hcsu_bill.location bt_location
,location_bill.address1 bt_address1
,location_bill.city bt_city
,location_bill.state bt_state
,location_bill.postal_code bt_postal_code
,hca_ship.cust_account_id st_cust_account_id
,hca_ship.account_number st_cust_account_num
,hcsu_bill.location st_location
,location_ship.address1 st_address1
,location_ship.city st_city
,location_ship.state st_state
FROM apps.hz_cust_accounts_all hca_ship
,apps.hz_cust_acct_sites_all hcas_ship
,apps.hz_cust_site_uses_all hcsu_ship
,apps.hz_party_sites party_site_ship
,apps.hz_parties party_ship
,apps.hz_locations location_ship
,hz_cust_accounts_all hca_bill
,hz_cust_acct_sites_all hcas_bill
,hz_cust_site_uses_all hcsu_bill
,apps.hz_party_sites party_site_bill
,apps.hz_parties party_bill
,apps.hz_locations location_bill
WHERE 1=1
AND hcas_bill.cust_account_id = hca_bill.cust_account_id
AND hcsu_bill.cust_acct_site_id = hcas_bill.cust_acct_site_id
AND party_site_bill.party_site_id = hcas_bill.party_site_id
AND party_site_bill.party_id = party_bill.party_id
AND party_site_bill.location_id = location_bill.location_id
AND hcsu_bill.site_use_code =
'BILL_TO'
AND hca_ship.cust_account_id = hcas_ship.cust_account_id
AND hcas_ship.cust_acct_site_id = hcsu_ship.cust_acct_site_id
AND party_site_ship.party_site_id = hcas_ship.party_site_id
AND party_site_ship.party_id = party_ship.party_id
AND party_site_ship.location_id = location_ship.location_id
AND hcsu_ship.site_use_code =
'SHIP_TO'
AND hcsu_ship.bill_to_site_use_id = hcsu_bill.site_use_id
AND hca_bill.status =
'A'
AND hcas_bill.status =
'A'
AND hcsu_bill.status =
'A'
AND hca_ship.status =
'A'
--AND hca_ship.account_number = '738673'
AND hca_bill.account_number =
'1881880'
;
Feel free to point out if anything is missing/wrong in this blog.
No comments:
Post a Comment