Sie sind auf Seite 1von 131

GL Entries with AP Payments Query in oracle apps

SELECT glp.start_date,
gjh.je_header_id,
gjh.doc_sequence_value voucher_no,
gjh.je_source,
gjh.je_category,
entity_code,
gjh.period_name,
gjh.status,
gjh.actual_flag,
gjh.default_effective_date,
gjl.je_line_num,
gjl.code_combination_id,
gjl.description voucher_desc,
xal.accounted_dr debit,
xal.accounted_cr credit,
gcc.segment1
|| '-'
|| gcc.segment2
|| '-'
|| gcc.segment3
|| '-'
|| gcc.segment4
|| '-'
|| gcc.segment5
|| '-'
|| gcc.segment6
|| '-'
|| gcc.segment7
account_code,
TO_CHAR (aca.check_number) trx_num,
aca.check_date trx_date
FROM gl.gl_je_headers gjh,
gl.gl_je_lines gjl,
gl.gl_code_combinations gcc,
gl.gl_periods glp,
gl.gl_import_references imp,
xla.xla_ae_lines xal,
xla.xla_ae_headers xah,
xla.xla_events xe,
xla.xla_transaction_entities xte,
ap.ap_checks_all aca
WHERE 1 = 1
AND gjh.je_header_id = gjl.je_header_id
AND gjl.status || '' = 'P'
AND gjl.code_combination_id = gcc.code_combination_id
AND gjh.period_name = glp.period_name
AND glp.period_set_name = :p_period_set_name
AND glp.adjustment_period_flag <> 'Y'

AND gjh.je_source = 'Payables'


AND gjl.je_header_id = imp.je_header_id
AND gjl.je_line_num = imp.je_line_num
AND imp.gl_sl_link_id = xal.gl_sl_link_id
AND imp.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xe.application_id
AND xah.event_id = xe.event_id
AND xe.application_id = xte.application_id
AND xte.application_id = 200
AND xe.entity_id = xte.entity_id
AND xte.entity_code = 'AP_PAYMENTS'
AND xte.source_id_int_1 = aca.check_id
AND gjh.default_effective_date BETWEEN :p_period_from_start_date
AND :p_period_to_end_date
AND (gjh.actual_flag = :p_actual_flag OR :p_actual_flag IS NULL)

GL Entries with the AR Transaction (Invoices) Query in oracle apps


SELECT glp.start_date, gjh.je_header_id, gjh.doc_sequence_value voucher_no,
gjh.je_source, gjh.je_category, entity_code, gjh.period_name,
gjh.status, gjh.actual_flag, gjh.default_effective_date,
gjl.je_line_num, gjl.code_combination_id,
gjl.description voucher_desc, xal.accounted_dr debit,
xal.accounted_cr credit,
gcc.segment1
|| '-'
|| gcc.segment2
|| '-'
|| gcc.segment3
|| '-'
|| gcc.segment4
|| '-'
|| gcc.segment5
|| '-'
|| gcc.segment6
|| '-'
|| gcc.segment7 account_code,
TO_CHAR (rct.trx_number) trx_num, rct.trx_date trx_date
FROM gl.gl_je_headers gjh,
gl.gl_je_lines gjl,
gl.gl_code_combinations gcc,
gl.gl_periods glp,
gl.gl_import_references imp,
xla.xla_ae_lines xal,
xla.xla_ae_headers xah,
xla.xla_events xe,
xla.xla_transaction_entities xte,
ra_customer_trx_all rct
WHERE 1 = 1
AND gjh.je_header_id = gjl.je_header_id

AND gjl.status || '' = 'P'


AND gjl.code_combination_id = gcc.code_combination_id
AND gjh.period_name = glp.period_name
AND glp.period_set_name = :p_period_set_name
AND glp.adjustment_period_flag <> 'Y'
AND gjh.je_source = 'Receivables'
AND gjl.je_header_id = imp.je_header_id
AND gjl.je_line_num = imp.je_line_num
AND imp.gl_sl_link_id = xal.gl_sl_link_id
AND imp.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xe.application_id
AND xah.event_id = xe.event_id
AND xe.application_id = xte.application_id
AND xte.application_id = 222
AND xe.entity_id = xte.entity_id
AND xte.entity_code = 'TRANSACTIONS'
AND xte.source_id_int_1 = rct.customer_trx_id
AND gjh.default_effective_date BETWEEN :p_period_from_start_date
AND :p_period_to_end_date
AND (gjh.actual_flag = :p_actual_flag OR :p_actual_flag IS NULL)

AR Receipts to GL link in oracle R12


SELECT glp.start_date,
gjh.je_header_id,
gjh.doc_sequence_value voucher_no,
gjh.je_source,
gjh.je_category,
entity_code,
gjh.period_name,
gjh.status,
gjh.actual_flag,
gjh.default_effective_date,
gjl.je_line_num,
gjl.code_combination_id,
gjl.description voucher_desc,
xal.accounted_dr debit,
xal.accounted_cr credit,
gcc.segment1
|| '-'
|| gcc.segment2
|| '-'
|| gcc.segment3
|| '-'
|| gcc.segment4
|| '-'
|| gcc.segment5
|| '-'

|| gcc.segment6
|| '-'
|| gcc.segment7
account_code,
TO_CHAR (acr.receipt_number) trx_num,
acr.receipt_date trx_date
FROM gl.gl_je_headers gjh,
gl.gl_je_lines gjl,
gl.gl_code_combinations gcc,
gl.gl_periods glp,
gl.gl_import_references imp,
xla.xla_ae_lines xal,
xla.xla_ae_headers xah,
xla.xla_events xe,
xla.xla_transaction_entities xte,
ar_cash_receipts_all acr
WHERE 1 = 1
AND gjh.je_header_id = gjl.je_header_id
AND gjl.status || '' = 'P'
AND gjl.code_combination_id = gcc.code_combination_id
AND gjh.period_name = glp.period_name
AND glp.period_set_name = :p_period_set_name
AND glp.adjustment_period_flag <> 'Y'
AND gjh.je_source = 'Receivables'
AND gjl.je_header_id = imp.je_header_id
AND gjl.je_line_num = imp.je_line_num
AND imp.gl_sl_link_id = xal.gl_sl_link_id
AND imp.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xe.application_id
AND xah.event_id = xe.event_id
AND xe.application_id = xte.application_id
AND xte.application_id = 222
AND xe.entity_id = xte.entity_id
AND xte.entity_code = 'RECEIPTS'
AND xte.source_id_int_1 = acr.cash_receipt_id
AND gjh.default_effective_date BETWEEN :p_period_from_start_date
AND :p_period_to_end_date
AND (gjh.actual_flag = :p_actual_flag OR :p_actual_flag IS NULL)

AR Adjustments to GL query in oracle apps


SELECT glp.start_date,
gjh.je_header_id,
gjh.doc_sequence_value voucher_no,
gjh.je_source,
gjh.je_category,
entity_code,
gjh.period_name,

gjh.status,
gjh.actual_flag,
gjh.default_effective_date,
gjl.je_line_num,
gjl.code_combination_id,
gjl.description voucher_desc,
xal.accounted_dr debit,
xal.accounted_cr credit,
gcc.segment1
|| '-'
|| gcc.segment2
|| '-'
|| gcc.segment3
|| '-'
|| gcc.segment4
|| '-'
|| gcc.segment5
|| '-'
|| gcc.segment6
|| '-'
|| gcc.segment7
account_code,
TO_CHAR (aaa.adjustment_number) trx_num,
aaa.apply_date trx_date
FROM gl.gl_je_headers gjh,
gl.gl_je_lines gjl,
gl.gl_code_combinations gcc,
gl.gl_periods glp,
gl.gl_import_references imp,
xla.xla_ae_lines xal,
xla.xla_ae_headers xah,
xla.xla_events xe,
xla.xla_transaction_entities xte,
ar_adjustments_all aaa
WHERE 1 = 1
AND gjh.je_header_id = gjl.je_header_id
AND gjl.status || '' = 'P'
AND gjl.code_combination_id = gcc.code_combination_id
AND gjh.period_name = glp.period_name
AND glp.period_set_name = :p_period_set_name
AND glp.adjustment_period_flag <> 'Y'
AND gjh.je_source = 'Receivables'
AND gjl.je_header_id = imp.je_header_id
AND gjl.je_line_num = imp.je_line_num
AND imp.gl_sl_link_id = xal.gl_sl_link_id
AND imp.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xe.application_id
AND xah.event_id = xe.event_id
AND xe.application_id = xte.application_id

AND xte.application_id = 222


AND xe.entity_id = xte.entity_id
AND xte.entity_code = 'ADJUSTMENTS'
AND xte.source_id_int_1 = aaa.adjustment_id
AND gjh.default_effective_date BETWEEN :p_period_from_start_date
AND :p_period_to_end_date
AND (gjh.actual_flag = :p_actual_flag OR :p_actual_flag IS NULL)

Link between Order Management and Account Receivables (OM Link AR)
SELECT ooha.order_number
, oola.line_number so_line_number
, oola.ordered_item
, oola.ordered_quantity * oola.unit_selling_price so_extended_price
, rcta.trx_number invoice_number
, rcta.trx_date
, rctla.line_number inv_line_number
, rctla.unit_selling_price inv_unit_selling_price
FROM oe_order_headers_all ooha
, oe_order_lines_all oola
, ra_customer_trx_all rcta
, ra_customer_trx_lines_all rctla
WHERE ooha.header_id = oola.header_id
AND rcta.customer_trx_id = rctla.customer_trx_id
AND rctla.interface_line_attribute6 = TO_CHAR (oola.line_id)
AND rctla.interface_line_attribute1 = TO_CHAR (ooha.order_number)
AND order_number = :p_order_number

Query to display BOL, MBOL, Trip details for a Sales Order


SELECT ooh.order_number
, wnd.NAME delivery_name
, wt.NAME trip_name
, ool.line_number
, ool.ordered_item
, ool.flow_status_code
, DECODE (wdd.released_status
, 'R', 'Ready For Release'
, 'B', 'Back Ordered'
, 'S', 'Released To Warehouse'
, 'D', 'Cancelled'
, 'N', 'Not Ready For Release'
, 'Y', 'Staged or Pick Confirmed'
, 'C', 'Interfaced/Shipped'
, 'I', 'Interfaced/Shipped'
, 'O', 'Not Shipped'
) delivery_status
, rct.trx_number invoice_number
, wdd.released_status
, ood.organization_name || ' (' || ood.organization_code || ')' ship_from_org
, hp_carrier.party_name carrier_name

, wdi.sequence_number bol_number
, wds.departure_net_weight ship_weight
, wds.actual_departure_date ship_date
, ooh.cust_po_number
, SUBSTR (hp.party_name, 1, 30) || ' ' ||
SUBSTR (hl_ship.address1, 1, 36) || ' ' ||
SUBSTR (hl_ship.address2, 1, 36) || ' ' ||
SUBSTR (hl_ship.city, 1, 30) || ' ' ||
SUBSTR (hl_ship.province , 1 , 2 ) || ' ' ||
SUBSTR (hl_ship.postal_code , 1 , 8 ) ship_to_address
FROM apps.hr_locations hl
, org_organization_definitions ood
, apps.oe_order_headers_all ooh
, oe_order_lines_all ool
, apps.hz_locations hl_ship
, apps.hz_parties hp
, apps.hz_party_sites hps
, apps.hz_cust_acct_sites_all hcas
, apps.hz_cust_site_uses_all hcsu
, apps.hz_party_sites hps_bill
, apps.hz_cust_acct_sites_all hcas_bill
, apps.hz_cust_site_uses_all hcsu_bill
, apps.wsh_delivery_details wdd
, apps.wsh_new_deliveries wnd
, apps.wsh_delivery_assignments wda
, apps.wsh_trips wt
, apps.wsh_delivery_legs wdl
, apps.wsh_trip_stops wds
, apps.wsh_document_instances wdi
, apps.hz_parties hp_carrier
, ra_customer_trx_all rct
WHERE 1 = 1
AND
ooh.header_id = ool.header_id
AND
ood.organization_id = ool.ship_from_org_id
AND
ooh.ship_from_org_id = hl.inventory_organization_id
AND
hl_ship.location_id = hps.location_id
AND
hp.party_id = hps.party_id
AND
hps.party_site_id = hcas.party_site_id
AND
hps_bill.party_site_id = hcas_bill.party_site_id
AND
hps_bill.party_id = hp.party_id
AND
hcas.cust_acct_site_id = hcsu.cust_acct_site_id
AND
hcsu.site_use_id = ooh.ship_to_org_id
AND
hcas_bill.cust_acct_site_id = hcsu_bill.cust_acct_site_id
AND
hcsu_bill.site_use_id = ooh.invoice_to_org_id
AND
ooh.header_id = wdd.source_header_id(+)
AND
wda.delivery_detail_id(+) = wdd.delivery_detail_id
AND
wda.delivery_id = wnd.delivery_id(+)
AND
ool.line_id = wdd.source_line_id
AND
wt.trip_id(+) = wds.trip_id
AND
wds.stop_id(+) = wdl.pick_up_stop_id
AND
wdl.delivery_id(+) = wnd.delivery_id

AND
hp_carrier.party_id(+) = wt.carrier_id
AND
wdi.entity_id(+) = wdl.delivery_leg_id
AND
wdi.entity_name(+) = 'WSH_DELIVERY_LEGS'
AND TO_CHAR (ooh.order_number) = rct.ct_reference(+)
AND TO_CHAR (ooh.order_number) = rct.interface_header_attribute1(+)
AND
interface_header_context(+) = 'ORDER ENTRY'
AND
ooh.order_number = :order_number
ORDER BY ool.flow_status_code
, ooh.order_number
, ool.line_number

Drop Ship Order Query in oracle apps


SELECT h.order_number
, l.line_number so_line_number
, ph.segment1 po_number
, l.ordered_item
, l.ordered_quantity
, por.release_num
, pl.line_num po_line_number
, ph.authorization_status
, prh.interface_source_code
, prh.segment1 requisition_number
, prl.line_num requisition_line_number
, ph.closed_date
, ph.closed_code
, ods.header_id so_header_id
, ods.line_id so_line_id
, prh.requisition_header_id
, prl.requisition_line_id
, ph.po_header_id
, pl.po_line_id
, pll.line_location_id po_line_location_id
, por.po_release_id
FROM oe_drop_ship_sources ods
, oe_order_headers_all h
, oe_order_lines_all l
, po_line_locations_all pll
, po_lines_all pl
, po_headers_all ph
, po_requisition_headers_all prh
, po_requisition_lines_all prl
, po_releases_all por
WHERE h.header_id = l.header_id
AND h.header_id = ods.header_id
AND l.line_id = ods.line_id
AND por.po_release_id(+) = ods.po_release_id
AND ods.line_location_id = pll.line_location_id(+)
AND ods.po_header_id = pl.po_header_id(+)
AND ods.po_line_id = pl.po_line_id(+)
AND ph.po_header_id(+) = pl.po_header_id

AND prl.requisition_header_id(+) = ods.requisition_header_id


AND prl.requisition_line_id(+) = ods.requisition_line_id
AND prh.requisition_header_id(+) = prl.requisition_header_id
AND h.order_number = :sales_order;

AR Transactions India Localization Tax Query in Oracle apps


SELECT TO_CHAR (trx_date, 'DD-MON-YYYY') ar_posting_date,
TO_CHAR (jatt.excise_invoice_date, 'DD-MON-YYYY') excise_invoice_date,
rcta.trx_number ar_trx_number, flv.meaning document_type,
jatt.excise_invoice_no, hca.account_number cust_bill_to,
hp.party_name cust_name, rctla.extended_amount basic_amt,
(SELECT NVL (jattt.tax_amount, 0)
FROM jai_ar_trx_tax_lines jattt, jai_cmn_taxes_all jcta
WHERE jattt.tax_id = jcta.tax_id
AND UPPER (jcta.tax_type) = 'EXCISE'
AND jattt.link_to_cust_trx_line_id = rctla.customer_trx_line_id)
excise_amt,
(SELECT NVL (jattt.tax_amount, 0)
FROM jai_ar_trx_tax_lines jattt,
jai_cmn_taxes_all jcta
WHERE jattt.tax_id = jcta.tax_id
AND UPPER (jcta.tax_type) = 'CST'
AND jattt.link_to_cust_trx_line_id = rctla.customer_trx_line_id)
sales_tax_amt,
( (SELECT NVL (SUM (extended_amount), 0)
FROM ra_customer_trx_lines_all
WHERE customer_trx_id = rcta.customer_trx_id)
- (SELECT NVL (jattt.tax_amount, 0)
FROM jai_ar_trx_tax_lines jattt, jai_cmn_taxes_all jcta
WHERE jattt.tax_id = jcta.tax_id
AND UPPER (jcta.tax_type) = 'TCS'
AND jattt.link_to_cust_trx_line_id = rctla.customer_trx_line_id)
) tcs_base_amt,
(SELECT NVL (jattt.tax_amount, 0)
FROM jai_ar_trx_tax_lines jattt, jai_cmn_taxes_all jcta
WHERE jattt.tax_id = jcta.tax_id
AND UPPER (jcta.tax_type) = 'TCS'
AND jattt.link_to_cust_trx_line_id = rctla.customer_trx_line_id)
tcs_amt,
(SELECT NVL (SUM (extended_amount), 0)
FROM ra_customer_trx_lines_all
WHERE customer_trx_id = rcta.customer_trx_id) tot_inv_amt,
(SELECT pan_no
FROM jai_cmn_cus_addresses
WHERE customer_id = rcta.bill_to_customer_id
AND ROWNUM = 1) party_pan_no,
NULL challan_no,
(SELECT tax_descr
FROM jai_ar_trx_tax_lines jattt, jai_cmn_taxes_all jcta
WHERE jattt.tax_id = jcta.tax_id
AND UPPER (jcta.tax_type) = 'TCS'
AND jattt.link_to_cust_trx_line_id = rctla.customer_trx_line_id)tax_desc,
NULL tcs_pay_voucher_no

FROM ra_customer_trx_all rcta,


ra_cust_trx_types_all rctt,
fnd_lookup_values flv,
ra_customer_trx_lines_all rctla,
jai_ar_trx_lines jatt,
hz_cust_accounts hca,
hz_parties hp
WHERE rcta.cust_trx_type_id = rctt.cust_trx_type_id
AND rcta.customer_trx_id = rctla.customer_trx_id
AND flv.lookup_type = 'TRX TYPES'
AND rctt.TYPE = flv.lookup_code
AND rctla.line_type = 'LINE'
AND jatt.customer_trx_id = rcta.customer_trx_id
AND jatt.customer_trx_line_id = rctla.customer_trx_line_id
AND rcta.bill_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND jatt.excise_invoice_no IS NOT NULL
AND TO_CHAR (trx_date, 'DD-MON-YYYY') BETWEEN
NVL (TO_CHAR (:p_from_date,
'DD-MON-YYYY'
),
TO_DATE (SYSDATE,
'DD-MON-YYYY'
)
) AND NVL (TO_CHAR (:p_to_date, 'DD-MON-YYYY' ), TO_DATE (SYSDATE, 'DD-MONYYYY' ) )
AND hca.cust_account_id = NVL (:p_cust_name, hca.cust_account_id)

AR to GL Link in oracle apps

SELECT trx.trx_number,
trx.cust_trx_type_id,
trx.bill_to_customer_id,
trx_dist.amount ar_inv_dist_amount,
trx_dist.code_combination_id ar_inv_dist_ccid,
gcc.segment1
|| '.'
|| gcc.segment2
|| '.'
|| gcc.segment3
|| '.'
|| gcc.segment4
|| '.'
|| gcc.segment5
|| '.'
|| gcc.segment6
|| '.'
|| gcc.segment7
|| '.'
|| gcc.segment8
ar_inv_dist_code_combination,
gjh.name gl_je_header_name,
gjh.description gl_je_header_desc,
gjl.je_line_num,

gjl.code_combination_id gl_je_line_ccid
FROM ar.ra_customer_trx_all trx,
ar.ra_cust_trx_line_gl_dist_all trx_dist,
gl.gl_code_combinations gcc,
gl.gl_ledgers gl,
xla.xla_transaction_entities xte,
xla.xla_ae_headers xah,
xla.xla_ae_lines xal,
xla.xla_distribution_links xdl,
gl.gl_import_references gir,
gl.gl_je_headers gjh,
gl.gl_je_lines gjl
WHERE 1 = 1
-- AND trx.org_id = :P_ORG_ID
-- AND trx.batch_source_id = :P_BATCH_SOURCE_ID
AND trx.customer_trx_id = :P_CUSTOMER_TRX_ID
AND trx.customer_trx_id = trx_dist.customer_trx_id
AND gcc.code_combination_id = trx_dist.code_combination_id
-- AND gl.short_name = :P_LEDGER_SHORT_NAME
AND gl.chart_of_accounts_id = gcc.chart_of_accounts_id
AND xte.ledger_id = gl.ledger_id
AND xte.entity_code = 'TRANSACTIONS'
AND xte.application_id = 222
AND xte.source_id_int_1 = trx.customer_trx_id
AND xah.entity_id = xte.entity_id
AND xal.ae_header_id = xah.ae_header_id
AND xal.accounting_class_code = 'REVENUE'
AND xdl.ae_header_id = xah.ae_header_id
AND xdl.ae_line_num = xal.ae_line_num
AND xdl.source_distribution_id_num_1 = trx_dist.cust_trx_line_gl_dist_id
AND xdl.application_id = 222
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id = gjh.je_header_id
AND gjl.je_line_num = gir.je_line_num;

AR Receipt Queries
Query for Total On Account Receipt Amount
SELECT NVL (SUM (ps.amount_due_remaining), 0) total_onacct_receipts
FROM hz_cust_accounts_all cust_acct,
ar_payment_schedules_all ps,
ar_receivable_applications_all arr,
hz_cust_acct_sites_all acct_site,
hz_party_sites party_site,
hz_locations loc,
hz_cust_site_uses_all site_uses,
ar_cash_receipts_all acr,
ar_cash_receipt_history_all crh,
gl_code_combinations cc
WHERE
TRUNC (ps.gl_date) <= :p_as_of_date
AND ps.customer_id = cust_acct.cust_account_id

AND cust_acct.account_number = :p_account_number


AND ps.customer_id = cust_acct.cust_account_id
AND acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND ps.cash_receipt_id = acr.cash_receipt_id
AND acr.cash_receipt_id = crh.cash_receipt_id
AND crh.account_code_combination_id = cc.code_combination_id
AND ps.trx_date <= :p_as_of_date
AND ps.CLASS = 'PMT'
AND ps.cash_receipt_id = arr.cash_receipt_id
AND arr.status IN ('ACC')
AND ps.status = 'OP'
AND site_uses.site_use_code = 'BILL_TO'
AND site_uses.cust_acct_site_id = acct_site.cust_acct_site_id
AND NVL (site_uses.status, 'A') = 'A'
AND cust_acct.cust_account_id = acct_site.cust_account_id
AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id
AND ps.customer_id = acct_site.cust_account_id
AND ps.customer_site_use_id = site_uses.site_use_id
HAVING NVL (SUM (arr.amount_applied), 0) > 0;
Query for Total Un-applied Receipt Amount
/* Formatted on 12/8/2014 3:12:36 PM (QP5 v5.115.810.9015) */
SELECT NVL (SUM (arr.amount_applied), 0) total_unapp_receipts
FROM hz_cust_accounts_all cust_acct,
ar_payment_schedules_all ps,
ar_receivable_applications_all arr,
hz_cust_acct_sites_all acct_site,
hz_party_sites party_site,
hz_locations loc,
hz_cust_site_uses_all site_uses,
ar_cash_receipts_all acr,
ar_cash_receipt_history_all crh,
gl_code_combinations cc
WHERE
TRUNC (ps.gl_date) <= :p_as_of_date
AND ps.customer_id = cust_acct.cust_account_id
AND cust_acct.account_number = :p_account_number
AND ps.customer_id = cust_acct.cust_account_id
AND acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND ps.cash_receipt_id = acr.cash_receipt_id
AND acr.cash_receipt_id = crh.cash_receipt_id
AND crh.account_code_combination_id = cc.code_combination_id
AND ps.trx_date <= :p_as_of_date
AND ps.CLASS = 'PMT'
AND ps.cash_receipt_id = arr.cash_receipt_id
AND arr.status = 'UNAPP'
AND ps.status = 'OP'
AND site_uses.site_use_code = 'BILL_TO'
AND site_uses.cust_acct_site_id = acct_site.cust_acct_site_id

AND NVL (site_uses.status, 'A') = 'A'


AND cust_acct.cust_account_id = acct_site.cust_account_id
AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id
AND ps.customer_id = acct_site.cust_account_id
AND ps.customer_site_use_id = site_uses.site_use_id
HAVING NVL (SUM (arr.amount_applied), 0) > 0;
Query for Total Uncleared Receipt Amount
/* Formatted on 12/8/2014 3:12:52 PM (QP5 v5.115.810.9015) */
SELECT NVL (SUM (ps.amount_due_remaining), 0) total_uncleared_receipts
FROM hz_cust_accounts_all cust_acct,
ar_payment_schedules_all ps,
ar_receivable_applications_all arr,
hz_cust_acct_sites_all acct_site,
hz_party_sites party_site,
hz_locations loc,
hz_cust_site_uses_all site_uses,
ar_cash_receipt_history_all crh,
ar_cash_receipts_all acr,
gl_code_combinations cc
WHERE
TRUNC (ps.gl_date) <= :p_as_of_date
AND ps.customer_id = cust_acct.cust_account_id
AND cust_acct.account_number = :p_account_number
AND ps.customer_id = cust_acct.cust_account_id
AND acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND ps.cash_receipt_id = acr.cash_receipt_id
AND acr.cash_receipt_id = crh.cash_receipt_id
AND crh.account_code_combination_id = cc.code_combination_id
AND ps.trx_date <= :p_as_of_date
AND ps.CLASS = 'PMT'
AND ps.cash_receipt_id = arr.cash_receipt_id
AND arr.status = 'UNAPP'
AND ps.status = 'OP'
AND site_uses.site_use_code = 'BILL_TO'
AND site_uses.cust_acct_site_id = acct_site.cust_acct_site_id
AND NVL (site_uses.status, 'A') = 'A'
AND cust_acct.cust_account_id = acct_site.cust_account_id
AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id
AND ps.customer_id = acct_site.cust_account_id
AND ps.customer_site_use_id = site_uses.site_use_id
AND ps.cash_receipt_id = crh.cash_receipt_id
AND crh.status NOT IN ('CLEARED')
HAVING NVL (SUM (arr.amount_applied), 0) > 0;

Receivables Useful Query


