Sie sind auf Seite 1von 18

Query to find GL to AR Receiving Transactions

Query to find GL to AR Receiving Transactions.

------------------------------------------------------------------------------- Query to find GL to AR Receiving Transactions -----------------------------------------------------------------------------SELECT b.NAME b.description b.running_total_accounted_dr b.running_total_accounted_cr b.status b.default_effective_date b.default_period_name b.creation_date u.user_name h.je_category h.je_source h.period_name h.NAME h.status h.creation_date u1.user_name h.description h.running_total_accounted_dr je_batch_name, je_batch_description, je_batch_total_dr, je_batch_total_cr, je_batch_status, je_batch_effective_date, je_batch_period_name, je_batch_creation_date, je_batch_created_by, je_header_category, je_header_source, je_header_period_name, je_header_journal_name, je_header_journal_status, je_header_created_date, je_header_created_by, je_header_description, je_header_total_acctd_dr,

h.running_total_accounted_cr l.je_line_num l.ledger_id glcc.concatenated_segments l.entered_dr l.entered_cr l.accounted_dr l.accounted_cr l.description glcc1.concatenated_segments xlal.accounting_class_code xlal.accounted_dr xlal.accounted_cr xlal.description xlal.accounting_date xlate.entity_code xlate.source_id_int_1 xlate.source_id_int_2 xlate.source_id_int_3 xlate.security_id_int_1 xlate.security_id_int_2 xlate.transaction_number rcvt.transaction_type rcvt.transaction_date rcvt.quantity rcvt.shipment_header_id rcvt.shipment_line_id rcvt.destination_type_code

je_header_total_acctd_cr, je_lines_line_number, je_lines_ledger_id, je_lines_ACCOUNT, je_lines_entered_dr, je_lines_entered_cr, je_lines_accounted_dr, je_lines_accounted_cr, je_lines_description, xla_lines_account, xla_lines_acct_class_code, xla_lines_accounted_dr, xla_lines_accounted_cr, xla_lines_description, xla_lines_accounting_date, xla_trx_entity_code, xla_trx_source_id_int_1, xla_trx_source_id_int_2, xla_trx_source_id_int_3, xla_trx_security_id_int_1, xla_trx_security_id_int_2, xla_trx_transaction_number, rcv_trx_transaction_type, rcv_trx_transaction_date, rcv_trx_quantity, rcv_trx_shipment_header_id, rcv_trx_shipment_line_id, rcv_trx_destination_type_code,

rcvt.po_header_id rcvt.po_line_id rcvt.po_line_location_id rcvt.po_distribution_id rcvt.vendor_id rcvt.vendor_site_id FROM gl_je_batches gl_je_headers gl_je_lines fnd_user fnd_user gl_code_combinations_kfv gl_code_combinations_kfv gl_import_references xla_ae_lines xla_ae_headers xla_events xla.xla_transaction_entities rcv_transactions WHERE 1=1 AND b.created_by AND h.created_by AND b.je_batch_id AND h.je_header_id AND l.code_combination_id AND l.je_header_id = = = = = =

rcv_trx_po_header_id, rcv_trx_po_line_id, rcv_trx_po_line_location_id, rcv_trx_po_distribution_id, rcv_trx_vendor_id, rcv_trx_vendor_site_id

b, h, l, u, u1, glcc, glcc1, gir, xlal, xlah, xlae, xlate, rcvt

u.user_id u1.user_id h.je_batch_id l.je_header_id glcc.code_combination_id gir.je_header_id

AND l.je_line_num AND gir.gl_sl_link_table AND gir.gl_sl_link_id AND xlal.application_id AND xlal.ae_header_id AND xlal.code_combination_id AND xlah.application_id AND xlah.event_id AND xlae.application_id AND xlae.entity_id AND xlate.source_id_int_1 AND h.je_category AND b.default_period_name ORDER BY h.je_category;

= = = = = = = = = = = = =

gir.je_line_num xlal.gl_sl_link_table xlal.gl_sl_link_id xlah.application_id xlah.ae_header_id glcc1.code_combination_id xlae.application_id xlae.event_id xlate.application_id xlate.entity_id rcvt.transaction_id 'Receiving' 'DEC-12'

Query to find GL Period-wise Transaction Summary


