SELECT GLLG.LEDGER_ID,GLLG.NAME, GLLG.LEDGER_CATEGORY_CODE ,
FLX.APPLICATION_ID, FLX.ID_FLEX_CODE, FLX.ID_FLEX_NAME ,
STR_TL.ID_FLEX_NUM, STR.ID_FLEX_STRUCTURE_CODE, STR_TL.ID_FLEX_STRUCTURE_NAME ,STR_TL.DESCRIPTION ,
SEG.SEGMENT_NAME,SEG.SEGMENT_NUM,SEG.APPLICATION_COLUMN_NAME,SEG.ENABLED_FLAG,SEG.SECURITY_ENABLED_FLAG--,SEG.FLEX_VALUE_SET_ID
,FLX_RULES.*
FROM FND_ID_FLEXS FLX
,FND_ID_FLEX_STRUCTURES_TL STR_TL
,FND_ID_FLEX_STRUCTURES STR
,FND_ID_FLEX_SEGMENTS SEG
,GL_LEDGERS GLLG
,(SELECT APS.APPLICATION_NAME ,
APS.APPLICATION_ID ,
FVR.FLEX_VALUE_RULE_NAME ,
RSP.RESPONSIBILITY_ID RESPONSIBILITY_ID,
RSP.RESPONSIBILITY_KEY RESPONSIBILITY,
FVR.FLEX_VALUE_SET_ID , VS.FLEX_VALUE_SET_NAME, VS.DESCRIPTION FLEX_VALUE_SET_DESC,
DECODE(FVRL.INCLUDE_EXCLUDE_INDICATOR,'E','EXCLUDE','I','INCLUDE') INC_EXC,
FVRL.FLEX_VALUE_LOW, FVRL.FLEX_VALUE_HIGH,
USR.USER_ID, USR.USER_NAME, USR_GRP.START_DATE, USR_GRP.END_DATE
FROM FND_FLEX_VALUE_RULES FVR,
FND_FLEX_VALUE_RULE_USAGES RU,
FND_FLEX_VALUE_RULE_LINES FVRL,
FND_RESPONSIBILITY RSP,
FND_APPLICATION_TL APS,
FND_FLEX_VALUE_SETS VS,
APPS.FND_USER_RESP_GROUPS USR_GRP,
APPS.FND_USER USR
WHERE 1=1
AND FVR.FLEX_VALUE_RULE_ID = RU.FLEX_VALUE_RULE_ID
AND FVR.FLEX_VALUE_RULE_ID = FVRL.FLEX_VALUE_RULE_ID
AND FVR.FLEX_VALUE_SET_ID = FVRL.FLEX_VALUE_SET_ID
AND RU.RESPONSIBILITY_ID = RSP.RESPONSIBILITY_ID
AND RU.APPLICATION_ID = APS.APPLICATION_ID
AND FVR.FLEX_VALUE_SET_ID = VS.FLEX_VALUE_SET_ID
AND RSP.RESPONSIBILITY_ID = USR_GRP.RESPONSIBILITY_ID
AND USR_GRP.USER_ID = USR.USER_ID
)FLX_RULES
WHERE 1=1
AND STR.APPLICATION_ID = STR_TL.APPLICATION_ID
and STR.ID_FLEX_CODE = STR_TL.ID_FLEX_CODE
and STR.ID_FLEX_NUM = STR_TL.ID_FLEX_NUM
AND FLX.APPLICATION_ID = STR_TL.APPLICATION_ID
AND FLX.ID_FLEX_CODE = STR_TL.ID_FLEX_CODE
AND STR_TL.LANGUAGE = USERENV('LANG')
AND STR_TL.APPLICATION_ID = SEG.APPLICATION_ID
AND STR_TL.ID_FLEX_CODE = SEG.ID_FLEX_CODE
AND STR_TL.ID_FLEX_NUM = SEG.ID_FLEX_NUM
AND STR_TL.ID_FLEX_NUM = GLLG.CHART_OF_ACCOUNTS_ID
AND FLX_RULES.FLEX_VALUE_SET_ID(+) = SEG.FLEX_VALUE_SET_ID
--AND FLX.ID_FLEX_NAME = 'System Items'
--AND STR_TL.ID_FLEX_STRUCTURE_NAME = 'System Items'
AND STR.ID_FLEX_STRUCTURE_CODE = 'SYSTEM_ITEMS'
--AND GLLG.LEDGER_ID = 1078 --SET OF BOOK
No comments:
Post a Comment