1)develop a query to list customer details
cust name,cust no,profile class,primary bill_to_address

(country,address,city,state,postal code),primary ship_to_address(country,address,city,state,po)


SELECT hp1.party_name,
hp1.party_id,
hca.account_number,
hcpc.name,
hcsua.site_use_code,
hl.country
|| ' '
|| hl.address1
|| ' '
|| hl.city
|| ' '
|| hl.state
|| ' '
|| hl.postal_code
"Address"
FROM hz_parties hp1,
hz_cust_accounts hca,
hz_party_sites hps,
hz_cust_profile_classes hcpc,
hz_customer_profiles hcp,
hz_locations hl,
hz_cust_acct_sites_all hcasa,
hz_cust_site_uses_all hcsua
WHERE 1 = 1
AND hca.account_number = 3896
AND hcp.profile_class_id = hcpc.profile_class_id(+)
AND hca.cust_account_id = hcp.cust_account_id
AND hp1.party_id = hca.party_id
--and hca.cust_account_id=hcasa.cust_account_id
AND hps.party_site_id = hcasa.party_site_id
AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND hp1.party_id = hps.party_id
AND hl.location_id = hps.location_id
AND hcsua.primary_flag = 'Y'
AND hcp.site_use_id IS NULL
AND hcasa.org_id = 204;
2)to extract customer invoice details,cust name,total invoice relevant to customer
cust no,cust name,date of invoice generated,amount of invoice,
amount of invoice last paid by the customer,credit limit,balance amount unpaid
SELECT hca.account_number,
hp.party_name,
rcta.trx_date,
(SELECT SUM (rctla.extended_amount)
FROM ra_customer_trx_lines_all rctla
WHERE rcta.customer_trx_id = rctla.customer_trx_id)
"INVOICE AMOUNT",

hcpa.overall_credit_limit,
apsa.amount_due_remaining,
acra.amount
FROM hz_parties hp,
hz_cust_accounts hca,
hz_customer_profiles hcp,
hz_cust_profile_amts hcpa,
ra_customer_trx_all rcta--, ra_customer_trx_lines_all rctla
,
ar_cash_receipts_all acra,
ar_receivable_applications_all araa,
ar_payment_schedules_all apsa
WHERE 1 = 1
AND hp.party_id = hca.party_id
AND hca.cust_account_id = hcp.cust_account_id
AND hcp.site_use_id IS NULL
AND hcpa.cust_account_profile_id = hcp.cust_account_profile_id
AND hcpa.currency_code = 'USD'
AND rcta.sold_to_customer_id = hca.cust_account_id
AND rcta.org_id = 204
--and rcta.customer_trx_id = rctla.customer_trx_id
AND rcta.customer_trx_id = apsa.customer_trx_id
AND araa.applied_customer_trx_id = apsa.customer_trx_id
AND acra.cash_receipt_id = araa.cash_receipt_id
AND rcta.trx_number = '11792'
AND acra.cash_receipt_id =
(SELECT MAX (cash_receipt_id)
FROM ar_receivable_applications_all araa_2
WHERE araa_2.applied_customer_trx_id = apsa.customer_trx_id)
;
3)to list all the invoices whicha r pending to b paid for more than 60 days from sysdate
cust no,cust name,invoice no,date of invoice,amount,
period of invoice pending for 30-60 days,period of invoice pending for 60-120 days,
period of invoice pending for more than 120 days
SELECT hca.account_number,
hp.party_name,
rcta.trx_number,
rcta.trx_date,
SUM (rctla.extended_amount),
CASE
WHEN TRUNC (SYSDATE - rcta.trx_date) BETWEEN 30 AND 60
THEN
rcta.trx_number
END
"Pending for 30 - 60 days",
CASE
WHEN TRUNC (SYSDATE - rcta.trx_date) BETWEEN 60 AND 120
THEN
rcta.trx_number

END
"Pending for 60 - 120 days",
CASE
WHEN TRUNC (SYSDATE - rcta.trx_date) > 120 THEN rcta.trx_number
END
"Pending for more than 120 days"
FROM hz_parties hp,
hz_cust_accounts hca,
ra_customer_trx_all rcta,
ra_customer_trx_lines_all rctla
WHERE hp.party_id = hca.party_id
AND rcta.org_id = 204
AND hca.cust_account_id = rcta.sold_to_customer_id
AND rcta.customer_trx_id = rctla.customer_trx_id
AND hca.account_number = 3896
GROUP BY hca.account_number, hp.party_name, rcta.trx_number, rcta.trx_date;
4)to list all the invoices paid during past 6 months
cust no,cust name,invoice no,receipt no,date of invoive,date of payment,amount
SELECT hca.account_number,
hp.party_name,
rcta.trx_number,
acra.receipt_number,
rcta.trx_date,
acra.creation_date,
acra.amount
FROM hz_parties hp,
hz_cust_accounts hca,
ra_customer_trx_all rcta--, ra_customer_trx_lines_all rctla
,
ar_cash_receipts_all acra,
ar_payment_schedules_all apsa,
ar_receivable_applications_all araa,
ar_lookups al
WHERE 1 = 1
AND hp.party_id = hca.party_id
AND rcta.sold_to_customer_id = hca.cust_account_id
AND rcta.org_id = 204
--and rcta.customer_trx_id = rctla.customer_trx_id
AND rcta.customer_trx_id = apsa.customer_trx_id
AND araa.applied_customer_trx_id = apsa.customer_trx_id
AND acra.cash_receipt_id = araa.cash_receipt_id
AND acra.status = al.lookup_code
AND al.lookup_type = 'PAYMENT_TYPE'
AND rcta.trx_number = '11792'
AND TRUNC (MONTHS_BETWEEN (SYSDATE, araa.creation_date)) <= 6;

AR to HZ Table Link

SELECT HP.PARTY_NAME CUSTOMER_NAME


FROM HZ_PARTIES HP,
RA_CUSTOMER_TRX_ALL RCTA,
HZ_CUST_ACCOUNTS_ALL HCAA
WHERE HP.PARTY_ID = HCAA.PARTY_ID
AND HCAA.CUST_ACCOUNT_ID = RCTA.BILL_TO_CUSTOMER_ID
AND RCTA.TRX_NUMBER = '500875'
AND RCTA.ORG_ID = 204
=======================================
SELECT ACRA.RECEIPT_NUMBER
FROM RA_CUSTOMER_TRX_ALL RCTA,
AR_CASH_RECEIPTS_ALL ACRA,
AR_RECEIVABLE_APPLICATIONS_ALL ARAA
WHERE RCTA.CUSTOMER_TRX_ID = ARAA.APPLIED_CUSTOMER_TRX_ID
AND ACRA.CASH_RECEIPT_ID = ARAA.CASH_RECEIPT_ID
AND RCTA.TRX_NUMBER = '500875'
AND RCTA.ORG_ID = 204
===============================
SELECT RCTTA.NAME
FROM RA_CUST_TRX_TYPES_ALL RCTTA,
RA_CUSTOMER_TRX_ALL RCTA
WHERE RCTTA.CUST_TRX_TYPE_ID = RCTA.CUST_TRX_TYPE_ID
AND RCTA.TRX_NUMBER = '500875'
AND RCTA.ORG_ID = RCTTA.ORG_ID
AND RCTA.ORG_ID = 204
=============================================
SELECT HP.PARTY_NAME,
HCAA.ACCOUNT_NUMBER,
HL.ADDRESS1,
HL.ADDRESS2,
HL.ADDRESS3,
HL.ADDRESS4,
HL.CITY,
HL.STATE,
HL.COUNTRY
FROM HZ_LOCATIONS HL,
HZ_PARTIES HP,
HZ_PARTY_SITES HPS,
HZ_CUST_ACCOUNTS_ALL HCAA,
HZ_CUST_ACCT_SITES_ALL HCASA,
HZ_CUST_SITE_USES_ALL HCSUA,
RA_CUSTOMER_TRX_ALL RCTA
WHERE HP.PARTY_ID = HPS.PARTY_ID
AND HPS.LOCATION_ID = HL.LOCATION_ID

AND HP.PARTY_ID = HCAA.PARTY_ID


AND HCAA.CUST_ACCOUNT_ID = HCASA.CUST_ACCOUNT_ID
AND HCASA.CUST_ACCT_SITE_ID = HCSUA.CUST_ACCT_SITE_ID
AND HCSUA.SITE_USE_ID = RCTA.SHIP_TO_SITE_USE_ID
AND HCASA.PARTY_SITE_ID = HPS.PARTY_SITE_ID
AND HCAA.CUST_ACCOUNT_ID = RCTA.BILL_TO_CUSTOMER_ID
AND HCSUA.SITE_USE_CODE = 'SHIP_TO'
AND RCTA.TRX_NUMBER = '500875'
=============================================
SELECT HP.PARTY_NAME,
HCAA.ACCOUNT_NUMBER,
HL.ADDRESS1,
HL.ADDRESS2,
HL.ADDRESS3,
HL.ADDRESS4,
HL.CITY,
HL.STATE,
HL.COUNTRY
FROM HZ_LOCATIONS HL,
HZ_PARTIES HP,
HZ_PARTY_SITES HPS,
HZ_CUST_ACCOUNTS_ALL HCAA,
HZ_CUST_ACCT_SITES_ALL HCASA,
HZ_CUST_SITE_USES_ALL HCSUA,
RA_CUSTOMER_TRX_ALL RCTA
WHERE HP.PARTY_ID = HPS.PARTY_ID
AND HPS.LOCATION_ID = HL.LOCATION_ID
AND HP.PARTY_ID = HCAA.PARTY_ID
AND HCAA.CUST_ACCOUNT_ID = HCASA.CUST_ACCOUNT_ID
AND HCASA.CUST_ACCT_SITE_ID = HCSUA.CUST_ACCT_SITE_ID
AND HCSUA.SITE_USE_ID = RCTA.BILL_TO_SITE_USE_ID
AND HCASA.PARTY_SITE_ID = HPS.PARTY_SITE_ID
AND HCAA.CUST_ACCOUNT_ID = RCTA.BILL_TO_CUSTOMER_ID
AND RCTA.ORG_ID = 204
AND HCSUA.SITE_USE_CODE = 'BILL_TO'
AND RCTA.TRX_NUMBER = '500875' ;

Query to display BOL, MBOL, Trip details for a Sales Order


SELECT ooh.order_number,
wnd.name delivery_name,
wt.name trip_name,
ool.line_number,
ool.ordered_item,
ool.flow_status_code,
DECODE (wdd.released_status,
'R',

'Ready For Release',


'B',
'Back Ordered',
'S',
'Released To Warehouse',
'D',
'Cancelled',
'N',
'Not Ready For Release',
'Y',
'Staged or Pick Confirmed',
'C',
'Interfaced/Shipped',
'I',
'Interfaced/Shipped',
'O',
'Not Shipped'
)
delivery_status,
rct.trx_number invoice_number,
wdd.released_status,
ood.organization_name || ' (' || ood.organization_code || ')'
ship_from_org,
hp_carrier.party_name carrier_name,
wdi.sequence_number bol_number,
wds.departure_net_weight ship_weight,
wds.actual_departure_date ship_date,
ooh.cust_po_number,
SUBSTR (hp.party_name, 1, 30)
|| ' '
|| SUBSTR (hl_ship.address1, 1, 36)
|| ' '
|| SUBSTR (hl_ship.address2, 1, 36)
|| ' '
|| SUBSTR (hl_ship.city, 1, 30)
|| ' '
|| SUBSTR (hl_ship.province, 1, 2)
|| ' '
|| SUBSTR (hl_ship.postal_code, 1, 8)
ship_to_address
FROM apps.hr_locations hl,
org_organization_definitions ood,
apps.oe_order_headers_all ooh,
oe_order_lines_all ool,
apps.hz_locations hl_ship,
apps.hz_parties hp,
apps.hz_party_sites hps,
apps.hz_cust_acct_sites_all hcas,
apps.hz_cust_site_uses_all hcsu,
apps.hz_party_sites hps_bill,
apps.hz_cust_acct_sites_all hcas_bill,

apps.hz_cust_site_uses_all hcsu_bill,
apps.wsh_delivery_details wdd,
apps.wsh_new_deliveries wnd,
apps.wsh_delivery_assignments wda,
apps.wsh_trips wt,
apps.wsh_delivery_legs wdl,
apps.wsh_trip_stops wds,
apps.wsh_document_instances wdi,
apps.hz_parties hp_carrier,
ra_customer_trx_all rct
WHERE 1 = 1
AND ooh.header_id = ool.header_id
AND ood.organization_id = ool.ship_from_org_id
AND ooh.ship_from_org_id = hl.inventory_organization_id
AND hl_ship.location_id = hps.location_id
AND hp.party_id = hps.party_id
AND hps.party_site_id = hcas.party_site_id
AND hps_bill.party_site_id = hcas_bill.party_site_id
AND hps_bill.party_id = hp.party_id
AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
AND hcsu.site_use_id = ooh.ship_to_org_id
AND hcas_bill.cust_acct_site_id = hcsu_bill.cust_acct_site_id
AND hcsu_bill.site_use_id = ooh.invoice_to_org_id
AND ooh.header_id = wdd.source_header_id(+)
AND wda.delivery_detail_id(+) = wdd.delivery_detail_id
AND wda.delivery_id = wnd.delivery_id(+)
AND ool.line_id = wdd.source_line_id
AND wt.trip_id(+) = wds.trip_id
AND wds.stop_id(+) = wdl.pick_up_stop_id
AND wdl.delivery_id(+) = wnd.delivery_id
AND hp_carrier.party_id(+) = wt.carrier_id
AND wdi.entity_id(+) = wdl.delivery_leg_id
AND wdi.entity_name(+) = 'WSH_DELIVERY_LEGS'
AND TO_CHAR (ooh.order_number) = rct.ct_reference(+)
AND TO_CHAR (ooh.order_number) = rct.interface_header_attribute1(+)
AND interface_header_context(+) = 'ORDER ENTRY'
AND ooh.order_number = :order_number
ORDER BY ool.flow_status_code, ooh.order_number, ool.line_number;

Sales order header information


SELECT ooh.order_number,
ooh.header_id hdr_id,
DECODE (ooh.order_category_code,
'MIXED', 'Mixed',
'ORDER', 'Regular',
'RETURN', 'Return',
ooh.order_category_code)
category,
ott.name ord_typ,

ooh.ordered_date,
ooh.transactional_curr_code curr,
os2.name sdt,
ooh.source_document_id sdi,
os1.name os,
ooh.orig_sys_document_ref osdr,
ooh.sold_to_org_id sold_to,
ooh.invoice_to_org_id invoice_to,
ooh.cust_po_number cust_po,
ooh.payment_type_code pay_type,
ooh.flow_status_code hdr_flow_status,
ooh.open_flag,
ooh.booked_flag,
ooh.cancelled_flag,
NVL (ooh.upgraded_flag, 'N') upgraded_flag
FROM oe_order_headers_all ooh,
oe_transaction_types_tl ott,
oe_order_sources os1,
oe_order_sources os2
WHERE 1 = 1
AND ooh.order_number = &order_number
AND ooh.order_type_id = ott.transaction_type_id
AND ooh.order_source_id = os1.order_source_id(+)
AND ooh.source_document_type_id = os2.order_source_id(+)
AND ott.language = (SELECT fl.language_code
FROM fnd_languages fl
WHERE fl.installed_flag = 'B');

Identifying Duplicate Shipments SQL Query


SELECT rsl.shipment_header_id, rsl.shipment_line_id, rsh.shipment_num
FROM rcv_shipment_lines rsl, rcv_shipment_headers rsh
WHERE rsl.shipment_header_id = rsh.shipment_header_id
AND rsh.creation_date >=
TO_DATE ('&from_date', 'DD-MON-YYYY HH24:MI:SS')
AND rsh.creation_date <= TO_DATE ('&to_date', 'DD-MON-YYYY HH24:MI:SS')
AND rsl.mmt_transaction_id IS NOT NULL
AND rsh.receipt_source_code = 'INVENTORY'
AND EXISTS (SELECT 1
FROM mtl_parameters mp
WHERE mp.organization_id = rsh.organization_id)
AND NOT EXISTS
(SELECT 1
FROM mtl_material_transactions mmt
WHERE mmt.transaction_id = rsl.mmt_transaction_id
AND mmt.transaction_source_type_id = 13
AND mmt.transaction_action_id IN (3, 21))
AND NOT EXISTS
(SELECT 1
FROM mtl_material_transactions mmt, rcv_transactions rt
WHERE mmt.rcv_transaction_id = rt.transaction_id

AND rt.shipment_line_id = rsl.shipment_line_id


AND rt.transaction_type = 'DELIVER')
UNION
SELECT rsl.shipment_header_id, rsl.shipment_line_id, rsh.shipment_num
FROM rcv_shipment_lines rsl, rcv_shipment_headers rsh
WHERE rsl.shipment_header_id = rsh.shipment_header_id
AND rsh.creation_date >=
TO_DATE ('&from_date', 'DD-MON-YYYY HH24:MI:SS')
AND rsh.creation_date <= TO_DATE ('&to_date', 'DD-MON-YYYY HH24:MI:SS')
AND rsl.mmt_transaction_id IS NOT NULL
AND rsh.receipt_source_code = 'INTERNAL ORDER'
AND EXISTS (SELECT 1
FROM mtl_parameters mp
WHERE mp.organization_id = rsh.organization_id)
AND NOT EXISTS
(SELECT 1
FROM mtl_material_transactions mmt
WHERE mmt.transaction_id = rsl.mmt_transaction_id
AND mmt.transaction_source_type_id = 8
AND mmt.transaction_action_id IN (1, 3, 21, 2))
AND NOT EXISTS
(SELECT 1
FROM mtl_material_transactions mmt, rcv_transactions rt
WHERE mmt.rcv_transaction_id = rt.transaction_id
AND rt.shipment_line_id = rsl.shipment_line_id
AND rt.transaction_type = 'DELIVER')
ORDER BY 1;

Credit Card Sales Order Queries


/* -----List of Orders which are pick released on Sysdate ---------*/

SELECT oeh.header_id, ott.name


Order_type,oeh.order_number,oeh.payment_type_code,rt.name
payment_term,ool.line_number,
ool.ordered_item,ool.schedule_ship_date,ool.flow_status_code line_status,
ohd.name,ooh.order_hold_id,ooh.creation_date,ooh.released_flag
FROM oe_order_headers_all oeh, oe_order_lines_all ool,oe_transaction_types_tl ott,
ra_terms_tl rt,
oe_order_holds_all ooh,
oe_hold_sources_all ohs,
oe_hold_definitions ohd
WHERE 1=1
and oeh.header_id=ool.header_id
AND oeh.flow_status_code != 'CLOSED'
and ool.flow_status_code!='CANCELLED'
and oeh.order_type_id=ott.transaction_type_id
and ott.language='US'
and oeh.payment_term_id=rt.term_id
and rt.language='US'
and oeh.header_id=ooh.header_id(+)

and ooh.hold_source_id=ohs.hold_source_id(+)
and ohs.hold_id=ohd.hold_id(+)
and trunc(ool.schedule_ship_date)= to_date('30-APR-14','DD-MON-YY')
and oeh.PAYMENT_TERM_ID in ( 1021 ,1143);
/*List of Standing Orders along with Credit Card Details on the first open line*/
SELECT OOHA.HEADER_ID,oola.line_number,oola.line_id,op.line_id,
OOHA.ORDER_NUMBER,
(SELECT hca.account_number
FROM hz_cust_accounts hca
WHERE hca.cust_account_id=ooha.sold_to_org_id
) CustomerNumber,
OOHA.FLOW_STATUS_CODE "OrderStatus",
OOHA.PAYMENT_TYPE_CODE,
ooha.credit_card_number,
OOLA.ORDERED_ITEM,
OOLA.ORDERED_QUANTITY,
OOLA.SHIPPED_QUANTITY,
oola.invoiced_quantity,
OOLA.TAX_VALUE,
(OOLA.UNIT_SELLING_PRICE * OOLA.ORDERED_QUANTITY) ITEMTOTALAMOUNT,
OOLA.FLOW_STATUS_CODE "LineStatus",
IFTE.TRXN_EXTENSION_ID ,
ic.ccnumber,
ic.chname,
ic.card_owner_id,
ic.masked_cc_number,
ic.card_issuer_code,
ic.expirydate,
ic.inactive_date
FROM OE_ORDER_HEADERS_ALL OOHA,
OE_ORDER_LINES_ALL OOLA,
OE_PAYMENTS OP,
IBY_FNDCPT_TX_EXTENSIONS IFTE,
IBY_PMT_INSTR_USES_ALL IPUA,
IBY_CREDITCARD IC
WHERE OOHA.HEADER_ID=OOLA.HEADER_ID
--AND OOHA.PAYMENT_TYPE_CODE LIKE 'CREDIT_CARD'
AND OP.line_ID(+)
=OOla.line_ID
AND OP.TRXN_EXTENSION_ID=IFTE.TRXN_EXTENSION_ID(+)
--AND IFTE.TRXN_EXTENSION_ID=ITSA.INITIATOR_EXTENSION_ID
AND IFTE.INSTR_ASSIGNMENT_ID=IPUA.INSTRUMENT_PAYMENT_USE_ID(+)
AND IPUA.INSTRUMENT_ID
=IC.INSTRID(+)
AND ooha.flow_status_code != 'CLOSED'
and ooha.PAYMENT_TERM_ID in ( 1021 ,1143)
and ooha.order_type_id=1010
and oola.line_id = (select min(l.line_id) from oe_order_lines_all l where
l.header_id=ooha.header_id
and l.flow_status_code not in ('CLOSED','CANCELLED'));
/List of Standing Orders for which credit card details are populated at header
level/

SELECT OOHA.HEADER_ID, OOHA.ORDER_NUMBER,


(SELECT hca.account_number
FROM hz_cust_accounts hca
WHERE hca.cust_account_id=ooha.sold_to_org_id
) CustomerNumber,
OOHA.FLOW_STATUS_CODE "OrderStatus",
OOHA.PAYMENT_TYPE_CODE,
ooha.credit_card_number,
IFTE.TRXN_EXTENSION_ID ,
ic.ccnumber,
ic.chname,
ic.card_owner_id,
ic.masked_cc_number,
ic.card_issuer_code,
ic.expirydate,
ic.inactive_date
FROM OE_ORDER_HEADERS_ALL OOHA,
OE_PAYMENTS OP,
IBY_FNDCPT_TX_EXTENSIONS IFTE,
IBY_PMT_INSTR_USES_ALL IPUA,
IBY_CREDITCARD IC
WHERE OP.header_id(+)
=OOha.header_id
and op.payment_level_code(+)='ORDER'
AND OP.TRXN_EXTENSION_ID=IFTE.TRXN_EXTENSION_ID(+)
AND IFTE.INSTR_ASSIGNMENT_ID=IPUA.INSTRUMENT_PAYMENT_USE_ID(+)
AND IPUA.INSTRUMENT_ID
=IC.INSTRID(+)
AND ooha.flow_status_code not in ('CLOSED' ,'CANCELLED')
and ooha.PAYMENT_TERM_ID in ( 1021 ,1143)
and ooha.order_type_id=1010;
XXXXXXXXXXXX0481

/**List of Standng order lines for with credit card details are shown******/
SELECT OOHA.HEADER_ID,OOHA.ORDER_NUMBER, OOHA.FLOW_STATUS_CODE
"OrderStatus",oola.line_number,oola.flow_status_code, oola.schedule_ship_date,
(SELECT hca.account_number
FROM hz_cust_accounts hca
WHERE hca.cust_account_id=ooha.sold_to_org_id
) CustomerNumber,
OOHA.PAYMENT_TYPE_CODE,
ooha.credit_card_number,
OOLA.ORDERED_ITEM,
OOLA.ORDERED_QUANTITY,
OOLA.SHIPPED_QUANTITY,
oola.invoiced_quantity,
ic.ccnumber,
ic.chname,
ic.card_owner_id,
ic.masked_cc_number,
ic.card_issuer_code,

ic.expirydate,
ic.inactive_date
FROM OE_ORDER_HEADERS_ALL OOHA,
OE_ORDER_LINES_ALL OOLA,
OE_PAYMENTS OP,
IBY_FNDCPT_TX_EXTENSIONS IFTE,
IBY_PMT_INSTR_USES_ALL IPUA,
IBY_CREDITCARD IC
WHERE OOHA.HEADER_ID=OOLA.HEADER_ID
AND OP.line_ID(+)
=OOla.line_ID
AND OP.TRXN_EXTENSION_ID=IFTE.TRXN_EXTENSION_ID(+)
AND IFTE.INSTR_ASSIGNMENT_ID=IPUA.INSTRUMENT_PAYMENT_USE_ID(+)
AND IPUA.INSTRUMENT_ID
=IC.INSTRID(+)
AND ooha.flow_status_code not in ('CLOSED' ,'CANCELLED')
and ooha.PAYMENT_TERM_ID in ( 1021 ,1143)
and ooha.order_type_id=1010
--and trunc(oola.schedule_ship_date)>trunc(sysdate)
--and trunc(oola.schedule_ship_date)= to_date('02-MAY-14','DD-MON-YY')
and oola.line_id = (select min(l.line_id) from oe_order_lines_all l where
l.header_id=ooha.header_id
and l.flow_status_code not in ('CLOSED','CANCELLED'))
order by oola.schedule_ship_date asc;
/**********query which we run daily to knows orders on
hold***************/
SELECT ooh.header_id,oeh.header_id, ott.name
Order_type,oeh.order_number,oeh.payment_type_code,rt.name
payment_term,ool.line_number,
ool.ordered_item,ool.schedule_ship_date,ool.flow_status_code line_status,
ohd.name,ooh.order_hold_id,ooh.creation_date,ooh.released_flag
,ic.ccnumber,
ic.chname,
ic.card_owner_id,
ic.masked_cc_number,
ic.card_issuer_code,
ic.expirydate,
ic.inactive_date
FROM oe_order_headers_all oeh, oe_order_lines_all ool,oe_transaction_types_tl ott,
ra_terms_tl rt,
oe_order_holds_all ooh,
oe_hold_sources_all ohs,
oe_hold_definitions ohd,
OE_PAYMENTS OP,
IBY_FNDCPT_TX_EXTENSIONS IFTE,
IBY_PMT_INSTR_USES_ALL IPUA,
IBY_CREDITCARD IC
WHERE 1=1
and oeh.header_id=ool.header_id
AND oeh.flow_status_code != 'CLOSED'
and ool.flow_status_code!='CANCELLED'
and oeh.order_type_id=ott.transaction_type_id
and ott.language='US'

