Following Query To Get Journal Details With Drill Down Of Journal Entry
ELECT --gjl.JE_HEADER_ID,gjl.je_line_num,gir.gl_sl_link_id , xlal.gl_sl_link_id,xlal.*
gjh.NAME "Journal Entry Name",gjh.JE_HEADER_ID,xlah.ae_header_id,
fnd_flex_ext.get_segs ('SQLGL',
'GL#',
xgl.chart_of_accounts_id,
xlal.code_combination_id)
ACCOUNT,
gcck.CONCATENATED_SEGMENTS gl_account_number,
NVL (xlal.ACCOUNTED_DR, 0) Accounted_dr,
NVL (xlal.ACCOUNTED_CR, 0) Accounted_cr,
gjh.PERIOD_NAME period,
gjh.DEFAULT_EFFECTIVE_DATE Effective_date,
gjh.DATE_CREATED Entery_date,
gjl.DESCRIPTION JE_DESCRIPTION,
gjh.CURRENCY_CODE,
xlate.transaction_number xla_trx_transaction_number,
xlah.event_id,
xlate.entity_id,
xlate.source_id_int_1,
xlate.SOURCE_ID_INT_2,
gjh.JE_SOURCE,
gjh.JE_CATEGORY,
xlate.entity_code,
xx_ads_gl_pkg.xx_ads_gl_prepareid (gjh.JE_SOURCE,
jc.user_je_category_name,
xlate.entity_code,
xlate.entity_id,
xlah.event_id,gjh.JE_HEADER_ID)
prepare_id --,xlate.*
,
jc.user_je_category_name Journal_Category
, xl3.meaning Journal_Entry_Type,xlate.SECURITY_ID_INT_1,gjh.DOC_SEQUENCE_VALUE
,gl.NAME ou_name
/* xx_ads_gl_pkg.xx_ads_gl_ouname (gjh.JE_SOURCE,
jc.user_je_category_name,
xlate.entity_code,
xlate.entity_id,
xlah.event_id,gjh.JE_HEADER_ID) ou_name*/
FROM gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations_kfv gcck,
gl_import_references gir,
xla.xla_ae_lines xlal,
xla.xla_ae_headers xlah,
xla.xla_events xlae,
xla.xla_transaction_entities xlate,
xla_gl_ledgers_v xgl,
gl_je_categories jc,
xla_lookups xl3,
gl_ledgers gl
WHERE gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
--AND gjh.JE_HEADER_ID =20129--24092-- 64524 --3328
-- and xlah.event_id=43049
AND gjl.CODE_COMBINATION_ID = gcck.CODE_COMBINATION_ID
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gir.gl_sl_link_table = xlal.gl_sl_link_table
AND gir.gl_sl_link_id = xlal.gl_sl_link_id
AND xlal.application_id = xlah.application_id
AND xlal.ae_header_id = xlah.ae_header_id
AND xlah.event_id = xlae.event_id
AND xlae.application_id = xlate.application_id
AND xlae.entity_id = xlate.entity_id
AND xgl.ledger_id = xlah.ledger_id
AND xlah.je_category_name = jc.je_category_name
AND xl3.lookup_type = 'XLA_ACCOUNTING_ENTRY_TYPE'
AND xl3.lookup_code = xlah.accounting_entry_type_code
AND gl.LEDGER_ID=gjh.LEDGER_ID
and gjl.LEDGER_ID=nvl(:P_LEDGER_ID,gjl.LEDGER_ID)
and gjh.ACTUAL_FLAG='A'
-- AND trunc(gjh.POSTED_DATE) BETWEEN '05-May-2013' AND '05-May-2013'
AND trunc(gjh.DEFAULT_EFFECTIVE_DATE) BETWEEN nvl(:P_FROM_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE)) AND nvl(:P_TO_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE))
UNION
SELECT --gjl.JE_HEADER_ID,gjl.je_line_num,gir.gl_sl_link_id , xlal.gl_sl_link_id,xlal.*
gjh.NAME "Journal Entry Name",gjh.JE_HEADER_ID, null ae_header_id,
fnd_flex_ext.get_segs ('SQLGL',
'GL#',
gcck.chart_of_accounts_id,
gjl.code_combination_id)
ACCOUNT,
gcck.CONCATENATED_SEGMENTS gl_account_number,
NVL (gjl.ACCOUNTED_DR, 0) Accounted_dr,
NVL (gjl.ACCOUNTED_CR, 0) Accounted_cr,
gjh.PERIOD_NAME period,
gjh.DEFAULT_EFFECTIVE_DATE Effective_date,
gjh.DATE_CREATED Entery_date,
gjl.DESCRIPTION JE_DESCRIPTION,
gjh.CURRENCY_CODE,
null xla_trx_transaction_number,
null event_id,
null entity_id,
null source_id_int_1,
null SOURCE_ID_INT_2,
gjh.JE_SOURCE,
gjh.JE_CATEGORY,
null entity_code,
xx_ads_gl_pkg.xx_ads_gl_prepareid (gjh.JE_SOURCE,
jc.user_je_category_name,
null,
null,
null,gjh.JE_HEADER_ID)
prepare_id ,
jc.user_je_category_name Journal_Category,
null Journal_Entry_Type,null SECURITY_ID_INT_1,gjh.DOC_SEQUENCE_VALUE
,gl.NAME ou_name
/*xx_ads_gl_pkg.xx_ads_gl_ouname(gjh.JE_SOURCE,
jc.user_je_category_name,
null,
null,
null,gjh.JE_HEADER_ID) ou_name*/
FROM gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations_kfv gcck,
gl_je_categories jc,
gl_ledgers gl
WHERE gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
--AND gjh.JE_HEADER_ID =35344
and gjh.PARENT_JE_HEADER_ID is null
AND gjl.CODE_COMBINATION_ID = gcck.CODE_COMBINATION_ID
AND gjh.JE_CATEGORY = jc.je_category_name
and gjh.JE_SOURCE='Manual'
and gjh.ACTUAL_FLAG='A'
AND gl.LEDGER_ID=gjh.LEDGER_ID
and gjl.LEDGER_ID=nvl(:P_LEDGER_ID,gjl.LEDGER_ID)
-- AND trunc(gjh.POSTED_DATE) BETWEEN '05-May-2013' AND '05-May-2013'
AND trunc(gjh.DEFAULT_EFFECTIVE_DATE) BETWEEN nvl(:P_FROM_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE)) AND nvl(:P_TO_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE))
ELECT --gjl.JE_HEADER_ID,gjl.je_line_num,gir.gl_sl_link_id , xlal.gl_sl_link_id,xlal.*
gjh.NAME "Journal Entry Name",gjh.JE_HEADER_ID,xlah.ae_header_id,
fnd_flex_ext.get_segs ('SQLGL',
'GL#',
xgl.chart_of_accounts_id,
xlal.code_combination_id)
ACCOUNT,
gcck.CONCATENATED_SEGMENTS gl_account_number,
NVL (xlal.ACCOUNTED_DR, 0) Accounted_dr,
NVL (xlal.ACCOUNTED_CR, 0) Accounted_cr,
gjh.PERIOD_NAME period,
gjh.DEFAULT_EFFECTIVE_DATE Effective_date,
gjh.DATE_CREATED Entery_date,
gjl.DESCRIPTION JE_DESCRIPTION,
gjh.CURRENCY_CODE,
xlate.transaction_number xla_trx_transaction_number,
xlah.event_id,
xlate.entity_id,
xlate.source_id_int_1,
xlate.SOURCE_ID_INT_2,
gjh.JE_SOURCE,
gjh.JE_CATEGORY,
xlate.entity_code,
xx_ads_gl_pkg.xx_ads_gl_prepareid (gjh.JE_SOURCE,
jc.user_je_category_name,
xlate.entity_code,
xlate.entity_id,
xlah.event_id,gjh.JE_HEADER_ID)
prepare_id --,xlate.*
,
jc.user_je_category_name Journal_Category
, xl3.meaning Journal_Entry_Type,xlate.SECURITY_ID_INT_1,gjh.DOC_SEQUENCE_VALUE
,gl.NAME ou_name
/* xx_ads_gl_pkg.xx_ads_gl_ouname (gjh.JE_SOURCE,
jc.user_je_category_name,
xlate.entity_code,
xlate.entity_id,
xlah.event_id,gjh.JE_HEADER_ID) ou_name*/
FROM gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations_kfv gcck,
gl_import_references gir,
xla.xla_ae_lines xlal,
xla.xla_ae_headers xlah,
xla.xla_events xlae,
xla.xla_transaction_entities xlate,
xla_gl_ledgers_v xgl,
gl_je_categories jc,
xla_lookups xl3,
gl_ledgers gl
WHERE gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
--AND gjh.JE_HEADER_ID =20129--24092-- 64524 --3328
-- and xlah.event_id=43049
AND gjl.CODE_COMBINATION_ID = gcck.CODE_COMBINATION_ID
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gir.gl_sl_link_table = xlal.gl_sl_link_table
AND gir.gl_sl_link_id = xlal.gl_sl_link_id
AND xlal.application_id = xlah.application_id
AND xlal.ae_header_id = xlah.ae_header_id
AND xlah.event_id = xlae.event_id
AND xlae.application_id = xlate.application_id
AND xlae.entity_id = xlate.entity_id
AND xgl.ledger_id = xlah.ledger_id
AND xlah.je_category_name = jc.je_category_name
AND xl3.lookup_type = 'XLA_ACCOUNTING_ENTRY_TYPE'
AND xl3.lookup_code = xlah.accounting_entry_type_code
AND gl.LEDGER_ID=gjh.LEDGER_ID
and gjl.LEDGER_ID=nvl(:P_LEDGER_ID,gjl.LEDGER_ID)
and gjh.ACTUAL_FLAG='A'
-- AND trunc(gjh.POSTED_DATE) BETWEEN '05-May-2013' AND '05-May-2013'
AND trunc(gjh.DEFAULT_EFFECTIVE_DATE) BETWEEN nvl(:P_FROM_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE)) AND nvl(:P_TO_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE))
UNION
SELECT --gjl.JE_HEADER_ID,gjl.je_line_num,gir.gl_sl_link_id , xlal.gl_sl_link_id,xlal.*
gjh.NAME "Journal Entry Name",gjh.JE_HEADER_ID, null ae_header_id,
fnd_flex_ext.get_segs ('SQLGL',
'GL#',
gcck.chart_of_accounts_id,
gjl.code_combination_id)
ACCOUNT,
gcck.CONCATENATED_SEGMENTS gl_account_number,
NVL (gjl.ACCOUNTED_DR, 0) Accounted_dr,
NVL (gjl.ACCOUNTED_CR, 0) Accounted_cr,
gjh.PERIOD_NAME period,
gjh.DEFAULT_EFFECTIVE_DATE Effective_date,
gjh.DATE_CREATED Entery_date,
gjl.DESCRIPTION JE_DESCRIPTION,
gjh.CURRENCY_CODE,
null xla_trx_transaction_number,
null event_id,
null entity_id,
null source_id_int_1,
null SOURCE_ID_INT_2,
gjh.JE_SOURCE,
gjh.JE_CATEGORY,
null entity_code,
xx_ads_gl_pkg.xx_ads_gl_prepareid (gjh.JE_SOURCE,
jc.user_je_category_name,
null,
null,
null,gjh.JE_HEADER_ID)
prepare_id ,
jc.user_je_category_name Journal_Category,
null Journal_Entry_Type,null SECURITY_ID_INT_1,gjh.DOC_SEQUENCE_VALUE
,gl.NAME ou_name
/*xx_ads_gl_pkg.xx_ads_gl_ouname(gjh.JE_SOURCE,
jc.user_je_category_name,
null,
null,
null,gjh.JE_HEADER_ID) ou_name*/
FROM gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations_kfv gcck,
gl_je_categories jc,
gl_ledgers gl
WHERE gjh.JE_HEADER_ID = gjl.JE_HEADER_ID
--AND gjh.JE_HEADER_ID =35344
and gjh.PARENT_JE_HEADER_ID is null
AND gjl.CODE_COMBINATION_ID = gcck.CODE_COMBINATION_ID
AND gjh.JE_CATEGORY = jc.je_category_name
and gjh.JE_SOURCE='Manual'
and gjh.ACTUAL_FLAG='A'
AND gl.LEDGER_ID=gjh.LEDGER_ID
and gjl.LEDGER_ID=nvl(:P_LEDGER_ID,gjl.LEDGER_ID)
-- AND trunc(gjh.POSTED_DATE) BETWEEN '05-May-2013' AND '05-May-2013'
AND trunc(gjh.DEFAULT_EFFECTIVE_DATE) BETWEEN nvl(:P_FROM_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE)) AND nvl(:P_TO_DATE,trunc(gjh.DEFAULT_EFFECTIVE_DATE))
No comments:
Post a Comment