Thursday 22 June 2023

OPM-SLA query

SELECT   period_name, gl_trans, acct_stat, event_type_code, event_desc,

         item_type, acct_class, co, loc, cc, acct, bl, futr, acct_desc,

         SUM (debit) dr, SUM (credit) cr

    FROM (SELECT /*+ full(xah) parallel (xah, 8) full (xal) parallel (xal, 16) full(gxah) parallel (gxah, 8) */

                 xah.period_name,

                 xah.gl_transfer_status_code gl_trans,

                 xah.accounting_entry_status_code acct_stat,

                 xah.event_type_code,

                 NVL (xet.description, xet.NAME) event_desc,

                 xal.accounting_class_code acct_class,

                 micv.category_concat_segs item_type,

                 gcc.segment1 co, gcc.segment2 loc, gcc.s! egment3 cc,

                 gcc.segment4 acct, gcc.segment5 bl, gcc.segment6 futr,

                 ffvv.description acct_desc,

                 NVL (xal.accounted_dr, xal.entered_dr) debit,

                 NVL (xal.accounted_cr, xal.entered_cr) credit

            FROM apps.xla_ae_headers xah,

                 apps.xla_ae_lines xal,

                 apps.gmf_xla_extract_headers gxah,

                 apps.xla_event_types_tl xet,

                 apps.gl_code_combinations gcc,

                 apps.fnd_flex_values_vl ffvv,

                 apps.fnd_flex_value_sets ffvs,

                 apps.mtl_system_items_b msib,

                 apps.mtl_item_categories_v micv

           WHERE xah.ae_header_id = xal.ae_header_id

             AND xah.event_id = gxah.event_id

             AND xah.event_type_code = xet.event_type_code

             AND xah.application_id = xet.application_id

             AND xal.code_combination_id = gcc.code_combination_id

             AND gcc.segment4 = ffvv.flex_value

             AND ffvv.flex_value_set_id = ffvs.flex_value_set_id

             AND ffvs.flex_value_set_name = 'BPIL_ACCOUNT'

             AND gxah.inventory_item_id = msib.inventory_item_id

             AND msib.organization_id = micv.organization_id

             AND msib.inventory_item_id = micv.inventory_item_id

             AND msib.organization_id = 102

             AND micv.category_set_name = 'Item GL Class'

             AND micv.category_concat_segs IN ('RM', 'PKG', 'INT', 'FG', 'BLK')

             AND gxah.reference_no <> 4

             AND xah.accounting_date BETWEEN '01-APR-2011' AND '30-APR-2011'

             AND xah.application_id = 555)

GROUP BY period_name,

         gl_trans,

         acct_stat,

         event_type_code,

         event_desc,

         item_type,

         acct_class,

         co,

         loc,

         cc,

         acct,

         bl,

         futr,

         acct_desc;


No comments:

Post a Comment