and oeh.payment_term_id=rt.term_id
and rt.language='US'
and ool.header_id=ooh.header_id(+)
and ool.line_id=nvl(ooh.line_id(+),ool.line_id)
-- and ool.line_id=ooh.line_id(+)
and ooh.hold_source_id=ohs.hold_source_id(+)
and ohs.hold_id=ohd.hold_id(+)
AND OP.line_ID(+)
=Ool.line_ID
AND OP.TRXN_EXTENSION_ID=IFTE.TRXN_EXTENSION_ID(+)
--and op.payment_level_code(+)='ORDER'
--AND IFTE.TRXN_EXTENSION_ID=ITSA.INITIATOR_EXTENSION_ID
AND IFTE.INSTR_ASSIGNMENT_ID=IPUA.INSTRUMENT_PAYMENT_USE_ID(+)
AND IPUA.INSTRUMENT_ID
=IC.INSTRID(+)
and trunc(ool.schedule_ship_date)= to_date('08-MAY-14','DD-MON-YY')
and oeh.PAYMENT_TERM_ID in ( 1021 ,1143);

Oracle Apps Receivables (AR) Tables


Transactions
RA_CUSTOMER_TRX_ALL

Transaction Header table

RA_CUSTOMER_TRX_LINES_ALL Transaction Lines table along with Tax lines.


RA_CUST_TRX_LINE_GL_DIST_A
Distribution for Transaction Lines
LL
RA_CUST_TRX_LINE_SALESREP
Salesrep information for Transaction Lines
S_ALL

Transaction Interface
Tables
RA_INTERFACE_LINES_ALL

Transaction Lines interface

RA_INTERFACE_SALESCREDITS
Transaction Sales credit information
_ALL
RA_INTERFACE_DISTRIBUTIONS
Transaction Distribution information
_ALL
RA_INTERFACE_ERRORS_ALL

Transaction errors table

AR_PAYMENTS_INTERFACE_ALL Interface table to import receipts


AR_INTERIM_CASH_RECEIPTS_A Lockbox transfers the receipts that pass validation to
LL
the interim tables

AR_INTERIM_CASH_RCPT_LINES Lockbox transfers the receipts that pass validation to


_ALL
the interim tables

Receipts tables
AR_CASH_RECEIPTS_ALL

Cash Receipt Header tables

AR_RECEIVABLE_APPLICATIONS
stores Receipt Application details
_ALL
This table is updated when an activity occurs against
AR_PAYMENT_SCHEDULES_ALL an invoice, debit memo, chargeback, credit memo,
on-account credit, bills receivable
This table stores all of the activity that is contained
for the life cycle of a receipt.
Each row represents one step.
AR_CASH_RECEIPT_HISTORY_A
The status field for that row tells you which step
LL
the receipt has reached.
Possible statuses are Approved, Confirmed,
Remitted, Cleared, and Reversed.

Customer Tables
HZ_PARTIES

A party is an entity that can enter into a business


relationship.

HZ_CUST_ACCOUNTS

This table stores information about


customer/financial relationships established between
a Party and the deploying company.

HZ_PARTY_SITES

This table links a party (HZ_PARTIES) and a location


(HZ_LOCATIONS) and stores location-Specific party
information such as a persons mail stops at their
work address.

HZ_CUST_ACCT_SITES_ALL

This table stores information about


customer/financial account sites information.

HZ_CUST_SITE_USES_ALL

This table stores information about the business


purposes assigned to a customer account site

HZ_LOCATIONS

A location is a point in geographical space described


by an address and/or geographical Indicators such
as latitude or longitude.

Setup tables
RA_CUST_TRX_TYPES_ALL

This table stores information about each transaction


type for all classes of transactions, for example,
invoices, commitments, and credit memos.

AR_RECEIPT_CLASSES

This table stores the different receipt classes that


you define.

AR_RECEIPT_METHODS

This table stores information about Payment


Methods, receipt attributes that you define and
assign to Receipt Classes to account for receipts and
their applications

Posted by Elangovan Ragavan at 14:48 No comments:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, Tables
MONDAY, 23 JUNE 2014

AR to GL link in R12
SELECT ooha.order_number,
oola.line_number,
wdd.source_header_type_name,
wnd.name,
rcta.trx_number,
xlate.transaction_number,
b.name batch_name,
b.description batch_description,
h.je_category,
h.je_source,
h.period_name je_period_name,
h.name journal_name,
h.status journal_status,
h.description je_description
FROM -- Create Sales Order -oe_order_headers_all ooha,
oe_order_lines_all oola,
-- Book the Sales Order -wsh_delivery_details wdd,
wsh_delivery_assignments wda,
wsh_new_deliveries wnd,

-- Enter Invoices in Receivables -ra_customer_trx_all rcta,


-- Sub ledger accounting -xla.xla_transaction_entities xlate,
xla_events xlae,
xla_ae_headers xlah,
xla_ae_lines xlal,
-- GL -gl_import_references gir,
gl_code_combinations_kfv glcc,
gl_je_lines l,
gl_je_headers h,
gl_je_batches b
WHERE 1 = 1
-- Create Sales Order -AND ORDER_NUMBER = '601694' -- (OR) AND trx_number = '1715'
AND ooha.header_id = oola.header_id
-- Book the Sales Order -AND oola.line_id = wdd.source_line_id
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wda.delivery_id = wnd.delivery_id
-- Enter Invoices in Receivables -AND TO_CHAR (ooha.order_number) = rcta.interface_header_attribute1
-- Sub ledger accounting -AND rcta.trx_number = xlate.transaction_number
AND xlae.application_id = xlate.application_id
AND xlae.entity_id = xlate.entity_id
AND xlah.event_id = xlae.event_id
AND xlal.ae_header_id = xlah.ae_header_id
-- GL ---Like Between Sub Ledger to GL -AND gir.gl_sl_link_table = xlal.gl_sl_link_table
AND gir.gl_sl_link_id = xlal.gl_sl_link_id
AND xlal.code_combination_id = glcc.code_combination_id
--Like Between Sub Ledger to GL -AND l.je_header_id = gir.je_header_id
AND l.je_line_num = gir.je_line_num
AND h.je_header_id = l.je_header_id
AND b.je_batch_id = h.je_batch_id
AND h.je_source = 'Receivables'
AND h.period_name = '12-07'
ORDER BY line_number
Posted by Elangovan Ragavan at 15:47 1 comment:

Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest


Labels: AR_Query, gl, XLA_SUB_LEDGER

Subledger-Ledger Linkage (Accounts Receivable)


AR (Cash Receipt)
select distinct
arc.receipt_number
,arc.receipt_date
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,glc.segment1
from ar_cash_receipt_history_all arh
,ar_distributions_all ard
,ar_cash_receipts_all arc
,ar_batches_all arb
,gl_code_combinations glc
,xla.xla_transaction_entities te
,xla_ae_headers xah
,xla_ae_lines xal
,xla_distribution_links xdl
,gl_import_references gir
,gl_je_headers gjh
,gl_je_lines gjl
where arh.cash_receipt_history_id = ard.source_id
and arc.cash_receipt_id = arh.cash_receipt_id
and arh.batch_id = arb.batch_id (+)
and ard.source_table = 'CRH'
and arc.type = 'CASH'
and arh.posting_control_id <> -3
and nvl (te.source_id_int_1, -99) = arc.cash_receipt_id
and te.application_id = 222
and te.entity_code = 'RECEIPTS'
and xah.entity_id = te.entity_id
and xah.event_id = arh.event_id
and xah.ae_header_id = xal.ae_header_id
and xal.code_combination_id = ard.code_combination_id
and xdl.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xal.ae_header_id

and xdl.event_id = xah.event_id


and gir.gl_sl_link_id = xal.gl_sl_link_id
and gjh.je_header_id = gir.je_header_id
and xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL'
and gjh.je_source = 'Receivables'
and gjh.je_category = 'Receipts'
and xah.event_type_code <> 'MANUAL'
and xal.gl_sl_link_table = 'XLAJEL'
and gir.je_line_num = gjl.je_line_num
and gjl.code_combination_id = glc.code_combination_id
and gjl.je_header_id = gjh.je_header_id
--and arc.receipt_number = 'MH1206201210' ;
AR (Misc Receipt)
select distinct
acr.receipt_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
from gl_code_combinations gcc
,gl_je_lines gjl
,gl_je_headers gjh
,gl_je_batches glb
,gl_import_references gir
,xla_ae_lines xal
,xla_ae_headers xah
,xla_distribution_links xdl
,ar_misc_cash_distributions_all msd
,ar_distributions_all dist
,ar_cash_receipts_all acr
,ar_receivables_trx_all art
where gcc.code_combination_id = gjl.code_combination_id
and gjh.je_header_id = gjl.je_header_id
and glb.je_batch_id = gjh.je_batch_id
and gjl.status = 'P'
and gjh.actual_flag = 'A'
and gir.je_header_id = gjh.je_header_id
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xah.ae_header_id = xal.ae_header_id

and xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL'


and gjh.je_source = 'Receivables'
and gjh.je_category = 'Misc Receipts'
and xdl.event_id = xah.event_id
and xah.ae_header_id = xdl.ae_header_id
and msd.event_id = xah.event_id
and msd.posting_control_id <> -3
and msd.misc_cash_distribution_id = dist.source_id
and dist.source_type = 'MISCCASH'
and dist.code_combination_id = gjl.code_combination_id
and acr.cash_receipt_id = msd.cash_receipt_id
and acr.type = 'MISC'
and art.receivables_trx_id = acr.receivables_trx_id
--and acr.receipt_number = '100009 IONA GEDDES'
union
select distinct
acr.receipt_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
from gl_code_combinations gcc
,gl_je_lines gjl
,gl_je_headers gjh
,gl_je_batches glb
,gl_import_references gir
,xla_ae_lines xal
,xla_ae_headers xah
,xla_distribution_links xdl
,ar_cash_receipt_history_all arh
,ar_distributions_all dist
,ar_cash_receipts_all acr
,ar_receivables_trx_all art
where gcc.code_combination_id = gjl.code_combination_id
and gjh.je_header_id = gjl.je_header_id
and glb.je_batch_id = gjh.je_batch_id
and gjl.status = 'P'
and gjh.actual_flag = 'A'
and gir.je_header_id = gjh.je_header_id
and gir.gl_sl_link_id = xal.gl_sl_link_id
and xah.ae_header_id = xal.ae_header_id

and xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL'


and gjh.je_source = 'Receivables'
and gjh.je_category = 'Misc Receipts'
and xdl.event_id = xah.event_id
and xah.ae_header_id = xdl.ae_header_id
and arh.event_id = xah.event_id
and arh.posting_control_id <> -3
and arh.cash_receipt_history_id = dist.source_id
and dist.code_combination_id = gjl.code_combination_id
and dist.line_id = xdl.source_distribution_id_num_1
and acr.cash_receipt_id = arh.cash_receipt_id
and acr.type = 'MISC'
and art.receivables_trx_id = acr.receivables_trx_id
--and acr.receipt_number = 'AG308260712NY';
AR (Invoice)
select distinct
rat.trx_number
,rat.trx_date transaction_date
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,glc.segment1,gjh.je_category
from ra_cust_trx_line_gl_dist_all rac
,ra_customer_trx_all rat
,ra_batches_all rab
,ra_customer_trx_lines_all ral
,gl_code_combinations glc
,xla_distribution_links xdl
,xla_ae_headers xah
,xla_ae_lines xal
,gl_import_references gir
,gl_je_lines gjl
,gl_je_headers gjh
where rat.customer_trx_id = rac.customer_trx_id
and rac.customer_trx_line_id = ral.customer_trx_line_id (+)
and rab.batch_id (+) = rat.batch_id
and rac.posting_control_id <> -3
and xdl.source_distribution_id_num_1 = rac.cust_trx_line_gl_dist_id
and xdl.source_distribution_type = 'RA_CUST_TRX_LINE_GL_DIST_ALL'

and gjh.je_source = 'Receivables'


and gjh.je_category = 'Sales Invoices'
and xah.event_type_code <> ' MANUAL'
and xah.ae_header_id = xdl.ae_header_id
and xal.ae_header_id = xah.ae_header_id
and xal.ae_line_num = xdl.ae_line_num
and gir.gl_sl_link_id = xal.gl_sl_link_id
and gjl.je_header_id = gir.je_header_id
and gir.je_line_num = gjl.je_line_num
and gjh.je_header_id = gjl.je_header_id
and glc.code_combination_id = gjl.code_combination_id
and rac.code_combination_id = gjl.code_combination_id
and gjh.je_header_id = gir.je_header_id
--and rat.trx_number = 'I0069600';
AR (Invoice Adjustment)
select distinct
rat.trx_number
,rat.trx_date
,gjl.entered_cr
,gjl.entered_dr
,gjl.accounted_cr
,gjl.accounted_dr
,gjh.name journal_name
,gjh.creation_date journal_creation_date
,glc.segment1
from ar_adjustments_all ara
,ar_distributions_all ard
,ra_customer_trx_all rat
,ar_receivables_trx_all art
,gl_code_combinations_kfv glc
,xla_distribution_links xdl
,xla_ae_headers xah
,xla_ae_lines xal
,xla.xla_transaction_entities te
,gl_import_references gir
,gl_je_headers gjh
,gl_je_lines gjl
where glc.code_combination_id = ard.code_combination_id
and ara.adjustment_id = ard.source_id
and rat.customer_trx_id = ara.customer_trx_id
and ara.receivables_trx_id = art.receivables_trx_id
and ard.source_table = 'ADJ'

and ara.posting_control_id <> -3


and xdl.source_distribution_id_num_1 = ard.line_id
and xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL'
and gjh.je_source = 'Receivables'
and gjh.je_category = 'Adjustment'
and xdl.event_id = xah.event_id
and xah.ae_header_id = xdl.ae_header_id
and xah.ae_header_id = xal.ae_header_id
and xal.code_combination_id = ard.code_combination_id
and xah.entity_id = te.entity_id
and te.application_id = 222
and te.entity_code = 'ADJUSTMENTS'
and nvl (te.source_id_int_1, (-99)) = ara.adjustment_id
and gir.gl_sl_link_id = xal.gl_sl_link_id
and gjh.je_header_id = gir.je_header_id
and gjh.je_header_id = gjl.je_header_id
and xal.code_combination_id = gjl.code_combination_id
--and rat.trx_number = 'A0005418';
Posted by Elangovan Ragavan at 11:20 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, XLA_SUB_LEDGER
FRIDAY, 6 JUNE 2014

List of Receipts API in Oracle Receivables


Below is the list of some of the Receipt APIs in Oracle Receivables. Receipt APIs provide an
extension to existing functionality for creating and manipulating receipts through standard AR
Receipts forms and lockboxes.
AR_RECEIPT_API_PUB is the main package that has several procedures to perform different
actions.
1] AR_RECEIPT_API_PUB.CREATE_CASH
Use this procedure to create a single cash receipt for payment received in the form of a check
or cash.
2] AR_RECEIPT_API_PUB.APPLY & AR_RECEIPT_API_PUB.APPLY_IN_DETAIL
Use these procedures to apply the cash receipts from a customer to an invoice, debit memo, or
other debit item.

3] AR_RECEIPT_API_PUB.UNAPPLY
Use this procedure to unapply a cash receipt application against a specified installment of a
debit item or payment schedule ID.
4] AR_RECEIPT_API_PUB.CREATE_AND_APPLY
Use this procedure to create a cash receipt and apply it to a specified installment of a debit
item.
5] AR_RECEIPT_API_PUB.REVERSE
Use this procedure to reverse cash and miscellaneous receipts.
6] AR_RECEIPT_API_PUB.APPLY_ON_ACCOUNT
Use this procedure to apply a cash receipt on account.
7] AR_RECEIPT_API_PUB.UNAPPLY_ON_ACCOUNT
Use this procedure to unapply an on-account application of a specified cash receipt.
8] AR_RECEIPT_API_PUB.ACTIVITY_APPLICATION
Use this procedure to create an activity application on a cash receipt, including Short Term
Debit (STD) and Receipt Write-off applications.
9] AR_RECEIPT_API_PUB. ACTIVITY_UNAPPLICATION
Use this procedure to create a reversal of an activity application on a cash receipt including
Short Term Debt and Receipt write-off.
10] AR_RECEIPT_API_PUB.CREATE_MISC
Use this procedure to create a miscellaneous receipt.

11] AR_RECEIPT_API_PUB.APPLY_OPEN_RECEIPT
Use this procedure to apply a cash receipt to another open receipt. Open receipts include
unapplied cash, on-account cash, and claim investigation applications.
12] AR_RECEIPT_API_PUB.UNAPPLY_OPEN_RECEIPT
Use this procedure to reverse a payment netting application on a cash receipt.

Posted by Elangovan Ragavan at 15:40 No comments:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API'S / INTREFACES, AR_Query
WEDNESDAY, 28 MAY 2014

Invoice Grouping Rules in Receivables R12


Grouping Rules group Revenue and Credit transactions into Invoices, Credit memos and Debit
Memos. Autoinvoice program uses the Grouping Rules to group similar sales orders into a
single invoice. We need to assign matching attributes while defining the Grouping Rules. These
attributes include mandatory and optional parameters. Mandatory parameters are pre-defined
by Oracle, where as optional attributes are optional and can be assigned based on the business
requirements. Following is the list of all Mandatory and Optional attributes which can be
assigned to the Grouping Rules.
Mandatory Attributes:
AGREEMENT_ID
COMMENTS
CONS_BILLING_NUMBER
CONVERSION_DATE
CONVERSION_RATE
CONVERSION_TYPE
CREDIT_METHOD_FOR_ACCT_RULE
CREDIT_METHOD_FOR_INSTALLMENTS
CURRENCY_CODE
CUSTOMER_BANK_ACCOUNT_ID
CUST_TRX_TYPE_ID
DOCUMENT_NUMBER
DOCUMENT_NUMBER_SEQUENCE_ID
GL_DATE
HEADER_ATTRIBUTE1-15
HEADER_ATTRIBUTE_CATEGORY
HEADER_GDF_ATTRIBUTE1-30
INITIAL_CUSTOMER_TRX_ID
INTERNAL_NOTES
INVOICING_RULE_ID
ORIG_SYSTEM_BILL_ADDRESS_ID
ORIG_SYSTEM_BILL_CONTACT_ID
ORIG_SYSTEM_BILL_CUSTOMER_ID
ORIG_SYSTEM_SOLD_CUSTOMER_ID
ORIG_SYSTEM_BATCH_NAME
PAYMENT_SERVER_ORDER_ID
PAYMENT_SET_ID
PREVIOUS_CUSTOMER_TRX_ID
PRIMARY_SALESREP_ID

PRINTING_OPTION
PURCHASE_ORDER
PURCHASE_ORDER_DATE
PURCHASE_ORDER_REVISION
REASON_CODE
RECEIPT_METHOD_ID
RELATED_CUSTOMER_TRX_ID
SET_OF_BOOKS_ID
TERM_ID
TERRITORY_ID
TRX_DATE
TRX_NUMBER

Optional Attributes:
ACCOUNTING_RULE_DURATION
ACCOUNTING_RULE_ID
ATTRIBUTE1-15
ATTRIBUTE_CATEGORY
INTERFACE_LINE_ATTRIBUTE1-15
INTERFACE_LINE_CONTEXT
INVENTORY_ITEM_ID
REFERENCE_LINE_ID
RULE_START_DATE
SALES_ORDER
SALES_ORDER_DATE
SALES_ORDER_LINE
SALES_ORDER_REVISION
SALES_ORDER_SOURCE
TAX_CODE
TAX_RATE

The following Ship-To fields were mandatory grouping attributes in release 11i, but are optional
in release 12ORIG_SYSTEM_SHIP_CUSTOMER_ID
ORIG_SYSTEM_SHIP_ADDRESS_ID
ORIG_SYSTEM_SHIP_CONTACT_IDThis is because ship to information is now stored at the line

level in R12. Therefore a single invoice could have different ship to information for each line.
Autoinvoice program matches all the mandatory parameters and group the transactions into
invoices. If all the mandatory parameters are matched for two or more similar transactions, they
will fall in a same invoice. If we define any optional attribute, Autoinvoice program matches
optional attributes in addition to the mandatory attributes to group the transactions.
For Example: SALES_ORDER is the optional attribute assigned to a grouping rule, there
Autoinvoice program matches all mandatory attributes + Sales Order for the transactions. For
any two or more transactions, if all the mandatory attributes and Sales Order(optional attribute)
are matching, only one invoice will be created for those transactions.
If your Grouping rule doesn't include Sales Order and Ship To fields in Optional attributes,

similar sales orders with different ship-to addresses but same bill to will be grouped into one
invoice and AR transaction form will not show any value in Ship-To address as it can not
determine which ship-to value to be picked from multiple sales orders.
Steps to create a Grouping Rule:
Responsibility: Receivables Manager
Navigation: Setup -> Transactions -> Auto Invoice -> Grouping Rules

Select Line Ordering Rules if you are using any. Optional grouping characteristics are optional.
If we are not giving any optional Grouping Characteristics, Autoinvoice will only matches
mandatory characteristics. We can assign Optional characteristics for Invoices, Credit Memos
and Debit Memos.

If we want to assign optional attributes for all invoices, credit memos and debit memos, First
assign optional characteristics for invoice class and the place the cursor on Class Invoices ad
use Down Arrow to define attributes for other classes(Credit Memo and Debit Memo) as well.
Posted by Elangovan Ragavan at 16:51 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, FUNCTIONAL

Transaction Dates for Auto Invoices in Receivables


If there is no value provided for Transaction Date, the Autoinvoice program populates the
Transaction date for Auto Invoices based several facors such as Derive Date option enabled or
Disabled for Transaction Source, few colums from RA_INTERFACE_LINES_ALL, Invoice rules
and Accounting Rules defind or not, and the default value provided in the parameters of
Autoinvoice program.
Let us see how Autoinvoice program derives Transaction date based on Derive Date option for
Transaction source and populted columns from RA_INTERFACE_LINES_ALL such as
GL_DATE, SHIP_DATE_ACTUAL and SALES_ORDER_DATE.
Case 1: If the Derive Date option is enabled for Transaction Source, Autoinvoice program uses
the following order to create Transaction Date.
1. GL_DATE
2. SHIP_DATE_ACTUAL
3. SALES_ORDER_DATE
4. DEFAULT_DATE (Provided in parameters of Autoinvoice program, which is mandatory)
Case2: If the Derive Date check box is disabled for Transaction Source, Autoinvoice program
uses following order to populated Transaction Date.
1. GL_DATE
2. DEFAULT_DATE (Provided in parameters of Autoinvoice program, which is mandatory)
Posted by Elangovan Ragavan at 16:49 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, FUNCTIONAL

Payment Term on AR Transactions

This post explains how AutoInvoice populates Payment Term on AR transaction


when you are using a Payment Term on Sales Order which is different from the
Default Payment Term assigned to Customer. For Example: The Payment Term
populated on Sales Order is '30 NET' and you have changed it to 'CREDIT'.
In this kind of scenario, AutoInvoice program checks following conditions to populate
the Payment Term on Transaction as on Sales Order.
1. 'Override Terms' check box should be enabled at Customer account and site
levels.
Navigation to check this option at Customer Account Level:
Customers -- Customers -- Search for the customer
Click on Account Details.
'Override Terms' check box should be enabled Under 'Account Profile' Tab.

Navigation to check this option at Customer Address Level:


Customers -- Customers -- Search for the customer
Click on Account Details.
Under Sites Tab, Click on Details for 'Bill To' customer site.
'Override Terms' check box should be enabled Under 'Profile' Tab.By checking the
Override Terms check box, you are saying that when a user creates an invoice for
this customer, he is allowed to change the Payment Term that defaults in. This
feature allows you to create
non-balance forward transactions within a BFB-enabled site.
So, the purpose of Override Terms option is to create non-balance forward
transactions for a BFB-enabled site. For BFB enabled customer, override
functionality work only with NON-BFB payment Terms .
2. If you have Override Terms check box checked, you still cannot override the
payment term if the following conditions are true:
-- The customer you are interfacing data for is a Balance Forward Billing (BFB)
enabled customer
-- The payment term you are providing in the interface tables is a BFB term that is
different from the default payment term you have set up at the Account or Site profile

That means for a BFB enabled customer, we can not override the Default Payment
Term with BFB enabled Payment Term.
If you try to override the default payment term with Non-BFB Payment Term, it will
work.
For example:
1.Customer - BFB Enabled
Default Payment Term - 30 NET
Override Payment Term - CREDIT (BFB Enabled)
Payment Term on AR Transaction - 30 NET
2. Customer - BFB Enabled
Default Payment Term - 30 NET
Override Payment Term - IMMEDIATE ( NON-BFB Payment Term)
Payment Term on AR Transaction - IMMEDIATE Note: Receivables uses the
following hierarchy to determine the default payment terms, stopping when one is
found:
customer Bill-To site level customer address level
customer level
Transaction Type
Posted by Elangovan Ragavan at 09:54 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, FUNCTIONAL

How to Debug the error 'Please complete your tax accounting flexfield'
This post explains the process to debug the error 'Please complete your tax accounting flexfield'
which appears in Auto Invoicing process.This approach helps you when the Receivables Auto
Accounting rules derive the Tax account segments from E Business Tax setups and you have
not much idea on EB Tax setups.

Step 1: Get the Customer details from Auto Invoice Import program output or
from Sales Order.

Step 2: Check the Auto Accounting setup for Tax Account


Responsibility: Any Receivables responsibility
Navigation: Setup > Transactions > Auto Accounting

Notice that the Account segment which is missing in the error has source as 'Taxes'.
It means this segment gets derived from EB Tax.Generally Receivables uses Tax
accounts which can be defined at any of the 3 levels shown below.
1. Tax
2. Tax Jurisdiction
3. Tax Rate
Refer to Metalink Note ID 885225.1 for detailed explanation.
Step 3: Create a manual AR invoice for same customer in test instances to
know the Tax account details.
Responsibility: Any Receivables responsibility
Navigation: Transactions > Transactions
Enter a manual invoice and open Invoice Distributions Window.

Note the distribution amount. Close this window and click on Tax button to open Tax
window.

Based on the Distribution amount noted from Invoice Distributions window, find out
the tax details in Tax window.

Step 4: Check whether the tax accounts are defined and/or active currently in
EB Tax.
(i) Check at Tax Jurisdiction level:
Responsibility: Tax Manager or any Tax responsibility which has access to setups.
Navigation: Tax Configuration > Tax Jurisdictions
Query the form with Tax Jurisdiction code noted from step 3.

Click on update button to open Tax Jurisdiction window.

Click on Tax Accounts button which is on top right. Check whether Tax accounts are
defined and/or active.
(ii) Check at Tax Rate level:
Navigation: Tax Configuration > Tax Rates
Query the form with required details noted from step 3.

