6:
7: ------------------------------------------------------------------------------------
8: -- Common variables
9: ------------------------------------------------------------------------------------
10: l_log_current_level NUMBER := FND_LOG.g_current_runtime_level;
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
7: ------------------------------------------------------------------------------------
8: -- Common variables
9: ------------------------------------------------------------------------------------
10: l_log_current_level NUMBER := FND_LOG.g_current_runtime_level;
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
15: l_log_unexpected NUMBER := FND_LOG.level_unexpected;
8: -- Common variables
9: ------------------------------------------------------------------------------------
10: l_log_current_level NUMBER := FND_LOG.g_current_runtime_level;
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
15: l_log_unexpected NUMBER := FND_LOG.level_unexpected;
16: ------------------------------------------------------------------------------------
9: ------------------------------------------------------------------------------------
10: l_log_current_level NUMBER := FND_LOG.g_current_runtime_level;
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
15: l_log_unexpected NUMBER := FND_LOG.level_unexpected;
16: ------------------------------------------------------------------------------------
17:
10: l_log_current_level NUMBER := FND_LOG.g_current_runtime_level;
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
15: l_log_unexpected NUMBER := FND_LOG.level_unexpected;
16: ------------------------------------------------------------------------------------
17:
18: -- Added by rbhavsar on July 25, 2007 to remap IB Tree Nodes to fix FP bug 6276991
11: l_log_statement NUMBER := FND_LOG.level_statement;
12: l_log_procedure NUMBER := FND_LOG.level_procedure;
13: l_log_error NUMBER := FND_LOG.level_error;
14: l_log_exception NUMBER := FND_LOG.level_exception;
15: l_log_unexpected NUMBER := FND_LOG.level_unexpected;
16: ------------------------------------------------------------------------------------
17:
18: -- Added by rbhavsar on July 25, 2007 to remap IB Tree Nodes to fix FP bug 6276991
19: TYPE T_ID_TBL IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
128: IF FND_API.to_boolean( p_init_msg_list ) THEN
129: FND_MSG_PUB.initialize;
130: END IF;
131:
132: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
133: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
134: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
135: 'At the start of the procedure');
136: END IF;
129: FND_MSG_PUB.initialize;
130: END IF;
131:
132: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
133: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
134: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
135: 'At the start of the procedure');
136: END IF;
137:
260: END IF;
261: END LOOP;
262: END IF;
263:
264: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
265: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
266: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': After normal execution',
267: 'At the end of the procedure');
268: END IF;
261: END LOOP;
262: END IF;
263:
264: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
265: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
266: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': After normal execution',
267: 'At the end of the procedure');
268: END IF;
269:
660: IF FND_API.to_boolean( p_init_msg_list ) THEN
661: FND_MSG_PUB.initialize;
662: END IF;
663:
664: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
665: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
666: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
667: 'At the start of the procedure');
668: END IF;
661: FND_MSG_PUB.initialize;
662: END IF;
663:
664: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
665: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
666: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
667: 'At the start of the procedure');
668: END IF;
669: --Validate the input parameter and get the root instance_id and relationship_id
723: );
724:
725: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
726: IF (l_log_statement >= l_log_current_level) THEN
727: FND_LOG.string(l_log_statement, 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
728: ' AHL_SB_RULES_PVT.Get_Violated_Instances call errored out');
729: END IF;
730: RAISE FND_API.G_EXC_ERROR;
731: END IF;
1049: END LOOP;
1050: END IF; --whether l_non_leaf_node is extra node
1051: END LOOP; --loop of get_non_leaf_nodes
1052:
1053: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1054: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1055: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': After normal execution',
1056: 'At the end of the procedure');
1057: END IF;
1050: END IF; --whether l_non_leaf_node is extra node
1051: END LOOP; --loop of get_non_leaf_nodes
1052:
1053: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1054: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1055: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': After normal execution',
1056: 'At the end of the procedure');
1057: END IF;
1058: -- Get all the error messages from the previous steps (if any) and raise the appropriate Exception
1362: IF FND_API.to_boolean( p_init_msg_list ) THEN
1363: FND_MSG_PUB.initialize;
1364: END IF;
1365:
1366: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1367: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1368: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
1369: 'At the start of the procedure');
1370: END IF;
1363: FND_MSG_PUB.initialize;
1364: END IF;
1365:
1366: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1367: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1368: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||': Begin API',
1369: 'At the start of the procedure');
1370: END IF;
1371:
1604: FND_MESSAGE.set_name('AHL', 'AHL_UC_HISTORY_COPY_FAILED');
1605: FND_MSG_PUB.add;
1606: END IF;
1607:
1608: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1609: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
1610: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':Within API',
1611: 'After updating the master_config_id');
1612: END IF;
1605: FND_MSG_PUB.add;
1606: END IF;
1607:
1608: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1609: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
1610: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':Within API',
1611: 'After updating the master_config_id');
1612: END IF;
1613:
1727: END IF; --whether it is a node belonging to subuc or extra node branch
1728: CLOSE check_subuc_extra;
1729: END LOOP; --of all non leaf nodes
1730:
1731: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1732: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
1733: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':Within API',
1734: 'After migration the whole UC tree');
1735: END IF;
1728: CLOSE check_subuc_extra;
1729: END LOOP; --of all non leaf nodes
1730:
1731: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1732: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
1733: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':Within API',
1734: 'After migration the whole UC tree');
1735: END IF;
1736:
1830: FND_MSG_PUB.add;
1831: END IF;
1832: END IF;
1833:
1834: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1835: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1836: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':After normal execution',
1837: 'Status changed and at the end of the procedure');
1838: END IF;
1831: END IF;
1832: END IF;
1833:
1834: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1835: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
1836: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||':After normal execution',
1837: 'Status changed and at the end of the procedure');
1838: END IF;
1839:
2086: --Initialize message list if p_init_msg_list is set to TRUE.
2087: IF FND_API.to_boolean( p_init_msg_list ) THEN
2088: FND_MSG_PUB.initialize;
2089: END IF;
2090: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2091: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
2092: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.begin',
2093: 'At the start of the procedure, p_instance_id = ' || p_instance_id || ', p_relationship_id = ' || p_relationship_id);
2094: END IF;
2087: IF FND_API.to_boolean( p_init_msg_list ) THEN
2088: FND_MSG_PUB.initialize;
2089: END IF;
2090: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2091: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
2092: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.begin',
2093: 'At the start of the procedure, p_instance_id = ' || p_instance_id || ', p_relationship_id = ' || p_relationship_id);
2094: END IF;
2095: --Validate the input parameter p_instance_id
2274:
2275: -- Added by rbhavsar on July 25, 2007 to remap IB Tree Nodes to fix FP bug 6276991
2276: Remap_IB_Tree(p_instance_id, p_relationship_id);
2277:
2278: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2279: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
2280: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.end',
2281: 'At the end of the procedure');
2282: END IF;
2275: -- Added by rbhavsar on July 25, 2007 to remap IB Tree Nodes to fix FP bug 6276991
2276: Remap_IB_Tree(p_instance_id, p_relationship_id);
2277:
2278: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2279: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE,
2280: 'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.end',
2281: 'At the end of the procedure');
2282: END IF;
2283: -- Get all the error messages from the previous steps (if any) and raise the appropriate Exception
2411: l_return_value BOOLEAN;
2412: l_transaction_type_id NUMBER;
2413:
2414: BEGIN
2415: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2416: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.begin',
2417: 'At the start of the procedure, p_instance_id = ' || p_instance_id || ', p_relationship_id = ' || p_relationship_id);
2418: END IF;
2419:
2412: l_transaction_type_id NUMBER;
2413:
2414: BEGIN
2415: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2416: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.begin',
2417: 'At the start of the procedure, p_instance_id = ' || p_instance_id || ', p_relationship_id = ' || p_relationship_id);
2418: END IF;
2419:
2420: -- Get the transaction_type_id for use later by the CSI_II_RELATIONSHIPS_PUB.update_relationship API
2429: -- Get all nodes that are non-extra nodes
2430: FOR l_nonextra_instances IN get_premapped_instances_csr LOOP
2431: -- Validate if the instance still matches the position
2432: -- Check if l_nonextra_instances.position_reference is under the position p_relationship_id
2433: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2434: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2435: 'Non Extra Node: l_nonextra_instances.subject_id = ' || l_nonextra_instances.subject_id ||
2436: ', l_nonextra_instances.position_reference = ' || l_nonextra_instances.position_reference);
2437: END IF;
2430: FOR l_nonextra_instances IN get_premapped_instances_csr LOOP
2431: -- Validate if the instance still matches the position
2432: -- Check if l_nonextra_instances.position_reference is under the position p_relationship_id
2433: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2434: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2435: 'Non Extra Node: l_nonextra_instances.subject_id = ' || l_nonextra_instances.subject_id ||
2436: ', l_nonextra_instances.position_reference = ' || l_nonextra_instances.position_reference);
2437: END IF;
2438: OPEN validate_position_csr(TO_NUMBER(l_nonextra_instances.position_reference));
2448: l_csi_relationship_rec.position_reference := null; -- Nullify the relationship
2449: l_csi_relationship_rec.object_id := l_ii_rel_dtls.object_id;
2450: l_csi_relationship_rec.subject_id := l_ii_rel_dtls.subject_id;
2451: l_csi_relationship_tbl(1) := l_csi_relationship_rec;
2452: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2453: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2454: 'About to call CSI_II_RELATIONSHIPS_PUB.update_relationship to update CSI II relationship with id ' ||
2455: l_ii_rel_dtls.relationship_id || ' between ' ||
2456: l_ii_rel_dtls.object_id || ' (object) and ' ||
2449: l_csi_relationship_rec.object_id := l_ii_rel_dtls.object_id;
2450: l_csi_relationship_rec.subject_id := l_ii_rel_dtls.subject_id;
2451: l_csi_relationship_tbl(1) := l_csi_relationship_rec;
2452: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2453: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2454: 'About to call CSI_II_RELATIONSHIPS_PUB.update_relationship to update CSI II relationship with id ' ||
2455: l_ii_rel_dtls.relationship_id || ' between ' ||
2456: l_ii_rel_dtls.object_id || ' (object) and ' ||
2457: l_ii_rel_dtls.subject_id || '(subject) with NULL position_reference ');
2469: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2470: END IF;
2471: ELSE
2472: -- Position Matches at current level: Drill down by calling Remap_IB_Tree recursively
2473: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2474: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2475: 'About to recursively call Remap_IB_Tree with p_instance_id = ' || l_nonextra_instances.subject_id ||
2476: ', p_relationship_id =' || l_nonextra_instances.position_reference);
2477: END IF;
2470: END IF;
2471: ELSE
2472: -- Position Matches at current level: Drill down by calling Remap_IB_Tree recursively
2473: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2474: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2475: 'About to recursively call Remap_IB_Tree with p_instance_id = ' || l_nonextra_instances.subject_id ||
2476: ', p_relationship_id =' || l_nonextra_instances.position_reference);
2477: END IF;
2478: Remap_IB_Tree(p_instance_id => l_nonextra_instances.subject_id,
2476: ', p_relationship_id =' || l_nonextra_instances.position_reference);
2477: END IF;
2478: Remap_IB_Tree(p_instance_id => l_nonextra_instances.subject_id,
2479: p_relationship_id => TO_NUMBER(l_nonextra_instances.position_reference));
2480: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2481: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2482: 'Returned from recursive call to Remap_IB_Tree.');
2483: END IF;
2484: END IF;
2477: END IF;
2478: Remap_IB_Tree(p_instance_id => l_nonextra_instances.subject_id,
2479: p_relationship_id => TO_NUMBER(l_nonextra_instances.position_reference));
2480: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2481: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2482: 'Returned from recursive call to Remap_IB_Tree.');
2483: END IF;
2484: END IF;
2485: CLOSE validate_position_csr;
2489: OPEN get_extra_children_csr;
2490: FETCH get_extra_children_csr BULK COLLECT INTO l_extra_instances_tbl;
2491: CLOSE get_extra_children_csr;
2492:
2493: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2494: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2495: 'Number of extra nodes: ' || l_extra_instances_tbl.COUNT ||
2496: ', Number of non-extra nodes: ' || l_premapped_instances_tbl.COUNT);
2497: END IF;
2490: FETCH get_extra_children_csr BULK COLLECT INTO l_extra_instances_tbl;
2491: CLOSE get_extra_children_csr;
2492:
2493: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2494: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2495: 'Number of extra nodes: ' || l_extra_instances_tbl.COUNT ||
2496: ', Number of non-extra nodes: ' || l_premapped_instances_tbl.COUNT);
2497: END IF;
2498: IF (l_extra_instances_tbl.COUNT > 0) THEN
2501: OPEN get_all_empty_positions_csr;
2502: FETCH get_all_empty_positions_csr BULK COLLECT INTO l_relations_tbl;
2503: CLOSE get_all_empty_positions_csr;
2504:
2505: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2506: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2507: 'Number of empty positions: ' || l_relations_tbl.COUNT);
2508: END IF;
2509: IF (l_relations_tbl.COUNT > 0) THEN
2502: FETCH get_all_empty_positions_csr BULK COLLECT INTO l_relations_tbl;
2503: CLOSE get_all_empty_positions_csr;
2504:
2505: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2506: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2507: 'Number of empty positions: ' || l_relations_tbl.COUNT);
2508: END IF;
2509: IF (l_relations_tbl.COUNT > 0) THEN
2510: -- Analyse and process instances with matching positions
2509: IF (l_relations_tbl.COUNT > 0) THEN
2510: -- Analyse and process instances with matching positions
2511: Process_Instances(p_x_extra_instances_tbl => l_extra_instances_tbl,
2512: p_x_relations_tbl => l_relations_tbl);
2513: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2514: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2515: 'Number of extra nodes after processing: ' || l_extra_instances_tbl.COUNT ||
2516: ', Number of empty positions after processing: ' || l_relations_tbl.COUNT);
2517: END IF;
2510: -- Analyse and process instances with matching positions
2511: Process_Instances(p_x_extra_instances_tbl => l_extra_instances_tbl,
2512: p_x_relations_tbl => l_relations_tbl);
2513: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2514: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2515: 'Number of extra nodes after processing: ' || l_extra_instances_tbl.COUNT ||
2516: ', Number of empty positions after processing: ' || l_relations_tbl.COUNT);
2517: END IF;
2518: END IF;
2517: END IF;
2518: END IF;
2519: END IF; -- There are child nodes
2520:
2521: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2522: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.end',
2523: 'At the end of the procedure.');
2524: END IF;
2525: END Remap_IB_Tree;
2518: END IF;
2519: END IF; -- There are child nodes
2520:
2521: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2522: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.end',
2523: 'At the end of the procedure.');
2524: END IF;
2525: END Remap_IB_Tree;
2526:
2571: l_matched_flag BOOLEAN;
2572: l_current_position NUMBER;
2573:
2574: BEGIN
2575: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2576: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.begin',
2577: 'At the start of the procedure, p_x_extra_instances_tbl.count = ' || p_x_extra_instances_tbl.count || ',p_x_relations_tbl.count = ' ||p_x_relations_tbl.count);
2578: END IF;
2579:
2572: l_current_position NUMBER;
2573:
2574: BEGIN
2575: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2576: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.begin',
2577: 'At the start of the procedure, p_x_extra_instances_tbl.count = ' || p_x_extra_instances_tbl.count || ',p_x_relations_tbl.count = ' ||p_x_relations_tbl.count);
2578: END IF;
2579:
2580: -- Get the transaction_type_id for use later by the CSI_II_RELATIONSHIPS_PUB.update_relationship API
2588:
2589: -- There are extra nodes present
2590: i := p_x_extra_instances_tbl.FIRST;
2591: WHILE (i IS NOT NULL) LOOP
2592: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2593: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2594: 'i = ' || i || ', p_x_extra_instances_tbl(i) = ' || p_x_extra_instances_tbl(i));
2595: END IF;
2596: -- Initialize associative array
2589: -- There are extra nodes present
2590: i := p_x_extra_instances_tbl.FIRST;
2591: WHILE (i IS NOT NULL) LOOP
2592: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2593: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2594: 'i = ' || i || ', p_x_extra_instances_tbl(i) = ' || p_x_extra_instances_tbl(i));
2595: END IF;
2596: -- Initialize associative array
2597: l_map_tbl(p_x_extra_instances_tbl(i)) := 0;
2607: l_instance_dtls.inventory_revision,
2608: l_instance_dtls.quantity,
2609: l_instance_dtls.unit_of_measure);
2610: IF (l_item_match) THEN
2611: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2612: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2613: 'Instance ' || p_x_extra_instances_tbl(i) || ' fits position ' || p_x_relations_tbl(j));
2614: END IF;
2615: IF (l_map_tbl(p_x_extra_instances_tbl(i))) <> 0 THEN
2608: l_instance_dtls.quantity,
2609: l_instance_dtls.unit_of_measure);
2610: IF (l_item_match) THEN
2611: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2612: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2613: 'Instance ' || p_x_extra_instances_tbl(i) || ' fits position ' || p_x_relations_tbl(j));
2614: END IF;
2615: IF (l_map_tbl(p_x_extra_instances_tbl(i))) <> 0 THEN
2616: -- More than one match
2663: l_csi_relationship_rec.position_reference := to_char(l_current_position);
2664: l_csi_relationship_rec.object_id := l_ii_rel_dtls.object_id;
2665: l_csi_relationship_rec.subject_id := l_ii_rel_dtls.subject_id;
2666: l_csi_relationship_tbl(1) := l_csi_relationship_rec;
2667: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2668: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2669: 'About to call CSI_II_RELATIONSHIPS_PUB.update_relationship to update CSI II relationship with id ' ||
2670: l_ii_rel_dtls.relationship_id || ' between ' ||
2671: l_ii_rel_dtls.object_id || ' (object) and ' ||
2664: l_csi_relationship_rec.object_id := l_ii_rel_dtls.object_id;
2665: l_csi_relationship_rec.subject_id := l_ii_rel_dtls.subject_id;
2666: l_csi_relationship_tbl(1) := l_csi_relationship_rec;
2667: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2668: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2669: 'About to call CSI_II_RELATIONSHIPS_PUB.update_relationship to update CSI II relationship with id ' ||
2670: l_ii_rel_dtls.relationship_id || ' between ' ||
2671: l_ii_rel_dtls.object_id || ' (object) and ' ||
2672: l_ii_rel_dtls.subject_id || '(subject) with position_reference ' ||
2684: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2685: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2686: END IF;
2687: -- Now recursively match all the children of the current instance/position
2688: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2689: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2690: 'About to recursively call Remap_IB_Tree');
2691: END IF;
2692: Remap_IB_Tree(p_instance_id => p_x_extra_instances_tbl(i),
2685: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2686: END IF;
2687: -- Now recursively match all the children of the current instance/position
2688: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2689: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2690: 'About to recursively call Remap_IB_Tree');
2691: END IF;
2692: Remap_IB_Tree(p_instance_id => p_x_extra_instances_tbl(i),
2693: p_relationship_id => l_current_position);
2690: 'About to recursively call Remap_IB_Tree');
2691: END IF;
2692: Remap_IB_Tree(p_instance_id => p_x_extra_instances_tbl(i),
2693: p_relationship_id => l_current_position);
2694: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2695: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2696: 'Returned from recursive call to Remap_IB_Tree');
2697: END IF;
2698: -- Now delete the matched relationship
2691: END IF;
2692: Remap_IB_Tree(p_instance_id => p_x_extra_instances_tbl(i),
2693: p_relationship_id => l_current_position);
2694: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2695: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, L_DEBUG_KEY,
2696: 'Returned from recursive call to Remap_IB_Tree');
2697: END IF;
2698: -- Now delete the matched relationship
2699: j := p_x_relations_tbl.FIRST;
2714: i := p_x_extra_instances_tbl.NEXT(i);
2715: END LOOP;
2716: l_map_tbl.DELETE; -- Clear up the temporary Associative Array
2717:
2718: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2719: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.end',
2720: 'At the end of the procedure. Remaining Instances: ' || p_x_extra_instances_tbl.count);
2721: END IF;
2722: END Process_instances;
2715: END LOOP;
2716: l_map_tbl.DELETE; -- Clear up the temporary Associative Array
2717:
2718: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
2719: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, L_DEBUG_KEY || '.end',
2720: 'At the end of the procedure. Remaining Instances: ' || p_x_extra_instances_tbl.count);
2721: END IF;
2722: END Process_instances;
2723: