Good SQL Collections

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 11
At a glance
Powered by AI
The document shows several SQL queries dealing with invoices, payments, suppliers and other financial tables.

Queries are shown to retrieve invoice, payment, supplier and other financial data from tables like AP_INVOICES_ALL, IBY_PAYMENTS_ALL, AP_CHECKS_ALL, POZ_SUPPLIERS_V and others.

Tables referenced include AP_INVOICES_ALL, IBY_PAYMENTS_ALL, AP_CHECKS_ALL, POZ_SUPPLIERS_V, IBY_EXTERNAL_PAYEES_ALL and many others related to invoices, payments, suppliers and financial data.

select * from FND_DOC_SEQUENCE_ASSIGNMENTS where doc_sequence_id in (

select doc_sequence_id From AP_INVOICES_ALL where INVOICE_NUM in ('2017YCRFEESR


EIM', '161111KGO750C') )
--select * from FND_DOCUMENTS_VL where trunc(creation_date ) = to_date('11/11/20
16', 'MM/DD/YYYY') and created_by = '001127'
--select * from FND_DOCUMENTS where trunc(creation_date ) = to_date('11/11/2016'
, 'MM/DD/YYYY') and created_by = '001127'

--select * from FND_ATTACHED_DOCUMENTS_VL


--select * From FUN_ERP_ATTACHMENT_CONTEXTS
-- select * from FND_ATTACHED_DOCUMENTS
--select * From AP_INVOICES_ALL where INVOICE_NUM in ( '2017YCRFEESREIM', '161
111KGO750C')
Subledger-Ledger Linkage (Accounts Payables)
AP (Item Lines)
select distinct
api.invoice_num
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,gcc.segment1
--,xdl.accounting_line_code
from gl_import_references gir
,xla_ae_lines xal
,xla_ae_headers xah
,xla_distribution_links xdl
,ap_invoices_all api
,ap_invoice_lines_all apl
,ap_invoice_distributions_all apd
,gl_je_lines gjl
,gl_je_headers gjh
,gl_code_combinations gcc
where api.invoice_id = apl.invoice_id
and apl.invoice_id = apd.invoice_id
and apl.line_number = apd.invoice_line_number
and gir.gl_sl_link_table = xal.gl_sl_link_table
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xal.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xah.ae_header_id
and gjl.je_header_id = gjh.je_header_id
and gjl.je_header_id = gir.je_header_id
and gjl.je_line_num = gir.je_line_num
and xdl.event_id = apd.accounting_event_id
and xdl.source_distribution_id_num_1 = apd.invoice_distribution_id
and xdl.source_distribution_type = 'AP_INV_DIST'
and xal.gl_sl_link_table = 'XLAJEL'
and xah.event_type_code <> 'MANUAL'
and gjh.je_source = 'Payables'
and gjh.je_category = 'Purchase Invoices'
and gcc.code_combination_id = gjl.code_combination_id
--and api.invoice_num = 'IE-365010'
;
AP (Prepayment Lines)
select distinct
api.invoice_num
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,gcc.segment1
--,xdl.accounting_line_code
from gl_import_references gir
,xla_ae_lines xal
,xla_ae_headers xah
,xla_distribution_links xdl
,ap_invoices_all api
,ap_invoice_lines_all apl
,ap_invoice_distributions_all apd
,gl_je_lines gjl
,gl_je_headers gjh
,gl_code_combinations gcc
where api.invoice_id = apl.invoice_id
and apl.invoice_id = apd.invoice_id
and apl.line_number = apd.invoice_line_number
and gir.gl_sl_link_table = xal.gl_sl_link_table
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xal.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xah.ae_header_id
and gjl.je_header_id = gjh.je_header_id
and gjl.je_header_id = gir.je_header_id
and gjl.je_line_num = gir.je_line_num
and xdl.event_id = apd.accounting_event_id
and xdl.applied_to_dist_id_num_1 = apd.prepay_distribution_id
and xdl.source_distribution_type = 'AP_PREPAY'
and xal.gl_sl_link_table = 'XLAJEL'
and xah.event_type_code <> 'MANUAL'
and gjh.je_source = 'Payables'
and gjh.je_category = 'Purchase Invoices'
and gcc.code_combination_id = gjl.code_combination_id
--and api.invoice_num = 'IE-365010'
;
AP (Payments)
select distinct
aca.checkrun_name
,aca.check_number
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,gcc.segment1
--,xdl.accounting_line_code
from ap_payment_hist_dists aphd
,ap_payment_history_all aph
,ap_checks_all aca
,xla_distribution_links xdl
,xla_ae_lines xal
,xla_ae_headers xah
,gl_import_references gir
,gl_je_lines gjl
,gl_je_headers gjh
,gl_je_batches gjb
,gl_code_combinations gcc
where xal.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xah.ae_header_id
and xdl.ae_line_num = xal.ae_line_num
and xdl.ae_header_id = xal.ae_header_id
and xal.gl_sl_link_table = gir.gl_sl_link_table
and xal.gl_sl_link_id = gir.gl_sl_link_id
and gir.je_header_id = gjl.je_header_id
and gir.je_line_num = gjl.je_line_num
and gjl.code_combination_id = gcc.code_combination_id
and gjl.je_header_id = gjh.je_header_id
and gjh.je_batch_id = gjb.je_batch_id
and aphd.payment_hist_dist_id = xdl.source_distribution_id_num_1
and xdl.source_distribution_type = 'AP_PMT_DIST'
and gjh.je_source = 'Payables'
and gjh.je_category = 'Payments'
and xah.event_type_code <> 'MANUAL'
and xal.gl_sl_link_table = 'XLAJEL'
and aphd.payment_history_id = aph.payment_history_id
and aph.check_id = aca.check_id
--and aca.check_number = '25467'
;
AP (Treasury Confirmation)
select distinct
aca.checkrun_name
,aca.check_number
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,gcc.segment1
--,xdl.accounting_line_code
from ap_payment_hist_dists aphd
,ap_invoice_payments_all aip
,fv_treasury_confirmations_all ftc
,ap_checks_all aca
,xla_distribution_links xdl
,xla_ae_lines xal
,xla_ae_headers xah
,gl_import_references gir
,gl_je_lines gjl
,gl_je_headers gjh
,gl_je_batches gjb
,gl_code_combinations gcc
where xal.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xah.ae_header_id
and xdl.ae_line_num = xal.ae_line_num
and xdl.ae_header_id = xal.ae_header_id
and xal.gl_sl_link_table = gir.gl_sl_link_table
and xal.gl_sl_link_id = gir.gl_sl_link_id
and gir.je_header_id = gjl.je_header_id
and gir.je_line_num = gjl.je_line_num
and gjl.code_combination_id = gcc.code_combination_id
and gjl.je_header_id = gjh.je_header_id
and gjh.je_batch_id = gjb.je_batch_id
and aphd.payment_hist_dist_id = xdl.source_distribution_id_num_1
and xdl.source_distribution_type = 'FV_TREASURY_CONFIRMATIONS_ALL'
and gjh.je_source = 'Payables'
and xah.event_type_code <> 'MANUAL'
and aphd.invoice_payment_id = aip.invoice_payment_id
and aip.check_id = aca.check_id
and aca.payment_instruction_id = ftc.payment_instruction_id
--and aca.check_number = '25467'
Outer join example
select A.SEGMENT1 , B.ACCOUNT_OWNER_PARTY_ID from POZ_SUPPLIERS_V A, IBY_ACCOU
NT_OWNERS B
where A.SEGMENT1 = '0000753880' and A.PARTY_ID = B.ACCOUNT_OWNER_PARTY_ID (+)
SQL to get USERID and Role and Name
select DISTINCT b1.USERNAME as USERNAME, A1.DISPLAY_NAME as DISPLAY_NAME, D1.RO
LE_COMMON_NAME from PER_PERSON_NAMES_F A1, PER_USERS b1, PER_USER_ROLES C1, PER
_ROLES_DN D1 where A1.Person_id = b1.Person_id and b1.Person_id is not null an
d b1.USER_ID = C1.USER_ID
and D1.ROLE_ID = C1.ROLE_ID and D1.ROLE_COMMON_NAME not in ('PER_EMPLOYEE_ABST
RACT',
'PER_CONTINGENT_WORKER_ABSTRACT', 'YRCW_HELPDESK', 'YRCW_PROVISIONER', 'YRCW_HR_
SPEC_VIEW_ALL_DATA', 'PER_LINE_MANAGER_ABSTRACT',' orclFAGroupWritePrivilegeGrou
p', 'YRCW_PAYROLL_MGR_VIEW_ALL_DATA', 'YRCW_HR_SPEC_VIEW_ALL_DATA', 'YRCW_COMPEN
SATION_ADMINISTRATOR_VIEWALL_DATA', 'YRCW_COMPENSATION_MANAGER_VIEWALL_DATA')
union
select DISTINCT b2.USERNAME as USERNAME, b2.USERNAME as DISPLAY_NAME, D2.ROLE_
COMMON_NAME from PER_USERS b2, PER_USER_ROLES C2, PER_ROLES_DN D2
where b2.Person_id is null and b2.USER_ID = C2.USER_ID
and D2.ROLE_ID = C2.ROLE_ID and D2.ROLE_COMMON_NAME not in ('PER_EMPLOYEE_ABSTR
ACT',
'PER_CONTINGENT_WORKER_ABSTRACT', 'YRCW_HELPDESK', 'YRCW_PROVISIONER', 'YRCW_HR_
SPEC_VIEW_ALL_DATA', 'PER_LINE_MANAGER_ABSTRACT',' orclFAGroupWritePrivilegeGrou
p', 'YRCW_PAYROLL_MGR_VIEW_ALL_DATA', 'YRCW_HR_SPEC_VIEW_ALL_DATA', 'YRCW_COMPEN
SATION_ADMINISTRATOR_VIEWALL_DATA', 'YRCW_COMPENSATION_MANAGER_VIEWALL_DATA', 'Y
RCW_HR_ANALYST_VIEW_ALL_DATA')
and b2.USERNAME not like 'FUSION%'
and b2.USERNAME not like 'FC_FIS%'
and b2.USERNAME not like 'OSN%'
AP_TERMS
SELECT *
FROM AP_TERMS
WHERE term_id IN
( SELECT DISTINCT terms_id
FROM AP_INVOICES_ALL
WHERE invoice_id = '166014'
);
AP_TERMS_LINES
SELECT *
FROM AP_TERMS_LINES
WHERE term_id IN
( SELECT DISTINCT terms_id
FROM AP_INVOICES_ALL
WHERE invoice_id = '166014'
);
AP_PAYMENT_SCHEDULES_ALL
SELECT
amount_remaining,
batch_id,
due_date,
gross_amount,
hold_flag,
invoice_id,
payment_num,
SUBSTR(payment_status_flag,1,1) payment_status_flag,
org_id
FROM
AP_PAYMENT_SCHEDULES_ALL
WHERE
invoice_id = '166014';
AP_INVOICE_PAYMENTS_ALL
SELECT
check_id,
SUBSTR(invoice_payment_id,1,15) invoice_payment_id,
amount,
payment_base_amount,
invoice_base_amount,
accounting_date,
period_name,
posted_flag,
accounting_event_id,
invoice_id,
org_id
FROM
AP_INVOICE_PAYMENTS_ALL
WHERE
invoice_id = '166014'
ORDER BY check_id ASC;
AP_PAYMENT_DISTRIBUTIONS_ALL
SELECT tab.*
FROM AP_INVOICE_PAYMENTS_ALL aip,
AP_PAYMENT_DISTRIBUTIONS_ALL tab
WHERE aip.invoice_payment_id = tab.invoice_payment_id
AND aip.invoice_id = '166014';
AP_CHECKS_ALL
SELECT
check_id,
check_number,
vendor_site_code,
amount,
base_amount,
checkrun_id,
checkrun_name,
check_date,
SUBSTR(status_lookup_code,1,15) status_lookup_code,
void_date,
org_id
FROM
AP_CHECKS_ALL
WHERE check_id IN
( SELECT DISTINCT check_id
FROM AP_INVOICE_PAYMENTS_ALL
WHERE invoice_id = '166014'
);
AP_PAYMENT_HISTORY_ALL
SELECT
payment_history_id,
check_id,
accounting_date,
SUBSTR(transaction_type,1,20) transaction_type,
posted_flag,
SUBSTR(accounting_event_id,1,10) accounting_event_id,
rev_pmt_hist_id,
org_id
FROM
AP_PAYMENT_HISTORY_ALL
WHERE check_id IN
(SELECT DISTINCT check_id
FROM AP_INVOICE_PAYMENTS_ALL
WHERE invoice_id = '166014'
)
ORDER BY payment_history_id ASC;
AP_PAYMENT_HIST_DISTS
SELECT aphd.*
FROM AP_INVOICE_DISTRIBUTIONS_ALL aid,
AP_PAYMENT_HIST_DISTS aphd,
AP_PAYMENT_HISTORY_ALL aph
WHERE aid.invoice_id = '166014'
AND aid.invoice_distribution_id = aphd.invoice_distribution_id
AND aph.payment_history_id = aphd.payment_history_id;

AP_RECON_DISTRIBUTIONS_ALL
SELECT *
FROM AP_RECON_DISTRIBUTIONS_ALL
WHERE check_id IN
( SELECT check_id
FROM AP_INVOICE_PAYMENTS_ALL
WHERE invoice_id = '166014'
);
AP_DOCUMENTS_PAYABLE
SELECT
pay_proc_trxn_type_code,
calling_app_doc_unique_ref1 check_id,
calling_app_doc_unique_ref2 invoice_id,
calling_app_doc_unique_ref4 invoice_payment_id,
calling_app_doc_ref_number invoice_number,
payment_function,
payment_date,
document_date,
document_type,
payment_currency_code,
payment_amount,
payment_method_code
FROM
AP_DOCUMENTS_PAYABLE
WHERE calling_app_id = 200 -- Application id for Payables
AND calling_app_doc_unique_ref2 = '166014';
IBY_DOCS_PAYABLE_ALL
SELECT *
FROM IBY_DOCS_PAYABLE_ALL
WHERE calling_app_id = 200
AND calling_app_doc_unique_ref2 = '166014';
IBY_PAYMENTS_ALL
SELECT *
FROM IBY_PAYMENTS_ALL
WHERE payment_id IN
(SELECT payment_id
FROM IBY_DOCS_PAYABLE_ALL
WHERE calling_app_id = 200
AND calling_app_doc_unique_ref2 = '166014'
);
IBY_PAY_INSTRUCTIONS_ALL
SELECT *
FROM IBY_PAY_INSTRUCTIONS_ALL
WHERE payment_instruction_id IN
(SELECT payment_instruction_id
FROM IBY_PAYMENTS_ALL
WHERE payment_id IN
(SELECT payment_id
FROM IBY_DOCS_PAYABLE_ALL
WHERE calling_app_id = 200
AND calling_app_doc_unique_ref2 = '166014'
);
);
SELECT
hou.name AP_BUSINESS_UNIT,
pv.SEGMENT1 SupplierID,
hp.PARTY_NAME Name,
aia.SOURCE origin,
aia.invoice_num,
aia.invoice_Date,
aia.INVOICE_AMOUNT,
aia.invoice_currency_code,
TO_CHAR(aia.creation_date, 'MM/DD/YYYY') invoice_creation_date,
TO_CHAR(aia.LAST_UPDATE_DATE, 'MM/DD/YYYY') invoice_last_updated_date,
aia.LAST_UPDATED_BY LAST_UPDATED_BY,
glcc.segment1 company,
glcc.segment2 account,
glcc.segment3 gl_function,
glcc.segment4 cost_center,
glcc.segment5 project,
glcc.segment6 future1,
glcc.segment7 future2
FROM
ap_invoices_all aia,
ap_invoice_lines_all ail,
ap_invoice_distributions_all aid,
poz_suppliers pv,
poz_supplier_sites_all_m sia,
hz_parties hp,
hr_all_organization_units hou,
gl_code_combinations glcc
WHERE
aia.invoice_id=ail.invoice_id
AND aia.invoice_id = aid.invoice_id
and aid.invoice_line_number = ail.line_number
AND sia.vendor_id = pv.vendor_id
AND sia.vendor_site_id = aia.vendor_site_id
AND sia.prc_bu_id = hou.organization_id
AND pv.vendor_id = aia.vendor_id
AND pv.party_id = hp.party_id
AND aid.dist_code_combination_id = glcc.code_combination_id
and aia.invoice_num like 'CAR000%'
and glcc.segment2 = '203402'

sql to get name and login id


select DISTINCT b1.USERNAME as USERNAME, A1.DISPLAY_NAME as DISPLAY_NAME, D1.RO
LE_COMMON_NAME from PER_PERSON_NAMES_F A1, PER_USERS b1, PER_USER_ROLES C1, PER
_ROLES_DN D1 where A1.Person_id = b1.Person_id and b1.Person_id is not null an
d b1.USER_ID = C1.USER_ID
and D1.ROLE_ID = C1.ROLE_ID and D1.ROLE_COMMON_NAME not in ('PER_EMPLOYEE_ABST
RACT',
'PER_CONTINGENT_WORKER_ABSTRACT', 'YRCW_HELPDESK', 'YRCW_PROVISIONER', 'YRCW_HR_
SPEC_VIEW_ALL_DATA', 'PER_LINE_MANAGER_ABSTRACT',' orclFAGroupWritePrivilegeGrou
p', 'YRCW_PAYROLL_MGR_VIEW_ALL_DATA', 'YRCW_HR_SPEC_VIEW_ALL_DATA', 'YRCW_COMPEN
SATION_ADMINISTRATOR_VIEWALL_DATA', 'YRCW_COMPENSATION_MANAGER_VIEWALL_DATA')
union
select DISTINCT b2.USERNAME as USERNAME, b2.USERNAME as DISPLAY_NAME, D2.ROLE_
COMMON_NAME from PER_USERS b2, PER_USER_ROLES C2, PER_ROLES_DN D2
where b2.Person_id is null and b2.USER_ID = C2.USER_ID
and D2.ROLE_ID = C2.ROLE_ID and D2.ROLE_COMMON_NAME not in ('PER_EMPLOYEE_ABSTR
ACT',
'PER_CONTINGENT_WORKER_ABSTRACT', 'YRCW_HELPDESK', 'YRCW_PROVISIONER', 'YRCW_HR_
SPEC_VIEW_ALL_DATA', 'PER_LINE_MANAGER_ABSTRACT',' orclFAGroupWritePrivilegeGrou
p', 'YRCW_PAYROLL_MGR_VIEW_ALL_DATA', 'YRCW_HR_SPEC_VIEW_ALL_DATA', 'YRCW_COMPEN
SATION_ADMINISTRATOR_VIEWALL_DATA', 'YRCW_COMPENSATION_MANAGER_VIEWALL_DATA', 'Y
RCW_HR_ANALYST_VIEW_ALL_DATA')
and b2.USERNAME not like 'FUSION%'
and b2.USERNAME not like 'FC_FIS%'
and b2.USERNAME not like 'OSN%'

select * from poz_supplier_sites_all_m where tax_reporting_site_flag = 'Y'


--select * from fnd_flex_values where FLEX_VALUE_SET_ID = 51461
--select * from fnd_flex_value_sets where flex_value_set_name='YRC_BU_CONTENT_GR
OUPS'
--select * from fnd_id_flex_structures where id_flex_structure_code IN ( 'YRCW',
'YRC US')
--select * from fnd_id_flex_segments where SEGMENT_NUM in (2,4,5)

select A.Segment1, A.VENDOR_NAME, b.VENDOR_SITE_code, b.ADDRESS_LINE1, b.ADDRES


S_LINE2, b.CITY, b.STATE, b.COUNTY,
b.COUNTRY, b.ZIP, C.NAME, C.Description
From POZ_SUPPLIERS_V A, POZ_SUPPLIER_SITES_V B, AP_TERMS_TL c
where A.Vendor_ID = B.Vendor_ID
and c.term_id = B.TERMS_ID
select LOOKUP_CODE,DISPLAYED_FIELD, DESCRIPTION
From ap_lookup_codes where lookup_type in ('AP_WFAPPROVAL_STATUS', 'INVOICE STA
TUS') and LOOKUP_CODE not like 'ORA%'
Supplier Terms
select A.Segment1, A.VENDOR_NAME, b.VENDOR_SITE_code, b.ADDRESS_LINE1, b.ADDRES
S_LINE2, b.CITY, b.STATE, b.COUNTY,
b.COUNTRY, b.ZIP, C.NAME, C.Description
From POZ_SUPPLIERS_V A, POZ_SUPPLIER_SITES_V B, AP_TERMS_TL c
where A.Vendor_ID = B.Vendor_ID
and c.term_id = B.TERMS_ID
to check ach advise email sent sql
select
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 1),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 2),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 3),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 4),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 5),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 6),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 7),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 8),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 9),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 10),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 11),
iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 12)
from Dual