Click on update button to open Tax Rates window.

Click on Tax Accounts button and check whether Tax accounts are defined and/or
active.
(iii) Check at Tax level:
Navigation: Tax Configuration > Taxes

Click on update button to open Tax window.

Click on Tax Accounts button which is on top right. Check whether Tax accounts are
defined and/or active.
Make sure the tax accounts are defined and are active, then re run Auto Invoice
program to process errored records.
Posted by Elangovan Ragavan at 09:26 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest

Labels: AR_Query, ERROR, FUNCTIONAL


THURSDAY, 22 MAY 2014

Customer Bank detail query in Oracle Apps r12

select DISTINCT ac.customer_name


,ac.customer_number
from iby_pmt_instr_uses_all
instr_assign,iby_external_payers_all
payee,iby_ext_bank_accounts
bankacct,hz_cust_accounts_all hcal,ar_customers
acwhere
instr_assign.instrument_id =
bankacct.ext_bank_account_id
and instr_assign.ext_pmt_party_id = payee.ext_payer_id
and instr_assign.instrument_type = 'BANKACCOUNT'and
instr_assign.payment_flow =
'FUNDS_CAPTURE'and instr_assign.payment_function =
'CUSTOMER_PAYMENT'and
hcal.cust_account_id = payee.cust_account_id
and ac.customer_number = hcal.account_number
and bankacct.bank_account_num = '22090402' (Pass
Banks Account or leave blank)

Posted by Elangovan Ragavan at 08:41 1 comment:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, Bank Query
THURSDAY, 26 DECEMBER 2013

AR Interface Table - Line Details


-- INTERFACE LINES DETAILS
SELECT hca.account_number act_no
, hca.cust_account_id cust_id
, hp.party_number party_no
, hp.party_name
, rila.INTERFACE_LINE_ATTRIBUTE4
, rila.interface_line_attribute2 crris
, rila.trx_number
, rila.trx_date
, rila.interface_line_id int_line_id
, rila.org_id
, rila.batch_source_name batch
, rila.interface_line_id line_id
, rila.interface_line_attribute1 attrib1
, gl.NAME sob
, rila.amount
, rila.line_number
, rila.quantity
, rila.unit_selling_price
, rila.memo_line_name
, rila.last_update_date
, rila.description

, rila.*
, '---> ERRORS'
, riea.interface_line_id
, riea.MESSAGE_TEXT
, riea.invalid_value
FROM ar.ra_interface_lines_all rila
, ar.ar_receipt_methods arm
, gl.gl_ledgers gl
, apps.hz_cust_accounts hca
, apps.hz_parties hp
, ar.ra_interface_errors_all riea
WHERE rila.receipt_method_id = arm.receipt_method_id(+)
AND rila.set_of_books_id = gl.ledger_id(+)
AND rila.orig_system_bill_customer_id = hca.cust_account_id
AND hp.party_id = hca.party_id
AND rila.interface_line_id = riea.interface_line_id(+)
AND 1 = 1;
Posted by Elangovan Ragavan at 09:58 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Interface Table - Summary by Batch Source Name


-- INTERFACE LINES SUMMARY

SELECT rila.batch_source_name batch


, rila.org_id
, COUNT(*) lines
, SUM(rila.unit_selling_price * rila.quantity) total

FROM ar.ra_interface_lines_all rila


, ar.ar_receipt_methods arm
, gl.gl_ledgers gl
, apps.hz_cust_accounts hca
, apps.hz_parties hp
, ar.ra_interface_errors_all riea
WHERE rila.receipt_method_id = arm.receipt_method_id(+)
AND rila.set_of_books_id = gl.ledger_id(+)
AND rila.orig_system_bill_customer_id = hca.cust_account_id
AND hp.party_id = hca.party_id
AND rila.interface_line_id = riea.interface_line_id(+)
GROUP BY rila.batch_source_name
, rila.org_id;
Posted by Elangovan Ragavan at 09:56 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Transaction Source Summary


SELECT rbsa.name source_name
, COUNT (*) tx_ct
, MAX (rcta.creation_date) recent_tx
FROM apps.ra_customer_trx_all rcta
, ar.ra_batch_sources_all rbsa
WHERE rcta.batch_source_id = rbsa.batch_source_id
AND 1 = 1
GROUP BY rbsa.name
ORDER BY rbsa.name;

Posted by Elangovan Ragavan at 09:53 1 comment:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Transactions - including lines and distributions


SELECT rcta.trx_number
, rcta.customer_trx_id
, rba.name batch
, rcta.creation_date
, rctta.name tx_type
, hp.party_number party
, hca.account_number act_no
, hp.party_name
, hps.party_site_number site_num
, rcta.request_id -- Autoinvoice Import Program
, rbsa.name source
, rbsa.description
, rcta.trx_date
, rctla.description line_descr
, rctla.unit_selling_price
, rctla.line_type
, rctla.interface_line_context
, rctla.tax_rate
, gcc.segment1 || '*' || gcc.segment2 || '*' || gcc.segment3 || '*'||
gcc.segment4 cgh_acct
FROM ar.ra_customer_trx_all rcta
, ar.ra_customer_trx_lines_all rctla
, ar.ra_cust_trx_line_gl_dist_all rctlgda
, ar.ra_batches_all rba

, ar.ra_cust_trx_types_all rctta
, apps.hz_cust_accounts hca
, apps.hz_parties hp
, ar.hz_party_sites hps
, apps.hz_cust_acct_sites_all hcasa
, apps.hz_cust_site_uses_all hcsua
, ar.hz_locations hl
, applsys.fnd_user fu1
, applsys.fnd_user fu2
, ar.ra_batch_sources_all rbsa
, gl.gl_code_combinations gcc
WHERE rcta.bill_to_customer_id = hca.cust_account_id
AND hp.party_id = hca.party_id
AND hp.party_id = hps.party_id
AND hcasa.party_site_id = hps.party_site_id
AND hca.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND rcta.created_by = fu1.user_id
AND rcta.last_updated_by = fu2.user_id
AND hcsua.site_use_id = rcta.bill_to_site_use_id
AND hps.location_id = hl.location_id
AND rcta.batch_source_id = rbsa.batch_source_id(+)
AND rcta.customer_trx_id = rctla.customer_trx_id
AND rctla.customer_trx_line_id = rctlgda.customer_trx_line_id
AND rctlgda.code_combination_id = gcc.code_combination_id
AND rcta.cust_trx_type_id = rctta.cust_trx_type_id
AND RCTA.BATCH_ID = RBA.BATCH_ID

--

AND RCTA.TRX_NUMBER = '123'


AND rcta.creation_date >= '01-SEP-2012'
AND rctla.line_type = 'LINE'
AND rctla.description = 'Internal Award'
AND gcc.segment1 = tbl_activity.flex_value
AND gcc.segment2 = tbl_detail.flex_value
AND 1 = 1;

Posted by Elangovan Ragavan at 09:52 1 comment:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Transactions - Header Only


-- TRANSACTION HEADERS ONLY

SELECT rcta.trx_number
, rcta.complete_flag complete
, rcta.request_id
, fu1.description created_by
, '## SOURCE ##'
, rbsa.name source_name
, rbsa.description
, '## STATS ##'
, fu2.description updated_by
, '## ACCOUNT ##'
, hp.party_name
, hca.account_number act_no
, hps.party_site_number site_num
, rcta.org_id

, '## DATES ##'


, rcta.trx_date
, rcta.creation_date
, rcta.last_update_date
, '## PRINT ##'
, rcta.printing_original_date print_first
, rcta.printing_last_printed print_last
, '## ADDRESS ##'
, hcsua.location
, hl.address1
, hl.address2
, hl.address3
, hl.address4
, hl.city
, hl.state
, hl.postal_code
, hl.country
FROM apps.ra_customer_trx_all rcta
, apps.hz_cust_accounts hca
, apps.hz_parties hp
, ar.hz_party_sites hps
, apps.hz_cust_acct_sites_all hcasa
, apps.hz_cust_site_uses_all hcsua
, ar.hz_locations hl
, applsys.fnd_user fu1
, applsys.fnd_user fu2
, ar.ra_batch_sources_all rbsa
WHERE rcta.bill_to_customer_id = hca.cust_account_id

AND hp.party_id = hca.party_id


AND hp.party_id = hps.party_id
AND hcasa.party_site_id = hps.party_site_id
AND hca.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND rcta.created_by = fu1.user_id
AND rcta.last_updated_by = fu2.user_id
AND hcsua.site_use_id = rcta.bill_to_site_use_id
AND hps.location_id = hl.location_id
AND rcta.batch_source_id = rbsa.batch_source_id(+)
AND rcta.creation_date > '10-DEC-2012'
AND 1 = 1;
Posted by Elangovan Ragavan at 09:49 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Customers, no receipt methods


-- CUSTOMER DETAILS NO RECEIPT METHODS
SELECT

hp.party_name
, hca.account_number act_no
, hca.cust_account_id
, hca.party_id
, DECODE(hca.status, 'I', 'Inactive', 'A', 'Active', 'Other') hdr
, '##'
, hca.creation_date hdr_creation_date
, fu_header.description hdr_created_by
, hca.last_update_date hdr_updated

, fu_hdr_upd.description hdr_updated_by
, '###'
, hcsua.org_id
, hps.party_site_number site_num
, hcsua.cust_acct_site_id
, hcsua.location
, hcsua.site_use_code
, hcsua.primary_flag
, DECODE(hcasa.status, 'I', 'Inactive', 'A', 'Active', 'Other') site
, '####'
, hcsua.creation_date site_creation_date
, fu_site.description site_created_by
, hcsua.last_update_date site_updated
, fu_site_upd.description site_updated_by
, '#####'
, hl.address1
, hl.address2
, hl.address3
, hl.address4
, hl.city
, hl.state
, hl.postal_code
FROM apps.hz_parties hp
, ar.hz_party_sites hps
, ar.hz_locations hl
, apps.hz_cust_accounts hca
, apps.hz_cust_acct_sites_all hcasa
, apps.hz_cust_site_uses_all hcsua

, applsys.fnd_user fu_header
, applsys.fnd_user fu_hdr_upd
, applsys.fnd_user fu_site
, applsys.fnd_user fu_site_upd
WHERE hp.party_id = hca.party_id
AND hp.party_id = hps.party_id
AND hcasa.party_site_id = hps.party_site_id
AND hca.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND hca.created_by = fu_header.user_id
AND hca.last_updated_by = fu_hdr_upd.user_id
AND hcsua.created_by = fu_site.user_id
AND hcsua.last_updated_by = fu_site_upd.user_id
AND hps.location_id = hl.location_id
AND hl.location_id = 123
--

AND hcasa.org_id = 123

--

AND hca.cust_account_id = 123

--

AND hcsua.cust_acct_site_id = 123

--

AND hp.party_name = 'BILLY BOBBY'

--

AND hcsua.cust_acct_site_id IN(123)

--

AND hca.account_number = 123

--

AND hca.cust_account_id = 123

ORDER BY hcsua.org_id
, hp.party_name;

AR Customers *with* receipt methods


-- CUSTOMER DETAILS with RECEIPT METHODS
SELECT hca.account_number act_no
, hca.cust_account_id cust_id
, hcsua.site_use_id

, hp.party_number
, hps.party_site_number site_num
, DECODE(hcasa.status, 'I', 'Inactive', 'A', 'Active', 'Other') status
, hp.party_name
, hcsua.location
, hcsua.site_use_code
, hcasa.creation_date site_created_date
, fu.description created_by
, hcasa.last_update_date site_update_date
, fu2.description updated_by
, rcrm.cust_receipt_method_id
, rcrm.customer_id
, rcrm.receipt_method_id
, rcrm.primary_flag
, rcrm.start_date
, rcrm.end_date
, rcrm.site_use_id
, rcrm.creation_date
FROM apps.hz_parties hp
, ar.hz_party_sites hps
, apps.hz_cust_accounts hca
, apps.hz_cust_acct_sites_all hcasa
, apps.hz_cust_site_uses_all hcsua
, applsys.fnd_user fu
, applsys.fnd_user fu2
, apps.ar_receipt_methods arm
, apps.ra_cust_receipt_methods rcrm
WHERE hp.party_id = hca.party_id
AND hp.party_id = hps.party_id
AND hcasa.party_site_id = hps.party_site_id
AND hca.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND hcsua.created_by = fu.user_id
AND hcsua.last_updated_by = fu2.user_id
AND arm.receipt_method_id = rcrm.receipt_method_id
AND rcrm.customer_id = hca.cust_account_id
AND rcrm.site_use_id = hcsua.site_use_id
AND hcasa.status <> 'I'
AND hca.cust_account_id = 123
-AND hca.account_number = '123'
AND rcrm.end_date IS NULL
AND 1 = 1
ORDER BY hp.party_name;
Posted by Elangovan Ragavan at 08:51 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR Customers Basic - Release 11i


SELECT
,
,
,
,

ca.account_number custno
ca.attribute_category
DECODE (cs.status, 'I', 'Inactive',
pa.party_name name
cu.site_use_code site_use

'A', 'Active',

'Other') status

, hps.party_site_number site_num
, cu.location site_location
, hl.address1
, hl.city
, hl.postal_code
, hl.country
FROM ar.hz_cust_site_uses_all cu
, ar.hz_cust_accounts ca
, ar.hz_cust_acct_sites_all cs
, ar.hz_parties pa
, ar.hz_party_sites hps
, ar.hz_locations hl
WHERE ca.cust_account_id = cs.cust_account_id
AND cu.cust_acct_site_id = cs.cust_acct_site_id
AND ca.party_id = pa.party_id
AND pa.party_id = hps.party_id
AND cs.party_site_id = hps.party_site_id
AND hps.location_id = hl.location_id
AND ca.account_number = 123
AND cu.site_use_code = 'BILL_TO'
AND ca.customer_type = 'R'
Posted by Elangovan Ragavan at 08:50 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 10 DECEMBER 2013

Oracle EBS Receivables Data Flow and Data Model


The Accounts Receivable function is responsible for managing outgoing invoices to customers
who purchased goods or services, and the collection and application of all payments, including
payments for invoices. The Oracle Receivables module (a part of the Oracle EBS Financials
Suite) helps the Accounts Receivable departments to manage this function effectively and
efficiently.
This post describes a summary of the Oracle Receivables data model and data flow. Some of
these tables are source tables for the Oracle Business Intelligence Applications Financial
Analytics module, specifically providing information for the Payabales dashboard.

To be in the position where you need to handle and process a payment in Receivables, you
need to have a buyer/payer (most times this is a customer but there are exceptions). Customer
records are stored in the HZ_CUST_ACCOUNTS and HZ_PARTIES tables. Each customer
needs to have a site (a location/address of business) for which information is stored in
HZ_CUST_ACCT_SITES_ALL and HZ_PARTY_SITES_ALL.
When a customer purchases goods or services from your company, an invoice is generated for
the customer. These invoice transactions are recorded in RA_CUSTOMER_TRX_ALL (invoice
headers) and RA_CUSTOMER_TRX_LINES_ALL (invoice lines).
When the customer makes a payment, this generates new transactions. These are recorded in
AR_CASH_RECEIPTS_ALL and AR_CASH_RECEIPT_HISTORY. If there is adjustment to an
invoice, this is recorded in AR_ADJUSTMENTS.
Sometimes payments are received in batches, where a single payment is for multiple invoices.
These batch payments have records in AR_BATCHES.
The AR_PAYMENT_SCHEDULE table holds one record per payment. Therefore, for payments
that pay an invoice in full, there will only be one record related to that invoice. However, if
payments for an invoice are broken up into a payment plan, or if a partial payment is received
for an invoice, additional records will be generated in this table for each payment.
I mentioned above that most times payments are from customers, but there are exceptions. An
example of an exception is payment from a bank for interest earned. The payment is not from
a customer and its not for goods/services provided. These types of payments are recorded in
AR_MISC_CASH_DISTRIBUTIONS.
These transactions affect accounting which will eventually make their way to the GL (when the
Receivables Transfer to GL program is run). The accounting transactions are generated in
RA_CUST_TRX_LINE_GL_DIST and AR_RECEIVABLE_APPLICATIONS.
1. What is TCA? Tables?
A) Trading Community Architecture. It is a centralized repository of business entities such as
Partners, Customers, and Organizations etc. It is a new framework developed in Oracle 11i.
HZ_PARTIES: The HZ_PARTIES table stores basic information about parties that can be shared
with any relationship that the party might establish with another party. Although a record in

the HZ_PARTIES table represents a unique party, multiple parties can have the same name.
The parties can be one of four types:
Organization for example, Oracle CorporationPerson for example, Jane DoeGroup for
example, World Wide Web ConsortiumRelationship for example, Jane Doe at Oracle
Corporation.
HZ_LOCATIONS: The HZ_LOCATIONS table stores information about a delivery or postal
address such as building number, street address, postal code, and directions to a location.
This table provides physical location information about parties (organizations and people) and
customer accounts.
HZ_PARTY_SITES: The HZ_PARTY_SITES table links a party (see HZ_PARTIES) and a location
(see HZ_LOCATIONS) and stores location-specific party information. One party can optionally
have one or more party sites. One location can optionally be used by one or more parties.
This party site can then be used for multiple customer accounts within the same party.
HZ_CUST_ACCT_SITES_ALL
HZ_CUST_SITE_USES_ALL
HZ_CUST_CONTACT_POINTS etc.
2. What are Base Tables or Interface Tables for Customer Conversions, Autolockbox, Auto
Invoice?
A) Customer Conversion:
Interface Tables : RA_CUSTOMERS_INTERFACE_ALL, RA_CUSTOMER_PROFILES_INT_ALL,
RA_CONTACT_PHONES_INT_ALL,
RA_CUSTOMER_BANKS_INT_ALL,
RA_CUST_PAY_METHOD_INT_ALL
Base Tables : RA_CUSTOMERS, RA_ADDRESSES, RA_SITE_USES_ALL,
RA_CUSTOMER_PROFILES_ALL, RA_PHONES etc
B) Auto Invoice:
Interface Tables : RA_INTERFACE_LINES_ALL, RA_INTERFACE_DISTRIBUTIONS_ALL
RA_INTERFACE_SALESCREDITS_ALL, RA_INTERFACE_ERRORS_ALL
Base Tables : RA_CUSTOMER_TRX_ALL, RA_CUSTOMER_TRX_LINES_ALL,
RA_CUST_TRX_LINE_GL_DIST_ALL, RA_CUST_TRX_LINE_SALESREPS_ALL,
RA_CUST_TRX_TYPES_ALL
C) AutoLockBox:
Interface Tables : AR_PAYMENTS_INTERFACE_ALL (POPULATED BY IMPORT PROCESS)
Interim tables : AR_INTERIM_CASH_RECEIPTS_ALL (All Populated by Submit Validation)
: AR_INTERIM_CASH_RCPT_LINES_ALL,
AR_INTERIM_POSTING
Base Tables : AR_CASH_RECEIPTS_ALL, AR_RECEIVABLE_APPLICATIONS_ALL,
AR_PAYMENT_SCHEDULES_ALL ( All Populated by post quick cash)
3. What are the tables in which Invoices/transactions information is stored?
A) RA_CUSTOMER_TRX_ALL, The RA_CUSTOMER_TRX_ALL table stores invoice, debit memo,
commitment, bills receivable, and credit memo header information. Each row in this table
includes general invoice information such as customer, transaction type, and printing
instructions.
RA_CUSTOMER_TRX_LINES_ALL, The RA_CUSTOMER_TRX_LINES_ALL table stores information
about invoice, debit memo, credit memo, bills receivable, and commitment lines (LINE,

FREIGHT and TAX).


RA_CUST_TRX_LINE_SALESREPS_ALL, The RA_CUST_TRX_LINE_SALESREPS_ALL table stores
sales credit assignments for invoice lines. If Receivables bases your invoice distributions on
sales credits, a mapping exists between the sales credit assignments in this table with the
RA_CUST_TRX_LINE_GL_DIST_ALL table.
The RA_CUST_TRX_LINE_GL_DIST_ALL table stores the accounting records for revenue,
unearned revenue, and unbilled receivables for each invoice or credit memo line. Oracle
Receivables creates one row for each accounting distribution, and at least one accounting
distribution must exist for each invoice or credit memo line. Each row in this table includes
the General Ledger account and the amount of the accounting entry.
The RA_CUST_TRX_LINE_SALESREPS_ALL table stores sales credit assignments for invoice
lines. If Receivables bases your invoice distributions on sales credits, a mapping exists
between the sales credit assignments in this table with the RA_CUST_TRX_LINE_GL_DIST_ALL
table.
4. What are the tables In which Receipt information is stored?
A) AR_PAYMENT_SCHEDULES_ALL, The AR_PAYMENT_SCHEDULES_ALL table stores all
transactions except adjustments and miscellaneous cash receipts. Oracle Receivables updates
this table when activity occurs against an invoice, debit memo, chargeback, credit memo, onaccount credit, or receipt.
Transaction classes determine if a transaction relates to either the RA_CUSTOMER_TRX_ALL
table or the AR_CASH_RECEIPTS_ALL table. Using the CUSTOMER_TRX_ID foreign key column,
the AR_PAYMENT_SCHEDULES_ALL table joins to the RA_CUSTOMER_TRX_ALL table for nonpayment transaction entries, such as the creation of credit memos, debit memos, invoices,
chargebacks, or deposits. Using the CASH_RECEIPT_ID foreign key column, the
AR_PAYMENT_SCHEDULES_ALL table joins to the AR_CASH_RECEIPTS_ALL table for invoicerelated payment transactions.
AR_CASH_RECEIPTS_ALL, The AR_CASH_RECEIPTS_ALL table stores one record for each receipt
that you enter. Oracle Receivables concurrently creates records in the
AR_CASH_RECEIPT_HISTORY_ALL, AR_PAYMENT_SCHEDULES_ALL, and
AR_RECEIVABLE_APPLICATIONS_ALL tables for invoice-related receipts. For receipts that are
not related to invoices, such as miscellaneous receipts, Receivables creates records in the
AR_MISC_CASH_DISTRIBUTIONS_ALL table instead of the AR_RECEIVABLE_APPLICATIONS_ALL
table.
AR_RECEIVABLE_APPLICATIONS_ALL, The AR_CASH_RECEIPTS_ALL table stores one record for
each receipt that you enter. Oracle Receivables concurrently creates records in the
AR_CASH_RECEIPT_HISTORY_ALL, AR_PAYMENT_SCHEDULES_ALL, and
AR_RECEIVABLE_APPLICATIONS_ALL tables for invoice-related receipts. For receipts that are
not related to invoices, such as miscellaneous receipts, Receivables creates records in the
AR_MISC_CASH_DISTRIBUTIONS_ALL table instead of the AR_RECEIVABLE_APPLICATIONS_ALL
table. Cash receipts proceed through the confirmation, remittance, and clearance steps. Each
step creates rows in the AR_CASH_RECEIPT_HISTORY table.
5. What are the tables in which Accounts information is stored?
RA_CUST_TRX_LINE_GL_DIST_ALL

6. What are the different statuses for Receipts?


A) Unidentified Lack of Customer Information
Unapplied Lack of Transaction/Invoice specific information (Ex- Invoice Number)
Applied When all the required information is provided.
On-Account, Non-Sufficient Funds, Stop Payment, and Reversed receipt.
8. What is Autolockbox?
A) Auto lockbox is a service that commercial banks offer corporate customers to enable them
to out source their account receivable payment processing. Auto lockbox can also be used to
transfer receivables from previous accounting systems into current receivables. It eliminates
manual data entry by automatically processing receipts that are sent directly to banks. It
involves three steps
1 Import (Formats data from bank file and populates the Interface Table),
2 Validation(Validates the data and then Populates data into Interim Tables),
3 Post Quick Cash(Applies Receipts and updates Balances in BaseTables).
9. What is Transmission Format?
A) Transmission Format specifies how data in the lockbox bank file should be organized such
that it can be successfully imported into receivables interface tables. Example, Default,
Convert, Cross Currency, Zengen are some of the standard formats provided by oracle.
10. What is Auto Invoice?
A) Autoinvoice is a tool used to import and validate transaction data from other financial
systems and create invoices, debit-memos, credit memos, and on account credits in Oracle
receivables. Using Custom Feeder programs transaction data is imported into the autoinvoice
interface tables.
Autoinvoice interface program then selects data from interface tables and creates
transactions in receivables (Populates receivable base tables) . Transactions with invalid
information are rejected by receivables and are stored in RA_INTERFACE_ERRORS_ALL
interface table.
11. What are the Mandatory Interface Tables in Auto Invoice?RA_INTERFACE_LINES_ALL,
RA_INTERFACE_DISTRIBUTIONS_ALL
RA_INTERFACE_SALESCREDITS_ALL.
12. What are the Set up required for Custom Conversion, Autolockbox and Auto Invoice?
A) Autoinvoice program Needs AutoAccounting to be defined prior to its execution.
13. What is AutoAccounting?A) By defining AutoAccounting we specify how the receivables
should determine the general ledger accounts for transactions manually entered or imported
using Autoinvoice. Receivables automatically creates default accounts(Accounting Flex field
values) for revenue, tax, freight, financial charge, unbilled receivable, and unearned revenue
accounts using the AutoAccounting information.
14. What are Autocash rules?A) Autocash rules are used to determine how to apply the
receipts to the customers outstanding debit items. Autocash Rule Sets are used to determine
the sequence of Autocash rules that Post Quickcash uses to update the customers account
balances.

15. What are Grouping Rules? (Used by Autoinvoice)


A) Grouping rules specify the attributes that must be identical for lines to appear on the same
transaction. After the grouping rules are defined autoinvoice uses them to group revenues and
credit transactions into invoices debit memos, and credit memos.
16. What are Line Ordering Rules? (Used by Autoinvoice)A) Line ordering rules are used to
order transaction lines when grouping the transactions into invoices, debit memos and credit
memos by autoinvoice program. For instance if transactions are being imported from oracle
order management , and an invoice line ordering rule for sales_order _line is created then the
invoice lists the lines in the same order of lines in sales order.
17. In which table you can see the amount due of a customer?
A) AR_PAYMENT_SCHEDULES_ALL
18. How do you tie Credit Memo to the Invoice?
At table level, In RA_CUSTOMER_TRX_ALL, If you entered a credit memo, the
PREVIOUS_CUSTOMER_TRX_ID column stores the customer transaction ID of the invoice that
you credited. In the case of on-account credits, which are not related to any invoice when the
credits are created, the PREVIOUS_CUSTOMER_TRX_ID column is null.
19. What are the available Key Flex Fields in Oracle Receivables?A) Sales Tax Location Flex
field, Its used for sales tax calculations.
Territory Flex field is used for capturing address information.
20. What are Transaction types? Types of Transactions in AR?
A) Transaction types are used to define accounting for different transactions such as Debit
Memo, Credit Memo, On-Account Credits, Charge Backs, Commitments and invoices.

