GL TO AP_INVOICE_PAYMENTS_ALL

Hi,
In R12 I want to link the gl_je_lines to the AP_INVOICE_PAYMENTS_ALL I was going to do the following:
gl_je_lines to XLA_AE_Lines (gl_sl_link_id)
XLA_AE_Lines to xla_distribution_links (ae_header_id / ae_line_num)
xla_distribution_links to AP_INVOICE_PAYMENTS_ALL - (source_distribution_id_num_1 to ????)
Assuming this is correct the question is when linking the xla_distribution_links.source_distribution_id_num_1 to the AP_INVOICE_PAYMENTS_ALL do I use the invoice_id column or the involice_payment_id column.

Hi,
Below is the way how you can link the AP via XLA to GL
SELECT 1
FROM ap_invoices ai, xla_transaction_entities ent, xla_ae_headers aeh,xla_ae_lines ael, gl_je_headers jeh, gl_je_lines jel,gl_import_references gir
WHERE ai.vendor_site_id = pvs.vendor_site_id
AND ai.vendor_id = pvs.vendor_id
AND ai.vendor_id = pv.vendor_id
AND ai.invoice_id = ent.source_id_int_1
AND TO_CHAR (aeh.accounting_date, 'MON-YYYY') = p_gl_period
AND ent.application_id = aeh.application_id
AND ent.entity_id = aeh.entity_id
AND ent.entity_code = 'AP_INVOICES'
AND aeh.accounting_entry_status_code = 'F'
AND aeh.gl_transfer_status_code = 'Y'
AND aeh.application_id = 200
AND ael.ae_header_id = aeh.ae_header_id
AND ael.application_id = aeh.application_id
AND jel.je_header_id = jeh.je_header_id
AND jeh.status = 'P'
AND jeh.actual_flag = 'A'
AND jel.period_name = jeh.period_name
AND jel.je_header_id = gir.je_header_id
AND jel.je_line_num = gir.je_line_num
AND jeh.je_header_id = gir.je_header_id
AND gir.gl_sl_link_id = ael.gl_sl_link_id
AND gir.gl_sl_link_table = ael.gl_sl_link_table
AND jeh.je_source IN ('Payables')
Now, the condition ent.entity_code = 'AP_INVOICES' will restrict you only to Invoices details. If you want the PAyment related details then have a Union all with
ap_checks_all ac,
xla_transaction_entities ent and join these with ac.check_id = ent.source_id_int_1 AND ent.entity_code = 'AP_PAYMENTS'
Hope this helps.
Thanks,
Ashwini.

