Wednesday 4 July 2012

Oracle Quoting form Bill to information Query

Oracle Quoting form Bill to information Query..


SELECT hcsua.location address1, hl.address1 address2, hl.address2 address3,
  hl.address3 address4, hl.address4 city, hl.city state, hl.state postal_code,
   hl.postal_code county, hl.county province, hcsua.site_use_id country_code,
  hpsu.primary_per_type primary_per_type, terr.territory_short_name country,
  hcsua.site_use_code site_use_type, hp.party_name party_name,
  hps.party_site_id
FROM
 HZ_PARTIES hp,
 HZ_PARTY_SITES hps,
 HZ_LOCATIONS hl,
 FND_TERRITORIES_VL terr,
 HZ_CUST_SITE_USES_ALL hcsua,
 HZ_CUST_ACCT_SITES_ALL hcasa,
 HZ_PARTY_SITE_USES hpsu
WHERE hp.party_id = ?
  AND hcasa.org_id = ?
  AND hcsua.site_use_code = 'BILL_TO'
  AND hps.party_id = hp.party_id
  AND hps.location_id = hl.location_id
  AND hcsua.CUST_ACCT_SITE_ID = hcasa.CUST_ACCT_SITE_ID
  AND hcasa.party_site_id = hps.party_site_id
  AND hl.country = terr.territory_code
  AND hpsu.party_site_id = hps.party_site_id
  AND hcsua.site_use_code = hpsu.site_use_type
  AND hp.status = 'A'
  AND hps.status = 'A'
  AND hpsu.status='A'
  ORDER BY hp.party_name, hl.address1,hl.address2, hl.address3, hl.address4

Regards,
Sal

No comments:

Post a Comment