AR TO GL LINK IN R12
AR TO GL LINK IN R12( THROUGH XLA) or ( WITH XLA )
/* Formatted on 11/29/2013 4:46:26 PM (QP5 v5.114.809.3010) */
SELECT ooha.order_number,
ooha.org_id,
hca.account_name,
hp.party_name "Customer Name",
hcasab.orig_system_reference BILL_TO_ORIG_REF,
hpsb.status BILL_TO_STATUS,
'ADDRESS1 - '
|| bill_loc.address1
|| ','
|| CHR (10)
|| 'ADDRESS2 - '
|| bill_loc.address2
|| ','
|| CHR (10)
|| 'ADDRESS3 - '
|| bill_loc.address3
|| ','

|| CHR (10)
|| 'CITY - '
|| bill_loc.city
|| ','
|| CHR (10)
|| 'POSTAL CD- '
|| bill_loc.postal_code
|| ','
|| CHR (10)
|| 'COUNTRY - '
|| bill_loc.country
BILL_TO_ADDRESS,
hcasas.orig_system_reference SHIP_TO_ORIG_REF,
hpss.status SHIP_TO_STATUS,
'ADDRESS1 - '
|| ship_loc.address1
|| ','
|| CHR (10)
|| 'ADDRESS2 - '
|| ship_loc.address2
|| ','
|| CHR (10)
|| 'ADDRESS3 - '
|| ship_loc.address3
|| ','
|| CHR (10)
|| 'CITY - '
|| ship_loc.city
|| ','
|| CHR (10)
|| 'POSTAL CD- '
|| ship_loc.postal_code
|| ','
|| CHR (10)
|| 'COUNTRY - '
|| ship_loc.country
SHIP_TO_ADDRESS,
oola.inventory_item_id,
oola.ordered_item,
msib.description item_description,
wnd.name delivery_number,
rct.trx_number "AR Invoice Number",
acr.receipt_number "AR Receipt Number",
gjh.ledger_id,
gjh.name
FROM oe_order_headers_all ooha,
oe_order_lines_all oola,
hz_parties hp,
hz_cust_accounts hca,
hz_party_sites hpss,
hz_party_sites hpsb,

hz_locations bill_loc,
hz_locations ship_loc,
hz_cust_acct_sites_all hcasab,
hz_cust_acct_sites_all hcasas,
hz_cust_site_uses_all hzsuab,
hz_cust_site_uses_all hzsuas,
mtl_system_items_b msib,
wsh_delivery_details wdd,
wsh_new_deliveries wnd,
wsh_delivery_assignments wda,
ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ra_cust_trx_line_gl_dist_all rctld,
ar_cash_receipts_all acr,
xla.xla_transaction_entities xte,
xla_events xe,
xla_ae_headers xah,
xla_ae_lines xal,
xla_distribution_links xdl,
gl_import_references gir,
gl_je_batches gjb,
gl_je_headers gjh,
gl_je_lines gjl
WHERE
ooha.order_number = :SalesOrderNumber--Right click :RequitionNumber from
Toad Enable Prompt For Substitution Variables
AND ooha.org_id = 204
AND hca.cust_account_id = ooha.sold_to_org_id
AND hp.party_id = hca.party_id
AND hpss.party_id = hca.party_id
AND hpsb.party_id = hca.party_id
AND bill_loc.location_id = hpss.location_id
AND ship_loc.location_id = hpsb.location_id
AND hcasas.cust_account_id = hca.cust_account_id
AND hcasab.cust_account_id = hca.cust_account_id
AND hcasas.party_site_id = hpss.party_site_id
AND hcasab.party_site_id = hpsb.party_site_id
AND hzsuas.cust_acct_site_id = hcasas.cust_acct_site_id
AND hzsuab.cust_acct_site_id = hcasab.cust_acct_site_id
AND hzsuas.site_use_id = ooha.ship_to_org_id
AND hzsuab.site_use_id = ooha.invoice_to_org_id
AND wda.delivery_id = wnd.delivery_id(+)
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wdd.source_header_id = ooha.header_id
AND wdd.source_line_id = oola.line_id
AND wdd.organization_id = msib.organization_id(+)
AND wdd.inventory_item_id = msib.inventory_item_id(+)
AND rct.interface_header_attribute1 = TO_CHAR (ooha.order_number)
AND rct.org_id = ooha.org_id
AND rctl.customer_trx_id = rct.customer_trx_id
AND rctl.sales_order = TO_CHAR (ooha.order_number)
AND rctld.customer_trx_id = rct.customer_trx_id

AND rctld.customer_trx_line_id = rctl.customer_trx_line_id


AND acr.receipt_number = 'G-1001'
AND acr.pay_from_customer = rct.sold_to_customer_id
AND acr.org_id = ooha.org_id
AND acr.customer_site_use_id = rct.bill_to_site_use_id
AND xte.transaction_number = acr.receipt_number
AND xte.entity_code = 'RECEIPTS'
AND xe.entity_id = xte.entity_id
AND xah.event_id = xe.event_id
AND xal.ae_header_id = xah.ae_header_id
AND xal.accounting_class_code = 'CASH'
AND xdl.ae_header_id = xah.ae_header_id
AND xdl.ae_line_num = xal.ae_line_num
--and xdl.source_distribution_id_num_1
AND gir.reference_5 = xte.entity_id
-- Entity Id
AND gir.reference_6 = TO_CHAR (xe.event_id)
--Event Id
AND gir.reference_7 = TO_CHAR (xah.ae_header_id)
-- AE Header Id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.created_by = 1318
AND gjb.je_batch_id = gir.je_batch_id
AND gjh.je_batch_id = gjb.je_batch_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id = gjh.je_header_id
AND gjl.je_line_num = gir.je_line_num
Posted by Elangovan Ragavan at 23:41 2 comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
FRIDAY, 29 NOVEMBER 2013

AR TO GL LINK IN R12
AR TO GL LINK IN R12( THROUGH XLA) or ( WITH XLA )
/* Formatted on 11/29/2013 4:46:26 PM (QP5 v5.114.809.3010) */
SELECT ooha.order_number,
ooha.org_id,
hca.account_name,
hp.party_name "Customer Name",
hcasab.orig_system_reference BILL_TO_ORIG_REF,
hpsb.status BILL_TO_STATUS,
'ADDRESS1 - '
|| bill_loc.address1
|| ','
|| CHR (10)
|| 'ADDRESS2 - '
|| bill_loc.address2
|| ','
|| CHR (10)
|| 'ADDRESS3 - '
|| bill_loc.address3
|| ','

|| CHR (10)
|| 'CITY - '
|| bill_loc.city
|| ','
|| CHR (10)
|| 'POSTAL CD- '
|| bill_loc.postal_code
|| ','
|| CHR (10)
|| 'COUNTRY - '
|| bill_loc.country
BILL_TO_ADDRESS,
hcasas.orig_system_reference SHIP_TO_ORIG_REF,
hpss.status SHIP_TO_STATUS,
'ADDRESS1 - '
|| ship_loc.address1
|| ','
|| CHR (10)
|| 'ADDRESS2 - '
|| ship_loc.address2
|| ','
|| CHR (10)
|| 'ADDRESS3 - '
|| ship_loc.address3
|| ','
|| CHR (10)
|| 'CITY - '
|| ship_loc.city
|| ','
|| CHR (10)
|| 'POSTAL CD- '
|| ship_loc.postal_code
|| ','
|| CHR (10)
|| 'COUNTRY - '
|| ship_loc.country
SHIP_TO_ADDRESS,
oola.inventory_item_id,
oola.ordered_item,
msib.description item_description,
wnd.name delivery_number,
rct.trx_number "AR Invoice Number",
acr.receipt_number "AR Receipt Number",
gjh.ledger_id,
gjh.name
FROM oe_order_headers_all ooha,
oe_order_lines_all oola,
hz_parties hp,
hz_cust_accounts hca,
hz_party_sites hpss,
hz_party_sites hpsb,

hz_locations bill_loc,
hz_locations ship_loc,
hz_cust_acct_sites_all hcasab,
hz_cust_acct_sites_all hcasas,
hz_cust_site_uses_all hzsuab,
hz_cust_site_uses_all hzsuas,
mtl_system_items_b msib,
wsh_delivery_details wdd,
wsh_new_deliveries wnd,
wsh_delivery_assignments wda,
ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ra_cust_trx_line_gl_dist_all rctld,
ar_cash_receipts_all acr,
xla.xla_transaction_entities xte,
xla_events xe,
xla_ae_headers xah,
xla_ae_lines xal,
xla_distribution_links xdl,
gl_import_references gir,
gl_je_batches gjb,
gl_je_headers gjh,
gl_je_lines gjl
WHERE
ooha.order_number = :SalesOrderNumber--Right click :RequitionNumber from
Toad Enable Prompt For Substitution Variables
AND ooha.org_id = 204
AND hca.cust_account_id = ooha.sold_to_org_id
AND hp.party_id = hca.party_id
AND hpss.party_id = hca.party_id
AND hpsb.party_id = hca.party_id
AND bill_loc.location_id = hpss.location_id
AND ship_loc.location_id = hpsb.location_id
AND hcasas.cust_account_id = hca.cust_account_id
AND hcasab.cust_account_id = hca.cust_account_id
AND hcasas.party_site_id = hpss.party_site_id
AND hcasab.party_site_id = hpsb.party_site_id
AND hzsuas.cust_acct_site_id = hcasas.cust_acct_site_id
AND hzsuab.cust_acct_site_id = hcasab.cust_acct_site_id
AND hzsuas.site_use_id = ooha.ship_to_org_id
AND hzsuab.site_use_id = ooha.invoice_to_org_id
AND wda.delivery_id = wnd.delivery_id(+)
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wdd.source_header_id = ooha.header_id
AND wdd.source_line_id = oola.line_id
AND wdd.organization_id = msib.organization_id(+)
AND wdd.inventory_item_id = msib.inventory_item_id(+)
AND rct.interface_header_attribute1 = TO_CHAR (ooha.order_number)
AND rct.org_id = ooha.org_id
AND rctl.customer_trx_id = rct.customer_trx_id
AND rctl.sales_order = TO_CHAR (ooha.order_number)
AND rctld.customer_trx_id = rct.customer_trx_id

AND rctld.customer_trx_line_id = rctl.customer_trx_line_id


AND acr.receipt_number = 'G-1001'
AND acr.pay_from_customer = rct.sold_to_customer_id
AND acr.org_id = ooha.org_id
AND acr.customer_site_use_id = rct.bill_to_site_use_id
AND xte.transaction_number = acr.receipt_number
AND xte.entity_code = 'RECEIPTS'
AND xe.entity_id = xte.entity_id
AND xah.event_id = xe.event_id
AND xal.ae_header_id = xah.ae_header_id
AND xal.accounting_class_code = 'CASH'
AND xdl.ae_header_id = xah.ae_header_id
AND xdl.ae_line_num = xal.ae_line_num
--and xdl.source_distribution_id_num_1
AND gir.reference_5 = xte.entity_id
-- Entity Id
AND gir.reference_6 = TO_CHAR (xe.event_id)
--Event Id
AND gir.reference_7 = TO_CHAR (xah.ae_header_id)
-- AE Header Id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.created_by = 1318
AND gjb.je_batch_id = gir.je_batch_id
AND gjh.je_batch_id = gjb.je_batch_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id = gjh.je_header_id
AND gjl.je_line_num = gir.je_line_num
Posted by Elangovan Ragavan at 16:49 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 19 NOVEMBER 2013

AR to GL Query
Provide Set of book id, Period name, AR invoice/Transaction to the following query. It will give
all GL Batch Name, GL Header and Line details along with the Posted status at the line level.
Query:
SELECT gjl.reference_4 AR_Transaction,
gjb.je_batch_id,
gjb.name batch_name,
gjh.je_header_id,
gjh.name Journal_Header_Name,
DECODE (gjh.ACTUAL_FLAG,
'A', 'Actual',
'B', 'Budget',
'E', 'Encumbrance')
Balance_Type,
gjl.subledger_doc_sequence_value Doc_Seq_Value,
gjl.effective_date GL_Date,
gjl.code_combination_id,
gjl.accounted_dr,
gjl.accounted_cr,
gjl.description Description,
DECODE (gjl.status, 'P', 'Posted', 'U', 'Unposted',

gjl.status)
Journal_Line_Status
FROM gl_je_headers gjh, gl_je_lines gjl, gl_je_batches gjb
WHERE
gjh.je_source = 'Receivables'
AND gjh.je_header_id = gjl.je_header_id
AND gjh.JE_BATCH_ID = gjb.JE_BATCH_ID
AND gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
AND gjh.period_name = gjb.default_period_name
AND gjh.set_of_books_id = &sob_id
AND gjh.period_name = '&Period_Name'
AND gjl.reference_4 = '&AR_trx_number';
Posted by Elangovan Ragavan at 18:09 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, gl

AR Customer list Query


Query:
SELECT rc.customer_number,
rc.CUSTOMER_NAME,
hp.party_id,
hp.party_type,
rc.TAX_REFERENCE,
hca.cust_account_id,
hca.PAYMENT_TERM_ID,
hps.location_id,
hcsu.location,
hcsu.site_use_code,
hcsa.bill_to_flag,
hcsu.GL_ID_REC Receiving_acc_ccid,
hl.address1,
hl.address2,
hl.address3,
hl.city,
hl.state,
hl.country,
hl.postal_code
FROM ra_customers rc,
hz_parties hp,
hz_party_sites hps,
hz_locations hl,
hz_cust_accounts_all hca,
hz_cust_acct_sites_all hcsa,
hz_cust_site_uses_all hcsu
WHERE
rc.party_id = hp.party_id
AND hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hp.party_id = hca.party_id
AND hcsa.party_site_id = hps.party_site_id
AND hcsu.cust_acct_site_id = hcsa.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
AND rc.customer_number = '&Customer_Number';

Posted by Elangovan Ragavan at 18:07 1 comment:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

How to delete/cancel AR Invoice/Transaction


Deleting AR Invoice:
You can delete the AR invoice in the following cases:
- The invoice in the incomplete status.
- The invoice doesn't posted.
- This is no receipt applied to the invoice.
Navigation: Receivables Manager > Transactions > Transactions
Query AR Transaction > Click on 'Incomplete' button > Goto Edit menu > Click on Delete
Note:
1. You might miss your invoice document sequence
2. Check with your company policies whether you can delete or not.
=> If the Invoice in 'complete' status, create a Credit Memo against this invoice and nullify the
transaction.
Posted by Elangovan Ragavan at 14:51 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
FRIDAY, 4 OCTOBER 2013

Oracle R12 Internal Requisition and Internal Sales Order Process Flow.
In this blog I will explain the Process flow and Setup required to create Oracle Order
Management Internal Sales order (ISO) from Internal requisition (IR)
What is internal sales order
A request within your company for goods or services. An internal sales order originates
from an employee or from another process as a requisition, such as inventory or
manufacturing, and becomes an internal sales order when the information is transferred
from Purchasing to Order Management. Also known as internal requisition or purchase
requisition.
Oracle Purchasing uses Order Import to transfer requisitions for internally sourced
products to Order Management. Once imported, the internal sales orders are processed
similar to regular sales orders.
Note: You can create requisitions (with same number) in two different operating units.
You can partially or fully cancel the line quantities on internal sales orders.
You can make the following attribute changes after an internal sales order has been generated:
Update Scheduled Shipment Date

Decrement order line quantity


Note: If you cancel an internal sales order, order line, or backordered order line that is linked to
an internal requisition, manually cancel the internal requisition. The order cancelProcessing
issues a reminder.
Test Case
Item IR Item004
Assign to Inventory Org M1 and M2
Create Requisition with Destination Org M1 and Source Org M2.Create Internal Sales Order in
M2
1# Create Item IR Item4 , with Purchased Item as template , in Oracle Inventory Management.

2# Mark Item as Internal Order Enabled.

3# Assign Item to M1 and M2 Inventory Orgs.

4# Define Cost for Item Navigation >Costs >Item Costs

5# Update the cost


Navigation
Costs
Update Standard Costs
Update Cost

6# Set the Internal Order Setup at Customer Ship To Site in Oracle Order Management.

7# Define Shipping Network setup Between M2 and M2 in Oracle Shipping.


Inventory > Setup > Organization > shipping Network

8# Define Purchasing Option Setup for Internal Sales Order and define
Internal requisition Order Type
Internal requisition Order Source.
in Oracle Purchasing Module

9#Create & Approve Requisition in Oracle Purchasing

Save and Approve Requisition.

10#submit Create Internal Order Concurrent program in Oracle Purchasing.

11#Submit Order Import

Query for Sales Order based on requisition Number.

12# Progress the Sales Order from Awaiting Shipping to Close.

Posted by Elangovan Ragavan at 17:40 2 comments:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
THURSDAY, 3 OCTOBER 2013

Query to find AR Invoices posted to GL in R12

In R12 all GL posted transactions are sits in


xla_ae_headers, xla_ae_lines, xla_transaction_entities.
The below Query will give All AR Invoices posted to GL in R12
SELECT RCTLG.AMOUNT,
AC.CUSTOMER_NUMBER,
AC.CUSTOMER_NAME,
RCX.TRX_NUMBER
FROM ra_customer_trx_all rcx,
ar_customers ac,
ra_cust_trx_line_gl_dist_all rctlg,
xla.xla_ae_headers xah,
xla.xla_ae_lines xal,
xla_distribution_links xdl,
gl_code_combinations gcc,
xla.xla_transaction_entities xte,
gl_import_references gir,
gl_je_headers gjh,
gl_je_lines gjl
WHERE rcx.bill_to_customer_id = ac.customer_id(+)
AND rcx.customer_trx_id = rctlg.customer_trx_id
AND xah.ae_header_id = xal.ae_header_id(+)
AND gcc.code_combination_id(+) = xal.code_combination_id
AND rctlg.code_combination_id = xal.code_combination_id
AND xdl.ae_header_id = xah.ae_header_id
AND xdl.ae_line_num = xal.ae_line_num
AND xdl.source_distribution_id_num_1 = rctlg.cust_trx_line_gl_dist_id
AND xte.source_id_int_1 = rcx.customer_trx_id
AND xte.entity_code = 'TRANSACTIONS'
AND rctlg.account_class = 'REV'
AND xte.entity_id = xah.entity_id
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 GIR.JE_HEADER_ID = GJH.JE_HEADER_ID
AND GJL.JE_HEADER_ID = GJH.JE_HEADER_ID
Posted by Elangovan Ragavan at 15:11 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
WEDNESDAY, 29 MAY 2013

AR 7 Bucket Ageing Query

Select MAIN_TAB.*
from
(select AR_TAB.account_number ,
AR_TAB.party_name,
AR_TAB.customer_trx_id,
AR_TAB.Trans_Type,
AR_TAB.trans_type_name,
AR_TAB.cust_trx_type_id,
AR_TAB.invoice_currency_code,
AR_TAB.location_code,
AR_TAB.trx_num,
AR_TAB.Trans_Date,
AR_TAB.gl_date,
AR_TAB.Due_Date,
AR_TAB.Fcy_Amt,
AR_TAB.Inr_Amt,
AR_TAB.exchange_rate,
AR_TAB.amount_due_remaining_FCY,
AR_TAB.Amount_Remaining_INR,
nvl(AR_TAB.ar_acctd_amt_due,0) ar_acctd_amt_due,
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0)) outstanding_amount_inr,
(nvl(AR_TAB.Fcy_Amt,0)-nvl(AR_TAB.ar_fcy_amt_due,0)) Outstanding_amount_fcy,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) <=0 then (AR_TAB.INR_AMT AR_TAB.ar_acctd_amt_due)
else 0 end ) Current_bal
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 1 and 30 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) One_30_Days_Past_Due ---1-30
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 31 and 60 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) ThirtyOne_60_Days_Past_Due ---31-60
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 61 and 90 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) One_90_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 91 and 120 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) One_120_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 121 and 150 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) One_150_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 151 and 180 then
(nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) One_180_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) > 180 then (nvl(AR_TAB.INR_AMT,0) -

nvl(AR_TAB.ar_acctd_amt_due,0))
else 0 end ) more_than_180_Days_Past_Due
from
(SELECT
hca.account_number account_number,
hp.PARTY_NAME party_name,
cta.CUSTOMER_TRX_ID customer_trx_id
--,acl.name collector_name
,decode(ps.class,'INV', 'Invoice', 'DM', 'Debit Memo','CM','Credit Memo') Trans_Type
,rctt.name trans_type_name,
rctt.CUST_TRX_TYPE_ID cust_trx_type_id
,cta.INVOICE_CURRENCY_CODE invoice_currency_code,
hou.LOCATION_CODE location_code,
ps.trx_number trx_num
,ps.trx_date Trans_Date,
ps.GL_DATE gl_date,
ps.due_date Due_Date,
ps.AMOUNT_DUE_ORIGINAL Fcy_Amt,
round((ps.AMOUNT_DUE_ORIGINAL * nvl(ps.EXCHANGE_RATE,1)),2) Inr_Amt ,
ps.EXCHANGE_RATE exchange_rate,
ps.AMOUNT_DUE_REMAINING amount_due_remaining_FCY
,ps.acctd_amount_due_remaining Amount_Remaining_INR,
(select round(sum(nvl(a.AMOUNT_APPLIED* nvl(ps.EXCHANGE_RATE,1) ,0)),2)
from ar_receivable_applications_all a
where a.APPLIED_PAYMENT_SCHEDULE_ID = ps.PAYMENT_SCHEDULE_ID
-- a.APPLIED_CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
and a.DISPLAY='Y'
and trunc(a.GL_DATE) between :p_from_date and :p_to_date
group by a.APPLIED_PAYMENT_SCHEDULE_ID) ar_acctd_amt_due,
(select round(sum(nvl(a.AMOUNT_APPLIED,0)),2) from ar_receivable_applications_all a where
a.APPLIED_PAYMENT_SCHEDULE_ID=ps.PAYMENT_SCHEDULE_ID
and a.DISPLAY='Y' and trunc(a.GL_DATE) between :p_from_date and :p_to_date
group by a.APPLIED_PAYMENT_SCHEDULE_ID) ar_fcy_amt_due
/*,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) <=0 then ps.acctd_amount_due_remaining
else 0 end ) Current_bal
,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 1 and 30 then
ps.acctd_amount_due_remaining
else 0 end ) One_30_Days_Past_Due ---1-30
,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 31 and 60 then
ps.acctd_amount_due_remaining
else 0 end ) ThirtyOne_60_Days_Past_Due ---31-60
,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 61 and 90 then
ps.acctd_amount_due_remaining
else 0 end ) One_90_Days_Past_Due,

(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 91 and 120 then


ps.acctd_amount_due_remaining
else 0 end ) One_120_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 121 and 150 then
ps.acctd_amount_due_remaining
else 0 end ) One_150_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 151 and 180 then
ps.acctd_amount_due_remaining
else 0 end ) One_180_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) > 180 then ps.acctd_amount_due_remaining
else 0 end ) more_than_180_Days_Past_Due*/
FROM apps.ar_payment_schedules_all ps
,apps.hz_cust_accounts hca
,apps.hz_parties hp
--,apps.ar_collectors acl
,apps.ra_customer_trx_all cta
,apps.ra_cust_trx_types_all rctt
,hr_organization_units_v hou
--ar_receivable_applications_all ara
WHERE hca.cust_account_id = ps.CUSTOMER_ID
AND ps.CUSTOMER_TRX_ID=cta.CUSTOMER_TRX_ID
--AND ara.APPLIED_CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
--AND ara.DISPLAY='Y'
AND cta.cust_trx_type_id = rctt.cust_trx_type_id
--AND (ps.status = 'OP' or(ps.STATUS='CL' and ps.GL_DATE_CLOSED < :p_to_date))
AND ps.class <> 'PMT'
AND ps.CLASS = nvl(:p_class,ps.CLASS)
AND ps.CLASS in('INV','DM')
--AND ps.customer_id > 0
--AND ps.AMOUNT_DUE_REMAINING <> 0
--AND trunc(ps.GL_DATE) < trunc(sysdate)
AND cta.INVOICE_CURRENCY_CODE <> 'INR'
AND hou.ORGANIZATION_ID=cta.ORG_ID
AND cta.ORG_ID = nvl(:p_org_id,cta.ORG_ID)
AND hp.PARTY_ID=hca.PARTY_ID
--AND hp.PARTY_NAME='Tea Promotors Export Pvt. Ltd.'
AND ps.INVOICE_CURRENCY_CODE<>'INR'
AND rctt.ORG_ID=cta.ORG_ID
AND ps.AMOUNT_ADJUSTED is null -- added on 10jul2012
--AND cta.TRX_NUMBER='511120003'
--AND trunc(ps.DUE_DATE) between nvl(:p_from_date,trunc(ps.DUE_DATE)) and
nvl(:p_to_date,trunc(ps.DUE_DATE))
--AND trunc(ps.GL_DATE) between nvl(:p_from_date,trunc(ps.GL_DATE)) and
nvl(:p_to_date,trunc(ps.GL_DATE)

AND trunc(ps.GL_DATE) between nvl(:p_from_date,trunc(ps.GL_DATE)) and


nvl(:p_to_date,trunc(ps.GL_DATE))) AR_TAB
--AND AR_TAB.Amount_Remaining_INR <>0
where (nvl(AR_TAB.INR_AMT,0) - nvl(AR_TAB.ar_acctd_amt_due,0)) <> 0
union all /*For credit Memo*/
select AR_TAB.account_number ,
AR_TAB.party_name,
AR_TAB.customer_trx_id,
AR_TAB.Trans_Type,
AR_TAB.trans_type_name,
AR_TAB.cust_trx_type_id,
AR_TAB.invoice_currency_code,
AR_TAB.location_code,
AR_TAB.trx_num,
AR_TAB.Trans_Date,
AR_TAB.gl_date,
AR_TAB.Due_Date,
AR_TAB.Fcy_Amt,
AR_TAB.Inr_Amt,
AR_TAB.exchange_rate,
AR_TAB.amount_due_remaining_FCY,
AR_TAB.Amount_Remaining_INR,
nvl(AR_TAB.ar_acctd_amt_due,0) ar_acctd_amt_due,
-(nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
outstanding_amount_inr,
-(nvl(abs(AR_TAB.Fcy_Amt),0)-nvl(AR_TAB.ar_fcy_amt_due,0)) Outstanding_amount_fcy,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) <=0 then -(abs(AR_TAB.INR_AMT) abs(AR_TAB.ar_acctd_amt_due))
else 0 end ) Current_bal
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 1 and 30 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) One_30_Days_Past_Due ---1-30
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 31 and 60 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) ThirtyOne_60_Days_Past_Due ---31-60
,(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 61 and 90 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) One_90_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 91 and 120 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) One_120_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 121 and 150 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) One_150_Days_Past_Due,

