1095: END Delete_LVS_Records;
1096:
1097:
1098: -- **************************************************************************
1099: -- Populate FII_FIN_CAT_MAPPINGS_GT Table for FIN_CAT_MAPPINGS
1100:
1101: PROCEDURE Get_FC_Mapping_GT IS
1102:
1103: Begin
1106: FII_MESSAGE.Func_Ent(func_name => 'FII_FIN_CAT_MAINTAIN_PKG.'||
1107: 'Get_FC_Mapping_GT');
1108: END IF;
1109:
1110: --First, populate FII_FIN_CAT_MAPPINGS_GT with the truncated portion
1111: --of the financial category hierarchy.
1112: --Note this already includes all self leaf records
1113: g_phase := 'populate FII_FIN_CAT_MAPPINGS_GT with truncated portion';
1114:
1109:
1110: --First, populate FII_FIN_CAT_MAPPINGS_GT with the truncated portion
1111: --of the financial category hierarchy.
1112: --Note this already includes all self leaf records
1113: g_phase := 'populate FII_FIN_CAT_MAPPINGS_GT with truncated portion';
1114:
1115: INSERT INTO FII_FIN_CAT_MAPPINGS_GT
1116: (parent_fin_cat_id,
1117: child_fin_cat_id)
1111: --of the financial category hierarchy.
1112: --Note this already includes all self leaf records
1113: g_phase := 'populate FII_FIN_CAT_MAPPINGS_GT with truncated portion';
1114:
1115: INSERT INTO FII_FIN_CAT_MAPPINGS_GT
1116: (parent_fin_cat_id,
1117: child_fin_cat_id)
1118: SELECT fh.parent_fin_cat_id,
1119: fh.child_fin_cat_id
1123: FROM FII_FIN_ITEM_HIERARCHIES ph
1124: WHERE ph.is_leaf_flag = 'Y');
1125:
1126: IF (FIIDIM_Debug) THEN
1127: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_MAPPINGS_GT');
1128: END IF;
1129:
1130: --Then, insert self-mapping records for all nodes in pruned hierarchy
1131: --FII_FIN_ITEM_HIERARCHIES. Note we should exclude all self leaf
1131: --FII_FIN_ITEM_HIERARCHIES. Note we should exclude all self leaf
1132: --records since they are inserted in the previous step.
1133: g_phase := 'insert self-mapping records for all nodes in pruned hierarchy';
1134:
1135: INSERT INTO FII_FIN_CAT_MAPPINGS_GT
1136: (parent_fin_cat_id,
1137: child_fin_cat_id)
1138: SELECT parent_fin_cat_id,
1139: child_fin_cat_id
1142: AND parent_fin_cat_id = child_fin_cat_id
1143: AND is_leaf_flag = 'N';
1144:
1145: IF (FIIDIM_Debug) THEN
1146: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_MAPPINGS_GT');
1147: END IF;
1148:
1149: --Call FND_STATS to collect statistics after populating the table
1150: g_phase := 'gather_table_stats for FII_FIN_CAT_MAPPINGS_GT';
1146: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_MAPPINGS_GT');
1147: END IF;
1148:
1149: --Call FND_STATS to collect statistics after populating the table
1150: g_phase := 'gather_table_stats for FII_FIN_CAT_MAPPINGS_GT';
1151:
1152: FND_STATS.gather_table_stats
1153: (ownname => g_schema_name,
1154: tabname => 'FII_FIN_CAT_MAPPINGS_GT');
1150: g_phase := 'gather_table_stats for FII_FIN_CAT_MAPPINGS_GT';
1151:
1152: FND_STATS.gather_table_stats
1153: (ownname => g_schema_name,
1154: tabname => 'FII_FIN_CAT_MAPPINGS_GT');
1155:
1156: IF (FIIDIM_Debug) THEN
1157: FII_MESSAGE.Func_Succ(func_name => 'FII_FIN_CAT_MAINTAIN_PKG.Get_FC_Mapping_GT');
1158: END IF;
1818: commit;
1819:
1820: --================================================================--
1821: --Populate FII_FIN_CAT_MAPPINGS table
1822: g_phase := 'Populate FII_FIN_CAT_MAPPINGS_GT table';
1823:
1824: Get_FC_Mapping_GT;
1825:
1826: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_LEAF_MAPS
1822: g_phase := 'Populate FII_FIN_CAT_MAPPINGS_GT table';
1823:
1824: Get_FC_Mapping_GT;
1825:
1826: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_LEAF_MAPS
1827: g_phase := 'Copy TMP FC Mapping table to the FC Mapping Table';
1828:
1829: FII_UTIL.truncate_table ('FII_FIN_CAT_LEAF_MAPS', 'FII', g_retcode);
1830:
1843: FII_USER_ID,
1844: SYSDATE,
1845: FII_USER_ID,
1846: FII_LOGIN_ID
1847: FROM FII_FIN_CAT_MAPPINGS_GT;
1848:
1849: IF (FIIDIM_Debug) THEN
1850: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_LEAF_MAPS');
1851: END IF;
1849: IF (FIIDIM_Debug) THEN
1850: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_LEAF_MAPS');
1851: END IF;
1852:
1853: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_MAPPINGS
1854: g_phase := 'Copy TMP FC Mapping table to the FC Mapping Table';
1855:
1856: FII_UTIL.truncate_table ('FII_FIN_CAT_MAPPINGS', 'FII', g_retcode);
1857:
1870: FII_USER_ID,
1871: SYSDATE,
1872: FII_USER_ID,
1873: FII_LOGIN_ID
1874: FROM FII_FIN_CAT_MAPPINGS_GT;
1875:
1876: IF (FIIDIM_Debug) THEN
1877: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_MAPPINGS');
1878: END IF;
2362: -- tabname => 'FII_FIN_ITEM_HIERARCHIES');
2363:
2364: --================================================================--
2365: --Populate FII_FIN_CAT_MAPPINGS table
2366: g_phase := 'Populate FII_FIN_CAT_MAPPINGS_GT table';
2367:
2368: Get_FC_Mapping_GT;
2369:
2370: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_LEAF_MAPS
2366: g_phase := 'Populate FII_FIN_CAT_MAPPINGS_GT table';
2367:
2368: Get_FC_Mapping_GT;
2369:
2370: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_LEAF_MAPS
2371: g_phase := 'DELETE FROM FII_FIN_CAT_LEAF_MAPS';
2372:
2373: DELETE FROM FII_FIN_CAT_LEAF_MAPS
2374: WHERE
2376: (SELECT parent_fin_cat_id, child_fin_cat_id
2377: FROM FII_FIN_CAT_LEAF_MAPS
2378: MINUS
2379: SELECT parent_fin_cat_id, child_fin_cat_id
2380: FROM FII_FIN_CAT_MAPPINGS_GT);
2381:
2382: IF (FIIDIM_Debug) THEN
2383: FII_UTIL.Write_Log('Deleted ' || SQL%ROWCOUNT || ' rows from FII_FIN_CAT_LEAF_MAPS');
2384: END IF;
2399: FII_USER_ID,
2400: SYSDATE,
2401: FII_USER_ID,
2402: FII_LOGIN_ID
2403: FROM FII_FIN_CAT_MAPPINGS_GT
2404: MINUS
2405: SELECT parent_fin_cat_id,
2406: child_fin_cat_id,
2407: SYSDATE,
2414: IF (FIIDIM_Debug) THEN
2415: FII_UTIL.Write_Log('Inserted ' || SQL%ROWCOUNT || ' rows into FII_FIN_CAT_LEAF_MAPS');
2416: END IF;
2417:
2418: --Copy FII_FIN_CAT_MAPPINGS_GT to FII_FIN_CAT_MAPPINGS
2419:
2420: g_phase := 'DELETE FROM FII_FIN_CAT_MAPPINGS';
2421:
2422: DELETE FROM FII_FIN_CAT_MAPPINGS
2425: (SELECT parent_fin_cat_id, child_fin_cat_id
2426: FROM FII_FIN_CAT_MAPPINGS
2427: MINUS
2428: SELECT parent_fin_cat_id, child_fin_cat_id
2429: FROM FII_FIN_CAT_MAPPINGS_GT);
2430:
2431: IF (FIIDIM_Debug) THEN
2432: FII_UTIL.Write_Log('Deleted ' || SQL%ROWCOUNT || ' rows from FII_FIN_CAT_MAPPINGS');
2433: END IF;
2448: FII_USER_ID,
2449: SYSDATE,
2450: FII_USER_ID,
2451: FII_LOGIN_ID
2452: FROM FII_FIN_CAT_MAPPINGS_GT
2453: MINUS
2454: SELECT parent_fin_cat_id,
2455: child_fin_cat_id,
2456: SYSDATE,