SELECT iepa.remit_advice_email, CALL.*


FROM iby_external_payees_all iepa, IBY_PAYMENTS_ALL IBYA, AP_CHECKS_ALL CALL
where iepa.remit_advice_email like '%[email protected]%'
and iepa.EXT_PAYEE_ID = IBYA.EXT_PAYEE_ID
and iepa.PARTY_SITE_ID = IBYA.PARTY_SITE_ID
and iepa.SUPPLIER_SITE_ID = IBYA.SUPPLIER_SITE_ID
and CALL.PAYMENT_ID = IBYA.PAYMENT_ID
order by CALL.PAYMENT_ID desc

select iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 2) from dual


select iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 8) from dual
select iby_fd_extract_gen_pvt.Get_sra_Attribute(96332, 9) from dual

select * From FND_APPL_TAXONOMY


--select APPLICATION_SHORT_NAME, PRODUCT_CODE, BASEPATH from FND_APPLICATION
--select * from FND_APPLICATION
--select * From FND_APPL_TAXONOMY
--select * from FND_TABLES

SELECT B.Name "Bu" ,


asp.segment1 "Supplier Num" ,
asp.vendor_name "Supplier Name" ,
ass.vendor_site_code "site name" ,
ass.address_line1 ,
ass.address_line2 ,
ass.city ,
ass.state ,
ass.zip ,
ass.country
FROM
POZ_SUPPLIERS_V asp ,
POZ_SUPPLIER_SITES_V ass ,
FINANCIALS_SYSTEM_PARAMS_ALL A,
HR_OPERATING_UNITS B
WHERE
B.NAme = 'ReddawayBU'
and A.ORG_ID = B.ORGANIZATION_ID
and A.ORG_ID = ass.PRC_BU_ID
and ass.vendor_id = asp.vendor_id
and asp.segment1 in
(
'1000040',
'1000077')
oracle supplier or vendor email id
select payment_id, iby_fd_extract_gen_pvt.Get_sra_Attribute(payment_id, 1), paym
ent_reference_number from iby_payments_all pmt
where payment_instruction_id = NVL(:1, payment_instruction_id) and separate_remi
t_advice_req_flag = _Y_ and payment_status in (_INSTRUCTION_CREATED_, _READY_TO
_REPRINT_, _SUBMITTED_FOR_PRINTING_, _FORMATTED_, _TRANSMITTED_, _ISSUED_) and
payment_instruction_id IN (SELECT payment_instruction_id FROM iby_pay_instructi
ons_all WHERE payment_instruction_id =pmt.payment_instruction_id AND (remittance
_advice_created_flag = _N_ OR iby_fd_post_picp_progs_pvt.get_allow_multiple_sra
_flag(payment_instruction_id) = _Y_)) and PAYMENT_REFERENCE_NUMBER >= NVL(:2, P
AYMENT_REFERENCE_NUMBER) and PAYMENT_REFERENCE_NUMBER <= NVL(:3, PAYMENT_REFERE
NCE_NUMBER)
Not Working
SELECT aps.segment1 "Vendor Number"
,aps.vendor_name "Vendor Name"
,iepa.remit_advice_email "Remittance Advice Email"
FROM ap_suppliers aps
,iby_external_payees_all iepa
WHERE iepa.payee_party_id = aps.party_id
AND aps.vendor_name= '&amp;Vendor_Name';
Working
SELECT iepa.remit_advice_email, CALL.*
FROM iby_external_payees_all iepa, IBY_PAYMENTS_ALL IBYA, AP_CHECKS_ALL CALL
where iepa.remit_advice_email like '%[email protected]%'
and iepa.EXT_PAYEE_ID = IBYA.EXT_PAYEE_ID
and iepa.PARTY_SITE_ID = IBYA.PARTY_SITE_ID
and iepa.SUPPLIER_SITE_ID = IBYA.SUPPLIER_SITE_ID
and CALL.PAYMENT_ID = IBYA.PAYMENT_ID
order by CALL.PAYMENT_ID
Distribution Name New Value Tablename.field
business-unit-gl 9999 gl_code_combinations.segment1
account 999999 gl_code_combinations.segment2
function 99 gl_code_combinations.segment3
deptid 9999 gl_code_combinations.segment4
project-id 999999 gl_code_combinations.segment5
AFFILIATE 9999 gl_code_combinations.segment6
FUTURE 1 99 gl_code_combinations.segment7
FUTURE 2 99 gl_code_combinations.segment8
sql to find missing invoices
select distinct A.REJECT_LOOKUP_CODE, A.CREATION_DATE, A.CREATED_BY, B.*
from AP_INTERFACE_REJECTIONS A, AP_INVOICES_INTERFACE B
where A.LOAD_REQUEST_ID = B.LOAD_REQUEST_ID(+)
and B.SOURCE = 'LRC'

You might also like