(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) between 151 and 180 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) One_180_Days_Past_Due,
(case when (:p_to_date - trunc(AR_TAB.DUE_DATE)) > 180 then (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0))
else 0 end ) more_than_180_Days_Past_Due
from
(SELECT
hca.account_number account_number,
hp.PARTY_NAME party_name,
cta.CUSTOMER_TRX_ID customer_trx_id
--,acl.name collector_name
,decode(ps.class,'INV', 'Invoice', 'DM', 'Debit Memo','CM','Credit Memo') Trans_Type
,rctt.name trans_type_name,
rctt.CUST_TRX_TYPE_ID cust_trx_type_id
,cta.INVOICE_CURRENCY_CODE invoice_currency_code,
hou.LOCATION_CODE location_code,
ps.trx_number trx_num
,ps.trx_date Trans_Date,
ps.GL_DATE gl_date,
ps.due_date Due_Date,
ps.AMOUNT_DUE_ORIGINAL Fcy_Amt,
round((ps.AMOUNT_DUE_ORIGINAL * nvl(ps.EXCHANGE_RATE,1)),2) Inr_Amt ,
ps.EXCHANGE_RATE exchange_rate,
ps.AMOUNT_DUE_REMAINING amount_due_remaining_FCY
,ps.acctd_amount_due_remaining Amount_Remaining_INR,
(select round(sum(nvl(a.AMOUNT_APPLIED*nvl(ps.EXCHANGE_RATE,1),0)),2)
from ar_receivable_applications_all a
where a.PAYMENT_SCHEDULE_ID = ps.PAYMENT_SCHEDULE_ID
-- a.APPLIED_CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
and a.DISPLAY='Y'
and trunc(a.GL_DATE) between :p_from_date and :p_to_date
group by a.PAYMENT_SCHEDULE_ID) ar_acctd_amt_due,
(select round(sum(nvl(abs(a.AMOUNT_APPLIED),0)),2)
from ar_receivable_applications_all a
where a.PAYMENT_SCHEDULE_ID = ps.PAYMENT_SCHEDULE_ID
-- a.APPLIED_CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
and a.DISPLAY='Y'
and trunc(a.GL_DATE) between :p_from_date and :p_to_date
group by a.PAYMENT_SCHEDULE_ID) ar_fcy_amt_due
/*,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) <=0 then ps.acctd_amount_due_remaining
else 0 end ) Current_bal
,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 1 and 30 then
ps.acctd_amount_due_remaining

else 0 end ) One_30_Days_Past_Due ---1-30


,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 31 and 60 then
ps.acctd_amount_due_remaining
else 0 end ) ThirtyOne_60_Days_Past_Due ---31-60
,(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 61 and 90 then
ps.acctd_amount_due_remaining
else 0 end ) One_90_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 91 and 120 then
ps.acctd_amount_due_remaining
else 0 end ) One_120_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 121 and 150 then
ps.acctd_amount_due_remaining
else 0 end ) One_150_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) between 151 and 180 then
ps.acctd_amount_due_remaining
else 0 end ) One_180_Days_Past_Due,
(case when (trunc(sysdate) - trunc(ps.GL_DATE)) > 180 then ps.acctd_amount_due_remaining
else 0 end ) more_than_180_Days_Past_Due*/
FROM apps.ar_payment_schedules_all ps
,apps.hz_cust_accounts hca
,apps.hz_parties hp
--,apps.ar_collectors acl
,apps.ra_customer_trx_all cta
,apps.ra_cust_trx_types_all rctt
,hr_organization_units_v hou
--ar_receivable_applications_all ara
WHERE hca.cust_account_id = ps.CUSTOMER_ID
AND ps.CUSTOMER_TRX_ID=cta.CUSTOMER_TRX_ID
--AND ara.APPLIED_CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
--AND ara.DISPLAY='Y'
AND cta.cust_trx_type_id = rctt.cust_trx_type_id
--AND (ps.status = 'OP' or(ps.STATUS='CL' and ps.GL_DATE_CLOSED < :p_to_date))
AND ps.class <> 'PMT'
AND ps.CLASS = nvl(:p_class,ps.CLASS)
AND ps.CLASS in('CM')
--AND ps.customer_id > 0
--AND ps.AMOUNT_DUE_REMAINING <> 0
--AND trunc(ps.GL_DATE) < trunc(sysdate)
AND cta.INVOICE_CURRENCY_CODE <> 'INR'
AND hou.ORGANIZATION_ID=cta.ORG_ID
AND cta.ORG_ID = nvl(:p_org_id,cta.ORG_ID)
AND hp.PARTY_ID=hca.PARTY_ID
--AND hp.PARTY_NAME='Tea Promotors Export Pvt. Ltd.'
AND ps.INVOICE_CURRENCY_CODE<>'INR'

AND rctt.ORG_ID=cta.ORG_ID
AND ps.AMOUNT_ADJUSTED is null -- added on 10jul2012
--AND cta.TRX_NUMBER='511120003'
--AND trunc(ps.DUE_DATE) between nvl(:p_from_date,trunc(ps.DUE_DATE)) and
nvl(:p_to_date,trunc(ps.DUE_DATE))
--AND trunc(ps.GL_DATE) between nvl(:p_from_date,trunc(ps.GL_DATE)) and
nvl(:p_to_date,trunc(ps.GL_DATE)
AND trunc(ps.GL_DATE) between nvl(:p_from_date,trunc(ps.GL_DATE)) and
nvl(:p_to_date,trunc(ps.GL_DATE))) AR_TAB
--AND AR_TAB.Amount_Remaining_INR <>0
where (nvl(abs(AR_TAB.INR_AMT),0) - nvl(abs(AR_TAB.ar_acctd_amt_due),0)) <> 0)
MAIN_TAB
order by MAIN_TAB.PARTY_NAME asc;
Posted by Elangovan Ragavan at 10:38 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query, REPORT_QUERY
TUESDAY, 14 MAY 2013

AR to GL Link r12

SELECT

>>SQL1:je_category=
INV/CM/DM/CB

SL
Fields
gle.NAMEledger_name,
gle.currency_codeledger_currency_code,
gcc.concatenated_segmentssla_gl_account,
gcc1.concatenated_segmentsgl_account,
gps.period_nameperiod_name,
party.party_nameparty_name,

party.party_numberparty_number,
cust.account_nameaccount_name,
cust.account_numbercustomer_number,
rct.trx_number,
rct.trx_date,
ctt.NAMEtrx_type,
DECODE(ctt.TYPE,
'INV','Invoices',
'CM','CreditMemos',
'DM','DebitMemos',
'CB','ChargeBacks',
NULL)
trx_class,
rct.complete_flag,
rct.invoice_currency_code,
rctgd.amountdist_AMT,
rctgd.acctd_amountdist_ACCTD_AMOUNT,
rctgd.gl_datear_gl_date,
Rctgd.Gl_Posted_DateAr_Gl_Posted_Date,
rctgd.account_classar_line_account_class,
ael.entered_drsla_line_entered_dr,
ael.entered_crsla_line_entered_cr,
NVL(ael.accounted_dr,0)NVL(ael.accounted_cr,0)
sla_line_accounted_net,
ael.accounted_drsla_line_accounted_dr,
ael.accounted_crsla_line_accounted_cr,
xdl.unrounded_entered_drsla_dist_entered_dr,

xdl.unrounded_entered_crsla_dist_entered_cr,
xdl.unrounded_accounted_drsla_dist_accounted_dr,
xdl.unrounded_accounted_crsla_dist_accounted_cr,
NVL(xdl.unrounded_accounted_dr,0)
NVL(xdl.unrounded_accounted_cr,0)
sla_dist_accounted_net,
DECODE(rctgd.posting_control_id,3,'N','Y')
gl_transfer_statusGLFields
Amounts
,
jl.entered_drgl_entered_dr,
jl.entered_crgl_entered_cr,
jl.accounted_drgl_accounted_dr,
jl.accounted_crgl_accounted_cr,
NVL(jl.entered_dr,0)NVL(jl.entered_cr,0)
gl_net_entered_amt,
NVL(jl.accounted_dr,0)NVL(jl.accounted_cr,0)
gl_net_accounted_amtJournal
Info.
,
jb.NAMEje_batch_name,
jb.descriptionje_batch_description,
jh.NAMEje_name,
jh.descriptionje_description,
jh.posted_dateje_posted_date,
DECODE(
jh.status,
'P',

'Posted',
'U',
'Unposted',
'F',
'Error7Showinginvalidjournalentrylinesornojournal
entrylines',
'K',
'Error10Showingunbalancedintercompanyjournalentry',
'Z',
'Error7Showinginvalidjournalentrylinesornojournal
entrylines',
'Unknown'
)
je_status,
DECODE(jh.actual_flag,
'A',
'Actual',
'B',
'Budget',
'E',
'Encumbrance')
je_typeReconcileStatusand
Amounts..
,
DECODE(
rctgd.posting_control_id,
3,
'NotTransferredToSLA',

DECODE(aeh.gl_transfer_status_code,
'Y','TransferredtoGL',
'NotTransferredtoGL')
)
reconcile_status,
xdl.accounting_line_code,
xdl.event_class_code,
xdl.event_type_code,
aeh.accounting_date,
aeh.gl_transfer_date,
hou.NAMEoperating_unit,
PrimaryKeys
rct.customer_trx_id,
rctgd.cust_trx_line_gl_dist_id,
ctt.cust_trx_type_id,
gle.ledger_id,
gcc.code_combination_idsla_code_combination_id,
gcc1.code_combination_idgl_code_combination_id,
party.party_id,
cust.cust_account_id,
aeh.ae_header_id,
ael.ae_line_num,
jl.je_line_num,
jh.je_header_id,
jb.je_batch_id,
jes.je_source_name,
xdl.event_id,

jec.je_category_name,
gps.start_date,
gps.end_date,
hou.organization_idorg_id,
PrimaryKeys
gcc1.code_combination_id,
aeh.application_id,
xdl.temp_line_num,
xdl.ref_ae_header_id,
gps.set_of_books_id,
hou.organization_id,
GCC.SEGMENT2GCC#50353#ACCOUNT,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT2,
'MAS_GL_COA_ACCOUNT')
GCC#50353#ACCOUNT#DESCR,
GCC.SEGMENT1GCC#50353#COMPANY,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT1,
'MAS_GL_COA_COMPANY')
GCC#50353#COMPANY#DESCR,
GCC.SEGMENT6GCC#50353#DEPARTMENT,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT6,
'MAS_GL_COA_DEPARTMENT')
GCC#50353#DEPARTMENT#DESCR,
GCC.SEGMENT8GCC#50353#FUTURE,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT8,
'MAS_GL_COA_FUTURE')
GCC#50353#FUTURE#DESCR,

GCC.SEGMENT7GCC#50353#IC,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT7,
'MAS_GL_COA_COMPANY')
GCC#50353#IC#DESCR,
GCC.SEGMENT4GCC#50353#LOB,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT4,
'MAS_GL_COA_LOB')
GCC#50353#LOB#DESCR,
GCC.SEGMENT5GCC#50353#LOCATIONS,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT5,
'MAS_GL_COA_LOCATION')
GCC#50353#LOCATIONS#DESCR,
GCC.SEGMENT3GCC#50353#QUALIFIER,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT3,
'MAS_GL_COA_ACCT_QUAL')
GCC#50353#QUALIFIER#DESCR
FROMra_customer_trxrct,
ra_cust_trx_line_gl_distrctgd,
ra_cust_trx_typesctt,
gl_ledgersgle,
gl_code_combinations_kfvgcc,
gl_code_combinations_kfvgcc1,
hz_partiesparty,
hz_cust_accountscust,
xla_ae_headersaeh,
xla_ae_linesael,
xla_distribution_linksxdl,

gl_import_referencesjir,
gl_je_batchesjb,
gl_je_headersjh,
gl_je_linesjl,
gl_je_sourcesjes,
gl_je_categoriesjec,
gl_period_statusesgps,
hr_operating_unitshou
WHERErct.customer_trx_id=rctgd.customer_trx_id
ANDrct.cust_trx_type_id=ctt.cust_trx_type_id
ANDrct.org_id=ctt.org_id
ANDrct.set_of_books_id=gle.ledger_id
ANDrctgd.code_combination_id=gcc.code_combination_id
ANDgcc.code_combination_id(+)=ael.code_combination_id
ANDgcc1.code_combination_id(+)=jl.code_combination_id
ANDrct.bill_to_customer_id=cust.cust_account_id
ANDcust.party_id=party.party_id
ANDrctgd.account_set_flag='N'xla
tables
ANDrctgd.cust_trx_line_gl_dist_id=
xdl.source_distribution_id_num_1(+)
ANDxdl.source_distribution_type(+)=
'RA_CUST_TRX_LINE_GL_DIST_ALL'
ANDxdl.ae_header_id=aeh.ae_header_id(+)
ANDxdl.ae_header_id=ael.ae_header_id(+)
ANDxdl.ae_line_num=ael.ae_line_num(+)
ANDjir.gl_sl_link_id(+)=ael.gl_sl_link_id
ANDjir.gl_sl_link_table(+)=ael.gl_sl_link_table

GlJoins
ANDjb.je_batch_id(+)=jir.je_batch_id
ANDjh.je_header_id(+)=jir.je_header_id
ANDjl.je_line_num(+)=jir.je_line_num
ANDjl.je_header_id(+)=jir.je_header_id
ANDjes.je_source_name(+)=jh.je_source
ANDjec.je_category_name(+)=jh.je_category
ANDjh.je_source(+)='Receivables'
ANDjh.je_category(+)='DebitMemos'
ANDctt.TYPE='DM'
ANDrct.complete_flag='Y'
ANDctt.post_to_gl='Y'
ANDgl_security_pkg.validate_access(gle.ledger_id)='TRUE'
ANDgle.object_type_code='L'
ANDgps.ledger_id=gle.ledger_id
ANDgps.application_id=222
ANDgps.adjustment_period_flag='N'
ANDrctgd.gl_dateBETWEENgps.start_dateANDgps.end_date
ANDhou.organization_id=rct.org_id;

AR to GL link
SELECTgle.NAMEledger_name,
gle.currency_codeledger_currency_code,
gcc.concatenated_segmentssla_gl_account,
gcc1.concatenated_segmentsgl_account,
gps.period_nameperiod_name,
party.party_nameparty_name,
party.party_numberparty_number,
cust.account_nameaccount_name,
cust.account_numbercustomer_number,
rct.trx_number,
rct.trx_date,
ctt.NAMEtrx_type,

DECODE(ctt.TYPE,
'INV','Invoices',
'CM','CreditMemos',
'DM','DebitMemos',
'CB','ChargeBacks',
NULL)
trx_class,
rct.complete_flag,
rct.invoice_currency_code,
rctgd.amountdist_AMT,
rctgd.acctd_amountdist_ACCTD_AMOUNT,
rctgd.gl_datear_gl_date,
rctgd.gl_posted_datear_gl_posted_date,
rctgd.account_classar_line_account_class,
ael.entered_drsla_line_entered_dr,
ael.entered_crsla_line_entered_cr,
NVL(ael.accounted_dr,0)NVL(ael.accounted_cr,0)
sla_line_accounted_net,
ael.accounted_drsla_line_accounted_dr,
ael.accounted_crsla_line_accounted_cr,
xdl.unrounded_entered_drsla_dist_entered_dr,
xdl.unrounded_entered_crsla_dist_entered_cr,
xdl.unrounded_accounted_drsla_dist_accounted_dr,
xdl.unrounded_accounted_crsla_dist_accounted_cr,
NVL(xdl.unrounded_accounted_dr,0)
NVL(xdl.unrounded_accounted_cr,0)
sla_dist_accounted_net,
DECODE(rctgd.posting_control_id,3,'N','Y')
gl_transfer_status
,
jl.entered_drgl_entered_dr,
jl.entered_crgl_entered_cr,
jl.accounted_drgl_accounted_dr,
jl.accounted_crgl_accounted_cr,
NVL(jl.entered_dr,0)NVL(jl.entered_cr,0)
gl_net_entered_amt,
NVL(jl.accounted_dr,0)NVL(jl.accounted_cr,0)
gl_net_accounted_amt
,
jb.NAMEje_batch_name,
jb.descriptionje_batch_description,
jh.NAMEje_name,
jh.descriptionje_description,
jh.posted_dateje_posted_date,
DECODE(
jh.status,
'P',
'Posted',
'U',
'Unposted',
'F',
'Error7Showinginvalidjournalentrylinesornojournal
entrylines',
'K',

'Error10Showingunbalancedintercompanyjournalentry',
'Z',
'Error7Showinginvalidjournalentrylinesornojournal
entrylines',
'Unknown'
)
je_status,
DECODE(jh.actual_flag,
'A',
'Actual',
'B',
'Budget',
'E',
'Encumbrance')
je_type
,
DECODE(
rctgd.posting_control_id,
3,
'NotTransferredToSLA',
DECODE(aeh.gl_transfer_status_code,
'Y','TransferredtoGL',
'NotTransferredtoGL')
)
reconcile_status,
xdl.accounting_line_code,
xdl.event_class_code,
xdl.event_type_code,
aeh.accounting_date,
aeh.gl_transfer_date,
hou.NAMEoperating_unit,
primaryKeys
rct.customer_trx_id,
rctgd.cust_trx_line_gl_dist_id,
ctt.cust_trx_type_id,
gle.ledger_id,
gcc.code_combination_idsla_code_combination_id,
gcc1.code_combination_idgl_code_combination_id,
party.party_id,
cust.cust_account_id,
aeh.ae_header_id,
ael.ae_line_num,
jl.je_line_num,
jh.je_header_id,
jb.je_batch_id,
jes.je_source_name,
xdl.event_id,
jec.je_category_name,
gps.start_date,
gps.end_date,
hou.organization_idorg_id,
PrimaryKeys
gcc.code_combination_id,
aeh.application_id,

xdl.temp_line_num,
xdl.ref_ae_header_id,
gps.set_of_books_id,
hou.organization_id,
GCC.SEGMENT2GCC#50353#ACCOUNT,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT2,
'MAS_GL_COA_ACCOUNT')
GCC#50353#ACCOUNT#DESCR,
GCC.SEGMENT1GCC#50353#COMPANY,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT1,
'MAS_GL_COA_COMPANY')
GCC#50353#COMPANY#DESCR,
GCC.SEGMENT6GCC#50353#DEPARTMENT,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT6,
'MAS_GL_COA_DEPARTMENT')
GCC#50353#DEPARTMENT#DESCR,
GCC.SEGMENT8GCC#50353#FUTURE,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT8,
'MAS_GL_COA_FUTURE')
GCC#50353#FUTURE#DESCR,
GCC.SEGMENT7GCC#50353#IC,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT7,
'MAS_GL_COA_COMPANY')
GCC#50353#IC#DESCR,
GCC.SEGMENT4GCC#50353#LOB,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT4,
'MAS_GL_COA_LOB')
GCC#50353#LOB#DESCR,
GCC.SEGMENT5GCC#50353#LOCATIONS,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT5,
'MAS_GL_COA_LOCATION')
GCC#50353#LOCATIONS#DESCR,
GCC.SEGMENT3GCC#50353#QUALIFIER,
xxeis.eis_rs_fin_utility.decode_vset(GCC.SEGMENT3,
'MAS_GL_COA_ACCT_QUAL')
GCC#50353#QUALIFIER#DESCR,
GCC1.SEGMENT2GCC1#50353#ACCOUNT,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT2,
'MAS_GL_COA_ACCOUNT')
GCC1#50353#ACCOUNT#DESCR,
GCC1.SEGMENT1GCC1#50353#COMPANY,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT1,
'MAS_GL_COA_COMPANY')
GCC1#50353#COMPANY#DESCR,
GCC1.SEGMENT6GCC1#50353#DEPARTMENT,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT6,
'MAS_GL_COA_DEPARTMENT')
GCC1#50353#DEPARTMENT#DESCR,
GCC1.SEGMENT8GCC1#50353#FUTURE,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT8,
'MAS_GL_COA_FUTURE')
GCC1#50353#FUTURE#DESCR,
GCC1.SEGMENT7GCC1#50353#IC,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT7,

'MAS_GL_COA_COMPANY')
GCC1#50353#IC#DESCR,
GCC1.SEGMENT4GCC1#50353#LOB,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT4,
'MAS_GL_COA_LOB')
GCC1#50353#LOB#DESCR,
GCC1.SEGMENT5GCC1#50353#LOCATIONS,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT5,
'MAS_GL_COA_LOCATION')
GCC1#50353#LOCATIONS#DESCR,
GCC1.SEGMENT3GCC1#50353#QUALIFIER,
xxeis.eis_rs_fin_utility.decode_vset(GCC1.SEGMENT3,
'MAS_GL_COA_ACCT_QUAL')
GCC1#50353#QUALIFIER#DESCR
FROMra_customer_trxrct,
ra_cust_trx_line_gl_distrctgd,
ra_cust_trx_typesctt,
gl_ledgersgle,
gl_code_combinations_kfvgcc,
gl_code_combinations_kfvgcc1,
hz_partiesparty,
hz_cust_accountscust,
xla_ae_headersaeh,
xla_ae_linesael,
xla_distribution_linksxdl,
gl_import_referencesjir,
gl_je_batchesjb,
gl_je_headersjh,
gl_je_linesjl,
gl_je_sourcesjes,
gl_je_categoriesjec,
gl_period_statusesgps,
hr_operating_unitshou
WHERErct.customer_trx_id=rctgd.customer_trx_id
ANDrct.cust_trx_type_id=ctt.cust_trx_type_id
ANDrct.org_id=ctt.org_id
ANDrct.set_of_books_id=gle.ledger_id
ANDrctgd.code_combination_id=gcc.code_combination_id
ANDgcc.code_combination_id(+)=ael.code_combination_id
ANDgcc1.code_combination_id(+)=jl.code_combination_id
ANDrct.bill_to_customer_id=cust.cust_account_id
ANDcust.party_id=party.party_id
ANDrctgd.account_set_flag='N'
xlatables
ANDrctgd.cust_trx_line_gl_dist_id=
xdl.source_distribution_id_num_1(+)
ANDxdl.source_distribution_type(+)=
'RA_CUST_TRX_LINE_GL_DIST_ALL'
ANDxdl.ae_header_id=aeh.ae_header_id(+)
ANDxdl.ae_header_id=ael.ae_header_id(+)
ANDxdl.ae_line_num=ael.ae_line_num(+)
ANDjir.gl_sl_link_id(+)=ael.gl_sl_link_id
ANDjir.gl_sl_link_table(+)=ael.gl_sl_link_table
GlJoins

ANDjb.je_batch_id(+)=jir.je_batch_id
ANDjh.je_header_id(+)=jir.je_header_id
ANDjl.je_line_num(+)=jir.je_line_num
ANDjl.je_header_id(+)=jir.je_header_id
ANDjes.je_source_name(+)=jh.je_source
ANDjec.je_category_name(+)=jh.je_category
ANDjh.je_source(+)='Receivables'
ANDjh.je_category(+)='CreditMemos'
ANDctt.TYPE='CM'
ANDrct.complete_flag='Y'
ANDctt.post_to_gl='Y'
ANDgl_security_pkg.validate_access(gle.ledger_id)='TRUE'
ANDgle.object_type_code='L'
ANDgps.ledger_id=gle.ledger_id
ANDgps.application_id=222
ANDgps.adjustment_period_flag='N'
ANDrctgd.gl_dateBETWEENgps.start_dateANDgps.end_date
ANDhou.organization_id=rct.org_id;

R12 Customer Contacts Query ...


/* Formatted on 5/8/2013 12:32:34 PM (QP5 v5.114.809.3010) */
SELECT hcasa.org_id,
role_acct.account_number,
hcasa.orig_system_reference,
rel.subject_id,
rel.object_id,
party.party_id party_id,
rel_party.party_id rel_party_id,
acct_role.cust_account_id,
acct_role.cust_acct_site_id,
party.person_pre_name_adjunct contact_prefix,
SUBSTRB (party.person_first_name, 1, 40) contact_first_name,
SUBSTRB (party.person_middle_name, 1, 40) contact_middle_name,
SUBSTRB (party.person_last_name, 1, 50) contact_last_name,
party.person_name_suffix contact_suffix,
acct_role.status,
org_cont.job_title contact_job_title,
org_cont.job_title_code contact_job_title_code,
rel_party.address1 contact_address1,
rel_party.address2 contact_address2,
rel_party.address3 contact_address3,
rel_party.address4 contact_address4,
rel_party.country contact_country,
rel_party.state contact_state,
rel_party.city contact_city,
rel_party.county contact_county,
rel_party.postal_code contact_postal_code
FROM hz_contact_points cont_point,
hz_cust_account_roles acct_role,
hz_parties party,
hz_parties rel_party,
hz_relationships rel,

hz_org_contacts org_cont,
hz_cust_accounts role_acct,
hz_contact_restrictions cont_res,
hz_person_language per_lang,
hz_cust_acct_sites_all hcasa
WHERE
acct_role.party_id = rel.party_id
AND acct_role.role_type = 'CONTACT'
AND org_cont.party_relationship_id = rel.relationship_id
AND rel.subject_id = party.party_id
AND rel_party.party_id = rel.party_id
AND cont_point.owner_table_id(+) = rel_party.party_id
AND cont_point.contact_point_type(+) = 'EMAIL'
AND cont_point.primary_flag(+) = 'Y'
AND acct_role.cust_account_id = role_acct.cust_account_id
AND role_acct.party_id = rel.object_id
AND party.party_id = per_lang.party_id(+)
AND per_lang.native_language(+) = 'Y'
AND party.party_id = cont_res.subject_id(+)
AND cont_res.subject_table(+) = 'HZ_PARTIES'
AND role_acct.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = acct_role.cust_acct_site_id
-- AND acct_role.cust_account_id
= p_customer_id --3177
-- AND acct_role.cust_acct_site_id
= p_address_id
-- AND hcasa.org_id
= 90
Posted by Elangovan Ragavan at 12:32 No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR to Gl And XLA ...