Similar Messages

  • Link Between AP_INVOICE_PAYMENTS_ALL and AP_PAYMENT_SCHEDULES_ALL

    Guys,
    I am new to Oracle Financials, can you please let me know if my understanding of link between AP_INVOICE_PAYMENTS_ALL and AP_PAYMENT_SCHEDULES_ALL is correct or not?
    SELECT ai.invoice_id
    , ai.invoice_num
    , aps.due_date
    , aip.accounting_date
    , aip.amount, aip.payment_num
    FROM ap_invoices_all ai
    , ap_invoice_payments_all aip
    , ap_payment_schedules_all aps
    WHERE aps.invoice_id = ai.invoice_id
    AND aip.invoice_id = aps.invoice_id
    AND aip.payment_num = aps.payment_num

    plz look at seeded view AP_DOCUMENTS_PAYABLE
    FROM
    ap_invoices_all ai,
            ap_invoice_payments_all aip,
            ap_payment_schedules_all aps,
    WHERE
    AND aip.invoice_id = ai.invoice_id
    AND ai.invoice_id = aps.invoice_id
          AND aps.payment_num = aip.payment_num
    ...your code a bit different by
    AND aip.invoice_id = aps.invoice_idbut it's ok
    >
    AND aip.payment_num = aps.payment_num
    Is this correct?
    >
    yes

  • Join IBY_DOCS_PAYABLE_ALL and AP_INVOICE_PAYMENTS_ALL

    I am currently pulling information from these two tables but need to join them to get unique records. I am currently getting duplicates with my current method. Is there an additional join that I am missing or do I need to fill this in with paramters? We are on 12.1.3
    My query:
    SELECT *
    FROM IBY_DOCS_PAYABLE_ALL p,
    AP_INVOICE_PAYMENTS_all i
    WHERE p.payment_service_request_id = p_payment_batch_id
    AND p.payment_id =p_payment_id
    AND p.calling_app_doc_unique_ref1 = i.check_id
    ORDER BY p.document_payable_id;

    plz look at seeded view AP_DOCUMENTS_PAYABLE
    FROM
    ap_invoices_all ai,
            ap_invoice_payments_all aip,
            ap_payment_schedules_all aps,
    WHERE
    AND aip.invoice_id = ai.invoice_id
    AND ai.invoice_id = aps.invoice_id
          AND aps.payment_num = aip.payment_num
    ...your code a bit different by
    AND aip.invoice_id = aps.invoice_idbut it's ok
    >
    AND aip.payment_num = aps.payment_num
    Is this correct?
    >
    yes

  • Payments and vendor invoices

    Kindly help on the following situation..
    1> Payments made to the vendor invoices
    Which back end tables do I need to hit to find out the payment details made to vendor invoices were in time or not( over dues). I need to do an analyses report in various buckets of time on when the vendor invoices were paid
    Thanks in advance,
    Regards
    Harsh

    The tables will be AP_CHECKS_ALL and AP_INVOICE_PAYMENTS_ALL. For the date when the payment was made you need to see which date column is relevant for your case.
    Thanks

  • URGENT -- Linking GL to AR & AP for custom report

    Hello All,
    I am having trouble linking GL tables to AR and AP tables for a customized Account Analysis report.
    I have an initial query but the values for Accounted_DR/CR and Entered_DR/CR do no seem to be correct, so it is possible that the links I have are possibly wrong.
    Any help would be greatly appreciated.
    Here is my initial query:
    SELECT DISTINCT NVL(src.user_je_source_name, '**********') SOURCE,
    NVL(cat.user_je_category_name, '**********') CATEGORY,
    jeh.NAME JOURNAL_NAME,
    jeb.NAME BATCH_NAME,
    jeh.period_name PERIOD_NAME,
    gcc.segment1 CO,
    gcc.segment2 COST_CENTER,
    gcc.segment3 ACCOUNT,
    gcc.segment4 SECTOR,
    gcc.segment5 AC_TYPE,
    gcc.segment6 PROJ,
    gcc.segment7 FUTURE,
    (gcc.segment1 || '-' || gcc.segment2 || '-' || gcc.segment3 || '-' || gcc.segment4 || '-' || gcc.segment5 || '-' || gcc.segment6 || '-' || gcc.segment7) ACCOUNT1,
    jel.accounted_dr ACCOUNTED_DR,
    jel.accounted_cr ACCOUNTED_CR,
    jel.entered_dr ENTERED_DR,
    jel.entered_cr ENTERED_CR,
    jel.description LINE_DESCRIPTION,
    (SELECT ffv.description
    FROM FND_FLEX_VALUES_VL ffv
    WHERE ffv.flex_value = gcc.segment3) ACCOUNT_DESCRIPTION,
    (SELECT ffv.description
    FROM FND_FLEX_VALUES_VL ffv
    WHERE ffv.flex_value = gcc.segment4) SECTOR_DESCRIPTION,
    ap.vendor_name VENDOR_NAME,
    ca.check_number CHECK_NUMBER,
    ca.check_date CHECK_DATE,
    aia.invoice_num INVOICE_NUM,
    aia.invoice_date INVOICE_DATE,
    jeh.posted_date POSTED_DATE,
    /*(SELECT DISTINCT awt.NAME
    FROM
    ap_invoice_lines_all ail,
    ap_awt_groups awt
    WHERE aia.invoice_id = ail.invoice_id
    AND ail.awt_group_id = awt.group_id
    AND rownum=1) TAX_NAME*/
    FROM gl_je_headers jeh,
    gl_je_lines jel,
    gl_je_batches jeb,
    gl_je_sources src,
    gl_je_categories cat,
    gl_code_combinations gcc,
    fnd_flex_values_vl ffv,
    gl_import_references gli,
    xla.xla_ae_lines xal,
    xla.xla_ae_headers xah,
    xla.xla_events xe,
    xla.xla_transaction_entities xte,
    apps.ap_invoices_all aia,
    ap.ap_suppliers ap,
    ap_invoice_payments_all aipa,
    ap_checks_all ca
    WHERE
    jeh.je_header_id = jel.je_header_id
    AND jeh.je_batch_id = jeb.je_batch_id
    AND jeh.je_source = src.je_source_name
    AND jeh.je_category = cat.je_category_name
    AND jel.code_combination_id = gcc.code_combination_id
    AND gcc.segment4 = ffv.flex_value
    AND jeh.je_batch_id = gli.je_batch_id
    AND jeh.je_header_id = gli.je_header_id
    AND jel.je_line_num = gli.je_line_num
    AND (NVL(gli.reference_9, 1) = 1 OR gli.reference_9 >0)
    AND gcc.code_combination_id = xal.code_combination_id
    AND gli.gl_sl_link_id = xal.gl_sl_link_id
    AND gli.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 xe.entity_id = xte.entity_id
    AND xte.source_id_int_1 =aia.invoice_id
    AND aia.vendor_id = ap.vendor_id
    AND aia.invoice_id = aipa.invoice_id(+)
    AND aipa.check_id = ca.check_id(+)
    AND jel.status || '' = 'P'
    AND jeb.average_journal_flag = 'N'
    AND jeh.period_name = :P_PERIOD_NAME
    --AND gcc.CODE_COMBINATION_ID=NVL(aia.ACCTS_PAY_CODE_COMBINATION_ID,gcc.CODE_COMBINATION_ID) /*link for GL and AP*/
    --AND gcc.CODE_COMBINATION_ID=NVL(aia.ACCTS_PAY_CODE_COMBINATION_ID,gcc.CODE_COMBINATION_ID) /*link for GL and AP*/
    ORDER BY ACCOUNT1,
    SOURCE ,
    CATEGORY,
    jeb.NAME
    Regards,
    Jovee
    Edited by: JoveeL on May 23, 2012 5:19 PM

    Hello again,
    I am still having trouble linking the data from GL. Specifically GL_JE_LINES and AP/AR values.
    Currently trying to link invoice details to GL details and Accounted CR/DR do not match up with the invoices and are sometimes repeating for different invoices.
    Upon checking, the values for GJ_JE_LINES repeat when I include the invoice details, but if I comment them out, they are okay.
    I suspect that there is something wrong with my link between the XLA and GL tables, but I could not narrow it down.
    I have tried looking it up in Google but there is nothing I found that is remotely helpful.
    Any helpful advice would be greatly appreciated.
    Regards,
    Jovelyn
    Edited by: JoveeL on May 23, 2012 5:15 PM

  • AP Payment to Generl Ledger (11i)

    Dear All,
    if I know the payment number and the payment has been transfered to general ledger, How can I get the journal batch name and journal name of the payment journal? Could someone comment?
    Thanks & Best Regards,
    Jerome

    ap_checks_all.check_id -> ap_invoice_payments_all.check_id -- is for payment creation and cancellation
    ap_invoice_payments_all.accounting_event_id -> ap_ae_headers_all.accounting_event_id -- is for payment creation and cancellation
    ap_checks_all.check_id -> ap_payment_history_all.check_id -- is for payment clearing and unclearing
    ap_payment_history_all.accounting_event_id -> ap_ae_headers_all.accounting_event_id -- is for payment clearing and unclearing
    ap_ae_headers_all.ae_header_id -> ap_ae_lines_all.ae_header_id
    ap_ae_lines_all.gl_sl_link_id,'APECL' -> gl_import_references.gl_sl_link_id,gl_sl_link_table
    gl_import_references.je_batch_id -> gl_je_batches.je_batch_id
    gl_import_references.je_header_id,je_line_num -> gl_je_lines.je_header_id,je_line_num
    Let me know, if you are using AX instead of Stand AP accounting for Payables.
    By
    Vamsi
    Edited by: Vamsi Kasina on Jun 20, 2009 8:45 PM

  • Count on a header table including the line data also in the query

    Hi,
    I have a requirement to develop a report which shows the metrics on supplier. I need to find the total PO's for this supplier that are matched to invoice
    report has to have toatl#ofpo's, #invoice, total_inv_amt and total_po_amt, total_tax_amt with item numbers also with in a time period. So my question is how can we achieve this I have this below query whih gives all the data but not sure how to get the counts with this. Any ideas
    SELECT hou.name,
    pov.vendor_name,
    api.invoice_num,
    api.invoice_id,
    invoice_date,
    gl_date,
    api.invoice_currency_code,
    apid.line_type_lookup_code inv_line_type,
    apid.description inv_description,
    apid.amount,
    apid.unit_price inv_price,
    amount_paid,
    apt.name payment_terms,
    payment_status_flag,
    apc.check_number,
    apc.check_date,
    poh.segment1 po_num,
    poh.creation_date po_creation_date,
    por.creation_date po_rel_creation_date,
    por.release_num,
    pol.line_num,
    mc.segment1 category_name,
    (select msi.segment1 item_num
    from inv.mtl_system_items_b msi
    where msi.inventory_item_id = pol.item_id
    and msi.organization_id = 1) item_num,
    pol.item_description po_item_description,
    poll.need_by_date,
    pol.unit_price po_price,
    poll.quantity,
    poll.quantity_cancelled,
    poll.quantity_received,
    poll.quantity_billed
    FROM ap.ap_invoices_all api,
    hr_operating_units hou,
    ap_terms_tl apt,
    ap.ap_invoice_distributions_all apid,
    po.po_distributions_all pod,
    po.po_vendors pov,
    po.po_headers_all poh,
    po.po_lines_all pol,
    po.po_line_locations_all poll,
    po.po_releases_all por,
    ap.ap_checks_all apc,
    ap.ap_invoice_payments_all apip,
    -- inv.mtl_system_items_b msi,
    apps.mtl_categories_b mc
    WHERE apt.term_id = api.terms_id
    AND hou.organization_id = api.org_id
    AND TRUNC (poh.creation_date) BETWEEN :p_start_date AND :p_end_date
    AND api.invoice_id = apid.invoice_id
    AND apid.po_distribution_id = pod.po_distribution_id(+)
    AND pov.vendor_id = api.vendor_id
    AND poh.po_header_id(+) = pod.po_header_id
    AND poll.line_location_id (+) = pod.line_location_id
    AND pol.po_line_id (+) = pod.po_line_id
    AND apip.check_id = apc.check_id(+)
    AND apip.invoice_id(+) = api.invoice_id
    AND mc.category_id(+) = pol.category_id
    AND por.po_release_id (+) = pod.po_release_id
    AND pov.vendor_id = 1

    Hi,
    The sounds like a job for the COUNT function. That's all I can say with any confidence based on the information you gave.
    If you want to see, on each row of output, how many of the rows with the same value of api.invoice_num have a value for poh.po_header_id, the you can use
    COUNT (poh.po_header_id) OVER (PARTITION BY api.invoice_num)   AS po_cntI could give much better directions if you could post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. I realize that's hard with so many tables. Even seeing some of your current output, and the desired output, might help.

  • 11i to R12 Upgrade- Doubt in XLA tables

    Hi All,
         I am migrating the 11i AP reports to R12..
         In the below query I have commented the obselete and changed 11i columns & tables , but I wasnt able to find the alternate column in WHERE clause for 2 columns in xla_ae_lines and 1 in xla_ae_headers.
         I have marked the ones for which I didn't find the alternate column in red
    SELECT  c.check_id,
            to_char(c.check_number) check_num ,
            i.invoice_id,
            i.invoice_num,
            c.amount,
            ael.accounted_dr accounted_dr,
            ael.entered_dr entered_dr,
            &p_flexdata4 c_flexdata4,
            aeh.accounting_date check_date,
            c.doc_sequence_value voucher_number,
            --ael.ae_line_type_code acct_line_type,
            ael.accounting_class_code acct_line_type,
            l3.displayed_field acct_line_type_name,
            ael.code_combination_id code_combination_id,
            ael.description comments ,
            v.segment1 vendor_num,
            v.vendor_name vendor_name,
            vs.vendor_site_code third_party_sub_name,
            c.check_date trx_date ,
            c.check_number trx_number_n,
            c.bank_account_name bank_account_name,
            abb.bank_name,
            aba.bank_account_num
    FROM 
          --ap_bank_accounts_all aba,
          --ap_bank_branches abb,
          ce_bank_accounts aba,
          ce_bank_branches_v abb,
          ap_invoice_distributions_all d,
          ap_invoices_all i,
          ap_invoice_payments_all p,
          ap_checks_all c,
          --ap_accounting_events_all ae,
          --ap_ae_headers_all aeh,
          --ap_ae_lines_all ael,
          xla_events ae,
          xla_ae_headers aeh,
          xla_ae_lines ael,
          xla_transaction_entities xte,
          ce_statement_lines sl,
          --ce_statement_headers_all sh,
          ce_statement_headers sh,
          ce_statement_reconcils_all csr,
          --po_vendor_sites_all vs,
          --po_vendors v,
          --ap_tax_codes AT,
          ap_supplier_sites_all vs,
          ap_suppliers v,
          zx_lines zl,
          rcv_shipment_headers rsh,
          po_releases_all pr,
          po_headers_all ph,
          po_distributions_all pd,
          rcv_transactions rct,
          gl_je_categories jc,
          gl_daily_conversion_types glct,
          fnd_document_sequences fd,
          fnd_document_sequences fd2,
          ap_lookup_codes l1,
          ap_lookup_codes l2 ,
          ap_lookup_codes l3 ,
          ap_lookup_codes l4 ,
          ap_lookup_codes l5 ,
          ap_lookup_codes l6,
          ap_lookup_codes l7,
          ap_lookup_codes l8 ,
          ap_lookup_codes l9 ,
          ap_lookup_codes l10 ,
          ap_lookup_codes l11 ,
          ap_lookup_codes l12,
          ap_lookup_codes l13,
          gl_code_combinations gcc1
    WHERE c.bank_account_id =aba.bank_account_id
          --AND aba.bank_branch_id =abb.bank_branch_id
          AND aba.bank_branch_id =abb.branch_party_id
          AND ael.code_combination_id =gcc1.code_combination_id(+)
          AND l1.lookup_code = c.payment_method_lookup_code
          AND l1.lookup_type = 'PAYMENT METHOD'
          AND l2.lookup_code(+) = d.line_type_lookup_code
          AND l2.lookup_type(+) = 'INVOICE DISTRIBUTION TYPE'
          --AND l3.lookup_code = ael.ae_line_type_code
          AND l3.lookup_code = ael.accounting_class_code
          AND l3.lookup_type = 'AE LINE TYPE'
          --AND l4.lookup_code = aeh.gl_transfer_flag
          AND l4.lookup_code = aeh.gl_transfer_status_code
          AND l4.lookup_type = 'POSTING STATUS'
          AND l5.lookup_code = ae.event_type_code
          AND l5.lookup_type = 'EVENT TYPE'
    --AND l6.lookup_code(+) = aeh.accounting_error_code
          AND l6.lookup_type(+) = 'ACCOUNTING ERROR TYPE'
    --AND l7.lookup_code(+) = ael.accounting_error_code
          AND l7.lookup_type(+) = 'ACCOUNTING ERROR TYPE'
          AND l8.lookup_code = 'Payments'
          AND l8.lookup_type = 'POSTING CATEGORY'
    --AND l9.lookup_code(+) = ael.gl_transfer_error_code
          AND l9.lookup_type(+) = 'POSTING EXCEPTIONS'
          AND l10.lookup_code = 'EVENT'
          AND l10.lookup_type = 'VIEW_ACCOUNTING'
          AND l11.lookup_code = 'LINE'
          AND l11.lookup_type = 'VIEW_ACCOUNTING'
          AND l12.lookup_code = 'APPLIED_TO'
          AND l12.lookup_type = 'VIEW_ACCOUNTING'
          AND l13.lookup_code = 'BANK_STATEMENT'
          AND l13.lookup_type = 'VIEW_ACCOUNTING'
          --AND AT.tax_id(+) = ael.tax_code_id
          AND i.invoice_id = zl.trx_id(+)
          AND zl.entity_code = 'AP_INVOICES'
          --AND jc.je_category_name = aeh.ae_category
          AND jc.je_category_name = aeh.je_category_name
          AND rsh.shipment_header_id = rct.shipment_header_id
          AND d.rcv_transaction_id = rct.transaction_id
          AND pr.po_release_id(+) = pd.po_release_id
          AND ph.po_header_id(+) = pd.po_header_id
          AND pd.po_distribution_id(+) = d.po_distribution_id
          AND ael.currency_conversion_type = glct.conversion_type(+)
          AND c.doc_sequence_id = fd.doc_sequence_id
          AND sh.doc_sequence_id = fd2.doc_sequence_id
          --AND ael.third_party_sub_id = vs.vendor_site_id
          --AND ael.third_party_id = v.vendor_id
          AND ael.party_site_id = vs.vendor_site_id
          AND ael.party_id = v.vendor_id
          AND i.invoice_id(+) = p.invoice_id
          --AND c.check_id = ae.source_id
          --AND ae.source_table = 'AP_CHECKS'
          --AND ae.accounting_event_id = aeh.accounting_event_id
          --AND aeh.ae_header_id = ael.ae_header_id
          AND i.invoice_id = xte.source_id_int_1
          AND xte.entity_code = 'AP_CHECKS'
          AND aeh.ae_header_id = ael.ae_header_id
          AND aeh.application_id = ael.application_id
          AND aeh.event_id=ae.event_id
          AND aeh.application_id = ae.application_id
          AND ae.entity_id=xte.entity_id
          AND ae.application_id = xte.application_id
          AND sl.statement_header_id = sh.statement_header_id(+)
          AND csr.statement_line_id = sl.statement_line_id(+)
          AND c.check_id = csr.reference_id(+)
          AND csr.reference_type = 'PAYMENT'
          AND csr.current_record_flag(+) = 'Y'
          AND decode(ael.source_table,'AP_INVOICE_PAYMENTS', ael.source_id,NULL) = p.invoice_payment_id(+)
          AND decode(ael.source_table,'AP_INVOICE_DISTRIBUTIONS', ael.source_id,NULL) = d.invoice_distribution_id(+)
          AND ael.accounted_dr IS NOT NULL
          AND (v.segment1 = :p_vendor_code
          OR :p_vendor_code IS NULL)
          AND (v.vendor_name = :p_vendor_name
          OR :p_vendor_name IS NULL)
          AND (abb.bank_name = :p_bank_name
          OR :p_bank_name IS NULL)
          AND (c.currency_code = :p_currency
          OR :p_currency IS NULL)
          AND (c.doc_sequence_value = :p_doc_sequence_value
          OR :p_doc_sequence_value IS NULL)
          AND (i.pay_group_lookup_code = :p_paygroup
          OR :p_paygroup IS NULL)
          AND ( c.check_date IS NULL
          OR trunc(c.check_date) = nvl(:p_payment_date, trunc(c.check_date)))
    Thanks and Regards,
    Madonna

    Hi Cheryl,
         Thank you for the reply..
         It would be nice if you could illustrate with a sample code..
    Thanks and Regards,
    Madonna

  • Need understanding on the ADDM

    Hi,
    Db version 11.2.0.3
    EBS version 12.1.3
    OS : Linux
    I have 2 SEV-1 SR's going on with Oracle on which we are working with them. I ran a ADDM from yesterday Morning till today afternoon( Almost 25 Hours).
    My understanding :
    1. Update query 85ag5gkm9wzmb is taking maximum of time and resources ( One SR is for this - this is Autoinvoice Master Program).
    2. SGA and PGA are undersized. Current SGA is 24Gb and PGA is 6Gb. Do I really need to increase SGA and PGA ? My previous has been that on increasing
    SGA/PGA to suggested value , it will further prompt for increasing.
    3. SYS.DBMS_SPACE.AUTO_SPACE_ADVISOR_JOB_PROC needs some action from my end, should I disable this job , what does it really do ? i am trying to figure that out ,
    any help on this will be appreciated.
    Please confirm if my understanding is correct and other suggestion/inputs you can provide. Also please suggest how to find if I/O is a bottleneck in the system ? I can see db file sequential read and db file scattered reads in the AWR but they are mostly by the update statement 85ag5gkm9wzmb.
    Below is the ADDM for reference.
              ADDM Report for Task 'TASK_10569'
    Analysis Period
    AWR snapshot range from 6708 to 6733.
    Time period starts at 19-DEC-13 11.30.37 AM
    Time period ends at 20-DEC-13 12.30.43 PM
    Analysis Target
    Database 'PROD' with DB ID 221722471.
    Database version 11.2.0.3.0.
    ADDM performed an analysis of instance PROD, numbered 1 and hosted at
    hostname.domainname.in.
    Activity During the Analysis Period
    Total database time was 448593 seconds.
    The average number of active sessions was 4.98.
    Summary of Findings
       Description                               Active Sessions      Recommendations
                                                 Percent of Activity  
    1  Top SQL Statements                        3.44 | 69.1          6
    2  Top Segments by "User I/O" and "Cluster"  2.64 | 53.06         5
    3  Undersized SGA                            .94 | 18.91          1
    4  Undersized PGA                            .28 | 5.66           0
    5  PL/SQL Execution                          .19 | 3.9            5
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              Findings and Recommendations
    Finding 1: Top SQL Statements
    Impact is 3.44 active sessions, 69.1% of total activity.
    SQL statements consuming significant database time were found. These
    statements offer a good opportunity for performance improvement.
       Recommendation 1: SQL Tuning
       Estimated benefit is 2.26 active sessions, 45.37% of total activity.
       Action
          Run SQL Tuning Advisor on the UPDATE statement with SQL_ID
          "85ag5gkm9wzmb".
          Related Object
             SQL statement with SQL_ID 85ag5gkm9wzmb.
             UPDATE RA_CUST_TRX_LINE_GL_DIST LGD SET (AMOUNT, ACCTD_AMOUNT) =
             (SELECT /*+ index(rec1 RA_CUST_TRX_LINE_GL_DIST_N6) ordered */
             NVL(LGD.AMOUNT, 0) - ( SUM(LGD2.AMOUNT) - ( DECODE(LGD.GL_DATE,
             REC1.GL_DATE, 1, 0) * CTL.EXTENDED_AMOUNT ) ), NVL(LGD.ACCTD_AMOUNT,
             0) - ( SUM(LGD2.ACCTD_AMOUNT) - ( DECODE(LGD.GL_DATE, REC1.GL_DATE,
             1, 0) * DECODE(:B2 , NULL, ROUND( CTL.EXTENDED_AMOUNT *
             NVL(CT.EXCHANGE_RATE,1), :B3 ), ROUND( ( CTL.EXTENDED_AMOUNT *
             NVL(CT.EXCHANGE_RATE,1) ) / :B2 ) * :B2 ) ) ) FROM
             RA_CUSTOMER_TRX_LINES CTL, RA_CUSTOMER_TRX CT,
             RA_CUST_TRX_LINE_GL_DIST LGD2, RA_CUST_TRX_LINE_GL_DIST REC1 WHERE
             CTL.CUSTOMER_TRX_LINE_ID = LGD2.CUSTOMER_TRX_LINE_ID AND
             CTL.CUSTOMER_TRX_ID = CT.CUSTOMER_TRX_ID AND LGD.CUSTOMER_TRX_LINE_ID
             = CTL.CUSTOMER_TRX_LINE_ID AND LGD2.ACCOUNT_SET_FLAG = 'N' AND
             REC1.CUSTOMER_TRX_ID = CT.CUSTOMER_TRX_ID AND REC1.ACCOUNT_CLASS =
             'REC' AND REC1.LATEST_REC_FLAG = 'Y' AND NVL(LGD.GL_DATE, TO_DATE(
             2415021, 'J') ) = NVL(LGD2.GL_DATE, TO_DATE( 2415021, 'J') ) GROUP BY
             CTL.CUSTOMER_TRX_LINE_ID, REC1.GL_DATE, CTL.EXTENDED_AMOUNT,
             CTL.REVENUE_AMOUNT, CT.EXCHANGE_RATE ), PERCENT = (SELECT /*+
             index(rec2 RA_CUST_TRX_LINE_GL_DIST_N6) */ DECODE(LGD.ACCOUNT_CLASS
             || LGD.ACCOUNT_SET_FLAG, 'SUSPENSEN', LGD.PERCENT, 'UNBILLN',
             LGD.PERCENT, 'UNEARNN', LGD.PERCENT, NVL(LGD.PERCENT, 0) - (
             SUM(NVL(LGD4.PERCENT, 0)) - DECODE(REC2.GL_DATE, NVL(LGD.GL_DATE,
             REC2.GL_DATE), 100, 0) ) ) FROM RA_CUST_TRX_LINE_GL_DIST LGD4,
             RA_CUST_TRX_LINE_GL_DIST REC2 WHERE LGD.CUSTOMER_TRX_LINE_ID =
             LGD4.CUSTOMER_TRX_LINE_ID AND REC2.CUSTOMER_TRX_ID =
             LGD.CUSTOMER_TRX_ID AND REC2.CUSTOMER_TRX_ID = LGD4.CUSTOMER_TRX_ID
             AND REC2.ACCOUNT_CLASS = 'REC' AND REC2.LATEST_REC_FLAG = 'Y' AND
             LGD4.ACCOUNT_SET_FLAG = LGD.ACCOUNT_SET_FLAG AND
             DECODE(LGD4.ACCOUNT_SET_FLAG, 'Y', LGD4.ACCOUNT_CLASS,
             LGD.ACCOUNT_CLASS) = LGD.ACCOUNT_CLASS AND NVL(LGD.GL_DATE, TO_DATE(
             2415021, 'J') ) = NVL(LGD4.GL_DATE, TO_DATE( 2415021, 'J') ) GROUP BY
             REC2.GL_DATE, LGD.GL_DATE ), LAST_UPDATED_BY = :B1 , LAST_UPDATE_DATE
             = SYSDATE WHERE CUST_TRX_LINE_GL_DIST_ID IN (SELECT /*+ index(rec3
             RA_CUST_TRX_LINE_GL_DIST_N6) */ MIN(DECODE(LGD3.GL_POSTED_DATE, NULL,
             LGD3.CUST_TRX_LINE_GL_DIST_ID, NULL) ) FROM RA_CUSTOMER_TRX_LINES
             CTL, RA_CUSTOMER_TRX T, RA_CUST_TRX_LINE_GL_DIST LGD3,
             RA_CUST_TRX_LINE_GL_DIST REC3 WHERE T.REQUEST_ID = :B5 AND
             T.CUSTOMER_TRX_ID = CTL.CUSTOMER_TRX_ID AND (CTL.LINE_TYPE IN (
             'TAX','FREIGHT','CHARGES','SUSPENSE' ) OR (CTL.LINE_TYPE = 'LINE' AND
             CTL.ACCOUNTING_RULE_ID IS NULL )) AND LGD3.CUSTOMER_TRX_LINE_ID =
             CTL.CUSTOMER_TRX_LINE_ID AND LGD3.ACCOUNT_SET_FLAG = 'N' AND
             REC3.CUSTOMER_TRX_ID = T.CUSTOMER_TRX_ID AND REC3.ACCOUNT_CLASS =
             'REC' AND REC3.LATEST_REC_FLAG = 'Y' AND
             NVL(T.PREVIOUS_CUSTOMER_TRX_ID, -1) = DECODE(:B4 , 'INV', -1,
             'REGULAR_CM', T.PREVIOUS_CUSTOMER_TRX_ID,
             NVL(T.PREVIOUS_CUSTOMER_TRX_ID, -1) ) GROUP BY
             CTL.CUSTOMER_TRX_LINE_ID, LGD3.GL_DATE, REC3.GL_DATE,
             CTL.EXTENDED_AMOUNT, CTL.REVENUE_AMOUNT, T.EXCHANGE_RATE HAVING (
             SUM(NVL(LGD3.AMOUNT, 0)) <> CTL.EXTENDED_AMOUNT *
             DECODE(LGD3.GL_DATE, REC3.GL_DATE, 1, 0) OR
             SUM(NVL(LGD3.ACCTD_AMOUNT, 0)) <> DECODE(LGD3.GL_DATE, REC3.GL_DATE,
             1, 0) * DECODE(:B2 , NULL, ROUND( CTL.EXTENDED_AMOUNT *
             NVL(T.EXCHANGE_RATE,1), :B3 ), ROUND( ( CTL.EXTENDED_AMOUNT *
             NVL(T.EXCHANGE_RATE,1) ) / :B2 ) * :B2 ) ) UNION SELECT /*+
             index(rec5 RA_CUST_TRX_LINE_GL_DIST_N6) INDEX (lgd5
             ra_cust_trx_line_gl_dist_n6) index(ctl2 ra_customer_trx_lines_u1) */
             TO_NUMBER( MIN(DECODE(LGD5.GL_POSTED_DATE||LGD5.ACCOUNT_CLASS||
             LGD5.ACCOUNT_SET_FLAG, 'REVN', LGD5.CUST_TRX_LINE_GL_DIST_ID, 'REVY',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'TAXN', LGD5.CUST_TRX_LINE_GL_DIST_ID,
             'TAXY', LGD5.CUST_TRX_LINE_GL_DIST_ID, 'FREIGHTN',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'FREIGHTY',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'CHARGESN',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'CHARGESY',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'UNEARNY',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, 'UNBILLY',
             LGD5.CUST_TRX_LINE_GL_DIST_ID, NULL ) ) ) FROM
             RA_CUST_TRX_LINE_GL_DIST LGD5, RA_CUST_TRX_LINE_GL_DIST REC5,
             RA_CUSTOMER_TRX_LINES CTL2, RA_CUSTOMER_TRX T WHERE T.REQUEST_ID =
             :B5 AND T.CUSTOMER_TRX_ID = REC5.CUSTOMER_TRX_ID AND
             CTL2.CUSTOMER_TRX_LINE_ID = LGD5.CUSTOMER_TRX_LINE_ID AND
             REC5.CUSTOMER_TRX_ID = LGD5.CUSTOMER_TRX_ID AND REC5.ACCOUNT_CLASS =
             'REC' AND REC5.LATEST_REC_FLAG = 'Y' AND (CTL2.LINE_TYPE IN (
             'TAX','FREIGHT','CHARGES','SUSPENSE') OR (CTL2.LINE_TYPE = 'LINE' AND
             (CTL2.ACCOUNTING_RULE_ID IS NULL OR LGD5.ACCOUNT_SET_FLAG = 'Y' )))
             GROUP BY LGD5.CUSTOMER_TRX_LINE_ID, LGD5.GL_DATE, REC5.GL_DATE,
             LGD5.ACCOUNT_SET_FLAG, DECODE(LGD5.ACCOUNT_SET_FLAG, 'N', NULL,
             LGD5.ACCOUNT_CLASS) HAVING SUM(NVL(LGD5.PERCENT, 0)) <> DECODE(
             NVL(LGD5.GL_DATE, REC5.GL_DATE), REC5.GL_DATE, 100, 0) )
       Rationale
          The SQL spent 100% of its database time on CPU, I/O and Cluster waits.
          This part of database time may be improved by the SQL Tuning Advisor.
       Rationale
          Database time for this SQL was divided as follows: 100% for SQL
          execution, 0% for parsing, 0% for PL/SQL execution and 0% for Java
          execution.
       Rationale
          SQL statement with SQL_ID "85ag5gkm9wzmb" was executed 20 times and had
          an average elapsed time of 9763 seconds.
       Rationale
          Top level calls to execute the PL/SQL statement with SQL_ID
          "gccbpwamzp78q" are responsible for 100% of the database time spent on
          the UPDATE statement with SQL_ID "85ag5gkm9wzmb".
          Related Object
             SQL statement with SQL_ID gccbpwamzp78q.
             declare l_header_rounding_flag VARCHAR2 ( 1 ) ; BEGIN select
             trx_header_level_rounding into l_header_rounding_flag from
             ar_system_parameters ; :return_value:i_return_value := arp_rounding .
             correct_dist_rounding_errors ( :request_id , NULL , NULL ,
             :rows_processed:i_rows_processed , :error_msg:i_error_msg , NULL ,
             NULL , :trx_class , 'N' , :debug_mode , l_header_rounding_flag , 'N'
             ) ; END ;
       Recommendation 2: SQL Tuning
       Estimated benefit is .42 active sessions, 8.39% of total activity.
       Action
          Run SQL Tuning Advisor on the SELECT statement with SQL_ID
          "d9xccqfmfjvns".
          Related Object
             SQL statement with SQL_ID d9xccqfmfjvns.
             SELECT RCT.CUSTOMER_TRX_ID K_TRX_ID, RCT.TRX_NUMBER, SUM
             (APS.AMOUNT_DUE_REMAINING) CM_AMOUNT_APPLIED,RCT.TRX_DATE FROM
             APPS.RA_CUSTOMER_TRX_ALL RCT, APPS.AR_PAYMENT_SCHEDULES_ALL APS,
             APPS.RA_CUST_TRX_TYPES_ALL TCTTA, APPS.AR_CUSTOMERS AC,
             APPS.HZ_CUSTOMER_PROFILES HCP, APPS.RA_TERMS RT WHERE
             RCT.CUST_TRX_TYPE_ID = TCTTA.CUST_TRX_TYPE_ID AND AC.CUSTOMER_ID =
             RCT.BILL_TO_CUSTOMER_ID AND RCT.CUSTOMER_TRX_ID=APS.CUSTOMER_TRX_ID
             AND AC.CUSTOMER_ID = HCP.CUST_ACCOUNT_ID AND RCT.BILL_TO_SITE_USE_ID
             = HCP.SITE_USE_ID AND RT.TERM_ID = HCP.STANDARD_TERMS AND TCTTA.TYPE
             IN ('INV') AND UPPER(TCTTA.NAME) IN ( SELECT UPPER(MEANING) FROM
             FND_LOOKUP_VALUES WHERE LOOKUP_TYPE = :B3 ) AND RCT.TRX_DATE <= NVL
             (TO_DATE(:B2 , 'RRRR/MM/DD HH24:MI:SS'), RCT.TRX_DATE) AND
             AC.CUSTOMER_ID = :B1 GROUP BY RCT.CUSTOMER_TRX_ID,
             RCT.TRX_NUMBER,RCT.TRX_DATE HAVING SUM (APS.AMOUNT_DUE_REMAINING) > 0
             ORDER BY RCT.TRX_DATE
       Rationale
          The SQL spent 100% of its database time on CPU, I/O and Cluster waits.
          This part of database time may be improved by the SQL Tuning Advisor.
       Rationale
          Database time for this SQL was divided as follows: 100% for SQL
          execution, 0% for parsing, 0% for PL/SQL execution and 0% for Java
          execution.
       Rationale
          SQL statement with SQL_ID "d9xccqfmfjvns" was executed 123412 times and
          had an average elapsed time of 0.29 seconds.
       Rationale
          Top level calls to execute the PL/SQL statement with SQL_ID
          "bcxz2s8wj5spc" are responsible for 100% of the database time spent on
          the SELECT statement with SQL_ID "d9xccqfmfjvns".
          Related Object
             SQL statement with SQL_ID bcxz2s8wj5spc.
             BEGIN XXSD_APPLY_CM_APPLY_TO_INV(:errbuf,:rc,:A0,:A1,:A2,:A3); END;
       Recommendation 3: SQL Tuning
       Estimated benefit is .3 active sessions, 6.04% of total activity.
       Action
          Run SQL Tuning Advisor on the SELECT statement with SQL_ID
          "2ujt2fg615ymk".
          Related Object
             SQL statement with SQL_ID 2ujt2fg615ymk.
             SELECT HP.PARTY_NAME PARTY_NAME, RCT.TRX_NUMBER TRX_NUMBER,
             RCT.TRX_DATE TRX_DATE, APS.AMOUNT_DUE_ORIGINAL AMOUNT_DUE_ORIGINAL,
             APS.AMOUNT_DUE_REMAINING OUTSTANDING_AMOUNT, RCTT.NAME
             TRANSACTION_TYPE FROM RA_CUSTOMER_TRX_ALL RCT,
             AR_PAYMENT_SCHEDULES_ALL APS, RA_CUST_TRX_TYPES_ALL RCTT,
             HZ_CUST_ACCOUNTS HCA, HZ_PARTIES HP, APPS.AR_CUSTOMERS AC,
             APPS.HZ_CUSTOMER_PROFILES HCP, APPS.RA_TERMS RT, HZ_PARTY_SITES HPS,
             HZ_CUST_ACCT_SITES_ALL HCASA, HZ_CUST_SITE_USES_ALL HCSUA WHERE 1 = 1
             AND RCT.BILL_TO_CUSTOMER_ID = HCA.CUST_ACCOUNT_ID AND HCA.PARTY_ID =
             HP.PARTY_ID AND APS.CUSTOMER_TRX_ID = RCT.CUSTOMER_TRX_ID AND
             APS.ORG_ID = RCT.ORG_ID AND RCTT.CUST_TRX_TYPE_ID =
             RCT.CUST_TRX_TYPE_ID AND RCTT.ORG_ID = RCT.ORG_ID AND AC.CUSTOMER_ID
             = HCA.CUST_ACCOUNT_ID AND AC.CUSTOMER_ID = RCT.BILL_TO_CUSTOMER_ID
             AND AC.CUSTOMER_ID = HCP.CUST_ACCOUNT_ID AND RCT.BILL_TO_SITE_USE_ID
             = HCP.SITE_USE_ID AND RT.TERM_ID = HCP.STANDARD_TERMS AND
             HPS.PARTY_SITE_ID = HCASA.PARTY_SITE_ID AND HCASA.CUST_ACCOUNT_ID =
             AC.CUSTOMER_ID AND HCASA.CUST_ACCT_SITE_ID = HCSUA.CUST_ACCT_SITE_ID
             AND HCSUA.SITE_USE_ID = RCT.BILL_TO_SITE_USE_ID AND RCT.TRX_DATE
             BETWEEN NVL (TO_DATE (:B6 , 'RRRR/MM/DD HH24:MI:SS' ), '1-JAN-1900' )
             AND NVL (TO_DATE (:B5 , 'RRRR/MM/DD HH24:MI:SS' ), '31-DEC-2100' )
             AND RCTT.NAME = NVL (:B4 , RCTT.NAME) AND RT.TERM_ID = NVL (:B3 ,
             RT.TERM_ID) AND HP.PARTY_NAME = NVL (:B2 , HP.PARTY_NAME) AND ( (CASE
             WHEN :B1 = 'Open' THEN APS.AMOUNT_DUE_REMAINING END != 0 ) OR ((CASE
             WHEN :B1 = 'Closed' THEN APS.AMOUNT_DUE_REMAINING END = 0 ) ) OR CASE
             WHEN :B1 IS NULL THEN 1 END = 1 )
       Rationale
          The SQL spent 100% of its database time on CPU, I/O and Cluster waits.
          This part of database time may be improved by the SQL Tuning Advisor.
       Rationale
          Database time for this SQL was divided as follows: 100% for SQL
          execution, 0% for parsing, 0% for PL/SQL execution and 0% for Java
          execution.
       Rationale
          SQL statement with SQL_ID "2ujt2fg615ymk" was executed 19 times and had
          an average elapsed time of 1368 seconds.
       Rationale
          At least 2 distinct execution plans were utilized for this SQL statement
          during the analysis period.
       Rationale
          Top level calls to execute the PL/SQL statement with SQL_ID
          "g969dx1d0uucf" are responsible for 100% of the database time spent on
          the SELECT statement with SQL_ID "2ujt2fg615ymk".
          Related Object
             SQL statement with SQL_ID g969dx1d0uucf.
             BEGIN XXSD_TRX_DETAIL_REPORT(:errbuf,:rc,:A0,:A1,:A2,:A3,:A4,:A5);
             END;
       Recommendation 4: SQL Tuning
       Estimated benefit is .2 active sessions, 4.04% of total activity.
       Action
          Run SQL Tuning Advisor on the SELECT statement with SQL_ID
          "gy02p15c6bf0w".
          Related Object
             SQL statement with SQL_ID gy02p15c6bf0w.
             SELECT SUM (RECEIPTS) -  SUM (PAYMENTS)  FROM (SELECT
             AIP.ACCOUNTING_DATE GL_DATE , DECODE(NVL(APC.VENDOR_NAME ,
             APC.REMIT_TO_SUPPLIER_NAME )  , 'FD Investment' , 'FD' , 'Payment' ) 
             TYPE , APC.DOC_SEQUENCE_VALUE VOUCHER_NO , APC.CREATION_DATE
             VOUCHER_DATE , TO_CHAR (APC.CHECK_NUMBER )  CHECK_NUMBER , TO_CHAR
             (NVL(APC.FUTURE_PAY_DUE_DATE , APC.CHECK_DATE )  , 'DD-MON-YYYY' ) 
             CHECK_DATE , NVL(APC.VENDOR_NAME , APC.REMIT_TO_SUPPLIER_NAME ) 
             VENDOR_NAME , API.ACCTS_PAY_CODE_COMBINATION_ID ACCOUNT_CODE ,
             'Supplier Payment' DESCRIPTION , TO_CHAR (DECODE(SIGN(SUM
             (AIP.AMOUNT) )  , -1 , SUM (AIP.AMOUNT *  NVL(AIP.EXCHANGE_RATE , 1 )
             ) *  -1  , SUM (0) )  )  RECEIPTS , TO_CHAR (DECODE(SIGN(SUM
             (AIP.AMOUNT) )  , 1 , SUM (AIP.AMOUNT *  NVL(AIP.EXCHANGE_RATE , 1 ) 
             ) , SUM (0) )  )  PAYMENTS , TO_NUMBER (SUM (AIP.AMOUNT * 
             NVL(AIP.EXCHANGE_RATE , 1 )  ) )  PAYMENTS1 , CBA.BANK_ACCOUNT_NAME
             BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM BANK_ACCOUNT_NUM ,
             BANK.PARTY_NAME BANK_NAME , BRANCH.PARTY_NAME BRANCH_NAME FROM
             APPS.AP_INVOICE_PAYMENTS_ALL AIP , APPS.AP_INVOICES_ALL API ,
             APPS.AP_CHECKS_ALL APC , APPS.CE_BANK_ACCOUNTS CBA ,
             APPS.CE_BANK_ACCT_USES_ALL CBU , HZ_PARTIES BANK , HZ_PARTIES BRANCH 
             WHERE API.INVOICE_ID =  AIP.INVOICE_ID  AND AIP.CHECK_ID = 
             APC.CHECK_ID  AND APC.CE_BANK_ACCT_USE_ID =  CBU.BANK_ACCT_USE_ID 
             AND CBA.BANK_ACCOUNT_ID =  CBU.BANK_ACCOUNT_ID  AND CBA.BANK_ID = 
             BANK.PARTY_ID  AND CBA.BANK_BRANCH_ID =  BRANCH.PARTY_ID  AND ( (
             APC.STATUS_LOOKUP_CODE IN ( 'NEGOTIABLE' , 'CLEARED' , 'VOIDED' ,
             'RECONCILED UNACCOUNTED' , 'RECONCILED' , 'CLEARED BUT UNACCOUNTED' )
             AND AIP.ACCOUNTING_DATE <  :b1  AND APC.FUTURE_PAY_DUE_DATE IS NULL 
             )  OR ( APC.STATUS_LOOKUP_CODE IN ( 'NEGOTIABLE' )  AND
             APC.FUTURE_PAY_DUE_DATE <  :b1 ) )  AND CBA.BANK_ACCOUNT_ID =  :b2 
             AND AIP.INVOICE_PAYMENT_TYPE IS NULL   AND ( API.ORG_ID IS NULL   OR
             API.ORG_ID =  :b3 )   GROUP BY AIP.ACCOUNTING_DATE ,
             DECODE(NVL(APC.VENDOR_NAME , APC.REMIT_TO_SUPPLIER_NAME )  , 'FD
             Investment' , 'FD' , 'Payment' )  , APC.DOC_SEQUENCE_VALUE ,
             APC.CREATION_DATE , TO_CHAR (APC.CHECK_NUMBER )  , TO_CHAR
             (NVL(APC.FUTURE_PAY_DUE_DATE , APC.CHECK_DATE )  , 'DD-MON-YYYY' )  ,
             NVL(APC.VENDOR_NAME , APC.REMIT_TO_SUPPLIER_NAME )  ,
             API.ACCTS_PAY_CODE_COMBINATION_ID , 'Supplier Payment' ,
             CBA.BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM , BANK.PARTY_NAME ,
             BRANCH.PARTY_NAME  UNION ALL SELECT APID.ACCOUNTING_DATE GL_DATE ,
             DECODE(POV.VENDOR_NAME , 'FD Investment' , 'FD' , 'I' )  TYPE ,
             API.DOC_SEQUENCE_VALUE VOUCHER_NO , API.CREATION_DATE VOUCHER_DATE ,
             API.INVOICE_NUM CHECK_NUMBER , TO_CHAR (API.INVOICE_DATE ,
             'DD-MON-YYYY' )  CHECK_DATE , POV.VENDOR_NAME VENDOR_NAME ,
             API.ACCTS_PAY_CODE_COMBINATION_ID ACCOUNT_CODE , NVL(API.DESCRIPTION
             , API.INVOICE_NUM )  DESCRIPTION , TO_CHAR (SUM (API.INVOICE_AMOUNT *
             NVL(API.EXCHANGE_RATE , 1 )  ) )  RECEIPTS , TO_CHAR (SUM (0) ,
             'fm999999999990.00' )  PAYMENTS , TO_NUMBER (SUM (0) )  PAYMENTS1 ,
             CBA.BANK_ACCOUNT_NAME BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM
             BANK_ACCOUNT_NUM , BANK.PARTY_NAME BANK_NAME , BRANCH.PARTY_NAME
             BRANCH_NAME FROM APPS.AP_INVOICE_DISTRIBUTIONS_ALL APID ,
             APPS.AP_INVOICE_LINES_ALL APLA , APPS.AP_INVOICES_ALL API ,
             APPS.PO_VENDORS POV , APPS.CE_BANK_ACCOUNTS CBA , HZ_PARTIES BANK ,
             HZ_PARTIES BRANCH   WHERE API.INVOICE_ID =  APID.INVOICE_ID  AND
             APLA.INVOICE_ID =  APID.INVOICE_ID  AND APLA.LINE_NUMBER = 
             APID.INVOICE_LINE_NUMBER  AND API.VENDOR_ID =  POV.VENDOR_ID  AND
             CBA.BANK_ACCOUNT_ID =  :b2  AND CBA.ASSET_CODE_COMBINATION_ID = 
             APID.DIST_CODE_COMBINATION_ID  AND CBA.BANK_ID =  BANK.PARTY_ID  AND
             CBA.BANK_BRANCH_ID =  BRANCH.PARTY_ID  AND APID.MATCH_STATUS_FLAG = 
             'A'  AND NVL(API.PAYMENT_STATUS_FLAG , 'N' )  !=  'N'  AND
             APID.ACCOUNTING_DATE <  :b1  AND ( API.ORG_ID IS NULL   OR API.ORG_ID
             =  :b3 )   GROUP BY APID.ACCOUNTING_DATE , DECODE(POV.VENDOR_NAME ,
             'FD Investment' , 'FD' , 'I' )  , API.DOC_SEQUENCE_VALUE ,
             API.CREATION_DATE , API.INVOICE_NUM , TO_CHAR (API.INVOICE_DATE ,
             'DD-MON-YYYY' )  , POV.VENDOR_NAME ,
             API.ACCTS_PAY_CODE_COMBINATION_ID , NVL(API.DESCRIPTION ,
             API.INVOICE_NUM )  , CBA.BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM ,
             BANK.PARTY_NAME , BRANCH.PARTY_NAME  UNION ALL SELECT ACRH.GL_DATE
             GL_DATE , DECODE(ACRH.STATUS , 'REVERSED' , 'REV' ,
             DECODE(ACRH.CREATED_FROM , 'RATE ADJUSTMENT TRIGGER' , 'ERF' ,
             'Receipt' )  )  TYPE , ACR.DOC_SEQUENCE_VALUE VOUCHER_NO ,
             ACR.CREATION_DATE VOUCHER_DATE , ACR.RECEIPT_NUMBER CHECK_NUMBER ,
             TO_CHAR (ACR.RECEIPT_DATE , 'DD-MON-YYYY' )  CHECK_DATE ,
             NVL(SUBSTR(HP.PARTY_NAME , 1 , 50 )  , 'Miscellaneous Activity' ) 
             VENDOR_NAME , ACRH.ACCOUNT_CODE_COMBINATION_ID ACCOUNT_CODE ,
             'Customer Receipt' DESCRIPTION , TO_CHAR (SUM (DECODE(ACRH.STATUS ,
             'REVERSED' , NVL(ADA.ACCTD_AMOUNT_DR , 0 )  , 'CLEARED' ,
             NVL(ADA.ACCTD_AMOUNT_DR , 0 )  , 'REMITTED' , NVL(ADA.ACCTD_AMOUNT_DR
             , 0 )  , 'CONFIRMED' , NVL(ADA.ACCTD_AMOUNT_DR , 0 )  ) ) ,
             'fm999999999990.00' )  RECEIPTS , TO_CHAR (SUM (DECODE(ACRH.STATUS ,
             'REVERSED' , NVL(ADA.ACCTD_AMOUNT_CR , 0 )  , 'CLEARED' ,
             NVL(ADA.ACCTD_AMOUNT_CR , 0 )  , 'REMITTED' , NVL(ADA.ACCTD_AMOUNT_CR
             , 0 )  , 'CONFIRMED' , NVL(ADA.ACCTD_AMOUNT_CR , 0 )  ) ) ,
             'fm999999999990.00' )  PAYMENTS , TO_NUMBER (TO_CHAR (SUM (0) )  ) 
             PAYMENTS1 , CBA.BANK_ACCOUNT_NAME BANK_ACCOUNT_NAME ,
             CBA.BANK_ACCOUNT_NUM BANK_ACCOUNT_NUM , BANK.PARTY_NAME BANK_NAME ,
             BRANCH.PARTY_NAME BRANCH_NAME FROM APPS.AR_CASH_RECEIPT_HISTORY_ALL
             ACRH , APPS.AR_CASH_RECEIPTS_ALL ACR , APPS.HZ_PARTIES HP ,
             APPS.HZ_CUST_ACCOUNTS HCA , APPS.CE_BANK_ACCOUNTS CBA ,
             APPS.CE_BANK_ACCT_USES_ALL CBAU , APPS.AR_DISTRIBUTIONS_ALL ADA ,
             HZ_PARTIES BANK , HZ_PARTIES BRANCH   WHERE ACRH.CASH_RECEIPT_ID = 
             ACR.CASH_RECEIPT_ID  AND CBAU.BANK_ACCT_USE_ID = 
             ACR.REMIT_BANK_ACCT_USE_ID  AND CBAU.BANK_ACCOUNT_ID = 
             CBA.BANK_ACCOUNT_ID  AND HCA.PARTY_ID =  HP.PARTY_ID     AND
             ACR.PAY_FROM_CUSTOMER =  HCA.CUST_ACCOUNT_ID     AND CBA.BANK_ID =
             BANK.PARTY_ID  AND CBA.BANK_BRANCH_ID =  BRANCH.PARTY_ID  AND
             ACRH.STATUS IN ( 'CLEARED' , 'REMITTED' , 'CONFIRMED' , 'REVERSED' ) 
             AND ACRH.CASH_RECEIPT_HISTORY_ID =  ADA.SOURCE_ID  AND
             ADA.SOURCE_TABLE =  'CRH'  AND ADA.SOURCE_TYPE !=  'BANK_CHARGES' 
             AND CBA.BANK_ACCOUNT_ID =  :b2  AND ACRH.GL_DATE <  :b1  AND (
             ACR.ORG_ID IS NULL   OR ACR.ORG_ID =  :b3 )  AND ( (
             ACR.REVERSAL_DATE IS NOT NULL   AND ACRH.STATUS =  'REVERSED' )  OR (
             ACRH.CASH_RECEIPT_HISTORY_ID IN (SELECT INCRH.CASH_RECEIPT_HISTORY_ID
             FROM APPS.AR_CASH_RECEIPT_HISTORY_ALL INCRH   WHERE
             INCRH.CASH_RECEIPT_ID =  ACR.CASH_RECEIPT_ID  AND INCRH.STATUS != 
             'REVERSED'   )) )   GROUP BY ACRH.GL_DATE , DECODE(ACRH.STATUS ,
             'REVERSED' , 'REV' , DECODE(ACRH.CREATED_FROM , 'RATE ADJUSTMENT
             TRIGGER' , 'ERF' , 'Receipt' )  )  , ACR.DOC_SEQUENCE_VALUE ,
             ACR.CREATION_DATE , ACR.RECEIPT_NUMBER , TO_CHAR (ACR.RECEIPT_DATE ,
             'DD-MON-YYYY' )  , NVL(SUBSTR(HP.PARTY_NAME , 1 , 50 )  ,
             'Miscellaneous Activity' )  , ACRH.ACCOUNT_CODE_COMBINATION_ID ,
             'Customer Receipt' , CBA.BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM ,
             BANK.PARTY_NAME , BRANCH.PARTY_NAME  UNION ALL SELECT ACRH.GL_DATE
             GL_DATE , DECODE(ADJ.REASON_CODE ,  NULL  , 'ADJ' , ADJ.REASON_CODE
             ||  ' - ADJ'  )  TYPE , ACR.DOC_SEQUENCE_VALUE VOUCHER_NO ,
             ACR.CREATION_DATE VOUCHER_DATE ,  NULL  CHECK_NUMBER ,  NULL 
             CHECK_DATE , NVL(SUBSTR(HP.PARTY_NAME , 1 , 50 )  , 'Miscellaneous
             Activity' )  VENDOR_NAME , ACRH.ACCOUNT_CODE_COMBINATION_ID
             ACCOUNT_CODE , NVL(ACR.COMMENTS , ACR.RECEIPT_NUMBER )  DESCRIPTION ,
             TO_CHAR (SUM (-1 *  ADJ.AMOUNT ) , 'fm999999999990.00' )  RECEIPTS , 
             NULL  PAYMENTS , TO_NUMBER (TO_CHAR (SUM (0) )  )  PAYMENTS1 ,
             CBA.BANK_ACCOUNT_NAME BANK_ACCOUNT_NAME , CBA.BANK_ACCOUNT_NUM
             BANK_ACCOUNT_NUM , BANK.PARTY_NAME BANK_NAME , BRANCH.PARTY_NAME
             BRANCH_NAME FROM APPS.AR_CASH_RECEIPT_HISTORY_ALL ACRH ,
             APPS.AR_CASH_RECEIPTS_ALL ACR , APPS.HZ_PARTIES HP ,
             APPS.HZ_CUST_ACCOUNTS HCA , APPS.CE_BANK_ACCOUNTS CBA ,
             APPS.CE_BANK_ACCT_USES_ALL CBAU , APPS.AR_RECEIVABLE_APPLICATIONS_ALL
             APP , APPS.AR_ADJUSTMENTS_ALL ADJ , HZ_PARTIES BANK , HZ_PARTIES
             BRANCH   WHERE ACRH.CASH_RECEIPT_ID =  ACR.CASH_RECEIPT_ID  AND
             APP.CASH_RECEIPT_ID =  ACRH.CASH_RECEIPT_ID  AND APP.DISPLAY =  'Y' 
             AND APP.STATUS =  'APP'  AND APP.APPLICATION_TYPE =  'CASH'  AND
             ADJ.CUSTOMER_TRX_ID =  APP.APPLIED_CUSTOMER_TRX_ID  AND
             ADJ.CHARGEBACK_CUSTOMER_TRX_ID IS NULL   AND ADJ.TYPE =  'CHARGES' 
             AND CBAU.BANK_ACCT_USE_ID =  ACR.REMIT_BANK_ACCT_USE_ID  AND
             CBAU.BANK_ACCOUNT_ID =  CBA.BANK_ACCOUNT_ID  AND ACRH.CASH_RECEIPT_ID
             =  ACR.CASH_RECEIPT_ID  AND HCA.PARTY_ID =  HP.PARTY_ID     AND
             ACR.PAY_FROM_CUSTOMER =  HCA.CUST_ACCOUNT_ID     AND CBA.BANK_ID =
             BANK.PARTY_ID  AND CBA.BANK_BRANCH_ID =  BRANCH.PARTY_ID  AND
             ACRH.STATUS IN ( 'CLEARED' , 'REMITTED' , 'CONFIRMED' , 'REVERSED' ) 
             AND CBA.BANK_ACCOUNT_ID =  :b2  AND ACRH.GL_DATE <  :b1  AND (
             ACR.ORG_ID IS NULL   OR ACR.ORG_ID =  :b3 )  AND ( (
             ACR.REVERSAL_DATE IS NOT NULL   AND ACRH.STATUS =  'REVERSED' )  OR (
             ACRH.CASH_RECEIPT_HISTORY_ID IN (SELECT MIN
             (INCRH.CASH_RECEIPT_HISTORY_ID) FROM APPS.AR_CASH_RECEIPT_HISTORY_ALL
             INCRH   WHERE INCRH.CASH_RECEIPT_ID =  ACR.CASH_RECEIPT_ID  AND
             INCRH.STATUS !=  'REVERSED'   )) )   GROUP BY ACRH.GL_DATE ,
             DECODE(ADJ.REASON_CODE ,  NULL  , 'ADJ' , ADJ.REASON_CODE ||  ' -
             ADJ'  )  , ACR.DOC_SEQUENCE_VALUE , ACR.CREATION_DATE ,  NULL  , 
             NULL  , NVL(SUBSTR(HP.PARTY_NAME , 1 , 50 )  , 'Miscellaneous
             Activity' )  , ACRH.ACCOUNT_CODE_COMBINATION_ID , NVL(ACR.COMMENTS ,
             ACR.RECEIPT_NUMBER )  ,  NULL  , CBA.BANK_ACCOUNT_NAME ,
             CBA.BANK_ACCOUNT_NUM , BANK.PARTY_NAME , BRANCH.PARTY_NAME  UNION ALL
             SELECT PT.TRANSACTION_DATE GL_DATE , DECODE(PT.CREATED_FROM_DIR ,
             'PAYMENT' , 'Payment' )  TYPE , PT.TRXN_REFERENCE_NUMBER VOUCHER_NO ,
             TRUNC (PT.CREATION_DATE )  VOUCHER_DATE , PT.BANK_TRXN_NUMBER
             CHECK_NUMBER , TO_CHAR (PT.TRANSACTION_DATE , 'DD-MON-YYYY' ) 
             CHECK_DATE , DESTBA.BANK_ACCOUNT_NAME VENDOR_NAME ,
             GCC.CODE_COMBINATION_ID ACCOUNT_CODE , 'Inter Bank Transfer' ACC_DESC
             , '0' RECEIPTS , TO_CHAR (SUM (PT.PAYMENT_AMOUNT) )  PAYMENTS ,
             TO_NUMBER (SUM (PT.PAYMENT_AMOUNT) )  PAYMENTS1 ,
             SRCBA.BANK_ACCOUNT_NAME BANK_ACCOUNT_NAME , SRCBA.BANK_ACCOUNT_NUM
             BANK_ACCOUNT_NUM , BANK.PARTY_NAME BANK_NAME , BRANCH.PARTY_NAME
             BRANCH_NAME FROM APPS.HZ_ORGANIZATION_PROFILES SBANKORGPROFILE ,
             APPS.HZ_CODE_ASSIGNMENTS SBANKCA , APPS.HZ_PARTIES SBRANCHPARTY ,
             APPS.HZ_ORGANIZATION_PROFILES SBRANCHORGPROFILE ,
             APPS.HZ_CODE_ASSIGNMENTS SBRANCHCA , APPS.HZ_RELATIONSHIPS SBRREL ,
             APPS.HZ_CODE_ASSIGNMENTS SBRANCHTYPECA , APPS.HZ_CONTACT_POINTS
             SBRANCHCP , APPS.HZ_CONTACT_POINTS SEDICP ,
             APPS.HZ_ORGANIZATION_PROFILES DBANKORGPROFILE ,
             APPS.HZ_CODE_ASSIGNMENTS DBANKCA , APPS.HZ_PARTIES DBRANCHPARTY ,
             APPS.HZ_ORGANIZATION_PROFILES DBRANCHORGPROFILE ,
             APPS.HZ_CODE_ASSIGNMENTS DBRANCHCA , APPS.HZ_RELATIONSHIPS DBRREL ,
             APPS.HZ_CODE_ASSIGNMENTS DBRANCHTYPECA , APPS.HZ_CONTACT_POINTS
             DBRANCHCP , APPS.HZ_CONTACT_POINTS DEDICP ,
             APPS.CE_PAYMENT_TRANSACTIONS PT , APPS.CE_BANK_ACCOUNTS SRCBA ,
             APPS.CE_BANK_ACCOUNTS DESTBA , APPS.XLE_ENTITY_PROFILES SRCLE ,
             APPS.XLE_ENTITY_PROFILES DESTLE , APPS.GL_CODE_COMBINATIONS GCC ,
             APPS.HZ_PARTIES HZP , HZ_PARTIES BANK , HZ_PARTIES BRANCH   WHERE
             SYSDATE  BETWEEN TRUNC (SBANKORGPROFILE.EFFECTIVE_START_DATE )  AND
             NVL(TRUNC (SBANKORGPROFILE.EFFECTIVE_END_DATE )  , SYSDATE  +  1  )  
             AND SBANKCA.CLASS_CATEGORY =  'BANK_INSTITUTION_TYPE'  AND
             SBANKCA.CLASS_CODE IN ( 'BANK' , 'CLEARINGHOUSE' )  AND
             SBANKCA.OWNER_TABLE_NAME =  'HZ_PARTIES'  AND ( SBANKCA.STATUS =  'A'
             OR SBANKCA.STATUS IS NULL  )  AND SBANKCA.OWNER_TABLE_ID = 
             SBANKORGPROFILE.PARTY_ID  AND SBRANCHPARTY.PARTY_TYPE = 
             'ORGANIZATION'  AND SBRANCHPARTY.STATUS =  'A'  AND
             SBRANCHORGPROFILE.PARTY_ID =  SBRANCHPARTY.PARTY_ID  AND SYSDATE 
             BETWEEN TRUNC (SBRANCHORGPROFILE.EFFECTIVE_START_DATE )  AND
             NVL(TRUNC (SBRANCHORGPROFILE.EFFECTIVE_END_DATE )  , SYSDATE  +  1  )
             AND SBRANCHCA.CLASS_CATEGORY =  'BANK_INSTITUTION_TYPE'  AND
             SBRANCHCA.CLASS_CODE IN ( 'BANK_BRANCH' , 'CLEARINGHOUSE_BRANCH' ) 
             AND SBRANCHCA.OWNER_TABLE_NAME =  'HZ_PARTIES'  AND (
             SBRANCHCA.STATUS =  'A'  OR SBRANCHCA.STATUS IS NULL  )  AND
             SBRANCHCA.OWNER_TABLE_ID =  SBRANCHPARTY.PARTY_ID  AND
             SBANKORGPROFILE.PARTY_ID =  SBRREL.OBJECT_ID  AND
             SBRREL.RELATIONSHIP_TYPE =  'BANK_AND_BRANCH'  AND
             SBRREL.RELATIONSHIP_CODE =  'BRANCH_OF'  AND SBRREL.STATUS =  'A' 
             AND SBRREL.SUBJECT_TABLE_NAME =  'HZ_PARTIES'  AND
             SBRREL.SUBJECT_TYPE =  'ORGANIZATION'  AND SBRREL.OBJECT_TABLE_NAME =
             'HZ_PARTIES'  AND SBRREL.OBJECT_TYPE =  'ORGANIZATION'  AND
             SBRREL.SUBJECT_ID =  SBRANCHPARTY.PARTY_ID  AND
             SBRANCHTYPECA.CLASS_CATEGORY    =  'BANK_BRANCH_TYPE'  AND
             SBRANCHTYPECA.PRIMARY_FLAG    =  'Y'  AND
             SBRANCHTYPECA.OWNER_TABLE_NAME    =  'HZ_PARTIES'  AND
             SBRANCHTYPECA.OWNER_TABLE_ID    =  SBRANCHPARTY.PARTY_ID  AND

    Hi Karan,
    If your DB node has 48 GB and there are no other applications/program running on the server than I believe you still have for room for SGA/PGA resize.
    GSS was scheduled to run at 20% till last week ( runs every week) while i just made it to run for auto_sample_size by giving the percent as 0. I have checked and found that most of the tables had good stats , though one of the programs has started to take too much time after that. So for now i have reverted it back to 20%.
    10% - 20% is the percentage which I usually go with and this works well for me. Anyways that being said 10% default would do the trick in most cases.
    The update statement which is causing the trouble is a seeded oracle program so we have checking that with oracle. ( Auto_invoice_master).
    Yes as recommended, Please get confirmation from SR as well.
    Please also see note:
    How To Setup AutoInvoice For Optimal Performance (Doc ID 1083467.1)
    Troubleshooting AutoInvoice Performance Issues (Doc ID 1089196.1)
    Thanks &
    Best Regards

  • Vendor ID, Last Update Date, Invoice Details - Query

    For each Supplier, we would like to know the vendor ID, vendor number, vendor name, vendor site code, Created Date, Last Update Date, last invoice date, last payment date, total number of invoices and total $ amount of invoices for each supplier.
    1) How do i find the last payment date and supplier catagory?
    2) As i have to use sum(invoice_amount), count(invoice_amount), max(payment_date) which point to 3 different tables, i am not sure how to use "group by" based on the Vendor_id alone while i select lot of fields from different table. Could you please help me with this?
    3) Please help me to get this query fixed.

    1) You can get last_payment_date by joining vendor_id to ap_invoices_all and the joining invoice_id with ap_invoice_payments_all to get the max accounting_date (i.e. last payment date)
    2) You are partially right. Invoice_amount and invoice_count are from the same table so you have to join 2 tables. Best way is to do a select in the select.
    e.g SELECT   pv.vendor_name, COUNT (1), SUM (invoice_amount), pv.vendor_id,
             (SELECT MAX (aipa.accounting_date)
                FROM ap_invoice_payments_all aipa, ap_invoices_all aia2
               WHERE aia2.vendor_id = pv.vendor_id
                 AND aia2.invoice_id = aipa.invoice_id) latest_payment
        FROM ap_invoices_all aia, po_vendors pv
       WHERE aia.vendor_id = pv.vendor_id
    GROUP BY pv.vendor_name, pv.vendor_idSandeep Gandhi

  • (11) TRIAL BALANCE REPORT에 PAID 된 INVOICE가 보이는 CASE

    제품 : FIN_AP
    작성날짜 : 2003-05-13
    TRIAL BALANCE REPORT에 PAID 된 INVOICE가 보이는 CASE
    ==============================================
    PURPOSE
    Applications 11.0.3 환경에서 AP의 Trial Balance Report 실행시 잘못 생성된 data가 보여지는 경우의 문제를 해결한다.
    Problem Description
    Paid 가 완전히 이루어져서 gl 로 까지 transfer 된 invoice가 trial balance report에 여전히 remaining 금액과 함께 나타나고 있다.
    이 때 Payament가 한번 void 되었다가 다시 reissue 된 경우이다.
    Workaround
    1. Aplist11.sql 이나 아래의 select 문으로 invoice 상태를 check한다.
    SELECT invoice_id, invoice_amount
    FROM ap_invoices_all
    WHERE invoice_num = <'problem invoice'>;
    2. Trial balance에 data가 어떻게 entry 되었는지 확인한다.
    SELECT *
    FROM ap_trial_balance
    WHERE invoice_id = <results from query #1>;
    3. Invoice 에 대한 payment 정보를 확인한다.
    SELECT invoice_id, invoice_payment_id, accounting_date, accrual_posted_flag,
    cash_posted_flag, posted_flag
    FROM ap_invoice_payments_all
    WHERE invoice_id = <results from query #1>;
    4. Payment에 대한 distribution line 정보를 확인한다.
    SELECT invoice_payment_id, payment_line_number, line_type_lookup_code,
    amount, base_amount
    FROM ap_payment_distributions_all
    WHERE invoice_payment_id = <invoice_payment_id returned in query #3>;
    일반적으로 void 되었다가 reissue 된 payment의 trial balance가 잘못된 경우는 ap_payment_distributions_all table에 data가 잘못 생성되었기 때문이다.
    위의 테이블에서 잘못 생성된 data를 correct 하거나 delete 한다음에
    patch 375496 을 이용하여 trial balance 를 rebuil 하는것이 workaround 이다.
    Solution Description
    $AP_TOP/patch/110/sql/apautopb.pls 의 버젼이 110.6 보다 낮은경우 이런 문제 예방을 위해 AP D patchset 이상을 적용한다.
    Reference Documents
    NOTE 106744.1

    maybe OP want to extract all numbers from his inbox using regular expressions?

  • Reconciled invoices are coming in the report

    Before changes
    SELECT 'FINANCE' detdepartment, 'FINANCE' detsub_dept, 'FINANCE' detuser_name,
           ai.unique_remittance_identifier, ai.invoice_num, ai.invoice_date,
           ai.description, ai.invoice_amount, av.vendor_name, av.vendor_type_disp,
           ai.invoice_received_date, TRUNC (aipa.creation_date) last_forward_date,
           TRUNC (xvd.creation_date + NVL (atl.due_days, 0)) due_date,
           trunc(sysdate)-(TRUNC(xvd.CREATION_DATE)+NVL(atl.DUE_DAYS,0))due_days,
           'Validated - Oracle Paid: Unclear' status, ai.invoice_id,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pha.segment1 || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_headers_all pha, ap_invoice_lines_all aila
             WHERE pha.po_header_id = aila.po_header_id
               AND aila.invoice_id = ai.invoice_id) po_number,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pha.type_lookup_code || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_headers_all pha, ap_invoice_lines_all aila
             WHERE pha.po_header_id = aila.po_header_id
               AND aila.invoice_id = ai.invoice_id) po_type,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pra.release_num || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_releases_all pra, ap_invoice_lines_all aila
             WHERE pra.po_release_id = aila.po_release_id
               AND aila.invoice_id = ai.invoice_id) release_number
      FROM apps.ap_terms apt,
           ap_invoices_all ai,
           ap_terms_lines atl,
           org_organization_definitions ood,
           fnd_user fu,
           xxindus_vhd_dynamic_h xvdh,
           xxindus_vhd_dynamic xvd,
           ap_lookup_codes alc,
           ap_invoice_payments_all aipa,
           ap_payment_history_all apha,
           ap_vendors_v av
    WHERE xvd.invoice_id = ai.invoice_id
       AND apt.term_id = ai.terms_id
       AND apt.term_id = atl.term_id
       AND atl.sequence_num = 1
       AND ai.terms_id = apt.term_id
       AND ai.org_id = ood.organization_id
       AND ai.created_by = fu.user_id
       AND ai.invoice_id = xvdh.invoice_id
       AND ai.invoice_id = xvd.invoice_id
       AND alc.lookup_code = ai.invoice_type_lookup_code
       AND ai.invoice_id = aipa.invoice_id
       AND aipa.check_id = apha.check_id
       AND aipa.invoice_payment_id = (SELECT MAX (invoice_payment_id)
                                        FROM ap_invoice_payments_all a
                                       WHERE a.invoice_id = ai.invoice_id)
       AND apha.accounting_event_id = (SELECT MAX (accounting_event_id)
                                         FROM ap_payment_history_all aph1
                                        WHERE aph1.check_id = apha.check_id)
       AND ai.vendor_id = av.vendor_id
       AND apha.transaction_type IN ('PAYMENT CREATED', 'PAYMENT UNCLEARING')
       AND ai.invoice_type_lookup_code = 'STANDARD'
       AND alc.lookup_type = 'INVOICE TYPE'
       AND alc.enabled_flag = 'Y'
       AND ai.wfapproval_status IN ('WFAPPROVED', 'MANUALLY APPROVED')
       AND xvdh.checked = 'Y'
       AND xvd.status = 'Sent to Finance'
       AND ai.cancelled_date IS NULL
       --- AND SYSDATE BETWEEN fu.start_date AND NVL(fu.end_date,SYSDATE)
       AND ai.invoice_amount =
                    NVL ((ai.amount_paid + NVL (ai.discount_amount_taken, 0)), 0)
    --   AND ood.organization_name = :p_org_name
       AND ood.organization_id = :p_org_id
       AND ai.invoice_received_date
              BETWEEN NVL (TRUNC (TO_DATE (:p_from_date, 'RRRR/MM/DD HH24:MI:SS')),
                           ai.invoice_received_date
                  AND NVL (TRUNC (TO_DATE (:p_to_date, 'RRRR/MM/DD HH24:MI:SS')),
                           SYSDATE
       AND (fu.user_name LIKE '%VHD%' OR fu.description = 'VHD')
    after changes
    SELECT 'FINANCE' detdepartment, 'FINANCE' detsub_dept, 'FINANCE' detuser_name,
           ai.unique_remittance_identifier, ai.invoice_num, ai.invoice_date,
           ai.description, ai.invoice_amount, av.vendor_name, av.vendor_type_disp,
           ai.invoice_received_date, TRUNC (aipa.creation_date) last_forward_date,
           TRUNC (xvd.creation_date + NVL (atl.due_days, 0)) due_date,
           trunc(sysdate)-(TRUNC(xvd.CREATION_DATE)+NVL(atl.DUE_DAYS,0))due_days,
           'Validated - Oracle Paid: Unclear' status, ai.invoice_id,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pha.segment1 || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_headers_all pha, ap_invoice_lines_all aila
             WHERE pha.po_header_id = aila.po_header_id
               AND aila.invoice_id = ai.invoice_id) po_number,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pha.type_lookup_code || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_headers_all pha, ap_invoice_lines_all aila
             WHERE pha.po_header_id = aila.po_header_id
               AND aila.invoice_id = ai.invoice_id) po_type,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, pra.release_num || '|')).EXTRACT
                                                                       ('//text()'),
                       '|'
              FROM po_releases_all pra, ap_invoice_lines_all aila
             WHERE pra.po_release_id = aila.po_release_id
               AND aila.invoice_id = ai.invoice_id) release_number
      FROM apps.ap_terms apt,
           ap_invoices_all ai,
           ap_terms_lines atl,
           org_organization_definitions ood,
           fnd_user fu,
           xxindus_vhd_dynamic_h xvdh,
           xxindus_vhd_dynamic xvd,
           ap_lookup_codes alc,
           ap_invoice_payments_all aipa,
           ap_payment_history_all apha,
           ap_vendors_v av
    WHERE xvd.invoice_id = ai.invoice_id
       AND apt.term_id = ai.terms_id
       AND apt.term_id = atl.term_id
       AND atl.sequence_num = 1
       AND ai.terms_id = apt.term_id
       AND ai.org_id = ood.organization_id
       AND ai.created_by = fu.user_id
       AND ai.invoice_id = xvdh.invoice_id
       AND ai.invoice_id = xvd.invoice_id
       AND alc.lookup_code = ai.invoice_type_lookup_code
       AND ai.invoice_id = aipa.invoice_id
       AND aipa.check_id = apha.check_id
        AND aipa.invoice_payment_id = (SELECT MAX (invoice_payment_id)
                                        FROM ap_invoice_payments_all a
                                       WHERE a.invoice_id = ai.invoice_id)
                                        group by a.transaction_type)                                  
       AND apha.accounting_event_id = (SELECT MAX (accounting_event_id)
                                         FROM ap_payment_history_all aph1
                                        WHERE aph1.check_id = apha.check_id)
       AND ai.vendor_id = av.vendor_id
       AND apha.transaction_type IN ('PAYMENT CREATED', 'PAYMENT UNCLEARIN\G')
       and not exists ( select 1
                        from   apps.ap_payment_history_all apha
                             ,apps.ap_invoice_payments_all aipa
                             ,apps.ap_invoices_all  ai1
                        where aipa.check_id = apha.check_id
                        and ai1.invoice_id = aipa.invoice_id
                        and ai1.INVOICE_ID=ai.invoice_id
                        and apha.transaction_type IN ('PAYMENT CLEARING')
                        and  apha.CREATION_DATE = ( select max(apha.CREATION_DATE)
                                                    from apps.ap_payment_history_all apha
                                                        ,apps.ap_invoice_payments_all aipa
                                                        ,apps.ap_invoices_all  ai2
                                                    where aipa.check_id = apha.check_id
                                                    and ai2.invoice_id = aipa.invoice_id
                                                    and ai2.INVOICE_ID=ai.INVOICE_ID
                      ) ---- newly added
       AND ai.invoice_type_lookup_code = 'STANDARD'
       AND alc.lookup_type = 'INVOICE TYPE'
       AND alc.enabled_flag = 'Y'
       AND ai.wfapproval_status IN ('WFAPPROVED', 'MANUALLY APPROVED')
       AND xvdh.checked = 'Y'
       AND xvd.status = 'Sent to Finance'
       AND ai.cancelled_date IS NULL
       --- AND SYSDATE BETWEEN fu.start_date AND NVL(fu.end_date,SYSDATE)
       AND ai.invoice_amount =
                    NVL ((ai.amount_paid + NVL (ai.discount_amount_taken, 0)), 0)
    --   AND ood.organization_name = :p_org_name
       AND ood.organization_id = :p_org_id
      - AND AI.INVOICE_NUM='A302689/EXM/OSR/03-2012'
       AND ai.invoice_received_date
              BETWEEN NVL (TRUNC (TO_DATE (:p_from_date, 'RRRR/MM/DD HH24:MI:SS')),
                           ai.invoice_received_date
                  AND NVL (TRUNC (TO_DATE (:p_to_date, 'RRRR/MM/DD HH24:MI:SS')),
                           SYSDATE
       AND (fu.user_name LIKE '%VHD%' OR fu.description = 'VHD')

    Hi karthick,
    Reconciled invoices are coming in the Report , some  invoice are coming in the repot if i use the following condition the invoice are not comming in the report   please advice  wheather i can use this condition are not
    and not exists ( select 1
                        from   apps.ap_payment_history_all apha
                             ,apps.ap_invoice_payments_all aipa
                             ,apps.ap_invoices_all  ai1
                        where aipa.check_id = apha.check_id
                        and ai1.invoice_id = aipa.invoice_id
                        and ai1.INVOICE_ID=ai.invoice_id
                        and apha.transaction_type IN ('PAYMENT CLEARING')
                        and  apha.CREATION_DATE = ( select max(apha.CREATION_DATE)
                                                    from apps.ap_payment_history_all apha
                                                        ,apps.ap_invoice_payments_all aipa
                                                        ,apps.ap_invoices_all  ai2
                                                    where aipa.check_id = apha.check_id
                                                    and ai2.invoice_id = aipa.invoice_id
                                                    and ai2.INVOICE_ID=ai.INVOICE_ID
    Thanks,
    Naresh

  • AP Trial Balance

    I'm not sure if this is the best place to ask this question, but here goes...
    I'm trying to re-create the AP Trial Balance in Discoverer so I can add additional info for the Accountants allowing them to analyze the data better. I found XLA_TRIAL_BALANCES and XLA_TRANSACTION_ENTITIES and I believe I'll be able to tie this back to AP_INVOICES_ALL, AP_INVOICE_PAYMENTS_ALL and AP_INVOICE_DISTRIBUTIONS to the the necessary detail.
    Does anyone know of any reason not to use the XLA tables mentioned above? (such as data being archived automatically from those tables?)
    Thanks,
    Emily

    Emily,
    Let's see if I can help out a bit. First off, in regards to the first reply to your posting, how to navigate to Financials.
    1. Start at Forum Home.
    2. Scroll down a ways. There will be a section titled "E-Business Suite".
    3. Within that section is a category called "Financials".
    That would be the section being referred to. There is not a separate category for each application (payables, receivables, etc.). It is all one big category for Financials.
    Secondly, what version of EBS are you on, if you know? It is helpful when posting to mention what version of EBS you are on, as there are differences between EBS 11 and EBS 12.
    My guess is that you are on a version of EBS 12. I am guessing that because the XLA application refers to Sub Ledger Accounting, a new concept that came into being with EBS 12. I myself am on EBS 11.5.10.2, so I have no direct experience working with EBS 12. So keep that in mind.
    Having said that, I am not convinced that the XLA table is the best table you want to use for this. Maybe you can make the connection back to the AP tables from subledger accounting, but that seems like a lot of work to do, if it even works.
    What you may want to look at is the AP_LIABILITY_BALANCE table. I think the information in the XLA_TRIAL_BALANCE table may be coming from this AP table anyway (not sure - guessing here). At least with the AP_LIABILITY_BALANCE table you are dealing with just payables related records. You would not be having to deal with all the activity in the general ledger (so a smaller volume of records, which should mean much better Discoverer performance). So you might want to look at that table to see if that table might work for you.
    Good luck.
    John Dickey

  • To link between AP and PO

    hi all
    in AP  ABC Manager super user  responsibility ---Payments : Entry----------
    payments
    when the  find symbol is clicked
    Find Payments form is opened
    which is the table used to get the  supplier name and dates from this screen?
    when find is clicked on the same screen
    a screen called PAYMENTS is opened
    showing  payment_date,payment_amount,bank account  i cud get these details from ap_checks_all
    but not able to get the table for functional amount,voucher num ,functional currency
    also when the tab InvoiceOverwiew is clicked the po NUMBER  and receipt number  can be seen  how to get the table info related to that
    based on the tables i cud gather i cud do this query
    SELECT TRUNC (ai.gl_date), aca.amount paymentamount,aca.BANK_ACCOUNT_NAME,ACA.PAYMENT_METHOD_LOOKUP_CODE,
           aca.vendor_name suppliername, aca.check_date paymentdate,
           ai.invoice_num, ai.invoice_currency_code, aipa.accounting_date,
           aipa.invoice_id, ai.vendor_id, ai.amount_paid, ai.invoice_amount,
           ai.invoice_date, ai.invoice_type_lookup_code, avv.vendor_name
      FROM ap_invoices_all ai,
           ap_vendors_v avv,
           ap_invoice_payments_all aipa,
       ap_checks_all aca
    WHERE ai.vendor_id = avv.vendor_id
       AND aca.vendor_id = ai.vendor_id
       AND aipa.check_id = aca.check_id
       AND aipa.invoice_id = ai.invoice_id
       kindly help me to get the po number,also the payment amount under invoices,functional amount,voucher num ,functional currency
    Edited by: makdutakdu on Oct 12, 2011 2:01 PM

    hi
    thank you very much for your reply
    i was able to get the PO number but am not able to get the voucher num,functional currency and functional amount
    for ap_distributions_all it was table does not exist
    this is the query
    SELECT TRUNC (ai.gl_date), aca.amount paymentamount, aca.bank_account_name,
           aca.payment_method_lookup_code, aca.vendor_name suppliername,
           aca.check_date paymentdate, aida.period_name, aida.creation_date,
           aida.description, aida.quantity_invoiced, aida.unit_price,
           ai.invoice_num, ai.invoice_currency_code, aipa.accounting_date,
           aipa.invoice_id, ai.vendor_id, ai.amount_paid, ai.invoice_amount,
           pda.destination_type_code, pda.destination_organization_id,
           ai.invoice_date, ai.invoice_type_lookup_code, avv.vendor_name,
           pha.segment1
      FROM ap_invoices_all ai,
           ap_vendors_v avv,
           ap_invoice_payments_all aipa,
           ap_checks_all aca,
           ap_invoice_distributions_all aida,
           po_distributions_all pda,
           po_headers_all pha
    WHERE ai.vendor_id = avv.vendor_id
       AND aca.vendor_id = ai.vendor_id
       AND aipa.check_id = aca.check_id
       AND aipa.invoice_id = ai.invoice_id
       AND ai.invoice_id = aida.invoice_id
       AND aida.po_distribution_id = pda.po_distribution_id
       AND pda.po_header_id = pha.po_header_idkindly guide me
    thanking in advance
    Edited by: makdutakdu on Oct 13, 2011 10:57 AM

  • How to get the total execution time from a tkprof file

    Hi,
    I have a tkprof file. How can I get the total execution time. Going through the file i guess the sum of "Total Waited" would give the total time in the section "Elapsed times include waiting on following events:"
    . The sample of tkprof is given below.
    SQL ID: gg52tq1ajzy7t Plan Hash: 3406052038
    SELECT POSTED_FLAG
    FROM
    AP_INVOICE_PAYMENTS WHERE CHECK_ID = :B1 UNION ALL SELECT POSTED_FLAG FROM
      AP_PAYMENT_HISTORY APH, AP_SYSTEM_PARAMETERS ASP WHERE CHECK_ID = :B1 AND
      NVL(APH.ORG_ID, -99) = NVL(ASP.ORG_ID, -99) AND
      (NVL(ASP.WHEN_TO_ACCOUNT_PMT, 'ALWAYS') = 'ALWAYS' OR
      (NVL(ASP.WHEN_TO_ACCOUNT_PMT, 'ALWAYS') = 'CLEARING ONLY' AND
      APH.TRANSACTION_TYPE IN ('PAYMENT CLEARING', 'PAYMENT UNCLEARING')))
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute    442      0.08       0.13          0          0          0           0
    Fetch      963      0.22       4.72        350      16955          0         521
    total     1406      0.31       4.85        350      16955          0         521
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 173     (recursive depth: 1)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
             1          1          1  UNION-ALL  (cr=38 pr=3 pw=0 time=139 us)
             1          1          1   TABLE ACCESS BY INDEX ROWID AP_INVOICE_PAYMENTS_ALL (cr=5 pr=0 pw=0 time=124 us cost=6 size=12 card=1)
             1          1          1    INDEX RANGE SCAN AP_INVOICE_PAYMENTS_N2 (cr=4 pr=0 pw=0 time=92 us cost=3 size=0 card=70)(object id 27741)
             0          0          0   NESTED LOOPS  (cr=33 pr=3 pw=0 time=20897 us)
             0          0          0    NESTED LOOPS  (cr=33 pr=3 pw=0 time=20891 us cost=12 size=41 card=1)
             1          1          1     TABLE ACCESS FULL AP_SYSTEM_PARAMETERS_ALL (cr=30 pr=0 pw=0 time=313 us cost=9 size=11 card=1)
             0          0          0     INDEX RANGE SCAN AP_PAYMENT_HISTORY_N1 (cr=3 pr=3 pw=0 time=20568 us cost=2 size=0 card=1)(object id 27834)
             0          0          0    TABLE ACCESS BY INDEX ROWID AP_PAYMENT_HISTORY_ALL (cr=0 pr=0 pw=0 time=0 us cost=3 size=30 card=1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                       350        0.15          4.33
      Disk file operations I/O                        3        0.00          0.00
      latch: shared pool                              1        0.17          0.17
    ********************************************************************************

    user13019948 wrote:
    Hi,
    I have a tkprof file. How can I get the total execution time.
    call count cpu elapsed disk query current rows
    total 1406 0.31 4.85 350 16955 0 521TOTAL ELAPSED TIME is 4.85 seconds from line above

Maybe you are looking for

  • Report alignment and header not proper while modifying using MS Office 2007

    We have an RTF template designed using old MS Office version (1997 - 2003). Wehn we save the document after making any change using MS Office 2007, the alignment is changed in the merged PDF output (esp. table cell border hiding / displaying). Moreov

  • Does pages 6.0 support internal links to other pages?

    I want to create links inside of Pages 6 to take the reader to other locations in the document. I need to have these fully functional links exported with the document into pdf. Has anyone actually tried this in 6.0? Des it work?

  • Image flickering from adjustment layer

    OK so using premiere CC 2014  i get an awful flicker on video that I have applied adjustment layers to,  if i remove the layer it plays cleanly but with the layer it flickers.  whats the fix?

  • Unable to update bank details in 11i

    Hi Team, I want to update the bank details in 11i (11.5.10). can you please provide any sample code for hz_bank_pub.update_bank. My problem is to end the bank by passing Inactive date to API.

  • WD-Element TABLE Setting 1st Row

    Hello, in WD(ABAP) I use a TABLE-Control. It is bind to a node. The node is bind to a internal table with a lot of entries. Now I want ro show the Rows beginning at specific row , greater than 1 at startup-time. The example should show the rows 30 to