SELECT s.segment1 supplier_number,
hps.attribute1 legacy_supplier_number,
ss.vendor_site_code supplier_site_code,
ss.org_id operating_unit,
ss.vendor_site_id supplier_site_id,
s.party_id party_id,
ib_pmt_instr.order_of_preference priority_number,
ib_pmt_instr.start_date,
ib_pmt_instr.end_date,
ib_pmt_instr.last_update_date instr_last_update_date ,
bank_ac.bank_account_num bank_account_number,
bank_ac.ext_bank_account_id bank_account_id,
bank_ac.bank_account_name,
bank_ac.last_update_date bank_ac_last_update_date,
bank_branch.bank_branch_name_alt supp_bank_name,
bank_branch.branch_number supp_bank_branch_num,
bank_branch.bank_number supp_bank_num,
bank_branch.address_line1|| ','||
bank_branch.address_line2|| ','||
bank_branch.address_line3|| ','||
bank_branch.address_line4|| ','||
bank_branch.city|| ','||
bank_branch.state supp_bank_branch_address,
bank_branch.eft_swift_code swift_code
FROM ap_suppliers s,
ap_supplier_sites_all ss,
hz_party_sites hps,
iby_external_payees_all ib_xt_payee,
iby_pmt_instr_uses_all ib_pmt_instr,
iby_ext_bank_accounts bank_ac,
ce_bank_branches_v bank_branch
WHERE 1 = 1
AND ss.org_id = <<g_org_id>>
AND s.vendor_id = ss.vendor_id
AND hps.party_site_id = ss.party_site_id
AND ib_xt_payee.supplier_site_id IS NULL
AND ib_xt_payee.payee_party_id = hps.party_id
AND ib_pmt_instr.ext_pmt_party_id = ib_xt_payee.ext_payee_id
AND ib_pmt_instr.instrument_type = 'BANKACCOUNT'
AND ib_pmt_instr.instrument_id = bank_ac.ext_bank_account_id
AND bank_ac.branch_id = bank_branch.branch_party_id(+)
AND NOT EXISTS
(SELECT 'Y'
FROM iby_external_payees_all ib_xt_payee,
iby_pmt_instr_uses_all ib_pmt_instr
WHERE ib_xt_payee.supplier_site_id = ss.vendor_site_id
AND ib_pmt_instr.ext_pmt_party_id = ib_xt_payee.ext_payee_id
AND ib_pmt_instr.instrument_type = 'BANKACCOUNT');
hps.attribute1 legacy_supplier_number,
ss.vendor_site_code supplier_site_code,
ss.org_id operating_unit,
ss.vendor_site_id supplier_site_id,
s.party_id party_id,
ib_pmt_instr.order_of_preference priority_number,
ib_pmt_instr.start_date,
ib_pmt_instr.end_date,
ib_pmt_instr.last_update_date instr_last_update_date ,
bank_ac.bank_account_num bank_account_number,
bank_ac.ext_bank_account_id bank_account_id,
bank_ac.bank_account_name,
bank_ac.last_update_date bank_ac_last_update_date,
bank_branch.bank_branch_name_alt supp_bank_name,
bank_branch.branch_number supp_bank_branch_num,
bank_branch.bank_number supp_bank_num,
bank_branch.address_line1|| ','||
bank_branch.address_line2|| ','||
bank_branch.address_line3|| ','||
bank_branch.address_line4|| ','||
bank_branch.city|| ','||
bank_branch.state supp_bank_branch_address,
bank_branch.eft_swift_code swift_code
FROM ap_suppliers s,
ap_supplier_sites_all ss,
hz_party_sites hps,
iby_external_payees_all ib_xt_payee,
iby_pmt_instr_uses_all ib_pmt_instr,
iby_ext_bank_accounts bank_ac,
ce_bank_branches_v bank_branch
WHERE 1 = 1
AND ss.org_id = <<g_org_id>>
AND s.vendor_id = ss.vendor_id
AND hps.party_site_id = ss.party_site_id
AND ib_xt_payee.supplier_site_id IS NULL
AND ib_xt_payee.payee_party_id = hps.party_id
AND ib_pmt_instr.ext_pmt_party_id = ib_xt_payee.ext_payee_id
AND ib_pmt_instr.instrument_type = 'BANKACCOUNT'
AND ib_pmt_instr.instrument_id = bank_ac.ext_bank_account_id
AND bank_ac.branch_id = bank_branch.branch_party_id(+)
AND NOT EXISTS
(SELECT 'Y'
FROM iby_external_payees_all ib_xt_payee,
iby_pmt_instr_uses_all ib_pmt_instr
WHERE ib_xt_payee.supplier_site_id = ss.vendor_site_id
AND ib_pmt_instr.ext_pmt_party_id = ib_xt_payee.ext_payee_id
AND ib_pmt_instr.instrument_type = 'BANKACCOUNT');
No comments:
Post a Comment