/* Formatted on 5/8/2013 12:12:24 PM (QP5 v5.114.809.3010) */
SELECT GJH.DESCRIPTION JV_HEADER_DESCRIPTION,
GJH.NAME JV_NAME,
GJH.JE_CATEGORY,
GJH.JE_SOURCE,
GJH.PERIOD_NAME,
NVL (XAL.ACCOUNTED_CR, 0) GL_CR,
NVL (XAL.ACCOUNTED_DR, 0) GL_DR,
GJL.DESCRIPTION JV_LINE_DESCRIPTION,
XAH.EVENT_TYPE_CODE,
XAH.DESCRIPTION SLA_DESCRIPTION,
XAL.AE_LINE_NUM,
XAL.ACCOUNTING_DATE GL_DATE,
(SELECT AC.CUSTOMER_NAME
FROM AR_CUSTOMERS AC
WHERE AC.CUSTOMER_ID = XAL.PARTY_ID)
CUSTOMER_NAME,
(SELECT ACR.RECEIPT_NUMBER
FROM AR_CASH_RECEIPTS_ALL ACR
WHERE ACR.DOC_SEQUENCE_ID = XAH.DOC_SEQUENCE_ID
AND ACR.DOC_SEQUENCE_VALUE = XAH.DOC_SEQUENCE_VALUE)
RECEIPT_NUMBER,

