53: AND oel.line_id = p_rma_line_id;
54:
55: EXCEPTION
56: WHEN no_data_found THEN
57: fnd_message.set_name('CSI', 'CSI_INT_OE_LINE_ID_INVALID');
58: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
59: fnd_msg_pub.add;
60: RAISE fnd_api.g_exc_error;
61: END;
54:
55: EXCEPTION
56: WHEN no_data_found THEN
57: fnd_message.set_name('CSI', 'CSI_INT_OE_LINE_ID_INVALID');
58: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
59: fnd_msg_pub.add;
60: RAISE fnd_api.g_exc_error;
61: END;
62:
66: x_error_message := fnd_msg_pub.get;
67: x_return_status := fnd_api.g_ret_sts_error;
68:
69: WHEN others THEN
70: fnd_message.set_name('FND', 'FND_GENERIC_MESSAGE');
71: fnd_message.set_token('MESSAGE', substr(sqlerrm, 240));
72: fnd_msg_pub.add;
73:
74: x_error_message := fnd_msg_pub.get;
67: x_return_status := fnd_api.g_ret_sts_error;
68:
69: WHEN others THEN
70: fnd_message.set_name('FND', 'FND_GENERIC_MESSAGE');
71: fnd_message.set_token('MESSAGE', substr(sqlerrm, 240));
72: fnd_msg_pub.add;
73:
74: x_error_message := fnd_msg_pub.get;
75: x_return_status := fnd_api.g_ret_sts_unexp_error;
101:
102: xnp_xml_utils.decode(p_msg_text, 'RMA_LINE_ID', l_rma_line_id);
103:
104: IF nvl(l_rma_line_id,fnd_api.g_miss_num) = fnd_api.g_miss_num THEN
105: fnd_message.set_name('CSI','CSI_DECODE_MGS_ERROR');
106: fnd_message.set_token('MESSAGE_id', p_msg_header.message_id);
107: fnd_message.set_token('MESSAGE_CODE', p_msg_header.message_code);
108: fnd_msg_pub.add;
109: RAISE fnd_api.g_exc_error;
102: xnp_xml_utils.decode(p_msg_text, 'RMA_LINE_ID', l_rma_line_id);
103:
104: IF nvl(l_rma_line_id,fnd_api.g_miss_num) = fnd_api.g_miss_num THEN
105: fnd_message.set_name('CSI','CSI_DECODE_MGS_ERROR');
106: fnd_message.set_token('MESSAGE_id', p_msg_header.message_id);
107: fnd_message.set_token('MESSAGE_CODE', p_msg_header.message_code);
108: fnd_msg_pub.add;
109: RAISE fnd_api.g_exc_error;
110: END IF;
103:
104: IF nvl(l_rma_line_id,fnd_api.g_miss_num) = fnd_api.g_miss_num THEN
105: fnd_message.set_name('CSI','CSI_DECODE_MGS_ERROR');
106: fnd_message.set_token('MESSAGE_id', p_msg_header.message_id);
107: fnd_message.set_token('MESSAGE_CODE', p_msg_header.message_code);
108: fnd_msg_pub.add;
109: RAISE fnd_api.g_exc_error;
110: END IF;
111:
132: debug(x_error_message);
133:
134: WHEN others THEN
135:
136: fnd_message.set_name('CSI','CSI_UNEXP_SQL_ERROR');
137: fnd_message.set_token('API_NAME', g_pkg_name||'.'||l_api_name);
138: fnd_message.set_token('SQL_ERROR', substr(sqlerrm, 1, 255));
139: fnd_msg_pub.add;
140:
133:
134: WHEN others THEN
135:
136: fnd_message.set_name('CSI','CSI_UNEXP_SQL_ERROR');
137: fnd_message.set_token('API_NAME', g_pkg_name||'.'||l_api_name);
138: fnd_message.set_token('SQL_ERROR', substr(sqlerrm, 1, 255));
139: fnd_msg_pub.add;
140:
141: x_error_message := fnd_msg_pub.get;
134: WHEN others THEN
135:
136: fnd_message.set_name('CSI','CSI_UNEXP_SQL_ERROR');
137: fnd_message.set_token('API_NAME', g_pkg_name||'.'||l_api_name);
138: fnd_message.set_token('SQL_ERROR', substr(sqlerrm, 1, 255));
139: fnd_msg_pub.add;
140:
141: x_error_message := fnd_msg_pub.get;
142: x_return_status := fnd_api.g_ret_sts_unexp_error;
248: AND oel.header_id = oeh.header_id;
249: EXCEPTION
250: WHEN no_data_found THEN
251: debug('Invalid RMA Order Line ID');
252: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
253: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
254: fnd_msg_pub.add;
255: RAISE fnd_api.g_exc_error;
256: END;
249: EXCEPTION
250: WHEN no_data_found THEN
251: debug('Invalid RMA Order Line ID');
252: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
253: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
254: fnd_msg_pub.add;
255: RAISE fnd_api.g_exc_error;
256: END;
257:
269: param_name => 'MASTER_ORGANIZATION_ID',
270: p_org_id => l_rma_line_rec.org_id);
271: Exception when others then
272: debug('Invalid Order line details - org_id: '||l_rma_line_rec.org_id);
273: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
274: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
275: fnd_msg_pub.add;
276: RAISE fnd_api.g_exc_error;
277: End;
270: p_org_id => l_rma_line_rec.org_id);
271: Exception when others then
272: debug('Invalid Order line details - org_id: '||l_rma_line_rec.org_id);
273: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
274: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
275: fnd_msg_pub.add;
276: RAISE fnd_api.g_exc_error;
277: End;
278: ELSE
299: FROM mtl_system_items
300: WHERE inventory_item_id = l_rma_line_rec.inventory_item_id
301: AND organization_id = l_orgn_id;
302: Exception when others then
303: fnd_message.set_name('CSI', 'CSI_INT_ITEM_ID_MISSING');
304: fnd_message.set_token('INVENTORY_ITEM_ID', l_rma_line_rec.inventory_item_id);
305: fnd_message.set_token('INV_ORGANZATION_ID', l_orgn_id);
306: fnd_msg_pub.add;
307: End;
300: WHERE inventory_item_id = l_rma_line_rec.inventory_item_id
301: AND organization_id = l_orgn_id;
302: Exception when others then
303: fnd_message.set_name('CSI', 'CSI_INT_ITEM_ID_MISSING');
304: fnd_message.set_token('INVENTORY_ITEM_ID', l_rma_line_rec.inventory_item_id);
305: fnd_message.set_token('INV_ORGANZATION_ID', l_orgn_id);
306: fnd_msg_pub.add;
307: End;
308: ELSE
301: AND organization_id = l_orgn_id;
302: Exception when others then
303: fnd_message.set_name('CSI', 'CSI_INT_ITEM_ID_MISSING');
304: fnd_message.set_token('INVENTORY_ITEM_ID', l_rma_line_rec.inventory_item_id);
305: fnd_message.set_token('INV_ORGANZATION_ID', l_orgn_id);
306: fnd_msg_pub.add;
307: End;
308: ELSE
309: debug('Invalid Organization ID - l_orgn_id: '||l_orgn_id);
306: fnd_msg_pub.add;
307: End;
308: ELSE
309: debug('Invalid Organization ID - l_orgn_id: '||l_orgn_id);
310: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
311: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
312: fnd_msg_pub.add;
313: RAISE fnd_api.g_exc_error;
314: END IF;
307: End;
308: ELSE
309: debug('Invalid Organization ID - l_orgn_id: '||l_orgn_id);
310: fnd_message.set_name('CSI','CSI_INT_OE_LINE_ID_INVALID');
311: fnd_message.set_token('OE_LINE_ID', p_rma_line_id);
312: fnd_msg_pub.add;
313: RAISE fnd_api.g_exc_error;
314: END IF;
315:
331: dbms_application_info.set_client_info(l_rma_line_rec.org_id);
332:
333: IF l_shippable_item_flag is NULL THEN
334: debug('Could not determine if the line item is shippable or not for the RMA Fulfillment Line.');
335: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
336: fnd_message.set_token('MESSAGE','Could not determine if the line item is shippable or not for the RMA Fulfillment Line.');
337: fnd_msg_pub.add;
338: raise fnd_api.g_exc_error;
339: ELSIF l_shippable_item_flag = 'Y' THEN
332:
333: IF l_shippable_item_flag is NULL THEN
334: debug('Could not determine if the line item is shippable or not for the RMA Fulfillment Line.');
335: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
336: fnd_message.set_token('MESSAGE','Could not determine if the line item is shippable or not for the RMA Fulfillment Line.');
337: fnd_msg_pub.add;
338: raise fnd_api.g_exc_error;
339: ELSIF l_shippable_item_flag = 'Y' THEN
340: IF (WF_ENGINE.ACTIVITY_EXIST_IN_PROCESS(
362: l_g_txn_line_rec.source_transaction_type_id := l_txn_type_id;
363:
364: IF NOT(l_found) THEN
365: debug('Transaction detail is Mandatory for RMA Fulfillment and was NOT found for the line.');
366: fnd_message.set_name('CSI', 'CSI_RMA_TXN_DTLS_REQD');
367: fnd_message.set_token('SRC_TXN_ID', p_rma_line_id);
368: fnd_msg_pub.add;
369: raise fnd_api.g_exc_error;
370: -- call the get api
363:
364: IF NOT(l_found) THEN
365: debug('Transaction detail is Mandatory for RMA Fulfillment and was NOT found for the line.');
366: fnd_message.set_name('CSI', 'CSI_RMA_TXN_DTLS_REQD');
367: fnd_message.set_token('SRC_TXN_ID', p_rma_line_id);
368: fnd_msg_pub.add;
369: raise fnd_api.g_exc_error;
370: -- call the get api
371: ELSE
378: AND source_transaction_id = p_rma_line_id;
379:
380: IF l_processing_status = 'PROCESSED' THEN
381: debug('This transaction detail is already PROCESSED.');
382: fnd_message.set_name('CSI', 'CSI_TXN_SRC_ALREADY_PROCESSED');
383: fnd_message.set_token('SRC_TBL', l_src_txn_table);
384: fnd_message.set_token('SRC_ID', p_rma_line_id);
385: fnd_msg_pub.add;
386: RAISE fnd_api.g_exc_error;
379:
380: IF l_processing_status = 'PROCESSED' THEN
381: debug('This transaction detail is already PROCESSED.');
382: fnd_message.set_name('CSI', 'CSI_TXN_SRC_ALREADY_PROCESSED');
383: fnd_message.set_token('SRC_TBL', l_src_txn_table);
384: fnd_message.set_token('SRC_ID', p_rma_line_id);
385: fnd_msg_pub.add;
386: RAISE fnd_api.g_exc_error;
387: END IF;
380: IF l_processing_status = 'PROCESSED' THEN
381: debug('This transaction detail is already PROCESSED.');
382: fnd_message.set_name('CSI', 'CSI_TXN_SRC_ALREADY_PROCESSED');
383: fnd_message.set_token('SRC_TBL', l_src_txn_table);
384: fnd_message.set_token('SRC_ID', p_rma_line_id);
385: fnd_msg_pub.add;
386: RAISE fnd_api.g_exc_error;
387: END IF;
388:
464: END IF;
465:
466: IF l_tld_quantity <> l_canceled_qty THEN
467: IF l_g_line_dtl_tbl.COUNT > 1 THEN
468: fnd_message.set_name('CSI', 'CSI_TXN_LINE_DTL_QTY_INVALID');
469: fnd_msg_pub.add;
470: RAISE fnd_api.g_exc_error;
471: ELSE
472: debug('Canceled Qty as on the Sales Order: '||l_canceled_qty);
526: RAISE fnd_api.g_exc_error;
527: END IF;
528: ELSE
529: debug('Instance reference on the Transaction detail is Mandatory for a RMA Fulfillment and was NOT found for the line.');
530: fnd_message.set_name('CSI', 'CSI_RMA_INST_REF_REQD');
531: fnd_message.set_token('SRC_TXN_ID', p_rma_line_id);
532: fnd_msg_pub.add;
533: raise fnd_api.g_exc_error;
534: END IF;
527: END IF;
528: ELSE
529: debug('Instance reference on the Transaction detail is Mandatory for a RMA Fulfillment and was NOT found for the line.');
530: fnd_message.set_name('CSI', 'CSI_RMA_INST_REF_REQD');
531: fnd_message.set_token('SRC_TXN_ID', p_rma_line_id);
532: fnd_msg_pub.add;
533: raise fnd_api.g_exc_error;
534: END IF;
535:
556: p_error_message => l_error_message );
557:
558: WHEN others THEN
559: rollback to rma_fulfillment;
560: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
561: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
562: fnd_msg_pub.add;
563:
564: x_return_status := fnd_api.g_ret_sts_error;
557:
558: WHEN others THEN
559: rollback to rma_fulfillment;
560: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
561: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
562: fnd_msg_pub.add;
563:
564: x_return_status := fnd_api.g_ret_sts_error;
565: l_error_message := csi_t_gen_utility_pvt.dump_error_stack;
737: WHERE cust_account_id = p_rma_line_rec.sold_to_org_id;
738:
739: EXCEPTION
740: WHEN others THEN
741: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
742: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
743: fnd_msg_pub.add;
744: RAISE fnd_api.g_exc_error;
745: END;
738:
739: EXCEPTION
740: WHEN others THEN
741: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
742: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
743: fnd_msg_pub.add;
744: RAISE fnd_api.g_exc_error;
745: END;
746:
836: Exception
837: when no_data_found THEN
838: l_curr_object_id := -9999;
839: when others THEN
840: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
841: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
842: fnd_msg_pub.add;
843: raise fnd_api.g_exc_error;
844: End;
837: when no_data_found THEN
838: l_curr_object_id := -9999;
839: when others THEN
840: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
841: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
842: fnd_msg_pub.add;
843: raise fnd_api.g_exc_error;
844: End;
845: --Check if the object id is being updated, if so raise error
845: --Check if the object id is being updated, if so raise error
846:
847: IF l_curr_object_id <> -9999 THEN
848: IF l_curr_object_id <> l_object_inst_id THEN
849: fnd_message.set_name('CSI','CSI_INT_OBJ_ID_NOT_ALLOW_UPD');
850: fnd_message.set_token('OBJECT_ID',l_object_inst_id);
851: fnd_msg_pub.add;
852: raise fnd_api.g_exc_error;
853: END IF;
846:
847: IF l_curr_object_id <> -9999 THEN
848: IF l_curr_object_id <> l_object_inst_id THEN
849: fnd_message.set_name('CSI','CSI_INT_OBJ_ID_NOT_ALLOW_UPD');
850: fnd_message.set_token('OBJECT_ID',l_object_inst_id);
851: fnd_msg_pub.add;
852: raise fnd_api.g_exc_error;
853: END IF;
854: END IF;
862: x_trx_sub_type_rec => l_txn_sub_type_rec,
863: x_return_status => l_return_status) ;
864:
865: IF l_return_status <> fnd_api.g_ret_sts_success THEN
866: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
867: fnd_message.set_token('MESSAGE','Call to the routine csi_utl_pkg.get_sub_type_rec Failed.');
868: fnd_msg_pub.add;
869: raise fnd_api.g_exc_error;
870: END IF;
863: x_return_status => l_return_status) ;
864:
865: IF l_return_status <> fnd_api.g_ret_sts_success THEN
866: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
867: fnd_message.set_token('MESSAGE','Call to the routine csi_utl_pkg.get_sub_type_rec Failed.');
868: fnd_msg_pub.add;
869: raise fnd_api.g_exc_error;
870: END IF;
871:
873: debug(' default sub_type_id :'||l_txn_sub_type_rec.sub_type_id );
874:
875: --Fix for bug 4243512
876: IF l_txn_sub_type_rec.src_change_owner = 'Y' THEN
877: fnd_message.set_name('CSI','CSI_SUB_TYPE_INVALID');
878: fnd_msg_pub.add;
879: raise fnd_api.g_exc_error;
880: END IF;
881: --end of fix.
936: END IF;
937: END LOOP;
938: ELSE
939: debug('Instance Party not found. Instance:'||l_instance_rec.instance_id);
940: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
941: fnd_message.set_token('MESSAGE','Instance Party not found. Instance:'||l_instance_rec.instance_id);
942: fnd_msg_pub.add;
943: RAISE fnd_api.g_exc_error;
944: END IF;
937: END LOOP;
938: ELSE
939: debug('Instance Party not found. Instance:'||l_instance_rec.instance_id);
940: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
941: fnd_message.set_token('MESSAGE','Instance Party not found. Instance:'||l_instance_rec.instance_id);
942: fnd_msg_pub.add;
943: RAISE fnd_api.g_exc_error;
944: END IF;
945:
950: NVL(l_instance_rec.active_end_date,fnd_api.g_miss_date) = fnd_api.g_miss_date )
951: THEN
952:
953: IF l_inst_owner_pty_id = l_internal_party_id THEN
954: fnd_message.set_name('CSI','CSI_INT_INST_REF_INVALID');
955: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
956: fnd_msg_pub.add;
957: RAISE fnd_api.g_exc_error;
958: ELSE
951: THEN
952:
953: IF l_inst_owner_pty_id = l_internal_party_id THEN
954: fnd_message.set_name('CSI','CSI_INT_INST_REF_INVALID');
955: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
956: fnd_msg_pub.add;
957: RAISE fnd_api.g_exc_error;
958: ELSE
959: debug('Location type code is :'||l_instance_rec.location_type_code);
956: fnd_msg_pub.add;
957: RAISE fnd_api.g_exc_error;
958: ELSE
959: debug('Location type code is :'||l_instance_rec.location_type_code);
960: fnd_message.set_name('CSI', 'CSI_NON_RETURNABLE_INSTANCE');
961: fnd_message.set_token('LOC_TYPE_CODE', l_instance_rec.location_type_code);
962: fnd_msg_pub.add;
963: raise fnd_api.g_exc_error;
964: END IF;
957: RAISE fnd_api.g_exc_error;
958: ELSE
959: debug('Location type code is :'||l_instance_rec.location_type_code);
960: fnd_message.set_name('CSI', 'CSI_NON_RETURNABLE_INSTANCE');
961: fnd_message.set_token('LOC_TYPE_CODE', l_instance_rec.location_type_code);
962: fnd_msg_pub.add;
963: raise fnd_api.g_exc_error;
964: END IF;
965: END IF;
991: debug('Internal party : '||l_internal_party_id);
992:
993: IF l_inst_owner_pty_id = l_internal_party_id THEN
994: IF nvl(l_txn_sub_type_rec.src_change_owner, 'N') = 'Y' THEN
995: fnd_message.set_name('CSI','CSI_INT_INST_REF_INVALID');
996: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
997: fnd_msg_pub.add;
998: RAISE fnd_api.g_exc_error;
999: END IF;
992:
993: IF l_inst_owner_pty_id = l_internal_party_id THEN
994: IF nvl(l_txn_sub_type_rec.src_change_owner, 'N') = 'Y' THEN
995: fnd_message.set_name('CSI','CSI_INT_INST_REF_INVALID');
996: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
997: fnd_msg_pub.add;
998: RAISE fnd_api.g_exc_error;
999: END IF;
1000: ELSIF l_inst_owner_pty_id <> l_src_txn_owner_pty_id THEN
1070: END IF;
1071:
1072: debug('Ownership Changed Successfully.');
1073: ELSE
1074: fnd_message.set_name('CSI','CSI_RMA_OWNER_MISMATCH');
1075: fnd_message.set_token('INSTANCE_ID', l_instance_rec.instance_id );
1076: fnd_message.set_token('OLD_PARTY_ID', l_inst_owner_pty_id );
1077: fnd_message.set_token('NEW_PARTY_ID', l_src_txn_owner_pty_id );
1078: fnd_msg_pub.add;
1071:
1072: debug('Ownership Changed Successfully.');
1073: ELSE
1074: fnd_message.set_name('CSI','CSI_RMA_OWNER_MISMATCH');
1075: fnd_message.set_token('INSTANCE_ID', l_instance_rec.instance_id );
1076: fnd_message.set_token('OLD_PARTY_ID', l_inst_owner_pty_id );
1077: fnd_message.set_token('NEW_PARTY_ID', l_src_txn_owner_pty_id );
1078: fnd_msg_pub.add;
1079: RAISE fnd_api.g_exc_error;
1072: debug('Ownership Changed Successfully.');
1073: ELSE
1074: fnd_message.set_name('CSI','CSI_RMA_OWNER_MISMATCH');
1075: fnd_message.set_token('INSTANCE_ID', l_instance_rec.instance_id );
1076: fnd_message.set_token('OLD_PARTY_ID', l_inst_owner_pty_id );
1077: fnd_message.set_token('NEW_PARTY_ID', l_src_txn_owner_pty_id );
1078: fnd_msg_pub.add;
1079: RAISE fnd_api.g_exc_error;
1080: END IF;
1073: ELSE
1074: fnd_message.set_name('CSI','CSI_RMA_OWNER_MISMATCH');
1075: fnd_message.set_token('INSTANCE_ID', l_instance_rec.instance_id );
1076: fnd_message.set_token('OLD_PARTY_ID', l_inst_owner_pty_id );
1077: fnd_message.set_token('NEW_PARTY_ID', l_src_txn_owner_pty_id );
1078: fnd_msg_pub.add;
1079: RAISE fnd_api.g_exc_error;
1080: END IF;
1081: END IF;
1130: FROM csi_item_instances
1131: WHERE instance_id = l_instance_rec.instance_id;
1132: Exception when others then
1133: debug('Fetch instance details failed ...');
1134: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1135: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1136: fnd_msg_pub.add;
1137: raise fnd_api.g_exc_unexpected_error;
1138: End;
1131: WHERE instance_id = l_instance_rec.instance_id;
1132: Exception when others then
1133: debug('Fetch instance details failed ...');
1134: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1135: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1136: fnd_msg_pub.add;
1137: raise fnd_api.g_exc_unexpected_error;
1138: End;
1139:
1195: and organization_id = l_dest_location_rec.inv_organization_id;--l_txn_line_dtl_rec.inv_organization_id;
1196: -- bug 3230999. since OM is always passing master inv.
1197: Exception when others Then
1198: debug('Could not determine serial control policy?');
1199: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1200: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1201: fnd_msg_pub.add;
1202: RAISE fnd_api.g_exc_unexpected_error;
1203: End;
1196: -- bug 3230999. since OM is always passing master inv.
1197: Exception when others Then
1198: debug('Could not determine serial control policy?');
1199: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1200: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1201: fnd_msg_pub.add;
1202: RAISE fnd_api.g_exc_unexpected_error;
1203: End;
1204:
1206: IF ( nvl(l_instance_rec.active_end_date,fnd_api.g_miss_date) <> fnd_api.g_miss_date
1207: AND l_instance_rec.active_end_date < sysdate ) THEN -- Added this new check, IF as part of 3746600
1208: IF l_instance_rec.instance_usage_code <> 'IN_RELATIONSHIP' THEN
1209: -- ONLY excluding Components since they get expired along with their parent in a config cancellation
1210: fnd_message.set_name('CSI','CSI_TXN_INVALID_INST_REF');
1211: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
1212: fnd_msg_pub.add;
1213: RAISE fnd_api.g_exc_error;
1214: END IF;
1207: AND l_instance_rec.active_end_date < sysdate ) THEN -- Added this new check, IF as part of 3746600
1208: IF l_instance_rec.instance_usage_code <> 'IN_RELATIONSHIP' THEN
1209: -- ONLY excluding Components since they get expired along with their parent in a config cancellation
1210: fnd_message.set_name('CSI','CSI_TXN_INVALID_INST_REF');
1211: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
1212: fnd_msg_pub.add;
1213: RAISE fnd_api.g_exc_error;
1214: END IF;
1215: ELSIF l_item_srl_code = 1 THEN
1214: END IF;
1215: ELSIF l_item_srl_code = 1 THEN
1216: IF abs(l_txn_line_dtl_rec.quantity) > l_instance_rec.quantity THEN
1217: -- check if the quantity is greater than the instance quantity
1218: fnd_message.set_name('CSI','CSI_INT_QTY_CHK_FAILED');
1219: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
1220: fnd_msg_pub.add;
1221: RAISE fnd_api.g_exc_error;
1222: ELSIF l_instance_rec.quantity > abs(l_txn_line_dtl_rec.quantity) THEN -- need to split the source cust prod first
1215: ELSIF l_item_srl_code = 1 THEN
1216: IF abs(l_txn_line_dtl_rec.quantity) > l_instance_rec.quantity THEN
1217: -- check if the quantity is greater than the instance quantity
1218: fnd_message.set_name('CSI','CSI_INT_QTY_CHK_FAILED');
1219: fnd_message.set_token('INSTANCE_ID',l_instance_rec.instance_id);
1220: fnd_msg_pub.add;
1221: RAISE fnd_api.g_exc_error;
1222: ELSIF l_instance_rec.quantity > abs(l_txn_line_dtl_rec.quantity) THEN -- need to split the source cust prod first
1223: debug('Original Instance Quantity: '||l_instance_rec.quantity);
1544: l_error_message := csi_t_gen_utility_pvt.dump_error_stack;
1545: debug(l_error_message);
1546: WHEN fnd_api.g_exc_unexpected_error THEN
1547: rollback to fulfill_rma_line;
1548: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1549: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1550: fnd_msg_pub.add;
1551: x_return_status := fnd_api.g_ret_sts_error;
1552: l_error_message := csi_t_gen_utility_pvt.dump_error_stack;
1545: debug(l_error_message);
1546: WHEN fnd_api.g_exc_unexpected_error THEN
1547: rollback to fulfill_rma_line;
1548: fnd_message.set_name('FND','FND_GENERIC_MESSAGE');
1549: fnd_message.set_token('MESSAGE',substr(sqlerrm,1,255));
1550: fnd_msg_pub.add;
1551: x_return_status := fnd_api.g_ret_sts_error;
1552: l_error_message := csi_t_gen_utility_pvt.dump_error_stack;
1553: debug(l_error_message);