select
pv.vendor_name Supplier_name,
pv.segment1 Supplier_num,
pvs.vendor_site_code Supplier_site_name,
(select party_site_number from hz_party_sites where party_site_id = pvs.party_site_id) site_num,
(select territory_short_name from fnd_territories_vl ft where pvs.country = ft.territory_code) site_country,
pvs.address_line1 site_address_line1,
pvs.address_line2 site_address_line2,
pvs.address_line3 site_address_line3,
pvs.address_line4 site_address_line4,
pvs.city site_city,
pvs.county site_county,
pvs.state site_state,
pvs.zip site_Postal_code,
hou.name BU_NAME ,
ship_loc.location_code ship_to_location_name,
ship_loc.address_line_1 ship_address_line_1,
ship_loc.address_line_2 ship_address_line_2,
ship_loc.address_line_3 ship_address_line_3,
ship_loc.town_or_city ship_to_city,
ship_loc.postal_code ship_to_postal_code,
(select territory_short_name from fnd_territories_vl ft where ship_loc.country = ft.territory_code) ship_to_country,
bill_loc.location_code bill_to_location_name,
bill_loc.address_line_1 bill_address_line_1,
bill_loc.address_line_2 bill_address_line_2,
bill_loc.address_line_3 bill_address_line_3,
bill_loc.town_or_city bill_to_city,
bill_loc.postal_code bill_to_postal_code,
(select territory_short_name from fnd_territories_vl ft where bill_loc.country = ft.territory_code) bill_to_country
from apps.po_vendors pv,
apps.ap_supplier_sites_all pvs,
apps.hr_operating_units hou,
hr_locations bill_loc,
hr_locations ship_loc
where pv.vendor_id = pvs.vendor_id
and pvs.org_id = hou.organization_id
and pvs.bill_to_location_id = bill_loc.location_id(+)
and pvs.ship_to_location_id = ship_loc.location_id(+)
-- and pvs.org_id = 43
and ((pv.end_date_active is null) or (pv.end_date_active > trunc(sysdate)))
and ((pvs.inactive_date is null) or (pvs.inactive_date > trunc(sysdate)))
order by pv.vendor_id,pvs.vendor_site_id
pv.vendor_name Supplier_name,
pv.segment1 Supplier_num,
pvs.vendor_site_code Supplier_site_name,
(select party_site_number from hz_party_sites where party_site_id = pvs.party_site_id) site_num,
(select territory_short_name from fnd_territories_vl ft where pvs.country = ft.territory_code) site_country,
pvs.address_line1 site_address_line1,
pvs.address_line2 site_address_line2,
pvs.address_line3 site_address_line3,
pvs.address_line4 site_address_line4,
pvs.city site_city,
pvs.county site_county,
pvs.state site_state,
pvs.zip site_Postal_code,
hou.name BU_NAME ,
ship_loc.location_code ship_to_location_name,
ship_loc.address_line_1 ship_address_line_1,
ship_loc.address_line_2 ship_address_line_2,
ship_loc.address_line_3 ship_address_line_3,
ship_loc.town_or_city ship_to_city,
ship_loc.postal_code ship_to_postal_code,
(select territory_short_name from fnd_territories_vl ft where ship_loc.country = ft.territory_code) ship_to_country,
bill_loc.location_code bill_to_location_name,
bill_loc.address_line_1 bill_address_line_1,
bill_loc.address_line_2 bill_address_line_2,
bill_loc.address_line_3 bill_address_line_3,
bill_loc.town_or_city bill_to_city,
bill_loc.postal_code bill_to_postal_code,
(select territory_short_name from fnd_territories_vl ft where bill_loc.country = ft.territory_code) bill_to_country
from apps.po_vendors pv,
apps.ap_supplier_sites_all pvs,
apps.hr_operating_units hou,
hr_locations bill_loc,
hr_locations ship_loc
where pv.vendor_id = pvs.vendor_id
and pvs.org_id = hou.organization_id
and pvs.bill_to_location_id = bill_loc.location_id(+)
and pvs.ship_to_location_id = ship_loc.location_id(+)
-- and pvs.org_id = 43
and ((pv.end_date_active is null) or (pv.end_date_active > trunc(sysdate)))
and ((pvs.inactive_date is null) or (pvs.inactive_date > trunc(sysdate)))
order by pv.vendor_id,pvs.vendor_site_id