(SELECT ACR.RECEIPT_DATE
FROM AR_CASH_RECEIPTS_ALL ACR
WHERE ACR.DOC_SEQUENCE_ID = XAH.DOC_SEQUENCE_ID
AND ACR.DOC_SEQUENCE_VALUE = XAH.DOC_SEQUENCE_VALUE)
RECEIPT_DATE,
(SELECT ACR.DOC_SEQUENCE_VALUE
FROM AR_CASH_RECEIPTS_ALL ACR
WHERE ACR.DOC_SEQUENCE_ID = XAH.DOC_SEQUENCE_ID
AND ACR.DOC_SEQUENCE_VALUE = XAH.DOC_SEQUENCE_VALUE)
VOUCHER_NUMBER,
(SELECT ACR.CREATION_DATE
FROM AR_CASH_RECEIPTS_ALL ACR
WHERE ACR.DOC_SEQUENCE_ID = XAH.DOC_SEQUENCE_ID
AND ACR.DOC_SEQUENCE_VALUE = XAH.DOC_SEQUENCE_VALUE)
VOUCHER_DATE,
DECODE (XAL.ACCOUNTED_CR, NULL, XAL.ACCOUNTED_DR, 0) RECEIPT,
DECODE (XAL.ACCOUNTED_DR, NULL, XAL.ACCOUNTED_CR, 0) PAYMENT
FROM GL_JE_BATCHES GJB,
GL_JE_HEADERS GJH,
GL_JE_LINES GJL,
GL_CODE_COMBINATIONS GCC,
GL_IMPORT_REFERENCES GIR,
XLA_AE_LINES XAL,
XLA_AE_HEADERS XAH,
XLA.XLA_TRANSACTION_ENTITIES XTE
WHERE
GJB.JE_BATCH_ID = GJH.JE_BATCH_ID
AND GJH.JE_HEADER_ID = GJL.JE_HEADER_ID
AND GJL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND GJL.JE_HEADER_ID = GIR.JE_HEADER_ID
AND GJL.JE_LINE_NUM = GIR.JE_LINE_NUM
AND GIR.GL_SL_LINK_ID = XAL.GL_SL_LINK_ID
AND GIR.GL_SL_LINK_TABLE = XAL.GL_SL_LINK_TABLE
AND XAL.AE_HEADER_ID = XAH.AE_HEADER_ID
AND XTE.APPLICATION_ID = XAH.APPLICATION_ID
AND XTE.ENTITY_ID = XAH.ENTITY_ID
AND GJL.STATUS = 'P'
AND GCC.SEGMENT5 = NVL (:P_ACC_NUM, GCC.SEGMENT5)
AND TRUNC (GJH.DEFAULT_EFFECTIVE_DATE) BETWEEN NVL (
:P_FROM_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND NVL (
:P_TO_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND GJH.JE_SOURCE = 'Receivables'
UNION ALL
---------------- Manual ----------------------SELECT GJH.DESCRIPTION JV_HEADER_DESCRIPTION,
GJH.NAME JV_NAME,
GJH.JE_CATEGORY,

GJH.JE_SOURCE,
GJH.PERIOD_NAME,
NVL (GJL.ACCOUNTED_DR, 0) ACCOUNTED_DR,
NVL (GJL.ACCOUNTED_CR, 0) ACCOUNTED_CR,
gjl.description jv_line_description,
'' EVENT_TYPE_CODE,
'' SLA_DESCRIPTION,
NULL AE_LINE_NUM,
GJH.DEFAULT_EFFECTIVE_DATE GL_DATE,
'' VENDOR_NAME,
'' CHECK_NUMBER,
NULL CHECK_DATE,
NULL VOUCHER_NUMBER,
NULL VOUCHER_DATE,
NVL (GJL.ACCOUNTED_DR, 0) RECEIPT,
NVL (GJL.ACCOUNTED_CR, 0) PAYMENT
FROM GL_JE_BATCHES GJB,
GL_JE_HEADERS GJH,
GL_JE_LINES GJL,
GL_CODE_COMBINATIONS GCC
WHERE
GJB.JE_BATCH_ID = GJH.JE_BATCH_ID
AND GJH.JE_HEADER_ID = GJL.JE_HEADER_ID
AND GJL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND GJL.STATUS = 'P'
AND GCC.SEGMENT5 = NVL (:P_ACC_NUM, GCC.SEGMENT5)
AND TRUNC (GJH.DEFAULT_EFFECTIVE_DATE) BETWEEN NVL (
:P_FROM_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND NVL (
:P_TO_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND GJH.JE_SOURCE = 'Manual'
UNION ALL
-----ALL OTHER SOURCES OTHER THAN ABOVE---------SELECT GJH.DESCRIPTION JV_HEADER_DESCRIPTION,
GJH.NAME JV_NAME,
GJH.JE_CATEGORY,
GJH.JE_SOURCE,
GJH.PERIOD_NAME,
NVL (XAL.ACCOUNTED_CR, 0) GL_CR,
NVL (XAL.ACCOUNTED_DR, 0) GL_DR,
GJL.DESCRIPTION JV_LINE_DESCRIPTION,
XAH.EVENT_TYPE_CODE,
XAH.DESCRIPTION SLA_DESCRIPTION,
XAL.AE_LINE_NUM,
XAL.ACCOUNTING_DATE GL_DATE,
'' VENDOR_NAME,
'' CHECK_NUMBER,
NULL CHECK_DATE,

NULL VOUCHER_NUMBER,
NULL VOUCHER_DATE,
DECODE (XAL.ACCOUNTED_CR, NULL, XAL.ACCOUNTED_DR, 0) RECEIPT,
DECODE (XAL.ACCOUNTED_DR, NULL, XAL.ACCOUNTED_CR, 0) PAYMENT
FROM XLA_AE_HEADERS XAH,
XLA_AE_LINES XAL,
GL_JE_LINES GJL,
GL_IMPORT_REFERENCES GIR,
GL_JE_HEADERS GJH,
GL_CODE_COMBINATIONS GCC
WHERE
XAH.AE_HEADER_ID = XAL.AE_HEADER_ID
AND GJL.JE_LINE_NUM = GIR.JE_LINE_NUM
AND GJL.JE_HEADER_ID = GIR.JE_HEADER_ID
AND GIR.GL_SL_LINK_TABLE = XAL.GL_SL_LINK_TABLE
AND GIR.GL_SL_LINK_ID = XAL.GL_SL_LINK_ID
AND GJL.JE_HEADER_ID = GJH.JE_HEADER_ID
AND GJL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND GCC.SEGMENT5 = NVL (:P_ACC_NUM, GCC.SEGMENT5)
AND TRUNC (GJH.DEFAULT_EFFECTIVE_DATE) BETWEEN NVL (
:P_FROM_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND NVL (
:P_TO_DATE,
TRUNC(GJH.DEFAULT_EFFECTIVE_DATE)
)
AND GJH.STATUS = 'P'
AND GJH.JE_SOURCE NOT IN
('Receivables', 'Payables', 'Cash Management')
Posted by Elangovan Ragavan at 12:14 No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
FRIDAY, 19 APRIL 2013

11i AR to Bank Query ...........


/* Formatted on 4/19/2013 9:47:51 AM (QP5 v5.114.809.3010) */
SELECT cba.bank_account_num bank_account_num,
cba.bank_account_id,
bb.bank_name bank_account_name
,
acr.deposit_date deposit_date,
hp.party_name customer_name,
hca.account_number customer_number,
acr.receipt_number receipt_number,
acr.receipt_date receipt_date,
acr.amount receipt_amount
,
rec_method.name Document_type
FROM ar_cash_receipts_all acr,
hz_parties hp,

hz_cust_accounts_all hca,
ap_bank_accounts_all cba,
ap_bank_branches bb,
ar_receipt_methods rec_method,
ar_receipt_classes rc
WHERE
1=1
AND acr.confirmed_flag = 'Y'
AND acr.pay_from_customer = hca.cust_account_id(+)
AND hp.party_id(+) = hca.party_id
AND acr.remittance_bank_account_id = cba.bank_account_id(+)
AND bb.bank_branch_id(+) = cba.bank_branch_id
AND acr.receipt_method_id = rec_method.receipt_method_id
AND rec_method.receipt_class_id = rc.receipt_class_id
AND cba.Bank_Account_Id =
NVL (:l_bank_account_id, cba.Bank_Account_Id)
AND acr.receipt_number >= NVL (:p_start_rec_no, acr.receipt_number)
AND acr.receipt_number <= NVL (:p_end_rec_no, acr.receipt_number)
AND TRUNC (acr.receipt_date) >= :p_start_rec_date
AND TRUNC (acr.receipt_date) <= :p_end_rec_date
AND acr.org_id = fnd_profile.VALUE ('ORG_ID')
Posted by Elangovan Ragavan at 10:35 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
THURSDAY, 18 APRIL 2013

TRANSACTION TYPE in Receivables


N > Receivables > Setup > Transactions > Transaction Types
Invoice Classes
Invoice This is your normal AR invoice. Used to increase the receivables
Debit Memo This is used to increase the receivables
Credit Memo This is used to decrease the receivables
Bills Receivable This is a negotiable insutrument which this is used as a secutiry
Chargeback This is used for an arrangement with the customer for regoniation of
payment terms
Deposit This is used to track the deposit received from customer
Guarantee This is used to track the guarantee received from customer
Natural Applications Only When receipt as well as CM to be applied Uncheck
Only receipt to be applied Check
Receivables Account When an AR transaction is created, your receivables againt the
transaction will be booked in this account (This will be Debited)

Freight Account When you have freight line, system will pick this account
Revenue Account When an AR transaction is created, your revenue is booked againt
the transaction in this account (This will be Credited)
Clearing Account
Unbilled Receivable Account
Unearned Revenue Account This is used when you had booked your revenue in
advance.
ACCOUNTING RULES N > Receivables > Setup > Accounting Rules
This is used to distribute your revenue in different periods. This is used for recognizing
your revenue.
AUTO ACCOIUNTING
N > Receivables > Setup > Transactions > AutoAccounting
This is used to control your accounting code combination to br derived based on
transaction type, sales person, memo line, Customer Site
It is mandetory to setup AuAccounting for Receivables and Revenue
PAYMENT TERM
N > Receivables > Setup > Transactions > Payment Term
TRANSACTION SOURCE
N > Receivables > Setup > Transactions > Sources
This is the source from which transactions are coming into the Oracel Receivables
SYSTEM OPTIPONS N > Receivables > Setup > System > System Options
Day per posting cycle???
Allow payment of unrelated transactions??
Sptil Amount?
MEMO LINE
N > Receivables > Setup > Transactions > Memo Lines
LINE TRANSACTION FLEXFIELD
N > Receivables > Setup > Financial > Flexfield > Descriptive > Segment
Query for Application Receivables
Title Line Transaction Flexfiled
LINE ODERDERING RULES N > Receivables > Setup > Transactions > AutoIndoice > Line Ordering Rules
GROUPING RULES N > Receivables > Setup > Transactions > AutoIndoice > Grouping Rules
OPEN THE PERIOD N > Receivables > Control > Accounting > Open/Close Periods

TRANSACTIONS
N > Receivables > Transactions > Transactions
COPY TRANSACTION
N > Receivables > Transactions > Transactions
Query the existing transaction, goto Actions > Copy To
CREATING CM
Option 1
N > Receivables > Transactions > Transactions
Select the Invoice Class as CM
Option 2
N > Receivables > Transactions > Credit Transactions
APPLYING CM TO INVOICE
N > Receivables > Transactions > Transactions
Create a CM. Complete it. Goto Actions > Applications
and select the Invoice against with you want to apply CM.
PROFILE CLASSES
N > Receivables > Customers > Profile Classes
CUSTOMER
N > Receivables > Customers > Customers
Posted by Elangovan Ragavan at 12:11 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

Oracle Account Receivables Setups wirh tables

Transactions Work Bench: Profile Class: To create profile class first we setup these three.
I. Payment Terms
II. Collector
III. Statement Cycle
Payment Terms: Nav: - Setup Transactions Payment Terms
Table Name: RA_TERMS_LINES
Then Click on Discounts Enter Discounts
Table Name: RA_TERMS_LINES_DISCOUNTS
Collectors: Nav: Setup Collections Collectors
Table Name: AR_COLLECTORS
Statement Cycle: Nav: Setup Print Statement Cycle

Table Name: AR_STATEMENT_CYCLE_DATES


Profile Classes: Nav: - Customers Profile Classes
Profile Class Tab
Table Name: AR_CUSTOMER_PROFILE_CLASSES_V
Credit Profile Tab
Profile Class Amount Tab
Table Name: AR_CUSTOMER_PROFILE_CLASSES_V
Creating Customers: Customers are two types
Organization Customers
Individual Customers
We can create Customers in two ways
1. Standard Customer
2. Quick Customer
Standard Customer: Nav: Customers Standard
First enter some dummy name into Name field then its gives some prompt then
click
On New
Then click on open its open another form Customer Address
Table Name: HZ_SITE_USES_V
Table Name: AR_CUSTOMERS_V
Quick Customer: Nav: Customers Quick
First enter some dummy name into Name field then its gives some prompt then
clickOn New
Table Name: AR_ADDRESSES_V
Table Name: AR_CUSTOMERS_V
Setups for Transaction Work Bench:
Setup Transaction Type
Setup Transaction Source
Setup Standard Memo Lines
Setup Auto Accounting
Define Items
Setup Tax codes
Fright Carriers
Setup Approval Limits
Define Payment Terms
Transaction Classes: Invoice
Debit Memo
Credit Memo
Charge back
Deposit

Guarantee
Bills Receivable
1. With out Transaction Type and Transaction Source we cannot create a Transaction.
2. The Definition of customer used in more than 80 Modules.
Transaction Type: Nav: Setup Transactions Transaction Type
Table Name: RA_CUST_TRX_TYPES
Transaction Status: Open Did not make a payment
Close After Receiving Payment
Pending Waiting for some approval
Void Cancel Invoice
Transaction Source: Nav: Setup Transactions Sources
Table Name: RA_BATCH_SOURCES
Transaction: Nav: Transactions Transactions
Table Name: RA_CUST_TRX_LINE_GL_DIST_V
After Complete: View Transactions: Nav: Collections Customer Accounts
Tax Codes: Nav: Setup Tax Codes
Table Name: AR_VAT_TAX_VL
ACCOUNTING HIERARCHY: Auto Accounting is a powerful flexible tool, which create GL Accounting Flex Field.
Customer Bill to site
Customer Header
Transaction Type
Auto Accounting
FREIGHT CARRIERS: These are two types.
Header Level
Line Level

1. Create Freight carriers


Nav: - Setup System Quick Codes Freight Carriers
Table Name: WSH_CARRIER_SERVICES_V
Table Name: WSH_ORG_CARRIER_SERVICES_V
2. Enter Transaction for freight
Nav: Transactions Transactions
After Complete: COPY TRANSACTION: Nav: Transactions Copy Transactions
When ever we copy Transaction then we complete the transaction then only it
shows
Balance.
After Complete: Standard Memo Line: It Useful only we entering non inventory invoices.
Nav: Setup Transactions item Memo Line
Table Name: AR_MEMO_LINES_VL
Print Invoice: Nav: Print Document Invoice
Then go to view Request
View Output: Foreign Currency transactions: Setup: 1. Enable foreign Currency
Nav: Setup Financials Currencies Currencies
2. Define Conversion Rate
Nav: Setup Financials Currencies Rates Daily
Table Name: GL_DAILY_RATES_V
3. Change currency rate type to Spot in System Options in accounting tab
Nav: Setup System System Options
Table Name: AR_SYSTEM_PARAMETERS
4. Enter Transaction
Nav: - Transactions Transactions
After Complete : View Accounting: -

Receivable Activities: It shows all details of discount given by customer


1. Earned Discount
2. Unearned Discount
Earned Discount: Nav: Setup Receipts Receivable Activity
Table Name: AR_RECEIVABLES_TRX
Unearned Discount: Nav: - Setup Receipts Receivable Activity
Table Name: AR_RECEIVABLES_TRX
Invoice Rules: Invoicing rule determined the period in which the receivable will be recognized.
These are two types
Bills in Advance
Bills in Arrears
Accounting Rules: Accounting Rule determine the period in which revenue will be recognized.
These are two types
Fixed
Variable
Bills in Advance: Nav - Setup Transactions Accounting Rules
Table Name: RA_RULE_SCHEDULES
Transaction for Bills in Advance: Nav: Transactions Transactions
After Complete: View Accounts: For these transactions we run a program for to view the accounting
Nav: Control Requests Run
Tools View Account
Table Name: XLA_AEL_SL_V
Bills in Arrears: Nav: Setup Transactions Accounting Rules
Table Name: RA_RULE_SCHEDULES
Transaction for Bills in Arrears: Nav: Transactions Transactions
Before save these line item open periods in Control Accounting open close
Tools View Account
Credit Memo: Setup: 1. Create Credit Memo Transaction Type

Nav: - Setup Transactions Transaction Type


1. Enter Invoice
Nav: Transactions Transactions
1. Enter Credit Memo Transaction
Nav: Transactions Transactions Summary
Debit Memo: 1.Create Debit Memo Transaction Type
Nav: - Setup Transactions Transaction Type
2.Create Debit Memo Transaction Source
Nav: Setup Transactions Source
3.Enter Invoice
Nav: - Transactions Transactions
4.Enter Debit Memo
Nav: - Transactions Transactions
View Debit Memo: Nav: - Collections Customer Accounts
Deposit and Guarantee: Deposit and Guarantee are called commitment Transactions. For these two we cant
adjust freight and Tax
Setup: 1.

Create Transaction Type


Nav: - Setup Transactions Transaction Type

1.

Create Transaction Source


Nav: Setup Transactions Source

1.

Enter Deposit Transactions


Nav: Transactions Transactions

1.

Enter Invoice
Nav: Transactions Transactions
Receipt Work Bench: -

Setup: 1. Setup Receivable Activities for earned and unearned Accounts.


2. Setup Bank
3. Setup Receipt Class
4. Setup Receipt Source
Receipts are two types
1.Income from Operations

2. Other Income (Miscellaneous Receipts)


We can create Receipts in two ways
1.Manual
2. Automatic
Bank: Nav: Setup Receipts Bank
Receipt Class: Nav: Setup Receipts Receipt Class
Receipt Source: Nav : - Setup Receipts Receipt Source
Receipt Transaction: Nav: Receipts Batches
Reversal of Receipts: These are two Types
Standard Reversal
Debit Memo Reversal
STANDARD REVERSAL: In Standard Reversal method when we reverse a receipt then original invoice status
will
Become open.
1.Enter Transaction
Nav - Transactions Transactions
2.Enter receipt for above Transaction
Nav: Receipts Receipts
1. Reverse of receipt
Nav - Receipts Receipts
Query for previous receipt
DEBIT MEMO REVERSAL: In DM Reversal the original invoice not disturb the status is closed only but sys will
Create a Debit Memo.
1.Enter Transaction
Nav - Transactions Transactions
2.Enter receipt for above Transaction

Nav: Receipts Receipts


3.Reverse of receipt
Nav: Receipts Receipts
Query for previous receipt
Charge back: We create charge back when we receive partial Amounts.
Setup: 1.Create Charge back Type
Create charge back source
. Enter a transaction for normal invoice
4. Enter receipt for above transaction
ADJUSTMENTS: 1.Setup for receivables activities
Nav: Setup Receipts Receivable Activities
Setup for Approval Limits
Nav: Setup Transactions Approval Limits
Enter transaction for adjustments
Enter receipts for above transaction
MISCELLANEOUS RECEIPTS: Setup: 1.Setup receivable activity for Miscellaneous Cash
Nav: - Setup Receipts Receivable Activity
Enter Receipts
Nav: Receipts Receipts
Collections Work Bench: Aging Buckets: These are two types
4 Bucket Aging
7 Bucket Aging
Bucket Aging: Nav: Setup Collections Aging Buckets

AR Laber chage based on the Customer

SELECT CUSTOMER_NAME,
NVL (SUM (Amount), 0) charges_Amount,
--TDS_Individuals_Customers_Name
CASE
WHEN TDS_Individuals_Customers_Name LIKE 'TDS Re%'
THEN
( select amount from RA_CUST_TRX_LINE_GL_DIST_ALL where
code_combination_id=x.code_combination_id and CUSTOMER_TRX_ID =
x.CUSTOMER_TRX_ID)
ELSE
0
END
AS TDS_Individuals_Customers_Name,
TDS_Amount AS TDS_Amount
FROM (
SELECT
RACTA.CUSTOMER_TRX_ID ,gcc.code_combination_id,
arc.CUSTOMER_NAME,
(RACTLA.UNIT_SELLING_PRICE * RACTLA.QUANTITY_ORDERED)
AS Amount,
glcdv.account AS TDS_Individuals_Customers_Name,
NVL (jaitdsc.amount, 0) AS TDS_Amount
FROM RA_CUSTOMER_TRX_ALL RACTA,
ra_customer_trx_lines_all RACTLA,
RA_CUST_TRX_LINE_GL_DIST_ALL RACTLGLDA,
GL_CODE_COMBINATIONS GCC,
ar_customers arc,
hr_operating_units hou,
JAI_AR_TDS_CERTIFICATES jaitdsc,
xxcapl_gl_code_desc_v glcdv
WHERE 1 = 1
AND RACTA.CUSTOMER_TRX_ID = RACTLA.CUSTOMER_TRX_ID
AND RACTLA.CUSTOMER_TRX_LINE_ID =
RACTLGLDA.CUSTOMER_TRX_LINE_ID
AND RACTLGLDA.CODE_COMBINATION_ID =
GCC.CODE_COMBINATION_ID
AND RACTA.BILL_TO_CUSTOMER_ID = arc.CUSTOMER_ID
AND RACTLGLDA.account_class = 'REV'
AND RACTLA.line_type = 'LINE'
AND hou.organization_id = RACTA.org_id
AND jaitdsc.CUSTOMER_ID(+) = arc.CUSTOMER_ID
AND glcdv.code_combination_id = gcc.code_combination_id
and RACTA.COMPLETE_FLAG='Y'
--AND RACTA.CUSTOMER_TRX_ID =
-- 112005
AND RACTA.org_id = NVL (:P_ORG_ID, RACTA.org_id)
AND TRUNC (RACTA.trx_date) >= :p_from_date
AND TRUNC (RACTA.trx_date) <= :p_to_date
AND RACTA.bill_to_customer_id =
NVL (:p_customer_id,
RACTA.bill_to_customer_id)
)X

GROUP BY X.CUSTOMER_NAME, X.TDS_Amount, X.TDS_Individuals_Customers_Name,


x.CUSTOMER_TRX_ID ,x.code_combination_id
Posted by Elangovan Ragavan at 11:48 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

Checking Credit Card Number validity in Internet Expenses, iPayments


/* Formatted on 4/18/2013 11:43:35 AM (QP5 v5.114.809.3010) */
SELECT rct.org_id Operating_unit,
rc.customer_name customer,
rct.trx_number invoice_number,
aps.AMOUNT_DUE_REMAINING,
apa.bank_account_name bank_name,
apa.bank_account_num credit_card_number,
apa.inactive_date credit_validaity_date,
acol.NAME collector_name
FROM AP_BANK_ACCOUNTS_ALL apa,
ra_customer_trx_all rct,
ra_customers rc,
ar_payment_schedules_all aps,
ra_batch_sources_all rbs,
AR_CUSTOMER_PROFILES ACP,
AR_COLLECTORS ACOL
WHERE
1=1
AND ACP.CUSTOMER_ID = rc.CUSTOMER_ID
AND ACP.COLLECTOR_ID = ACOL.COLLECTOR_ID
AND ACP.SITE_USE_ID IS NULL
AND rct.batch_source_id = rbs.batch_source_id
AND rct.customer_trx_id = aps.customer_trx_id
AND rct.org_id = aps.org_id
AND apa.bank_account_id = rct.customer_bank_account_id
AND rc.customer_id = rct.bill_to_customer_id
AND aPS.gl_date_closed = TO_DATE ('4712/12/31', 'YYYY/MM/DD')
AND aps.selected_for_receipt_batch_id IS NULL
AND aps.status = 'OP'
AND rct.attribute9 = 'CREDIT CARD'
AND RCT.ORG_ID > 202
AND aps.reserved_type IS NULL
AND aps.reserved_value IS NULL
AND aps.AMOUNT_DUE_REMAINING > 0
ORDER BY aps.AMOUNT_DUE_REMAINING DESC;
Posted by Elangovan Ragavan at 11:45 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
WEDNESDAY, 10 APRIL 2013

Customer listing with Bill to and ship to Addresses

SELECT hp.party_name
, hp.party_number
, hca.account_number
, hca.cust_account_id
, hp.party_id
, hps.party_site_id
, hps.location_id
, hl.address1
, hl.address2
, hl.address3
, hl.city
, hl.state
, hl.country
, hl.postal_code
, hcsu.site_use_code
, hcsu.site_use_id
, hcsa.bill_to_flag
FROM hz_parties hp
, hz_party_sites hps
, hz_locations hl
, hz_cust_accounts_all hca
, hz_cust_acct_sites_all hcsa
, hz_cust_site_uses_all hcsu
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hp.party_id = hca.party_id
AND hcsa.party_site_id = hps.party_site_id
AND hcsu.cust_acct_site_id = hcsa.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
AND hca.account_number = '';
Posted by Elangovan Ragavan at 12:58 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

To find Shipper info


select
wnd.delivery_id delivery_id,
substrb(party.party_name,1,50) customer,
wpb.name batch_name,
wsh_util_core.get_location_description(
wnd.INITIAL_PICKUP_LOCATION_ID,
'NEW UI CODE') ship_from,
wsh_util_core.get_location_description(
wnd.ULTIMATE_DROPOFF_LOCATION_ID,
'NEW UI CODE') ship_to,
wnd.INITIAL_PICKUP_DATE pickup_date,
wnd.ULTIMATE_DROPOFF_DATE dropoff_date,
lv.meaning ship_method,

wnd.WAYBILL waybill,
wnd.GROSS_WEIGHT gross_weight,
wnd.WEIGHT_UOM_CODE uom,
wnd.status_code,
we.message
from wsh_new_deliveries wnd,
wsh_picking_batches wpb,
wsh_exceptions we,
fnd_lookup_values_vl lv,
hz_cust_accounts cust_acct,
hz_parties party
where wnd.delivery_id = 12814
and wpb.batch_id = wnd.batch_id
and we.delivery_id(+) = wnd.delivery_id
and we.exception_name(+) = 'WSH_BATCH_MESSAGE'
and lv.lookup_code(+) = wpb.ship_method_code
and lv.lookup_type(+) = 'SHIP_METHOD'
and lv.view_application_id(+) = 3
and cust_acct.cust_account_id (+)=wnd.customer_id
and party.party_id(+) = cust_acct.party_id
Posted by Elangovan Ragavan at 12:57 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 26 MARCH 2013

To FInd the Undefine Customer in Receipt (OR) Null receipt customer in AR


/* Formatted on 3/27/2013 1:13:18 PM (QP5 v5.114.809.3010) */
SELECT DISTINCT gcc.segment1 Company,
bat.NAME batch_name,
arc.deposit_date deposit_date,
SUBSTRB (party.party_name, 1, 50) customer_name,
cust.ACCOUNT_NUMBER customer_number,
arc.receipt_number receipt_number,
arc.receipt_date receipt_date,
ara.status receipt_status,
ara.amount_applied receipt_amount,
gcc.concatenated_segments applied_gl_account,
ara.gl_date gl_date,
ara.apply_date applied_date,
trx.trx_number applied_trx_number,
trx.trx_date applied_trx_date
FROM ar_receivable_applications_all ara,
ar_cash_receipts_all arc,
ar_receipt_methods arm,
hz_parties party,
hz_cust_accounts cust,
gl_code_combinations_kfv gcc,
ra_customer_trx_all trx,
ar_cash_receipt_history_all acrh,
ar_batches_all bat,
hr_operating_units hou

WHERE
1=1
AND arc.cash_receipt_id = ara.cash_receipt_id(+)
AND arc.TYPE = 'CASH'
AND ara.display = 'Y'
AND ara.application_type = 'CASH'
AND NVL (ara.confirmed_flag, 'Y') = 'Y'
AND NVL (arc.confirmed_flag, 'Y') = 'Y'
AND acrh.cash_receipt_id = arc.cash_receipt_id
AND acrh.first_posted_record_flag = 'Y'
AND cust.CUST_ACCOUNT_ID(+) = arc.pay_from_customer
AND CUST.PARTY_ID = PARTY.PARTY_ID(+)
AND arc.receipt_method_id = arm.receipt_method_id
AND bat.batch_id(+) = acrh.batch_id
AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
AND ara.applied_customer_trx_id = trx.customer_trx_id
AND trx.org_id = hou.organization_id
AND arc.receipt_number BETWEEN NVL (:p_in_cr_number,
arc.receipt_number)
AND NVL (:p_in_cr_number_high,
arc.receipt_number)
AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
AND NVL (:p_company_to, segment1)
AND party.party_name BETWEEN NVL (:p_in_customer_low,
party.party_name)
AND NVL (:p_in_customer_high,
party.party_name)
AND bat.name BETWEEN NVL (:p_in_batch_low, bat.name)
AND NVL (:p_in_batch_high, bat.name)
-AND arc.deposit_date BETWEEN NVL (:p_in_deposit_date_low,
-arc.deposit_date)
-AND NVL (:p_in_deposit_date_high,
-arc.deposit_date)
AND arc.status BETWEEN NVL (:p_in_status_low, arc.status)
AND NVL (:p_in_status_high, arc.status)
AND ara.gl_date BETWEEN NVL (:p_in_gl_date_low, ara.gl_date)
AND NVL (:p_in_gl_date_high, ara.gl_date)
AND DECODE (NVL (:p_in_currency, arc.currency_code),
'All', arc.currency_code,
NVL (:p_in_currency, arc.currency_code)) =
arc.currency_code
UNION
----- NULL CUSTOMER -----/* Formatted on 3/26/2013 12:30:47 PM (QP5 v5.114.809.3010) */
SELECT gcc.segment1 Company,
bat.NAME batch_name,
arc.deposit_date deposit_date,
NULL customer_name,
NULL customer_number,
arc.receipt_number receipt_number,
arc.receipt_date receipt_date,
arc.STATUS receipt_status,

acrh.amount receipt_amount,
gcc.concatenated_segments applied_gl_account,
acrh.gl_date gl_date,
NULL applied_date,
NULL applied_trx_number,
NULL applied_trx_date
FROM ar_cash_receipts_all arc,
ar_cash_receipt_history_all acrh,
ar_batches_all bat,
gl_code_combinations_kfv gcc,
ar_receipt_methods arm
WHERE
1=1
AND ARC.PAY_FROM_CUSTOMER IS NULL
AND acrh.cash_receipt_id = arc.cash_receipt_id
AND bat.batch_id(+) = acrh.batch_id
-AND arc.receipt_number in('1204298-UNITED TEL','300497-TRIANGLE','1202381UNITED TEL')
AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
AND arc.receipt_method_id = arm.receipt_method_id
AND arc.receipt_number BETWEEN NVL (:p_in_cr_number,
arc.receipt_number)
AND NVL (:p_in_cr_number_high,
arc.receipt_number)
AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
AND NVL (:p_company_to, segment1)
-AND party.party_name BETWEEN NVL (:p_in_customer_low,
-party.party_name)
-AND NVL (:p_in_customer_high,
-party.party_name)
AND bat.name BETWEEN NVL (:p_in_batch_low, bat.name)
AND NVL (:p_in_batch_high, bat.name)
-AND arc.deposit_date BETWEEN NVL (:p_in_deposit_date_low,
-arc.deposit_date)
-AND NVL (:p_in_deposit_date_high,
-arc.deposit_date)
AND arc.status BETWEEN NVL (:p_in_status_low, arc.status)
AND NVL (:p_in_status_high, arc.status)
AND acrh.gl_date BETWEEN NVL (:p_in_gl_date_low, acrh.gl_date)
AND NVL (:p_in_gl_date_high, acrh.gl_date)
AND DECODE (NVL (:p_in_currency, arc.currency_code),
'All', arc.currency_code,
NVL (:p_in_currency, arc.currency_code)) =
arc.currency_code
=====================================================================
SELECT bat.NAME batch_name,
arc.receipt_number receipt_number,
acrh.gl_date gl_date,
arc.deposit_date deposit_date,
arc.STATUS receipt_status,
acrh.amount receipt_amount,

--

arC.amount,
gcc.concatenated_segments applied_gl_account,
arc.receipt_date receipt_date
FROM ar_cash_receipts_all arc,
ar_cash_receipt_history_all acrh,
ar_batches_all bat,
gl_code_combinations_kfv gcc,
ar_receipt_methods arm
WHERE
1=1
and ARC.PAY_FROM_CUSTOMER is NULL
AND acrh.cash_receipt_id = arc.cash_receipt_id
AND bat.batch_id(+) = acrh.batch_id
AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
AND arc.receipt_method_id = arm.receipt_method_id
AND acrh.gl_date BETWEEN NVL (:p_in_gl_date_low, acrh.gl_date)
AND NVL (:p_in_gl_date_high, acrh.gl_date)
AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
AND NVL (:p_company_to, segment1)

Posted by Elangovan Ragavan at 13:07 1 comment:


Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
MONDAY, 30 JULY 2012

11i_AR_Recipet_data and invoice data


select distinct
rct.ORG_ID,
rct.trx_number,
rct.trx_date,
rct.TERM_DUE_DATE,
hp.PARTY_NUMBER Customer_Number,
hp.party_name Customer_Name,
aps.AMOUNT_APPLIED,
aps.AMOUNT_DUE_ORIGINAL,
aps.AMOUNT_DUE_REMAINING,
acr.receipt_number,
acr.receipt_date,
ara.cash_receipt_id,
aps.PAYMENT_SCHEDULE_ID,
ara.PAYMENT_SCHEDULE_ID,
taxline.PRECEDENCE_1,
taxline.PRECEDENCE_2,
taxline.PRECEDENCE_3,
taxline.PRECEDENCE_4,
taxline.PRECEDENCE_5,
taxline.tax_amount T_AMOUNT
From ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ja_in_ra_cust_trx_tax_lines taxline,
hz_cust_accounts hca,
hz_parties hp,

AR_PAYMENT_SCHEDULES_ALL aps,
ar_receivable_applications_all ara,
AR_CASH_RECEIPTS_ALL acr
where rct.bill_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
and rct.customer_trx_id = aps.customer_trx_id(+)
and rct.customer_trx_id = ara.applied_customer_trx_id(+)
and ara.CASH_RECEIPT_ID = acr.CASH_RECEIPT_ID(+)
and rct.CUSTOMER_TRX_ID = rctl.CUSTOMER_TRX_ID
AND taxline.link_to_cust_trx_line_id(+) = rctl.customer_trx_line_id
AND TRUNC (rct.CREATION_DATE) BETWEEN '01-APR-2011' AND '13-AUG-2011'
and rct.SET_OF_BOOKS_ID = 5
--and rct.ORG_ID = 90
Posted by Elangovan Ragavan at 19:22 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
MONDAY, 16 JULY 2012

How to delete/cancel AR Invoice/Transaction


Deleting AR Invoice:
You can delete the AR invoice in the following cases:
- The invoice in the incomplete status.
- The invoice doesn't posted.
- This is no receipt applied to the invoice.
Navigation: Receivables Manager > Transactions > Transactions
Query AR Transaction > Click on 'Incomplete' button > Goto Edit menu > Click on Delete
Note:
1. You might miss your invoice document sequence
2. Check with your company policies whether you can delete or not.
=> If the Invoice in 'complete' status, create a Credit Memo against this invoice and nullify the
transaction.
Posted by Elangovan Ragavan at 20:22 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 8 MAY 2012

Transactions Posted from AR TO GL


SELECT
l.effective_date GL Date,
l.accounted_dr Debit,
l.accounted_cr Credit,
l.description Description,
l.reference_4 AR Number,
l.reference_9 AR Type
FROM gl_je_lines l, gl_je_headers h
WHERE je_source = Receivables

AND h.je_header_id = l.je_header_id


AND h.set_of_books_id =
AND h.period_name =
Posted by Elangovan Ragavan at 17:09 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

Query to fetch the detail info about a particular customers open invoices
SELECT hp.party_name
,hc.cust_account_id
,hc.account_number
customer_number
,amount_due_remaining
amount_due_remaining
,aps.amount_due_original amount_due_original
,ra.trx_number
FROM ra_customer_trx_all
ra,
ra_customer_trx_lines_all rl,
ar_payment_schedules_all aps,
ra_cust_trx_types_all rt,
hz_cust_accounts
hc,
hz_parties
hp,
hz_cust_acct_sites_all hcasa_bill,
hz_cust_site_uses_all hcsua_bill,
hz_party_sites
hps_bill,
ra_cust_trx_line_gl_dist_all rct
WHERE ra.customer_trx_id
= rl.customer_trx_id
AND ra.customer_trx_id
= aps.customer_trx_id
AND ra.org_id
= aps.org_id
AND rct.customer_trx_id
= aps.customer_trx_id
AND rct.customer_trx_id
= ra.customer_trx_id
AND rct.customer_trx_id
= rl.customer_trx_id
AND rct.customer_trx_line_id = rl.customer_trx_line_id
AND ra.complete_flag
= 'Y'
AND rl.line_type
IN ('FREIGHT', 'LINE')
AND ra.cust_trx_type_id
= rt.cust_trx_type_id
AND ra.bill_to_customer_id
= hc.cust_account_id
AND hc.status
= 'A'
AND hp.party_id
= hc.party_id
AND hcasa_bill.cust_account_id = ra.bill_to_customer_id
AND hcasa_bill.cust_acct_site_id = hcsua_bill.cust_acct_site_id
AND hcsua_bill.site_use_code = 'BILL_TO'
AND hcsua_bill.site_use_id
= ra.bill_to_site_use_id
AND hps_bill.party_site_id
= hcasa_bill.party_site_id
AND hcasa_bill.status
= 'A'
AND hcsua_bill.status
= 'A'
AND aps.amount_due_remaining <> 0
AND aps.status
= 'OP'
AND hc.cust_account_id
=?;
Posted by Elangovan Ragavan at 16:59 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 24 JANUARY 2012

AR Salce Invoice
Sales invoice
SELECT hou.NAME operating_unit_name,
rct.trx_number sales_invoice_number,
ooh.order_number,
rc.customer_name,
rsa.NAME sales_person_name,
msi.segment1 item_number,
mln.lot_number,
msi.primary_unit_of_measure primary_uom,
ool.ordered_quantity primary_quantity,
msi.secondary_uom_code secondary_uom,
ool.ordered_quantity2 secondary_quantity,
msi.organization_id inventory_org_id,
ool.org_id,
rctl.extended_amount amount
FROM oe_order_headers_all ooh,
oe_order_lines_all ool,
hr_operating_units hou,
ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ra_customers rc,
ra_salesreps_all rsa,
mtl_system_items_b msi,
mtl_lot_numbers mln
WHERE ooh.header_id = ool.header_id
AND hou.organization_id = ool.org_id
AND ool.reference_customer_trx_line_id = rctl.customer_trx_line_id
AND rct.sold_to_customer_id = rc.customer_id
AND ooh.salesrep_id = rsa.salesrep_id
AND mln.inventory_item_id = msi.inventory_item_id
AND mln.organization_id = msi.organization_id

Receipt
SELECT ACR.RECEIPT_NUMBER
,ARM.NAME RECEIPT_METHOD
,ACR.RECEIPT_DATE
,ACRH.GL_DATE
,ABB.BANK_NAME
,ABA.BANK_ACCOUNT_NUM
,HP.PARTY_NAME CUSTOMER_NAME
FROM AR_RECEIPT_METHODS ARM
,AR_CASH_RECEIPTS_ALL ACR
,AR_CASH_RECEIPT_HISTORY_ALL ACRH
,AP_BANK_ACCOUNTS ABA

,AP_BANK_BRANCHES ABB
,HZ_PARTIES HP
,HZ_CUST_ACCOUNTS HCA
WHERE ARM.RECEIPT_METHOD_ID=ACR.RECEIPT_METHOD_ID
AND ACR.CASH_RECEIPT_ID=ACRH.CASH_RECEIPT_ID
AND ACR.REMITTANCE_BANK_ACCOUNT_ID=ABA.BANK_ACCOUNT_ID(+)
AND ABA.BANK_ACCOUNT_ID=ABB.BANK_BRANCH_ID(+)
AND ACR.PAY_FROM_CUSTOMER=HCA.CUST_ACCOUNT_ID
AND HCA.PARTY_ID=HP.PARTY_ID

AR INVOICE
select rcta.trx_number invoice_num,
--sales_order_reference,
rct.gl_date,
rctl.inventory_item_id,
rct.amount,
rcta.trx_date invoice_date,
rctl.taxable_amount tax_amount
-- revenue_account_id,
--receivables_account_id,
from ra_customer_trx_lines_all rctl,
ra_cust_trx_line_gl_dist_all rct,
ra_customer_trx_all rcta
where rctcl.customer_trx_line_id=rct.customer_trx_line_id
and rctl.customer_trx_id=rcta.customer_trx_id
and rcta.customer_trx_id=rct.customer_trx_id
Posted by Elangovan Ragavan at 19:53 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query

AR RECEIPT TO INVOICE QUERY


Select * from GL_JE_HEADERS gjh,
GL_JE_LINES gjl,
AR_CASH_RECEIPT_HISTORY_ALL acrha,
AR_CASH_RECEIPTS_ALL acra,
AR_RECEIVABLE_APPLICATIONS_ALL araa,
RA_CUSTOMER_TRX_ALL rcta,
RA_CUSTOMER_TRX_LINES_ALL rctla,
RA_CUST_TRX_LINE_GL_DIST_ALL rctlgda,
GL_CODE_COMBINATIONS gcc
WHERE gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
AND gjl.CODE_COMBINATION_ID = abaa.ASSET_CODE_COMBINATION_ID
AND acrha.CASH_RECEIPT_ID = acra.CASH_RECEIPT_ID
AND acrha.CASH_RECEIPT_HISTORY_ID = araa.CASH_RECEIPT_HISTORY_ID
AND acrha.CASH_RECEIPT_ID = araa.CASH_RECEIPT_ID
AND rcta.CUSTOMER_TRX_ID = araa.APPLIED_CUSTOMER_TRX_ID
AND rcta.CUSTOMER_TRX_ID = rctla.CUSTOMER_TRX_ID

AND rctlgda.CUSTOMER_TRX_LINE_ID = rctla.CUSTOMER_TRX_LINE_ID


AND gcc.CODE_COMBINATION_ID = rctlgda.CODE_COMBINATION_ID

AR INVOICE QUERY
exec mo_global.init('AR');
/* Formatted on 2011/12/26 23:23 (Formatter Plus v4.8.8) */
SELECT rct.org_id, hou.NAME ou_name, rct.customer_trx_id, rct.trx_number,
rct.old_trx_number, TRUNC (rct.trx_date) trx_date, ctl.line_number,
ctl.customer_trx_line_id, lgd.amount, lgd.account_class,
lgd.acctd_amount, al_class.meaning, lgd.al_class_meaning, gcc.concatenated_segments,
ffv.description acct_desc, rctt.TYPE, rctt.NAME trx_type_name,
rctt.description, rctt.post_to_gl, rctt.accounting_affect_flag,
lgd.gl_date, rct.complete_flag, rctt.status, gcc.segment3 account_no,
ffv.description account_des, rctt.end_date
FROM ra_cust_trx_line_gl_dist_v lgd,
gl_code_combinations_kfv gcc,
fnd_flex_values_vl ffv,
ra_customer_trx_all rct,
apps.ra_cust_trx_types_all rctt,
hr_operating_units hou,
ra_customer_trx_lines_all ctl,
ra_customer_trx_lines_all ctl_line,
ar_lookups al_class
WHERE lgd.code_combination_id = gcc.code_combination_id
AND ffv.flex_value = gcc.segment3
AND rct.customer_trx_id = lgd.customer_trx_id
AND rctt.cust_trx_type_id(+) = rct.cust_trx_type_id
AND hou.organization_id(+) = rct.org_id
AND lgd.customer_trx_line_id = ctl.customer_trx_line_id(+)
AND ctl.link_to_cust_trx_line_id = ctl_line.customer_trx_line_id(+)
AND al_class.lookup_type = 'AUTOGL_TYPE'
AND al_class.lookup_code = lgd.account_class
AND TRUNC (rct.trx_date) BETWEEN :p_from_date AND :p_to_date
--AND rct.customer_trx_id = 1082
order by rct.org_id, hou.NAME , rct.customer_trx_ID
-------------------------- NEXT -----------------------------/* Formatted on 12/26/2011 9:20:35 PM (QP5 v5.115.810.9015) */
SELECT rct.org_id,
hou.NAME ou_name,
rct.customer_trx_id,
rct.trx_number,
rct.old_trx_number,
TRUNC (rct.trx_date) trx_date,
ctl.line_number,
ctl.customer_trx_line_id,
lgd.amount,
lgd.ACCOUNT_CLASS,

lgd.acctd_amount,
-lgdv.AL_CLASS_MEANING,
gcc.concatenated_segments,
ffv.description acct_desc,
-rctt.TYPE,
-rctt.NAME trx_type_name,
-rctt.description,
rctt.post_to_gl,
rctt.accounting_affect_flag,
lgd.GL_DATE,
rct.COMPLETE_FLAG,
rctt.status,
gcc.SEGMENT3 ACCOUNT_NO,
ffv.DESCRIPTION ACCOUNT_DES,
rctt.end_date,
AL_CLASS.MEANING,
AL_TYPE.MEANING
FROM ra_cust_trx_line_gl_dist_all lgd,
ra_customer_trx_lines_all ctl,
ra_customer_trx_all rct,
hr_operating_units hou,
gl_code_combinations_kfv gcc,
apps.ra_cust_trx_types_all rctt,
fnd_flex_values_vl ffv,
RA_CUSTOMER_TRX_LINES CTL_LINE,
AR_LOOKUPS AL_CLASS,
AR_LOOKUPS AL_TYPE,
RA_RULES RR
WHERE
lgd.customer_trx_line_id = ctl.customer_trx_line_id(+)
AND rct.customer_trx_id(+) = ctl.customer_trx_id
AND hou.organization_id(+) = rct.org_id
AND gcc.code_combination_id = lgd.code_combination_id
AND rctt.cust_trx_type_id(+) = rct.cust_trx_type_id
AND CTL.LINK_TO_CUST_TRX_LINE_ID = CTL_LINE.CUSTOMER_TRX_LINE_ID(+)
AND AL_CLASS.LOOKUP_TYPE = 'AUTOGL_TYPE'
AND AL_CLASS.LOOKUP_CODE = LGD.ACCOUNT_CLASS
AND AL_TYPE.LOOKUP_TYPE(+) = 'STD_LINE_TYPE'
AND AL_TYPE.LOOKUP_CODE(+) = CTL.LINE_TYPE
AND CTL.ACCOUNTING_RULE_ID = RR.RULE_ID(+)
AND ffv.flex_value = gcc.segment3
AND TRUNC (rct.trx_date) BETWEEN :p_from_date AND :p_to_date
ORDER BY rct.org_id, hou.NAME,rct.trx_number
Posted by Elangovan Ragavan at 23:04 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
WEDNESDAY, 2 NOVEMBER 2011

R12 AR Recipet Tax and Invoice query


select distinct
rct.ORG_ID,

rct.trx_number,
rct.trx_date,
rct.TERM_DUE_DATE,
hp.PARTY_NUMBER Customer_Number,
hp.party_name Customer_Name,
aps.AMOUNT_APPLIED,
aps.AMOUNT_DUE_ORIGINAL,
aps.AMOUNT_DUE_REMAINING,
acr.receipt_number,
acr.receipt_date,
ara.cash_receipt_id,
aps.PAYMENT_SCHEDULE_ID,
ara.PAYMENT_SCHEDULE_ID,
taxline.PRECEDENCE_1,
taxline.PRECEDENCE_2,
taxline.PRECEDENCE_3,
taxline.PRECEDENCE_4,
taxline.PRECEDENCE_5,
taxline.tax_amount T_AMOUNT
From ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
JAI_AR_TRX_TAX_LINES taxline,
-- ja_in_ra_cust_trx_tax_lines taxline,
hz_cust_accounts hca,
hz_parties hp,
AR_PAYMENT_SCHEDULES_ALL aps,
ar_receivable_applications_all ara,
AR_CASH_RECEIPTS_ALL acr
where rct.bill_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
and rct.customer_trx_id = aps.customer_trx_id(+)
and rct.customer_trx_id = ara.applied_customer_trx_id(+)
and ara.CASH_RECEIPT_ID = acr.CASH_RECEIPT_ID(+)
and rct.CUSTOMER_TRX_ID = rctl.CUSTOMER_TRX_ID
AND taxline.link_to_cust_trx_line_id(+) = rctl.customer_trx_line_id
AND TRUNC (rct.CREATION_DATE) BETWEEN '01-APR-2011' AND '13-AUG-2011'
-- and rct.SET_OF_BOOKS_ID = 5
--and rct.ORG_ID = 90
Posted by Elangovan Ragavan at 14:54 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
MONDAY, 31 OCTOBER 2011

R12 Customer
/* Formatted on 18-08-2011 20:52:09 (QP5 v5.115.810.9015) */
SELECT hp.party_name,
hp.party_number,

hca.account_number,
hca.cust_account_id,
hp.party_id,
hps.party_site_id,
hps.location_id,
hl.address1,
hl.address2,
hl.address3,
hl.city,
hl.state,
hl.country,
hl.postal_code,
hcsu.site_use_code,
hcsu.site_use_id,
hcsa.bill_to_flag
FROM hz_parties hp,
hz_party_sites hps,
hz_locations hl,
hz_cust_accounts_all hca,
hz_cust_acct_sites_all hcsa,
hz_cust_site_uses_all hcsu
WHERE
Qhp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hp.party_id = hca.party_id
AND hcsa.party_site_id = hps.party_site_id
AND hcsu.cust_acct_site_id = hcsa.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
Posted by Elangovan Ragavan at 16:13 1 comment:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: AR_Query
TUESDAY, 25 OCTOBER 2011

AR Invoice Tax
/* Formatted on 09-08-2011 16:32:56 (QP5 v5.115.810.9015) */
SELECT DISTINCT
(SELECT name
FROM hr_operating_units
WHERE organization_id = rctl.org_id AND set_of_books_id = 5)
Operating_unit,
jai.customer_trx_id T_TAX_HEADER_ID,
jai.CUSTOMER_TRX_ID,
jai.trx_number T_TRX_NUMBER,
jline.line_number T_LINE_NUMBER,
taxline.tax_line_no T_TAX_LINE_NO,
tax.tax_name T_TAX_NAME,
tax.TAX_TYPE ,
taxline.PRECEDENCE_1,
taxline.PRECEDENCE_2,
taxline.PRECEDENCE_3,
taxline.PRECEDENCE_4,
taxline.PRECEDENCE_5,

taxline.tax_amount T_AMOUNT
FROM ra_customer_trx_lines_all rctl,
ra_cust_trx_line_gl_dist_all rct,
ra_customer_trx_all rcta,
ja_in_ra_customer_trx jai,
ja_in_ra_customer_trx_lines jline,
ja_in_ra_cust_trx_tax_lines taxline,
ja_in_tax_codes tax
WHERE
rctl.customer_trx_line_id = rct.customer_trx_line_id
AND rct.customer_trx_id = rcta.customer_trx_id
AND rcta.customer_trx_id = jai.customer_trx_id(+)
AND jai.customer_trx_id = jline.customer_trx_id
AND taxline.link_to_cust_trx_line_id = rctl.customer_trx_line_id
AND taxline.tax_id = tax.tax_id
AND TRUNC (rcta.TRX_DATE) BETWEEN '01-AUG-2011' AND '13-AUG-2011'
--AND rctl.LINE_TYPE = 'TAX'
AND rcta.SET_OF_BOOKS_ID = 5

Das könnte Ihnen auch gefallen