Query to find GL Period-wise Transaction Summary.

------------------------------------------------------------------------------- Query to find GL Period-wise Transaction Summary -----------------------------------------------------------------------------SELECT

b.name b.description b.running_total_accounted_dr b.running_total_accounted_cr b.status b.default_effective_date b.default_period_name b.creation_date, u.user_name h.je_category, h.je_source, h.period_name h.name h.status h.creation_date u1.user_name h.description h.running_total_accounted_dr h.running_total_accounted_cr l.je_line_num l.ledger_id, glcc.concatenated_segments l.entered_dr, l.entered_cr, l.accounted_dr, l.accounted_cr, xlal.unrounded_accounted_dr xlal.unrounded_accounted_cr

batch_name, batch_description, batch_total_dr, batch_total_cr, batch_status, effective_date, batch_period_name,

batch_created_by,

je_period_name, journal_name, journal_status, je_created_date, je_created_by, je_description, je_total_dr, je_total_cr, line_number,

account,

xla_unrounded_accounted_dr, xla_unrounded_accounted_cr,

l.description, xlal.code_combination_id, xlal.accounting_class_code, xlal.accounted_dr xlal.accounted_cr xlal.description xlal.accounting_date xlate.entity_code xlate.source_id_int_1 xlate.source_id_int_2 xlate.source_id_int_3 xlate.security_id_int_1 xlate.security_id_int_2 xlate.transaction_number FROM gl_je_batches gl_je_headers gl_je_lines fnd_user fnd_user gl_code_combinations_kfv gl_import_references xla_ae_lines xla_ae_headers xla_events xla.xla_transaction_entities WHERE 1=1 AND b.created_by = u.user_id b, h, l, u, u1, glcc, gir, xlal, xlah, xlae, xlate xlal_accounted_dr, xlal_accounted_cr, xlal_description, xlal_accounting_date, xlate_entity_code, xlate_source_id_int_1, xlate_source_id_int_2, xlate_source_id_int_3, xlate_security_id_int_1, xlate_security_id_int_2, xlate_transaction_number

AND h.created_by AND b.je_batch_id AND h.je_header_id AND xlal.code_combination_id AND l.je_header_id AND l.je_line_num AND gir.gl_sl_link_table AND gir.gl_sl_link_id AND xlal.ae_header_id AND xlah.event_id AND xlae.entity_id AND xlae.application_id

= = = = = = = = = = = =

u1.user_id h.je_batch_id l.je_header_id glcc.code_combination_id gir.je_header_id gir.je_line_num xlal.gl_sl_link_table xlal.gl_sl_link_id xlah.ae_header_id xlae.event_id xlate.entity_id xlate.application_id

-- AND XLATE.SOURCE_ID_INT_1 = RCVT.TRANSACTION_ID AND h.je_source AND h.period_name = = 'Receivables' 'NOV-12' --'&PERIOD_NAME'

Query to find Bank information


Bank, Bank Account, and Bank Branches information from R12.

------------------------------------------------------------------------------- Query to find Bank, Bank Account, and Bank Branches information ------------------------------------------------------------------------------

SELECT cba.bank_account_name cba.bank_account_num cba.multi_currency_allowed_flag cba.zero_amount_allowed cba.account_classification bb.bank_name bb.bank_branch_type bb.bank_branch_name bb.bank_branch_number bb.eft_swift_code -- bb.description ou.name gcf.concatenated_segments FROM ce_bank_accounts ce_bank_acct_uses_all cefv_bank_branches hr_operating_units gl_code_combinations_kfv cba, bau, bb, ou, gcf

"Bank Account Name", "Bank Account Number", "Multi Currency Flag", "Zero Amount Flag", "Account Classification", "Bank Name", "Bank Branch Type", "Bank Branch Name", "Bank Branch Number", "Swift Code", "Description", "Operating Unit", "GL Code Combination"

WHERE cba.bank_account_id = bau.bank_account_id AND cba.bank_branch_id AND ou.organization_id = bb.bank_branch_id = bau.org_id

AND cba.asset_code_combination_id = gcf.code_combination_id AND (cba.end_date IS NULL OR cba.end_date > TRUNC(SYSDATE)) ORDER BY TO_NUMBER(cba.bank_account_num);

