The below query for relation ship between Oracle IExpenses and Oracle Payables.
The below query will give the End to End details raising expense report to Payments made against.
select *
from ap_expense_report_headers_all aerha
,ap_expense_report_lines_all aerla
,ap_expense_report_params_all aerpa
,per_all_people_f papf
,ap_invoices_all aia
,ap_invoice_payments_all aipa
,ap_checks_all aca
where aerha.employee_id = papf.person_id
and aerha.report_header_id = aerla.report_header_id
and aerla.web_parameter_id = aerpa.parameter_id
and aerha.expense_status_code = 'PAID'
and papf.effective_end_date >= trunc(sysdate)
and aerha.invoice_num = aia.invoice_num
and aia.invoice_id = aipa.invoice_id
and aipa.check_id = aca.check_id;
EXPDA.REPORT_HEADER_ID,
EXPDA.REPORT_LINE_ID,
EXPDA.REPORT_DISTRIBUTION_ID,
EXPL.ITEM_DESCRIPTION,
EXPL.WEB_PARAMETER_ID,
EXPDA.WEB_PARAMETER_ID,
(select fu.user_name from fnd_user fu where fu.user_id=expl.created_by) requested_user,
expda.*
FROM APPS.AP_EXPENSE_REPORT_HEADERS_ALL EXPH,
APPS.AP_EXPENSE_REPORT_LINES_ALL EXPL,
APPS.AP_EXP_REPORT_DISTS_ALL EXPDA
WHERE 1 = 1
AND EXPH.REPORT_HEADER_ID = EXPL.REPORT_HEADER_ID
AND EXPL.REPORT_HEADER_ID = EXPDA.REPORT_HEADER_ID
AND EXPL.REPORT_LINE_ID = EXPDA.REPORT_LINE_ID
AND EXPL.AP_VALIDATION_ERROR IS NOT NULL
ORDER BY EXPL.REPORT_LINE_ID DESC;
No comments:
Post a Comment