Pending batches for the period before closing the period
-----------------------------------------------------------------------
SELECT
eh.legal_entity_id,
mp.organization_code,
gbh.batch_no,
gbh.actual_start_date,
GBH.BATCH_CLOSE_DATE,
DECODE(xah.event_type_code,'MANUAL',xah.event_type_code,'NON-MANUAL')Man_NonMan,
XAL.ACCOUNTING_CLASS_CODE,
XAH.Accounting_date,
XAL.CODE_COMBINATION_ID,
FND_FLEX_EXT.GET_SEGS('SQLGL','GL#', gcc.chart_of_accounts_id, gcc.code_combination_id) Account,
TO_CHAR(SUM(NVL(accounted_cr,0))),
TO_CHAR(SUM(NVL(accounted_dr,0)))
FROM
XLA_AE_LINES XAL,
XLA_AE_HEADERS XAH,
gme_batch_header gbh,
GMF_XLA_EXTRACT_HEADERS EH,
GMF_XLA_EXTRACT_LINES EL,
mtl_parameters mp,
gl_code_combinations gcc
WHERE xal.ae_header_id = xah.ae_header_id
AND XAL.APPLICATION_ID = XAH.APPLICATION_ID
AND XAL.APPLICATION_ID = 555
AND XAL.code_combination_id = gcc.code_combination_id(+)
AND eh.header_id = el.header_id
AND eh.source_document_id = gbh.batch_id
AND eh.txn_source = 'PM'
AND el.journal_line_type = 'WIP'
AND GBH.BATCH_STATUS = 4
AND XAH.EVENT_ID = EH.EVENT_ID
AND MP.ORGANIZATION_ID = EH.ORGANIZATION_ID
AND EH.LEGAL_ENTITY_ID = 996 --modify with LE
AND MP.ORGANIZATION_CODE = 'PR1' --modify with Organization code
AND ( TO_CHAR(GBH.ACTUAL_START_DATE, 'MON-YYYY') = 'JAN-2014' --Modify the start date
OR TO_CHAR(GBH.BATCH_CLOSE_DATE,'MON-YYYY') = 'JAN-2014' ) --modify the end date
GROUP BY eh.legal_entity_id,
mp.organization_code,
gbh.batch_no,
gbh.actual_start_date,
gbh.batch_close_date,
DECODE(xah.event_type_code,'MANUAL',xah.event_type_code,'NON-MANUAL'),
XAL.ACCOUNTING_CLASS_CODE,
XAH.Accounting_date,
xal.code_combination_id,
FND_FLEX_EXT.GET_SEGS('SQLGL','GL#', GCC.CHART_OF_ACCOUNTS_ID, GCC.CODE_COMBINATION_ID)
;
-----------------------------------------------------------------------
SELECT
eh.legal_entity_id,
mp.organization_code,
gbh.batch_no,
gbh.actual_start_date,
GBH.BATCH_CLOSE_DATE,
DECODE(xah.event_type_code,'MANUAL',xah.event_type_code,'NON-MANUAL')Man_NonMan,
XAL.ACCOUNTING_CLASS_CODE,
XAH.Accounting_date,
XAL.CODE_COMBINATION_ID,
FND_FLEX_EXT.GET_SEGS('SQLGL','GL#', gcc.chart_of_accounts_id, gcc.code_combination_id) Account,
TO_CHAR(SUM(NVL(accounted_cr,0))),
TO_CHAR(SUM(NVL(accounted_dr,0)))
FROM
XLA_AE_LINES XAL,
XLA_AE_HEADERS XAH,
gme_batch_header gbh,
GMF_XLA_EXTRACT_HEADERS EH,
GMF_XLA_EXTRACT_LINES EL,
mtl_parameters mp,
gl_code_combinations gcc
WHERE xal.ae_header_id = xah.ae_header_id
AND XAL.APPLICATION_ID = XAH.APPLICATION_ID
AND XAL.APPLICATION_ID = 555
AND XAL.code_combination_id = gcc.code_combination_id(+)
AND eh.header_id = el.header_id
AND eh.source_document_id = gbh.batch_id
AND eh.txn_source = 'PM'
AND el.journal_line_type = 'WIP'
AND GBH.BATCH_STATUS = 4
AND XAH.EVENT_ID = EH.EVENT_ID
AND MP.ORGANIZATION_ID = EH.ORGANIZATION_ID
AND EH.LEGAL_ENTITY_ID = 996 --modify with LE
AND MP.ORGANIZATION_CODE = 'PR1' --modify with Organization code
AND ( TO_CHAR(GBH.ACTUAL_START_DATE, 'MON-YYYY') = 'JAN-2014' --Modify the start date
OR TO_CHAR(GBH.BATCH_CLOSE_DATE,'MON-YYYY') = 'JAN-2014' ) --modify the end date
GROUP BY eh.legal_entity_id,
mp.organization_code,
gbh.batch_no,
gbh.actual_start_date,
gbh.batch_close_date,
DECODE(xah.event_type_code,'MANUAL',xah.event_type_code,'NON-MANUAL'),
XAL.ACCOUNTING_CLASS_CODE,
XAH.Accounting_date,
xal.code_combination_id,
FND_FLEX_EXT.GET_SEGS('SQLGL','GL#', GCC.CHART_OF_ACCOUNTS_ID, GCC.CODE_COMBINATION_ID)
;
No comments:
Post a Comment