Query to list Customer (Party), Account, Site data


As my client was going through its customer related data clean up in its Oracle R12 applications, I wrote the following query to retrieve all the information that were needed to provide a list of its customer (party), account, site, address, collector, and other related information.

-============================================================================= -- Filename : Customer Data Query -- Programmer : Abul Mohsin -- Date -- Language -- Module -- Purpose -: 29-Oct-2012 : SQL : AR : Lists Customer (Party), Customer Account, and Customer Site related information.

-============================================================================= SELECT ----------------------------------------------------------- Party Information ---------------------------------------------------------hp.party_number hp.party_name hp.party_type DECODE(hp.status, 'A', 'Active', 'I', 'Inactive', hp.status) "Party Status", "Registry ID", "Party Name", "Party Type",

----------------------------------------------------------

-- Account Information ---------------------------------------------------------hca.account_number DECODE(hca.status, 'A', 'Active', 'I', 'Inactive', hca.status) hca.account_name hca.customer_class_code DECODE(hca.customer_type, 'R', 'External', 'I', 'Internal', hca.customer_type) "Account Type", "Account Status", "Account Description", "Classification", "Account Number",

----------------------------------------------------------- Site Information ---------------------------------------------------------hps.party_site_number DECODE(hcas.status, 'A', 'Active', 'Inactive') DECODE(hcas.bill_to_flag, 'P', 'Primary', 'Y', 'Yes', hcas.bill_to_flag) DECODE(hcas.ship_to_flag, 'P', 'Primary', 'Y', 'Yes', hcas.ship_to_flag) "Ship To Flag", "Bill To Flag", "Site Status", "Customer Site Number",

hcas.cust_acct_site_id

"Customer Acct Site ID",

----------------------------------------------------------- Address Information ---------------------------------------------------------hl.address1 hl.address2 hl.address3 hl.address4 hl.city hl.state hl.postal_code ter.name "Address1", "Address2", "Address3", "Address4", "City", "State", "Zip Code", "Territory",

----------------------------------------------------------- DFF Information (specific to client) ---------------------------------------------------------hcas.attribute4 hcas.attribute8 hca.attribute3 hca.attribute7 hca.attribute4 hca.attribute5 hca.attribute1 hca.attribute2 hca.attribute6 "SMG Key", "GLN Key", "Credit Approval Date", "Credit Approved By", "Acct Opened Date", "Credit Collection Status", "BPCS Last Trx Date", "BPCS Avg Pay Days", "BPCS RCM Reference",

----------------------------------------------------------- Collector Information ---------------------------------------------------------col.name "Collector Name",

----------------------------------------------------------- Account Profile Information ---------------------------------------------------------hcp.credit_checking hcp.credit_hold hcpa.auto_rec_min_receipt_amount hcpa.overall_credit_limit hcpa.trx_credit_limit "Credit Check Flag", "Credit Hold Flag", "Min Receipt Amount", "Credit Limit", "Order Credit Limit",

----------------------------------------------------------- Attachment Flag ---------------------------------------------------------NVL((SELECT 'Y' FROM fnd_documents_vl doc, fnd_lobs blo,

fnd_attached_documents att WHERE doc.media_id = blo.file_id AND doc.document_id = att.document_id AND att.entity_name = 'AR_CUSTOMERS' AND att.pk1_value AND ROWNUM = 1), 'N' ) "Attachment Flag", ----------------------------------------------------------- Party Relationship Flag ---------------------------------------------------------NVL((SELECT 'Y' FROM hz_cust_acct_relate_all hzcar WHERE hzcar.cust_account_id = hca.cust_account_id AND hzcar.relationship_type = 'ALL' = hca.cust_account_id

AND ROWNUM = 1), 'N' ) "Party Relationship Flag", ----------------------------------------------------------- Account Relationship Flag ---------------------------------------------------------NVL((SELECT 'Y' FROM hz_cust_acct_relate_all hzcar WHERE hzcar.cust_account_id = hca.cust_account_id AND ROWNUM = 1), 'N' ) "Account Relationship Flag", ----------------------------------------------------------- Party Contact Flag ---------------------------------------------------------NVL((SELECT 'Y' FROM hz_parties hp2 WHERE 1=1 AND hp2.party_id = hp.party_id AND ( hp2.url IS NOT NULL OR -- LENGTH(TRIM(hp.email_address)) > 5 INSTR(hp2.email_address, '@') > 0 OR hp2.primary_phone_purpose IS NOT NULL ) ), 'N' ) "Party Contact Flag", ----------------------------------------------------------- Account Contact Flag ----------------------------------------------------------

