657: /****************************Cursors Declaration End*******************/
658:
659: BEGIN
660: IF g_po_pdoi_write_to_file IS NULL THEN
661: po_debug.set_file_io(NULL);
662: ELSIF g_po_pdoi_write_to_file = 'Y' THEN
663: po_debug.set_file_io(TRUE);
664: ELSE
665: po_debug.set_file_io(FALSE);
659: BEGIN
660: IF g_po_pdoi_write_to_file IS NULL THEN
661: po_debug.set_file_io(NULL);
662: ELSIF g_po_pdoi_write_to_file = 'Y' THEN
663: po_debug.set_file_io(TRUE);
664: ELSE
665: po_debug.set_file_io(FALSE);
666: END IF;
667:
661: po_debug.set_file_io(NULL);
662: ELSIF g_po_pdoi_write_to_file = 'Y' THEN
663: po_debug.set_file_io(TRUE);
664: ELSE
665: po_debug.set_file_io(FALSE);
666: END IF;
667:
668: FND_FILE.put_line(FND_FILE.LOG,'==>POASLGEN starts at ' || TO_CHAR(sysdate,'MM/DD/RR HH24:MI:SS'));
669:
668: FND_FILE.put_line(FND_FILE.LOG,'==>POASLGEN starts at ' || TO_CHAR(sysdate,'MM/DD/RR HH24:MI:SS'));
669:
670: IF g_po_pdoi_write_to_file ='Y' THEN
671: l_progress :='000';
672: PO_DEBUG.put_line('Entering '||g_pkg_name||l_procedure_name);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
669:
670: IF g_po_pdoi_write_to_file ='Y' THEN
671: l_progress :='000';
672: PO_DEBUG.put_line('Entering '||g_pkg_name||l_procedure_name);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
670: IF g_po_pdoi_write_to_file ='Y' THEN
671: l_progress :='000';
672: PO_DEBUG.put_line('Entering '||g_pkg_name||l_procedure_name);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
671: l_progress :='000';
672: PO_DEBUG.put_line('Entering '||g_pkg_name||l_procedure_name);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
672: PO_DEBUG.put_line('Entering '||g_pkg_name||l_procedure_name);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
673: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_document_id : '||to_char(p_document_id));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
674: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_id : '||to_char(p_vendor_id));
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
675: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_purchasing_org_id : '||to_char(p_purchasing_org_id));
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
676: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_vendor_site_id : '||to_char(p_vendor_site_id));
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
684: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_assignment_set_id : '||p_assignment_set_id);
677: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_create_sourcing_rule : '||p_create_sourcing_rule);
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
684: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_assignment_set_id : '||p_assignment_set_id);
685: END IF;
678: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_update_sourcing_rule : '||p_update_sourcing_rule);
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
684: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_assignment_set_id : '||p_assignment_set_id);
685: END IF;
686:
679: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_agreement_lines_selection : '||p_agreement_lines_selection);
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
684: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_assignment_set_id : '||p_assignment_set_id);
685: END IF;
686:
687:
680: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_level : '||p_sourcing_level);
681: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_inv_org : '||to_char(p_inv_org));
682: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_sourcing_rule_name : '||p_sourcing_rule_name);
683: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_release_gen_method : '||p_release_gen_method);
684: PO_DEBUG.put_line(l_progress||' : Input Parameter : '||'p_assignment_set_id : '||p_assignment_set_id);
685: END IF;
686:
687:
688:
696:
697: IF g_po_pdoi_write_to_file='Y' THEN
698: l_progress := '001';
699: FND_FILE.PUT_LINE(FND_FILE.OUTPUT,l_progress||' Incompatible call to API : '||l_cr_api_version);
700: PO_DEBUG.put_line(l_progress||' Incompatible call to API : '||l_cr_api_version);
701: END IF;
702: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
703: END IF;
704:
724:
725:
726: IF g_po_pdoi_write_to_file='Y' THEN
727: l_progress :='002';
728: PO_DEBUG.put_line(l_progress||' : Operating Unit Id : '||l_orgid);
729: l_progress :='003';
730: PO_DEBUG.put_line(l_progress||' : Archival Option :'||l_archive_on_approve);
731: END IF;
732:
726: IF g_po_pdoi_write_to_file='Y' THEN
727: l_progress :='002';
728: PO_DEBUG.put_line(l_progress||' : Operating Unit Id : '||l_orgid);
729: l_progress :='003';
730: PO_DEBUG.put_line(l_progress||' : Archival Option :'||l_archive_on_approve);
731: END IF;
732:
733: ----This Concurrent Program should run Only If Archival Is Set To Archive On Approve
734: IF(l_archive_on_approve <> 'APPROVE')THEN
733: ----This Concurrent Program should run Only If Archival Is Set To Archive On Approve
734: IF(l_archive_on_approve <> 'APPROVE')THEN
735: IF g_po_pdoi_write_to_file='Y' THEN
736: l_progress :='004';
737: PO_DEBUG.put_line(l_progress||' : Archival Option '||l_archive_on_approve||' is incompatible with this concurrent request :');
738: END IF;
739: l_error_message:=PO_CORE_S.get_translated_text('PO_SR_ASL_ARCHIVAL_OPTION');
740: FND_FILE.put_line(FND_FILE.OUTPUT,l_error_message);
741: RAISE FND_API.G_EXC_ERROR;--RAISE ERROR
764: IF(p_agreement_lines_selection='NEW')THEN
765:
766: IF g_po_pdoi_write_to_file ='Y' THEN
767: l_progress :='005';
768: PO_DEBUG.put_line(l_progress||' : Agreement Lines Selection :'||p_agreement_lines_selection);
769: END IF;
770:
771: -- SQL What: Querying to find the last line created in a previous
772: -- revision of the document
791:
792:
793: IF g_po_pdoi_write_to_file ='Y' THEN
794: l_progress :='006';
795: PO_DEBUG.put_line(l_progress||': Previous Line Number :'||p_agreement_lines_selection);
796: END IF;
797:
798: END IF;
799:
805: IF p_agreement_lines_selection='NEW' THEN
806: OPEN get_new_lines_to_be_processed;
807: IF g_po_pdoi_write_to_file ='Y' THEN
808: l_progress :='007';
809: PO_DEBUG.put_line(l_progress||': Opened cursor :'||'get_new_lines_to_be_processed');
810: END IF;
811: ELSE
812: OPEN get_all_document_lines;
813: IF g_po_pdoi_write_to_file ='Y' THEN
811: ELSE
812: OPEN get_all_document_lines;
813: IF g_po_pdoi_write_to_file ='Y' THEN
814: l_progress :='008';
815: PO_DEBUG.put_line(l_progress||': Opened cursor : get_all_document_lines');
816: END IF;
817: END IF;
818:
819: -- If the create sourcing rule is set to 'Y' set the value of create_update_flag to CREATE.
884: IF p_agreement_lines_selection='NEW' THEN
885: CLOSE get_new_lines_to_be_processed;
886: IF g_po_pdoi_write_to_file ='Y' THEN
887: l_progress :='009';
888: PO_DEBUG.put_line(l_progress||' : Closed cursor : get_new_lines_to_be_processed');
889: END IF;
890: ELSE
891: CLOSE get_all_document_lines;
892: IF g_po_pdoi_write_to_file ='Y' THEN
890: ELSE
891: CLOSE get_all_document_lines;
892: IF g_po_pdoi_write_to_file ='Y' THEN
893: l_progress :='010';
894: PO_DEBUG.put_line(l_progress||' : Closed cursor : get_all_document_lines');
895: END IF;
896: END IF;
897:
898: EXCEPTION
1082: BEGIN
1083:
1084: IF g_po_pdoi_write_to_file ='Y' THEN
1085: l_progress :='000';
1086: PO_DEBUG.put_line(l_progress||'Calling procedure create_update_sourcing_rules ');
1087: END IF;
1088: --Setting the assignment type depending on the value of sourcing_level
1089: IF nvl(p_sourcing_level,'ITEM')='ITEM' THEN
1090: l_assignment_type_id:=3;
1120: x_header_processable_flag := 'Y';
1121:
1122: IF (g_po_pdoi_write_to_file = 'Y') THEN
1123: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
1124: PO_DEBUG.put_line('Sourcing Rules creation API returned successfully');
1125: ELSE
1126: PO_DEBUG.put_line('Sourcing Rules creation API returned failure');
1127: END IF;
1128: END IF;
1122: IF (g_po_pdoi_write_to_file = 'Y') THEN
1123: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
1124: PO_DEBUG.put_line('Sourcing Rules creation API returned successfully');
1125: ELSE
1126: PO_DEBUG.put_line('Sourcing Rules creation API returned failure');
1127: END IF;
1128: END IF;
1129:
1130: -- SQL What: Querying for the value of Global Agreement Flag to
1142: END IF;
1143:
1144: IF g_po_pdoi_write_to_file ='Y' THEN
1145: l_progress :='001';
1146: PO_DEBUG.put_line(l_progress||' : Global Agreement Flag : '||l_ga_flag);
1147: END IF;
1148:
1149: IF (p_vendor_site_id IS NOT NULL)THEN
1150: l_vendor_site_id:=p_vendor_site_id;
1149: IF (p_vendor_site_id IS NOT NULL)THEN
1150: l_vendor_site_id:=p_vendor_site_id;
1151: IF g_po_pdoi_write_to_file ='Y' THEN
1152: l_progress :='002';
1153: PO_DEBUG.put_line(l_progress||' : Value of p_vendor_site_id : '||to_char(p_vendor_site_id));
1154: END IF;
1155: END IF;
1156:
1157: IF (nvl(l_ga_flag,'N') = 'Y' AND ( p_vendor_site_id IS NULL)) THEN
1205: WHEN OTHERS THEN
1206: x_header_processable_flag := 'N';
1207: FND_FILE.put_line(FND_FILE.LOG,'Error occured in '||' : '||g_pkg_name||l_procedure_name||SQLERRM||' : '||SQLCODE);
1208: IF (g_po_pdoi_write_to_file = 'Y') THEN
1209: PO_DEBUG.put_line('Sourcing Rules/ASL creation failed');
1210: END IF;
1211: po_message_s.SQL_ERROR(
1212: p_package => g_pkg_name
1213: , p_routine => l_procedure_name