Thursday, August 5, 2021

Query to get GL batch details for AR receipts and AR invoice

SELECT gjb.name GL_batch_name,
gjh.name Journal_Name,
gjl.period_name,
gjh.JE_CATEGORY,
gjh.JE_SOURCE,
gjh.currency_code,
DECODE (gjh.actual_flag, 'A', 'Actual','B', 'Budget','E', 'Encumbrance') Balance_Type,
DECODE (gjl.status, 'P', 'Posted', 'U', 'Unposted', gjl.status) Batch_Status,
gjh.posted_date,
acra.receipt_number,
acra.doc_sequence_value
FROM gl_je_lines gjl,
gl_je_headers gjh,
gl_je_batches gjb, 
gl_import_references gir,
xla_ae_lines xal,
xla_ae_headers xah,
xla_events xe,
xla_transaction_entities xte,
ar_cash_receipts_all acra
WHERE gjb.je_batch_id = gjh.je_batch_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 gir.gl_sl_link_table = xal.gl_sl_link_table
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xal.application_id = xah.application_id
and xal.ae_header_id = xah.ae_header_id
--and xal.ae_line_num = 1
and xah.application_id = xe.application_id
and xah.event_id = xe.event_id
and xe.application_id = xte.application_id
and xe.entity_id = xte.entity_id
and xte.application_id = 222
and xte.entity_code = 'RECEIPTS'
and xte.source_id_int_1 = acra.cash_receipt_id
and acra.cash_receipt_id in(127282,838383);
SELECT gjb.name GL_batch_name,
gjh.name Journal_Name,
gjl.period_name,
gjh.JE_CATEGORY,
gjh.JE_SOURCE,
gjh.currency_code,
DECODE (gjh.ACTUAL_FLAG, 'A', 'Actual','B', 'Budget','E', 'Encumbrance') Balance_Type,
DECODE (gjl.status, 'P', 'Posted', 'U', 'Unposted', gjl.status) Batch_Status,
gjh.posted_date,
rcta.trx_number,
rcta.trx_date
FROM apps.gl_je_lines gjl,
apps.gl_je_headers gjh,
apps.gl_je_batches gjb, 
apps.gl_import_references gir,
apps.xla_ae_lines xal,
apps.xla_ae_headers xah,
apps.xla_events xe,
apps.xla_transaction_entities xte,
apps.ra_customer_trx_all rcta
WHERE gjb.je_batch_id = gjh.je_batch_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 gir.gl_sl_link_table = xal.gl_sl_link_table
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xal.application_id = xah.application_id
and xal.ae_header_id = xah.ae_header_id
and xal.ae_line_num = 1 /*If AR Transaction has multiple lines then xla_ae_lines table contains multiple lines*/
and xah.application_id = xe.application_id
and xah.event_id = xe.event_id
and xe.application_id = xte.application_id
and xe.entity_id = xte.entity_id
and xte.application_id = 222
and xte.entity_code = 'TRANSACTIONS'
and xte.source_id_int_1 = rcta.customer_trx_id
and trim(rcta.trx_number) = trim('&AR_trx_number');

EBS Order Holds details and release responsibility

  SELECT ooh.order_number,                  ooh.ordered_date,                 ooh.flow_status_code,                 ooh.credit_card_approval...