NVL((SELECT 'Y' FROM hz_contact_points WHERE status = 'A' AND owner_table_id = (SELECT hcar.party_id FROM hz_cust_account_roles ar_contacts_v WHERE hcar.cust_account_id hcar, acv = hca.cust_account_id

AND hcar.cust_account_role_id = acv.contact_id AND hcar.cust_acct_site_id IS NULL account level only AND ROWNUM = 1 -- add this row to show inactive sites (i.e. with no site id) ) AND ROWNUM = 1), 'N' ) "Account Contact Flag", ----------------------------------------------------------- Site Contact Flag ---------------------------------------------------------NVL((SELECT 'Y' FROM hz_contact_points WHERE status = 'A' AND owner_table_id = ( SELECT hcar.party_id FROM hz_cust_account_roles ar_contacts_v WHERE = hcar, acv -- look for

hcar.cust_acct_site_id

hcas.cust_acct_site_id

AND hcar.cust_account_role_id AND ROWNUM = 1 sites (i.e. with no site id) ) AND ROWNUM = 1), 'N' would suffice this condition ) "Site Contact Flag" FROM hz_parties hz_party_sites hz_cust_accounts_all hz_cust_acct_sites_all hz_customer_profiles hz_cust_profile_amts hz_locations ra_territories ar_collectors WHERE 1=1 AND hp.party_id AND hca.cust_account_id AND hps.party_site_id(+) AND hp.party_id AND hca.cust_account_id AND hps.location_id AND col.collector_id AND hcas.territory_id = = = = = = = = hca.party_id hcas.cust_account_id(+) hcas.party_site_id hcp.party_id hcp.cust_account_id hl.location_id(+) hcp.collector_id ter.territory_id(+) hp, hps, hca, hcas, hcp, hcpa, hl, ter, col

acv.contact_id

-- add this row to show inactive

-- any contact (email, phone, fax)

AND hcp.cust_account_profile_id = hcpa.cust_account_profile_id ----

AND hp.party_type types AND hp.status Parties/Customers ----

= 'ORGANIZATION'

-- only ORGANIZATION Party

= 'A'

-- only Active

-- following conditions are for testing purpose only -- comment/uncomment as needed ----- AND hp.party_number -- AND hca.account_number = 11530 = 32253 --32396 --31753 --32253 --31038

ORDER BY TO_NUMBER(hp.party_number), hp.party_name, hca.account_number;

Query to find Request Group for concurrent program


Following query finds the associated request group and the application module name (Payables, Receivables, etc.) for a concurrent program. In this example, I used "TAMS Send Email Process (UNIGROUP)" as concurrent program name. With a little modification to the query, you should be able to find concurrent request set name also.

------------------------------------------------------------------------------- Query to find request group and application name for a concurrent program -----------------------------------------------------------------------------SELECT cpt.user_concurrent_program_name "Concurrent Program Name",

DECODE(rgu.request_unit_type, 'P', 'Program', 'S', 'Set', rgu.request_unit_type) cp.concurrent_program_name rg.application_id rg.request_group_name fat.application_name fa.application_short_name fa.basepath FROM fnd_request_groups fnd_request_group_units fnd_concurrent_programs fnd_concurrent_programs_tl fnd_application fnd_application_tl WHERE rg.request_group_id AND rgu.request_unit_id AND cp.concurrent_program_id AND rg.application_id AND fa.application_id AND cpt.language AND fat.language = = = = = = = rg, rgu, cp, cpt, fa, fat rgu.request_group_id cp.concurrent_program_id cpt.concurrent_program_id fat.application_id fat.application_id USERENV('LANG') USERENV('LANG') "Unit Type", "Concurrent Program Short Name", "Application ID", "Request Group Name", "Application Name", "Application Short Name", "Basepath"

AND cpt.user_concurrent_program_name = 'TAMS Send Email Process (UNIGROUP)';