Thursday, April 12, 2012

Qucik Look HZ Tables



Query to get all customer details of SO:

SELECT ooh.order_number,
       hp_bill.party_name,
       hl_ship.address1 ship_to_address,
       hl_bill.address1 bill_to_address,
       ooh.transactional_curr_code currency_code, mp.organization_code,
       ooh.fob_point_code, ooh.freight_terms_code, ooh.cust_po_number
  FROM apps.oe_order_headers_all ooh,
       apps.hz_cust_site_uses_all hcs_ship,
       apps.hz_cust_acct_sites_all hca_ship,
       apps.hz_party_sites hps_ship,
       apps.hz_parties hp_ship,
       apps.hz_locations hl_ship,
       apps.hz_cust_site_uses_all hcs_bill,
       apps.hz_cust_acct_sites_all hca_bill,
       apps.hz_party_sites hps_bill,
       apps.hz_parties hp_bill,
       apps.hz_locations hl_bill,
       apps.mtl_parameters mp
 WHERE header_id = 134051
   AND ooh.ship_to_org_id = hcs_ship.site_use_id
   AND hcs_ship.cust_acct_site_id = hca_ship.cust_acct_site_id
   AND hca_ship.party_site_id = hps_ship.party_site_id
   AND hps_ship.party_id = hp_ship.party_id
   AND hps_ship.location_id = hl_ship.location_id
   AND ooh.invoice_to_org_id = hcs_bill.site_use_id
   AND hcs_bill.cust_acct_site_id = hca_bill.cust_acct_site_id
   AND hca_bill.party_site_id = hps_bill.party_site_id
   AND hps_bill.party_id = hp_bill.party_id
   AND hps_bill.location_id = hl_bill.location_id
   AND mp.organization_id(+) = ooh.ship_from_org_id
  
  
  
Query to get SHIP_TO of SO:  
 
SELECT hl.address1 ship_to
  FROM apps.oe_order_headers_all ooh,
       apps.hz_cust_site_uses_all hcs,
       apps.hz_cust_acct_sites_all hca,
       apps.hz_party_sites hps,
       apps.hz_locations hl
 WHERE ooh.header_id = 134051
   AND ooh.ship_to_org_id = hcs.site_use_id
   AND hcs.cust_acct_site_id = hca.cust_acct_site_id
   AND hca.party_site_id = hps.party_site_id
   AND hps.location_id = hl.location_id
  


Query to get BILL_TO of SO:
 
SELECT hl.address1 bill_to
  FROM apps.oe_order_headers_all ooh,
       apps.hz_cust_site_uses_all hcs,
       apps.hz_cust_acct_sites_all hca,
       apps.hz_party_sites hps,
       apps.hz_locations hl
 WHERE ooh.header_id = 134051
   AND ooh.invoice_to_org_id = hcs.site_use_id
   AND hcs.cust_acct_site_id = hca.cust_acct_site_id
   AND hca.party_site_id = hps.party_site_id
   AND hps.location_id = hl.location_id
Related Posts Plugin for WordPress, Blogger...