AP Invoice liability (Trial Balance) Query: R12 AP GL PO RCV XLA
SELECT NVL (f.currency_code, d.invoice_currency_code) currency_code,
d.invoice_amount, d.wfapproval_status, d.invoice_num, d.invoice_id,
i.segment1 v_code, i.vendor_name,
NVL (d.invoice_amount, 0) - NVL (d.amount_paid, 0) amt,
SUM (a.acctd_rounded_cr) - SUM (a.acctd_rounded_dr) amount,
b.accounting_date, f.segment1 po_num, f.comments descr,
h.receipt_num rct_num, c.segment6 loc, c.segment2 cost_centre,
d.doc_sequence_value ap_voucher, j.employee_number, j.full_name
FROM xla_transaction_entities xte,
ap.ap_invoice_distributions_all b,
ap.ap_invoice_lines_all k,
gl.gl_code_combinations c,
ap.ap_invoices_all d,
po.po_distributions_all e,
po.po_headers_all f,
apps.rcv_transactions g,
apps.rcv_shipment_headers h,
apps.po_vendors i,
apps.per_all_people_f j,
(SELECT /*+ index(tb XLA_TRIAL_BALANCES_N2) */
tb.code_combination_id, tb.ledger_id, tb.party_id party_id,
tb.gl_date, tb.ae_header_id,
NVL (tb.applied_to_entity_id,
tb.source_entity_id
) entity_id,
tb.definition_code, tb.record_type_code,
SUM (NVL (tb.acctd_rounded_cr, 0)) acctd_rounded_cr,
SUM (NVL (tb.acctd_rounded_dr, 0)) acctd_rounded_dr,
SUM (NVL (tb.acctd_rounded_cr, 0))
- SUM (NVL (tb.acctd_rounded_dr, 0)) diff,
party_id
FROM xla_trial_balances tb
WHERE tb.definition_code = 'AP_200_1001'
AND tb.gl_date <= :acc_date --GL Date Value
AND tb.code_combination_id IN (SELECT code_combination_id
FROM gl_code_combinations a
WHERE a.segment3 = :acc_code)--GL CC Value
GROUP BY tb.code_combination_id,
tb.ledger_id,
tb.party_id,
tb.party_id,
NVL(tb.applied_to_entity_id,tb.source_entity_id),
tb.record_type_code,
tb.party_id,
tb.gl_date,
tb.definition_code,
tb.ae_header_id) a
WHERE a.code_combination_id = c.code_combination_id
AND d.INVOICE_NUM = :invoice_num --Invoice Num
AND a.definition_code = 'AP_200_1001'
AND a.entity_id = xte.entity_id
AND xte.application_id = 200
AND xte.ledger_id = a.ledger_id
AND NVL (source_id_int_1, (-99)) = d.invoice_id
AND d.invoice_id = k.invoice_id
AND k.line_number = b.invoice_line_number
AND c.segment3 = :acc_code --GL CC Code
AND a.gl_date <= :acc_date --Gl Date
AND k.invoice_id = b.invoice_id
AND b.distribution_line_number = '1'
AND k.line_number = '1'
AND b.po_distribution_id = e.po_distribution_id(+)
AND e.po_header_id = f.po_header_id(+)
AND b.rcv_transaction_id = g.transaction_id(+)
AND g.shipment_header_id = h.shipment_header_id(+)
AND f.agent_id = j.person_id(+)
AND i.vendor_id = d.vendor_id
AND d.set_of_books_id = a.ledger_id
AND d.org_id = :l_org_id --Invoice Org Id
AND TRUNC (SYSDATE) BETWEEN j.effective_start_date(+)
AND j.effective_end_date(+)
HAVING SUM (a.acctd_rounded_cr) - SUM (a.acctd_rounded_dr) <> 0
GROUP BY f.currency_code,
d.invoice_amount,
b.project_id,
d.wfapproval_status,
d.invoice_num,
d.invoice_id,
b.accounting_date,
f.segment1,
h.receipt_num,
i.segment1,
i.vendor_name,
c.segment6,
d.doc_sequence_value,
c.segment2,
j.employee_number,
j.full_name,
f.agent_id,
f.comments,
d.invoice_currency_code,
b.posted_flag,
d.amount_paid,
d.invoice_id
d.invoice_amount, d.wfapproval_status, d.invoice_num, d.invoice_id,
i.segment1 v_code, i.vendor_name,
NVL (d.invoice_amount, 0) - NVL (d.amount_paid, 0) amt,
SUM (a.acctd_rounded_cr) - SUM (a.acctd_rounded_dr) amount,
b.accounting_date, f.segment1 po_num, f.comments descr,
h.receipt_num rct_num, c.segment6 loc, c.segment2 cost_centre,
d.doc_sequence_value ap_voucher, j.employee_number, j.full_name
FROM xla_transaction_entities xte,
ap.ap_invoice_distributions_all b,
ap.ap_invoice_lines_all k,
gl.gl_code_combinations c,
ap.ap_invoices_all d,
po.po_distributions_all e,
po.po_headers_all f,
apps.rcv_transactions g,
apps.rcv_shipment_headers h,
apps.po_vendors i,
apps.per_all_people_f j,
(SELECT /*+ index(tb XLA_TRIAL_BALANCES_N2) */
tb.code_combination_id, tb.ledger_id, tb.party_id party_id,
tb.gl_date, tb.ae_header_id,
NVL (tb.applied_to_entity_id,
tb.source_entity_id
) entity_id,
tb.definition_code, tb.record_type_code,
SUM (NVL (tb.acctd_rounded_cr, 0)) acctd_rounded_cr,
SUM (NVL (tb.acctd_rounded_dr, 0)) acctd_rounded_dr,
SUM (NVL (tb.acctd_rounded_cr, 0))
- SUM (NVL (tb.acctd_rounded_dr, 0)) diff,
party_id
FROM xla_trial_balances tb
WHERE tb.definition_code = 'AP_200_1001'
AND tb.gl_date <= :acc_date --GL Date Value
AND tb.code_combination_id IN (SELECT code_combination_id
FROM gl_code_combinations a
WHERE a.segment3 = :acc_code)--GL CC Value
GROUP BY tb.code_combination_id,
tb.ledger_id,
tb.party_id,
tb.party_id,
NVL(tb.applied_to_entity_id,tb.source_entity_id),
tb.record_type_code,
tb.party_id,
tb.gl_date,
tb.definition_code,
tb.ae_header_id) a
WHERE a.code_combination_id = c.code_combination_id
AND d.INVOICE_NUM = :invoice_num --Invoice Num
AND a.definition_code = 'AP_200_1001'
AND a.entity_id = xte.entity_id
AND xte.application_id = 200
AND xte.ledger_id = a.ledger_id
AND NVL (source_id_int_1, (-99)) = d.invoice_id
AND d.invoice_id = k.invoice_id
AND k.line_number = b.invoice_line_number
AND c.segment3 = :acc_code --GL CC Code
AND a.gl_date <= :acc_date --Gl Date
AND k.invoice_id = b.invoice_id
AND b.distribution_line_number = '1'
AND k.line_number = '1'
AND b.po_distribution_id = e.po_distribution_id(+)
AND e.po_header_id = f.po_header_id(+)
AND b.rcv_transaction_id = g.transaction_id(+)
AND g.shipment_header_id = h.shipment_header_id(+)
AND f.agent_id = j.person_id(+)
AND i.vendor_id = d.vendor_id
AND d.set_of_books_id = a.ledger_id
AND d.org_id = :l_org_id --Invoice Org Id
AND TRUNC (SYSDATE) BETWEEN j.effective_start_date(+)
AND j.effective_end_date(+)
HAVING SUM (a.acctd_rounded_cr) - SUM (a.acctd_rounded_dr) <> 0
GROUP BY f.currency_code,
d.invoice_amount,
b.project_id,
d.wfapproval_status,
d.invoice_num,
d.invoice_id,
b.accounting_date,
f.segment1,
h.receipt_num,
i.segment1,
i.vendor_name,
c.segment6,
d.doc_sequence_value,
c.segment2,
j.employee_number,
j.full_name,
f.agent_id,
f.comments,
d.invoice_currency_code,
b.posted_flag,
d.amount_paid,
d.invoice_id
Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
ReplyDeleteseo company in india
There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this.
ReplyDeleteBase SAS Training in Chennai
Truely a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic. keep sharing your information regularly for my future reference. This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.
ReplyDeleteBest Laser Clinic In Chennai
Very nice post here thanks for it I always like and search such topics and everything connected to them. Keep update more information..
ReplyDeleteInformatica Training in Chennai
There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this.
ReplyDeleteSEO Company in India|Digital Marketing Company in Chennai
It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
ReplyDeletePest Control in Chennai
Security Services in Chennai
I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
ReplyDeleteAndroid App Development Company
iOS App Development Company
Loved your blog
ReplyDeleteKeep updating us
technology guest post
dosto kya aapke partner ko safed pani problem ho gyi hain toh aaj mein aap ko सफेद पानी की आयुर्वेदिक दवा ke baare mein btaunga jiske istmaal se aap safed pani ki problem chutkare pa saktein hain
ReplyDelete