1: PACKAGE BODY PO_PDOI_POSTPROC_PVT AS
2: /* $Header: PO_PDOI_POSTPROC_PVT.plb 120.48.12020000.3 2013/02/10 20:43:15 vegajula ship $ */
3:
4: d_pkg_name CONSTANT VARCHAR2(30) :=
5: PO_LOG.get_package_base('PO_PDOI_POSTPROC_PVT');
6:
7: DOC_POSTPROC_EXC EXCEPTION;
8:
9: -------------------------------------------------------
254:
255: BEGIN
256:
257: d_position := 0;
258: IF (PO_LOG.d_proc) THEN
259: PO_LOG.proc_begin(d_module);
260: END IF;
261:
262: PO_TIMING_UTL.start_time (PO_PDOI_CONSTANTS.g_T_POSTPROCESSING);
255: BEGIN
256:
257: d_position := 0;
258: IF (PO_LOG.d_proc) THEN
259: PO_LOG.proc_begin(d_module);
260: END IF;
261:
262: PO_TIMING_UTL.start_time (PO_PDOI_CONSTANTS.g_T_POSTPROCESSING);
263:
266: OPEN c_doc;
267:
268: LOOP
269:
270: IF (PO_LOG.d_stmt) THEN
271: PO_LOG.stmt(d_module, d_position, 'inside loop');
272: END IF;
273:
274: FETCH c_doc
267:
268: LOOP
269:
270: IF (PO_LOG.d_stmt) THEN
271: PO_LOG.stmt(d_module, d_position, 'inside loop');
272: END IF;
273:
274: FETCH c_doc
275: BULK COLLECT
275: BULK COLLECT
276: INTO l_docs_tbl
277: LIMIT PO_PDOI_PARAMS.g_request.batch_size;
278:
279: IF (PO_LOG.d_stmt) THEN
280: PO_LOG.stmt(d_module, d_position, 'num of records fetched: '
281: || l_docs_tbl.COUNT);
282: END IF;
283: d_position := 10;
276: INTO l_docs_tbl
277: LIMIT PO_PDOI_PARAMS.g_request.batch_size;
278:
279: IF (PO_LOG.d_stmt) THEN
280: PO_LOG.stmt(d_module, d_position, 'num of records fetched: '
281: || l_docs_tbl.COUNT);
282: END IF;
283: d_position := 10;
284:
306: PO_PDOI_PARAMS.g_out.err_tolerance_exceeded :=
307: l_doc_info.err_tolerance_exceeded;
308: END IF;
309:
310: IF (PO_LOG.d_stmt) THEN
311: PO_LOG.stmt(d_module, d_position, 'interface_header_id: ' ||
312: l_doc_rec.interface_header_id ||
313: ', processing header_id: ' || l_doc_rec.po_header_id ||
314: ', action: ' || l_doc_rec.action);
307: l_doc_info.err_tolerance_exceeded;
308: END IF;
309:
310: IF (PO_LOG.d_stmt) THEN
311: PO_LOG.stmt(d_module, d_position, 'interface_header_id: ' ||
312: l_doc_rec.interface_header_id ||
313: ', processing header_id: ' || l_doc_rec.po_header_id ||
314: ', action: ' || l_doc_rec.action);
315: END IF;
353: import_uda_attrs(l_uda_lines_tbl,
354: l_doc_rec.po_header_id,
355: x_return_status,
356: l_doc_rec.draft_id);
357: IF (PO_LOG.d_stmt) THEN
358: PO_LOG.stmt(d_module, d_position, 'x_return_status after import_uda_attrs', x_return_status);
359: END IF;
360: IF Nvl(x_return_status,FND_API.G_RET_STS_SUCCESS) = FND_API.G_RET_STS_SUCCESS
361: THEN
354: l_doc_rec.po_header_id,
355: x_return_status,
356: l_doc_rec.draft_id);
357: IF (PO_LOG.d_stmt) THEN
358: PO_LOG.stmt(d_module, d_position, 'x_return_status after import_uda_attrs', x_return_status);
359: END IF;
360: IF Nvl(x_return_status,FND_API.G_RET_STS_SUCCESS) = FND_API.G_RET_STS_SUCCESS
361: THEN
362:
375: x_header_rejected => l_header_rejected,
376: x_remove_draft => l_remove_draft -- bug5129752
377: );
378:
379: IF (PO_LOG.d_stmt) THEN
380: PO_LOG.stmt(d_module, d_position, 'l_header_rejected', l_header_rejected);
381: END IF;
382:
383: IF (l_header_rejected = FND_API.G_FALSE) THEN
376: x_remove_draft => l_remove_draft -- bug5129752
377: );
378:
379: IF (PO_LOG.d_stmt) THEN
380: PO_LOG.stmt(d_module, d_position, 'l_header_rejected', l_header_rejected);
381: END IF;
382:
383: IF (l_header_rejected = FND_API.G_FALSE) THEN
384: d_position := 30;
389: x_transfer_flag => l_transfer_flag,
390: x_submit_for_buyer_acc_flag => l_submit_for_buyer_acc_flag
391: );
392:
393: IF (PO_LOG.d_stmt) THEN
394: PO_LOG.stmt(d_module, d_position, 'l_transfer_flag', l_transfer_flag);
395: PO_LOG.stmt(d_module, d_position, 'l_submit_for_buyer_acc_flag',
396: l_submit_for_buyer_acc_flag);
397: END IF;
390: x_submit_for_buyer_acc_flag => l_submit_for_buyer_acc_flag
391: );
392:
393: IF (PO_LOG.d_stmt) THEN
394: PO_LOG.stmt(d_module, d_position, 'l_transfer_flag', l_transfer_flag);
395: PO_LOG.stmt(d_module, d_position, 'l_submit_for_buyer_acc_flag',
396: l_submit_for_buyer_acc_flag);
397: END IF;
398:
391: );
392:
393: IF (PO_LOG.d_stmt) THEN
394: PO_LOG.stmt(d_module, d_position, 'l_transfer_flag', l_transfer_flag);
395: PO_LOG.stmt(d_module, d_position, 'l_submit_for_buyer_acc_flag',
396: l_submit_for_buyer_acc_flag);
397: END IF;
398:
399: d_position := 40;
420:
421: IF (l_submit_for_buyer_acc_flag = FND_API.G_TRUE) THEN
422: d_position := 60;
423:
424: IF (PO_LOG.d_stmt) THEN
425: PO_LOG.stmt(d_module, d_position, 'launch buyer acceptance process');
426: END IF;
427:
428: -- submit document for buyer acceptance
421: IF (l_submit_for_buyer_acc_flag = FND_API.G_TRUE) THEN
422: d_position := 60;
423:
424: IF (PO_LOG.d_stmt) THEN
425: PO_LOG.stmt(d_module, d_position, 'launch buyer acceptance process');
426: END IF;
427:
428: -- submit document for buyer acceptance
429: PO_DIFF_SUMMARY_PKG.start_workflow
529: WHERE interface_header_id = l_doc_rec.interface_header_id;
530:
531: --removing the document_numbering for clm docs and moving it to a separate api assign_clm_document_number
532:
533: IF (PO_LOG.d_stmt) THEN
534: PO_LOG.stmt(d_module, d_position, 'process_code', l_process_Code);
535: END IF;
536:
537: ELSE
530:
531: --removing the document_numbering for clm docs and moving it to a separate api assign_clm_document_number
532:
533: IF (PO_LOG.d_stmt) THEN
534: PO_LOG.stmt(d_module, d_position, 'process_code', l_process_Code);
535: END IF;
536:
537: ELSE
538: IF (PO_LOG.d_stmt) THEN
534: PO_LOG.stmt(d_module, d_position, 'process_code', l_process_Code);
535: END IF;
536:
537: ELSE
538: IF (PO_LOG.d_stmt) THEN
539: PO_LOG.stmt(d_module, d_position, 'header gets rejected');
540: END IF;
541:
542: -- bug5129752
535: END IF;
536:
537: ELSE
538: IF (PO_LOG.d_stmt) THEN
539: PO_LOG.stmt(d_module, d_position, 'header gets rejected');
540: END IF;
541:
542: -- bug5129752
543: IF (l_remove_draft = FND_API.G_FALSE) THEN
555: PO_PDOI_UTL.commit_work;
556:
557: EXCEPTION
558: WHEN OTHERS THEN
559: PO_LOG.stmt(d_module, d_position, 'rollback to savepoint po_pdoi_doc_postproc_sp');
560:
561: ROLLBACK TO SAVEPOINT po_pdoi_doc_postproc_sp;
562: RAISE;
563: END;
568: close c_doc;
569:
570: PO_TIMING_UTL.stop_time (PO_PDOI_CONSTANTS.g_T_POSTPROCESSING);
571:
572: IF (PO_LOG.d_proc) THEN
573: PO_LOG.proc_end(d_module);
574: END IF;
575:
576: EXCEPTION
569:
570: PO_TIMING_UTL.stop_time (PO_PDOI_CONSTANTS.g_T_POSTPROCESSING);
571:
572: IF (PO_LOG.d_proc) THEN
573: PO_LOG.proc_end(d_module);
574: END IF;
575:
576: EXCEPTION
577: WHEN OTHERS THEN
621: l_po_line_id_tbl PO_TBL_NUMBER;
622: BEGIN
623:
624: d_position := 0;
625: IF (PO_LOG.d_proc) THEN
626: PO_LOG.proc_begin(d_module);
627: END IF;
628:
629: DELETE FROM po_lines_draft_all
622: BEGIN
623:
624: d_position := 0;
625: IF (PO_LOG.d_proc) THEN
626: PO_LOG.proc_begin(d_module);
627: END IF;
628:
629: DELETE FROM po_lines_draft_all
630: WHERE draft_id = p_draft_id
678: FROM po_line_locations_all PLLA
679: WHERE PLLA.po_line_id = l_po_line_id_tbl(i)
680: AND PLLA.line_location_id = PPDD.entity_id);
681:
682: IF (PO_LOG.d_proc) THEN
683: PO_LOG.proc_end(d_module);
684: END IF;
685:
686: EXCEPTION
679: WHERE PLLA.po_line_id = l_po_line_id_tbl(i)
680: AND PLLA.line_location_id = PPDD.entity_id);
681:
682: IF (PO_LOG.d_proc) THEN
683: PO_LOG.proc_end(d_module);
684: END IF;
685:
686: EXCEPTION
687: WHEN OTHERS THEN
738: l_chg_exist_tbl PO_TBL_VARCHAR1;
739:
740: BEGIN
741: d_position := 0;
742: IF (PO_LOG.d_proc) THEN
743: PO_LOG.proc_begin(d_module);
744: END IF;
745:
746: SELECT PHI.interface_header_id,
739:
740: BEGIN
741: d_position := 0;
742: IF (PO_LOG.d_proc) THEN
743: PO_LOG.proc_begin(d_module);
744: END IF;
745:
746: SELECT PHI.interface_header_id,
747: PHI.action,
811: FORALL i IN 1..l_dft_to_delete_tbl.COUNT
812: DELETE po_drafts
813: WHERE draft_id = l_dft_to_delete_tbl(i);
814:
815: IF (PO_LOG.d_proc) THEN
816: PO_LOG.proc_end(d_module);
817: END IF;
818:
819: EXCEPTION
812: DELETE po_drafts
813: WHERE draft_id = l_dft_to_delete_tbl(i);
814:
815: IF (PO_LOG.d_proc) THEN
816: PO_LOG.proc_end(d_module);
817: END IF;
818:
819: EXCEPTION
820: WHEN OTHERS THEN
863: l_is_std_po BOOLEAN := FALSE;
864:
865: BEGIN
866: d_position := 0;
867: IF (PO_LOG.d_proc) THEN
868: PO_LOG.proc_begin(d_module);
869: END IF;
870:
871: x_header_rejected := FND_API.G_FALSE;
864:
865: BEGIN
866: d_position := 0;
867: IF (PO_LOG.d_proc) THEN
868: PO_LOG.proc_begin(d_module);
869: END IF;
870:
871: x_header_rejected := FND_API.G_FALSE;
872:
904: PO_PDOI_CONSTANTS.g_CALL_MOD_CATALOG_UPLOAD )) THEN
905:
906: d_position := 10;
907:
908: IF (PO_LOG.d_stmt) THEN
909: PO_LOG.stmt(d_module, d_position, 'failed Check 1');
910: END IF;
911:
912: x_header_rejected := FND_API.G_TRUE;
905:
906: d_position := 10;
907:
908: IF (PO_LOG.d_stmt) THEN
909: PO_LOG.stmt(d_module, d_position, 'failed Check 1');
910: END IF;
911:
912: x_header_rejected := FND_API.G_TRUE;
913:
919: -- add more checks here
920: -- Check 2: There should at least be one line that is valid
921: IF (x_header_rejected = FND_API.G_FALSE) THEN
922: IF ( p_doc_info.number_of_valid_lines = 0 ) THEN
923: IF (PO_LOG.d_stmt) THEN
924: PO_LOG.stmt(d_module, d_position, 'failed Check 2');
925: END IF;
926:
927: IF ( p_doc_rec.action <> PO_PDOI_CONSTANTS.g_ACTION_UPDATE ) THEN
920: -- Check 2: There should at least be one line that is valid
921: IF (x_header_rejected = FND_API.G_FALSE) THEN
922: IF ( p_doc_info.number_of_valid_lines = 0 ) THEN
923: IF (PO_LOG.d_stmt) THEN
924: PO_LOG.stmt(d_module, d_position, 'failed Check 2');
925: END IF;
926:
927: IF ( p_doc_rec.action <> PO_PDOI_CONSTANTS.g_ACTION_UPDATE ) THEN
928: -- If action <> update, we need to tell user that the document created
966: p_remove_draft => x_remove_draft -- bug5129752
967: );
968: END IF;
969:
970: IF (PO_LOG.d_proc) THEN
971: PO_LOG.proc_end(d_module);
972: END IF;
973: EXCEPTION
974: WHEN OTHERS THEN
967: );
968: END IF;
969:
970: IF (PO_LOG.d_proc) THEN
971: PO_LOG.proc_end(d_module);
972: END IF;
973: EXCEPTION
974: WHEN OTHERS THEN
975: PO_MESSAGE_S.add_exc_msg
1017: l_role_auth_acceptance VARCHAR2(30);
1018:
1019: BEGIN
1020: d_position := 0;
1021: IF (PO_LOG.d_proc) THEN
1022: PO_LOG.proc_begin(d_module);
1023: END IF;
1024:
1025: -- transfer if
1018:
1019: BEGIN
1020: d_position := 0;
1021: IF (PO_LOG.d_proc) THEN
1022: PO_LOG.proc_begin(d_module);
1023: END IF;
1024:
1025: -- transfer if
1026: -- 1) document is not a global agreement, OR
1052: END IF;
1053:
1054: END IF; -- if not ga or ...
1055:
1056: IF (PO_LOG.d_stmt) THEN
1057: PO_LOG.stmt(d_module, d_position, 'x_transfer_flag', x_transfer_flag);
1058: PO_LOG.stmt(d_module, d_position, 'x_submit_for_buyer_acc_flag',
1059: x_submit_for_buyer_acc_flag);
1060: END IF;
1053:
1054: END IF; -- if not ga or ...
1055:
1056: IF (PO_LOG.d_stmt) THEN
1057: PO_LOG.stmt(d_module, d_position, 'x_transfer_flag', x_transfer_flag);
1058: PO_LOG.stmt(d_module, d_position, 'x_submit_for_buyer_acc_flag',
1059: x_submit_for_buyer_acc_flag);
1060: END IF;
1061:
1054: END IF; -- if not ga or ...
1055:
1056: IF (PO_LOG.d_stmt) THEN
1057: PO_LOG.stmt(d_module, d_position, 'x_transfer_flag', x_transfer_flag);
1058: PO_LOG.stmt(d_module, d_position, 'x_submit_for_buyer_acc_flag',
1059: x_submit_for_buyer_acc_flag);
1060: END IF;
1061:
1062: IF (PO_LOG.d_proc) THEN
1058: PO_LOG.stmt(d_module, d_position, 'x_submit_for_buyer_acc_flag',
1059: x_submit_for_buyer_acc_flag);
1060: END IF;
1061:
1062: IF (PO_LOG.d_proc) THEN
1063: PO_LOG.proc_end(d_module);
1064: END IF;
1065: EXCEPTION
1066: WHEN OTHERS THEN
1059: x_submit_for_buyer_acc_flag);
1060: END IF;
1061:
1062: IF (PO_LOG.d_proc) THEN
1063: PO_LOG.proc_end(d_module);
1064: END IF;
1065: EXCEPTION
1066: WHEN OTHERS THEN
1067: PO_MESSAGE_S.add_exc_msg
1106: l_lines src_rule_lines_rec_type;
1107:
1108: BEGIN
1109: d_position := 0;
1110: IF (PO_LOG.d_proc) THEN
1111: PO_LOG.proc_begin(d_module);
1112: END IF;
1113:
1114: assign_document_number ( p_doc_rec => p_doc_rec );
1107:
1108: BEGIN
1109: d_position := 0;
1110: IF (PO_LOG.d_proc) THEN
1111: PO_LOG.proc_begin(d_module);
1112: END IF;
1113:
1114: assign_document_number ( p_doc_rec => p_doc_rec );
1115:
1124: ( p_doc_rec => p_doc_rec,
1125: x_lines => l_lines
1126: );
1127:
1128: IF (PO_LOG.d_stmt) THEN
1129: PO_LOG.stmt(d_module, d_position, '# of lines requiring sourcing rules',
1130: l_lines.po_line_id_tbl.COUNT);
1131: END IF;
1132: END IF;
1125: x_lines => l_lines
1126: );
1127:
1128: IF (PO_LOG.d_stmt) THEN
1129: PO_LOG.stmt(d_module, d_position, '# of lines requiring sourcing rules',
1130: l_lines.po_line_id_tbl.COUNT);
1131: END IF;
1132: END IF;
1133:
1155: THEN
1156: set_fpdsng_report_info(p_doc_rec.po_header_id);
1157: END IF;
1158:
1159: IF (PO_LOG.d_stmt) THEN
1160: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1161: END IF;
1162:
1163: --
1156: set_fpdsng_report_info(p_doc_rec.po_header_id);
1157: END IF;
1158:
1159: IF (PO_LOG.d_stmt) THEN
1160: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1161: END IF;
1162:
1163: --
1164: -- approved. If the approval method is NONE, submission check was returning error
1187: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
1188: d_position := 40;
1189:
1190:
1191: IF (PO_LOG.d_stmt) THEN
1192: PO_LOG.stmt(d_module, d_position, 'starting approval workflow');
1193: END IF;
1194:
1195: start_po_approval_workflow
1188: d_position := 40;
1189:
1190:
1191: IF (PO_LOG.d_stmt) THEN
1192: PO_LOG.stmt(d_module, d_position, 'starting approval workflow');
1193: END IF;
1194:
1195: start_po_approval_workflow
1196: ( p_doc_rec => p_doc_rec
1202: l_new_auth_status := 'APPROVED';
1203:
1204: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1205:
1206: IF (PO_LOG.d_stmt) THEN
1207: PO_LOG.stmt(d_module, d_position, 'creating sourcing rules');
1208: END IF;
1209:
1210: d_position := 60;
1203:
1204: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1205:
1206: IF (PO_LOG.d_stmt) THEN
1207: PO_LOG.stmt(d_module, d_position, 'creating sourcing rules');
1208: END IF;
1209:
1210: d_position := 60;
1211: process_sourcing_rules
1229:
1230: d_position := 90;
1231:
1232:
1233: IF (PO_LOG.d_stmt) THEN
1234: PO_LOG.stmt(d_module, d_position, 'Reserving document');
1235: END IF;
1236:
1237: -- reserve document
1230: d_position := 90;
1231:
1232:
1233: IF (PO_LOG.d_stmt) THEN
1234: PO_LOG.stmt(d_module, d_position, 'Reserving document');
1235: END IF;
1236:
1237: -- reserve document
1238: reserve_fund
1242:
1243: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
1244:
1245:
1246: IF (PO_LOG.d_stmt) THEN
1247: PO_LOG.stmt(d_module, d_position, 'Fund reservation was not done correctly');
1248: END IF;
1249:
1250: -- If fund reservation is not successful, we need to revert the
1243: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
1244:
1245:
1246: IF (PO_LOG.d_stmt) THEN
1247: PO_LOG.stmt(d_module, d_position, 'Fund reservation was not done correctly');
1248: END IF;
1249:
1250: -- If fund reservation is not successful, we need to revert the
1251: -- authorization status back
1294: x_process_code := 'I';
1295: END IF;
1296: /* END IF; --if approval method is NONE
1297:
1298: IF (PO_LOG.d_proc) THEN
1299: PO_LOG.proc_end(d_module);
1300: END IF;
1301: EXCEPTION
1302: WHEN OTHERS THEN
1295: END IF;
1296: /* END IF; --if approval method is NONE
1297:
1298: IF (PO_LOG.d_proc) THEN
1299: PO_LOG.proc_end(d_module);
1300: END IF;
1301: EXCEPTION
1302: WHEN OTHERS THEN
1303: PO_MESSAGE_S.add_exc_msg
1340: l_need_to_create_src_rules VARCHAR2(1);
1341: l_lines src_rule_lines_rec_type;
1342: BEGIN
1343: d_position := 0;
1344: IF (PO_LOG.d_proc) THEN
1345: PO_LOG.proc_begin(d_module);
1346: END IF;
1347:
1348: l_doc_info := PO_PDOI_PARAMS.g_docs_info(p_doc_rec.interface_header_id);
1341: l_lines src_rule_lines_rec_type;
1342: BEGIN
1343: d_position := 0;
1344: IF (PO_LOG.d_proc) THEN
1345: PO_LOG.proc_begin(d_module);
1346: END IF;
1347:
1348: l_doc_info := PO_PDOI_PARAMS.g_docs_info(p_doc_rec.interface_header_id);
1349:
1358: ( p_doc_rec => p_doc_rec,
1359: x_lines => l_lines
1360: );
1361:
1362: IF (PO_LOG.d_stmt) THEN
1363: PO_LOG.stmt(d_module, d_position, '# of lines requiring src rules: ' ||
1364: l_lines.po_line_id_tbl.COUNT);
1365: END IF;
1366: END IF;
1359: x_lines => l_lines
1360: );
1361:
1362: IF (PO_LOG.d_stmt) THEN
1363: PO_LOG.stmt(d_module, d_position, '# of lines requiring src rules: ' ||
1364: l_lines.po_line_id_tbl.COUNT);
1365: END IF;
1366: END IF;
1367:
1367:
1368: d_position := 30;
1369: transfer_draft_to_txn (p_doc_rec => p_doc_rec);
1370:
1371: IF (PO_LOG.d_stmt) THEN
1372: PO_LOG.stmt(d_module, d_position, 'Called transfer draft to txn');
1373: END IF;
1374:
1375: IF (l_doc_info.has_lines_to_notify = FND_API.G_TRUE) THEN
1368: d_position := 30;
1369: transfer_draft_to_txn (p_doc_rec => p_doc_rec);
1370:
1371: IF (PO_LOG.d_stmt) THEN
1372: PO_LOG.stmt(d_module, d_position, 'Called transfer draft to txn');
1373: END IF;
1374:
1375: IF (l_doc_info.has_lines_to_notify = FND_API.G_TRUE) THEN
1376: -- set header level process code to NOTIFIED
1377: UPDATE po_headers_interface
1378: SET process_code = 'NOTIFIED'
1379: WHERE interface_header_id = p_doc_rec.interface_header_id;
1380:
1381: IF (PO_LOG.d_stmt) THEN
1382: PO_LOG.stmt(d_module, d_position, 'start price tolerance workflow');
1383: END IF;
1384:
1385: -- start workflow
1378: SET process_code = 'NOTIFIED'
1379: WHERE interface_header_id = p_doc_rec.interface_header_id;
1380:
1381: IF (PO_LOG.d_stmt) THEN
1382: PO_LOG.stmt(d_module, d_position, 'start price tolerance workflow');
1383: END IF;
1384:
1385: -- start workflow
1386: PO_PDOI_PRICE_TOLERANCE_PVT.start_price_tolerance_wf
1405: ( p_doc_rec => p_doc_rec,
1406: x_approval_method => l_approval_method
1407: );
1408:
1409: IF (PO_LOG.d_stmt) THEN
1410: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1411: END IF;
1412:
1413: --
1406: x_approval_method => l_approval_method
1407: );
1408:
1409: IF (PO_LOG.d_stmt) THEN
1410: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1411: END IF;
1412:
1413: --
1414: -- approved. If the approval method is NONE, submission check was returning error
1435: x_process_code := NULL;
1436: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
1437: d_position := 50;
1438:
1439: IF (PO_LOG.d_stmt) THEN
1440: PO_LOG.stmt(d_module, d_position, 'launch approval workflow');
1441: END IF;
1442:
1443: start_po_approval_workflow
1436: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
1437: d_position := 50;
1438:
1439: IF (PO_LOG.d_stmt) THEN
1440: PO_LOG.stmt(d_module, d_position, 'launch approval workflow');
1441: END IF;
1442:
1443: start_po_approval_workflow
1444: ( p_doc_rec => p_doc_rec
1471: IF (l_new_auth_status = 'APPROVED') then
1472: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_blanket = 'APPROVE') THEN
1473: d_position := 80;
1474:
1475: IF (PO_LOG.d_stmt) THEN
1476: PO_LOG.stmt(d_module, d_position, 'Need to archive');
1477: END IF;
1478:
1479: archive_po
1472: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_blanket = 'APPROVE') THEN
1473: d_position := 80;
1474:
1475: IF (PO_LOG.d_stmt) THEN
1476: PO_LOG.stmt(d_module, d_position, 'Need to archive');
1477: END IF;
1478:
1479: archive_po
1480: ( p_doc_rec => p_doc_rec
1501: /*END IF; --if approval method is NONE
1502:
1503: END IF;
1504:
1505: IF (PO_LOG.d_proc) THEN
1506: PO_LOG.proc_end(d_module);
1507: END IF;
1508: EXCEPTION
1509: WHEN OTHERS THEN
1502:
1503: END IF;
1504:
1505: IF (PO_LOG.d_proc) THEN
1506: PO_LOG.proc_end(d_module);
1507: END IF;
1508: EXCEPTION
1509: WHEN OTHERS THEN
1510: PO_MESSAGE_S.add_exc_msg
1544: l_lines src_rule_lines_rec_type;
1545: BEGIN
1546:
1547: d_position := 0;
1548: IF (PO_LOG.d_proc) THEN
1549: PO_LOG.proc_begin(d_module);
1550: END IF;
1551:
1552: assign_document_number ( p_doc_rec => p_doc_rec );
1545: BEGIN
1546:
1547: d_position := 0;
1548: IF (PO_LOG.d_proc) THEN
1549: PO_LOG.proc_begin(d_module);
1550: END IF;
1551:
1552: assign_document_number ( p_doc_rec => p_doc_rec );
1553:
1562: ( p_doc_rec => p_doc_rec,
1563: x_lines => l_lines
1564: );
1565:
1566: IF (PO_LOG.d_stmt) THEN
1567: PO_LOG.stmt(d_module, d_position, '# lines requiring src rules: ' || l_lines.po_line_id_tbl.COUNT);
1568: END IF;
1569: END IF;
1570:
1563: x_lines => l_lines
1564: );
1565:
1566: IF (PO_LOG.d_stmt) THEN
1567: PO_LOG.stmt(d_module, d_position, '# lines requiring src rules: ' || l_lines.po_line_id_tbl.COUNT);
1568: END IF;
1569: END IF;
1570:
1571: d_position := 30;
1576: ( p_doc_rec => p_doc_rec,
1577: x_approval_method => l_approval_method
1578: );
1579:
1580: IF (PO_LOG.d_stmt) THEN
1581: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1582: END IF;
1583:
1584: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1577: x_approval_method => l_approval_method
1578: );
1579:
1580: IF (PO_LOG.d_stmt) THEN
1581: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1582: END IF;
1583:
1584: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1585: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1584: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1585: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1586: d_position := 50;
1587:
1588: IF (PO_LOG.d_stmt) THEN
1589: PO_LOG.stmt(d_module, d_position, 'creating sourcing rules');
1590: END IF;
1591:
1592: process_sourcing_rules
1585: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1586: d_position := 50;
1587:
1588: IF (PO_LOG.d_stmt) THEN
1589: PO_LOG.stmt(d_module, d_position, 'creating sourcing rules');
1590: END IF;
1591:
1592: process_sourcing_rules
1593: ( p_doc_rec => p_doc_rec,
1614: p_doc_rec => p_doc_rec
1615: );
1616: --
1617:
1618: IF (PO_LOG.d_proc) THEN
1619: PO_LOG.proc_end(d_module);
1620: END IF;
1621: EXCEPTION
1622: WHEN OTHERS THEN
1615: );
1616: --
1617:
1618: IF (PO_LOG.d_proc) THEN
1619: PO_LOG.proc_end(d_module);
1620: END IF;
1621: EXCEPTION
1622: WHEN OTHERS THEN
1623: PO_MESSAGE_S.add_exc_msg
1657: l_lines src_rule_lines_rec_type;
1658:
1659: BEGIN
1660: d_position := 0;
1661: IF (PO_LOG.d_proc) THEN
1662: PO_LOG.proc_begin(d_module);
1663: END IF;
1664:
1665: l_doc_info := PO_PDOI_PARAMS.g_docs_info(p_doc_rec.interface_header_id);
1658:
1659: BEGIN
1660: d_position := 0;
1661: IF (PO_LOG.d_proc) THEN
1662: PO_LOG.proc_begin(d_module);
1663: END IF;
1664:
1665: l_doc_info := PO_PDOI_PARAMS.g_docs_info(p_doc_rec.interface_header_id);
1666:
1675: ( p_doc_rec => p_doc_rec,
1676: x_lines => l_lines
1677: );
1678:
1679: IF (PO_LOG.d_stmt) THEN
1680: PO_LOG.stmt(d_module, d_position, '# lines requiring src rules: ' ||
1681: l_lines.po_line_id_tbl.COUNT);
1682: END IF;
1683: END IF;
1676: x_lines => l_lines
1677: );
1678:
1679: IF (PO_LOG.d_stmt) THEN
1680: PO_LOG.stmt(d_module, d_position, '# lines requiring src rules: ' ||
1681: l_lines.po_line_id_tbl.COUNT);
1682: END IF;
1683: END IF;
1684:
1692: UPDATE po_headers_interface
1693: SET process_code = 'NOTIFIED'
1694: WHERE interface_header_id = p_doc_rec.interface_header_id;
1695:
1696: IF (PO_LOG.d_stmt) THEN
1697: PO_LOG.stmt(d_module, d_position, 'start price tolerance workflow');
1698: END IF;
1699:
1700: -- start workflow
1693: SET process_code = 'NOTIFIED'
1694: WHERE interface_header_id = p_doc_rec.interface_header_id;
1695:
1696: IF (PO_LOG.d_stmt) THEN
1697: PO_LOG.stmt(d_module, d_position, 'start price tolerance workflow');
1698: END IF;
1699:
1700: -- start workflow
1701: PO_PDOI_PRICE_TOLERANCE_PVT.start_price_tolerance_wf
1721: ( p_doc_rec => p_doc_rec,
1722: x_approval_method => l_approval_method
1723: );
1724:
1725: IF (PO_LOG.d_stmt) THEN
1726: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1727: END IF;
1728:
1729: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1722: x_approval_method => l_approval_method
1723: );
1724:
1725: IF (PO_LOG.d_stmt) THEN
1726: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
1727: END IF;
1728:
1729: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1730: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1729: IF (l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_AUTO_APPROVE) THEN
1730: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1731: d_position := 60;
1732:
1733: IF (PO_LOG.d_stmt) THEN
1734: PO_LOG.stmt(d_module, d_position, 'Creating Sourcing rules');
1735: END IF;
1736:
1737: process_sourcing_rules
1730: IF (l_need_to_create_src_rules = FND_API.G_TRUE) THEN
1731: d_position := 60;
1732:
1733: IF (PO_LOG.d_stmt) THEN
1734: PO_LOG.stmt(d_module, d_position, 'Creating Sourcing rules');
1735: END IF;
1736:
1737: process_sourcing_rules
1738: ( p_doc_rec => p_doc_rec,
1753: p_doc_rec => p_doc_rec
1754: );
1755: --
1756:
1757: IF (PO_LOG.d_proc) THEN
1758: PO_LOG.proc_end(d_module);
1759: END IF;
1760: EXCEPTION
1761: WHEN OTHERS THEN
1754: );
1755: --
1756:
1757: IF (PO_LOG.d_proc) THEN
1758: PO_LOG.proc_end(d_module);
1759: END IF;
1760: EXCEPTION
1761: WHEN OTHERS THEN
1762: PO_MESSAGE_S.add_exc_msg
1821: p_return_status VARCHAR2(1); -- bug 7277317
1822: BEGIN
1823:
1824: d_position := 0;
1825: IF (PO_LOG.d_proc) THEN
1826: PO_LOG.proc_begin(d_module);
1827: END IF;
1828:
1829: assign_document_number ( p_doc_rec => p_doc_rec );
1822: BEGIN
1823:
1824: d_position := 0;
1825: IF (PO_LOG.d_proc) THEN
1826: PO_LOG.proc_begin(d_module);
1827: END IF;
1828:
1829: assign_document_number ( p_doc_rec => p_doc_rec );
1830:
1916: x_headers => l_headers
1917: );
1918:
1919: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
1920: IF (PO_LOG.d_stmt) THEN
1921: PO_LOG.stmt(d_module, d_position, 'header count within batch',
1922: l_headers.rec_count);
1923: END IF;
1924:
1917: );
1918:
1919: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
1920: IF (PO_LOG.d_stmt) THEN
1921: PO_LOG.stmt(d_module, d_position, 'header count within batch',
1922: l_headers.rec_count);
1923: END IF;
1924:
1925: SELECT interface_header_id
1953:
1954: d_position := 35;
1955:
1956:
1957: IF (PO_LOG.d_stmt) THEN
1958: PO_LOG.stmt(d_module, d_position, 'Calculation of correct Funded Value starts, if its a CLM document');
1959: END IF;
1960:
1961: l_is_clm := po_partial_funding_pkg.Is_CLM_Document (p_Doc_type => 'PO',
1954: d_position := 35;
1955:
1956:
1957: IF (PO_LOG.d_stmt) THEN
1958: PO_LOG.stmt(d_module, d_position, 'Calculation of correct Funded Value starts, if its a CLM document');
1959: END IF;
1960:
1961: l_is_clm := po_partial_funding_pkg.Is_CLM_Document (p_Doc_type => 'PO',
1962: p_Doc_Level_Id => p_doc_rec.PHI_PO_HEADER_ID);
1969: WHERE po_header_id = p_doc_rec.PHI_PO_HEADER_ID;
1970:
1971: FOR i IN 1 .. l_distribution_id_tbl.COUNT LOOP
1972:
1973: IF (PO_LOG.d_stmt) THEN
1974: PO_LOG.stmt(d_module, d_position, 'Processing the PO_DISTRIBUTION_ID ',l_distribution_id_tbl(i));
1975: END IF;
1976:
1977: l_amount_ordered := PO_DOCUMENT_TOTALS_PVT.getEncumberedAmountForDist(
1970:
1971: FOR i IN 1 .. l_distribution_id_tbl.COUNT LOOP
1972:
1973: IF (PO_LOG.d_stmt) THEN
1974: PO_LOG.stmt(d_module, d_position, 'Processing the PO_DISTRIBUTION_ID ',l_distribution_id_tbl(i));
1975: END IF;
1976:
1977: l_amount_ordered := PO_DOCUMENT_TOTALS_PVT.getEncumberedAmountForDist(
1978: p_distribution_id => l_distribution_id_tbl(i)
1977: l_amount_ordered := PO_DOCUMENT_TOTALS_PVT.getEncumberedAmountForDist(
1978: p_distribution_id => l_distribution_id_tbl(i)
1979: );
1980:
1981: IF (PO_LOG.d_stmt) THEN
1982: PO_LOG.stmt(d_module, d_position, 'Funded Value for this Distribution ',l_funded_value_tbl(i));
1983: PO_LOG.stmt(d_module, d_position, 'Actual Encumbrance amount of this Distribution ',l_amount_ordered);
1984: END IF;
1985:
1978: p_distribution_id => l_distribution_id_tbl(i)
1979: );
1980:
1981: IF (PO_LOG.d_stmt) THEN
1982: PO_LOG.stmt(d_module, d_position, 'Funded Value for this Distribution ',l_funded_value_tbl(i));
1983: PO_LOG.stmt(d_module, d_position, 'Actual Encumbrance amount of this Distribution ',l_amount_ordered);
1984: END IF;
1985:
1986: IF (l_partial_funded_flag_tbl(i) = 'N') THEN
1979: );
1980:
1981: IF (PO_LOG.d_stmt) THEN
1982: PO_LOG.stmt(d_module, d_position, 'Funded Value for this Distribution ',l_funded_value_tbl(i));
1983: PO_LOG.stmt(d_module, d_position, 'Actual Encumbrance amount of this Distribution ',l_amount_ordered);
1984: END IF;
1985:
1986: IF (l_partial_funded_flag_tbl(i) = 'N') THEN
1987:
1990: change_in_funded_value = l_amount_ordered
1991: WHERE po_distribution_id = l_distribution_id_tbl(i)
1992: AND budget_account_id IS NOT NULL;
1993:
1994: IF (PO_LOG.d_stmt) THEN
1995: PO_LOG.stmt(d_module, d_position, 'Updated the Encumbrance amount for this Distribution to ',l_amount_ordered);
1996: END IF;
1997:
1998: ELSIF (l_partial_funded_flag_tbl(i) = 'Y' AND NVL(l_funded_value_tbl(i),0) > l_amount_ordered) THEN
1991: WHERE po_distribution_id = l_distribution_id_tbl(i)
1992: AND budget_account_id IS NOT NULL;
1993:
1994: IF (PO_LOG.d_stmt) THEN
1995: PO_LOG.stmt(d_module, d_position, 'Updated the Encumbrance amount for this Distribution to ',l_amount_ordered);
1996: END IF;
1997:
1998: ELSIF (l_partial_funded_flag_tbl(i) = 'Y' AND NVL(l_funded_value_tbl(i),0) > l_amount_ordered) THEN
1999:
1996: END IF;
1997:
1998: ELSIF (l_partial_funded_flag_tbl(i) = 'Y' AND NVL(l_funded_value_tbl(i),0) > l_amount_ordered) THEN
1999:
2000: IF (PO_LOG.d_stmt) THEN
2001: PO_LOG.stmt(d_module, d_position, 'The total order value is less than the funded value for the po_distribution_id '
2002: , l_distribution_id_tbl(i));
2003: END IF;
2004:
1997:
1998: ELSIF (l_partial_funded_flag_tbl(i) = 'Y' AND NVL(l_funded_value_tbl(i),0) > l_amount_ordered) THEN
1999:
2000: IF (PO_LOG.d_stmt) THEN
2001: PO_LOG.stmt(d_module, d_position, 'The total order value is less than the funded value for the po_distribution_id '
2002: , l_distribution_id_tbl(i));
2003: END IF;
2004:
2005: IF (l_results IS NULL) THEN
2020: );
2021:
2022: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
2023:
2024: IF (PO_LOG.d_stmt) THEN
2025: PO_LOG.stmt(d_module, d_position, 'header count within batch',
2026: l_headers.rec_count);
2027: END IF;
2028:
2021:
2022: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
2023:
2024: IF (PO_LOG.d_stmt) THEN
2025: PO_LOG.stmt(d_module, d_position, 'header count within batch',
2026: l_headers.rec_count);
2027: END IF;
2028:
2029: SELECT interface_header_id
2071: ( p_doc_rec => p_doc_rec,
2072: x_approval_method => l_approval_method
2073: );
2074:
2075: IF (PO_LOG.d_stmt) THEN
2076: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2077: END IF;
2078:
2079: --
2072: x_approval_method => l_approval_method
2073: );
2074:
2075: IF (PO_LOG.d_stmt) THEN
2076: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2077: END IF;
2078:
2079: --
2080: -- approved. If the approval method is NONE, submission check was returning error
2099: x_process_code := NULL;
2100: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
2101: d_position := 60;
2102:
2103: IF (PO_LOG.d_stmt) THEN
2104: PO_LOG.stmt(d_module, d_position, 'launching approval workflow');
2105: END IF;
2106:
2107: start_po_approval_workflow
2100: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
2101: d_position := 60;
2102:
2103: IF (PO_LOG.d_stmt) THEN
2104: PO_LOG.stmt(d_module, d_position, 'launching approval workflow');
2105: END IF;
2106:
2107: start_po_approval_workflow
2108: ( p_doc_rec => p_doc_rec
2117: p_new_auth_status => l_new_auth_status
2118: );
2119:
2120:
2121: IF (PO_LOG.d_stmt) THEN
2122: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
2123: END IF;
2124:
2125: IF ( l_need_to_encumber = FND_API.G_TRUE) THEN
2118: );
2119:
2120:
2121: IF (PO_LOG.d_stmt) THEN
2122: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
2123: END IF;
2124:
2125: IF ( l_need_to_encumber = FND_API.G_TRUE) THEN
2126: d_position := 80;
2139: );
2140:
2141: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
2142: d_position := 100;
2143: IF (PO_LOG.d_stmt) THEN
2144: PO_LOG.stmt(d_module, d_position, 'failed fund reservation');
2145: END IF;
2146:
2147: /*6851752 Start
2140:
2141: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
2142: d_position := 100;
2143: IF (PO_LOG.d_stmt) THEN
2144: PO_LOG.stmt(d_module, d_position, 'failed fund reservation');
2145: END IF;
2146:
2147: /*6851752 Start
2148: Set Authorization Status to PRE-APPROVED, when it fails funds check */
2164: Launch Approval, when it fails funds check and the Authrization status is PRE-APPROVED*/
2165:
2166: IF (l_fund_reserve_result = FND_API.G_FALSE) AND (l_new_auth_status = 'PRE-APPROVED') THEN
2167:
2168: IF (PO_LOG.d_stmt) THEN
2169: PO_LOG.stmt(d_module, d_position, 'launching approval workflow');
2170: END IF;
2171: start_po_approval_workflow
2172: ( p_doc_rec => p_doc_rec
2165:
2166: IF (l_fund_reserve_result = FND_API.G_FALSE) AND (l_new_auth_status = 'PRE-APPROVED') THEN
2167:
2168: IF (PO_LOG.d_stmt) THEN
2169: PO_LOG.stmt(d_module, d_position, 'launching approval workflow');
2170: END IF;
2171: start_po_approval_workflow
2172: ( p_doc_rec => p_doc_rec
2173: );
2178:
2179: IF (l_new_auth_status = 'APPROVED') THEN
2180: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_std_po = 'APPROVE') THEN
2181: d_position := 120;
2182: IF (PO_LOG.d_stmt) THEN
2183: PO_LOG.stmt(d_module, d_position, 'archiving...');
2184: END IF;
2185:
2186: archive_po
2179: IF (l_new_auth_status = 'APPROVED') THEN
2180: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_std_po = 'APPROVE') THEN
2181: d_position := 120;
2182: IF (PO_LOG.d_stmt) THEN
2183: PO_LOG.stmt(d_module, d_position, 'archiving...');
2184: END IF;
2185:
2186: archive_po
2187: ( p_doc_rec => p_doc_rec
2207: END IF;
2208: /*END IF; --if approval method is NONE
2209: END IF;
2210:
2211: IF (PO_LOG.d_proc) THEN
2212: PO_LOG.proc_end(d_module);
2213: END IF;
2214:
2215: EXCEPTION
2208: /*END IF; --if approval method is NONE
2209: END IF;
2210:
2211: IF (PO_LOG.d_proc) THEN
2212: PO_LOG.proc_end(d_module);
2213: END IF;
2214:
2215: EXCEPTION
2216: WHEN OTHERS THEN
2276:
2277: p_return_status VARCHAR2(1); -- bug 7277317
2278: BEGIN
2279: d_position := 0;
2280: IF (PO_LOG.d_proc) THEN
2281: PO_LOG.proc_begin(d_module);
2282: END IF;
2283:
2284: transfer_draft_to_txn (p_doc_rec => p_doc_rec);
2277: p_return_status VARCHAR2(1); -- bug 7277317
2278: BEGIN
2279: d_position := 0;
2280: IF (PO_LOG.d_proc) THEN
2281: PO_LOG.proc_begin(d_module);
2282: END IF;
2283:
2284: transfer_draft_to_txn (p_doc_rec => p_doc_rec);
2285:
2347: );
2348:
2349: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
2350:
2351: IF (PO_LOG.d_stmt) THEN
2352: PO_LOG.stmt(d_module, d_position, 'header count within batch',
2353: l_headers.rec_count);
2354: END IF;
2355:
2348:
2349: l_headers.rec_count := l_headers.intf_header_id_tbl.COUNT;
2350:
2351: IF (PO_LOG.d_stmt) THEN
2352: PO_LOG.stmt(d_module, d_position, 'header count within batch',
2353: l_headers.rec_count);
2354: END IF;
2355:
2356: SELECT Max(interface_header_id)
2390: ( p_doc_rec => p_doc_rec,
2391: x_approval_method => l_approval_method
2392: );
2393:
2394: IF (PO_LOG.d_stmt) THEN
2395: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2396: END IF;
2397:
2398: --
2391: x_approval_method => l_approval_method
2392: );
2393:
2394: IF (PO_LOG.d_stmt) THEN
2395: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2396: END IF;
2397:
2398: --
2399: -- approved. If the approval method is NONE, submission check was returning error
2419: IF (p_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2420: x_process_code := NULL;
2421: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
2422: d_position := 40;
2423: IF (PO_LOG.d_stmt) THEN
2424: PO_LOG.stmt(d_module, d_position, 'start approval workflow');
2425: END IF;
2426:
2427: start_po_approval_workflow
2420: x_process_code := NULL;
2421: IF ( l_approval_method = PO_PDOI_CONSTANTS.g_appr_method_INIT_APPROVAL) THEN
2422: d_position := 40;
2423: IF (PO_LOG.d_stmt) THEN
2424: PO_LOG.stmt(d_module, d_position, 'start approval workflow');
2425: END IF;
2426:
2427: start_po_approval_workflow
2428: ( p_doc_rec => p_doc_rec
2442: ( p_doc_rec => p_doc_rec,
2443: p_new_auth_status => l_new_auth_status
2444: );
2445:
2446: IF (PO_LOG.d_stmt) THEN
2447: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
2448: END IF;
2449:
2450: IF (l_need_to_encumber = FND_API.G_TRUE) THEN
2443: p_new_auth_status => l_new_auth_status
2444: );
2445:
2446: IF (PO_LOG.d_stmt) THEN
2447: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
2448: END IF;
2449:
2450: IF (l_need_to_encumber = FND_API.G_TRUE) THEN
2451: d_position := 60;
2456: );
2457:
2458: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
2459: d_position := 70;
2460: IF (PO_LOG.d_stmt) THEN
2461: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2462: END IF;
2463:
2464: -- No need to set the authorziation_status because transfer program
2457:
2458: IF (l_fund_reserve_result = FND_API.G_FALSE) THEN
2459: d_position := 70;
2460: IF (PO_LOG.d_stmt) THEN
2461: PO_LOG.stmt(d_module, d_position, 'l_approval_method', l_approval_method);
2462: END IF;
2463:
2464: -- No need to set the authorziation_status because transfer program
2465: -- should have handled the approval status properly
2477:
2478: IF (l_new_auth_status = 'APPROVED') THEN
2479: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_std_po = 'APPROVE') THEN
2480: d_position := 90;
2481: IF (PO_LOG.d_stmt) THEN
2482: PO_LOG.stmt(d_module, d_position, 'l_archiving...');
2483: END IF;
2484:
2485: archive_po
2478: IF (l_new_auth_status = 'APPROVED') THEN
2479: IF (PO_PDOI_PARAMS.g_sys.when_to_archive_std_po = 'APPROVE') THEN
2480: d_position := 90;
2481: IF (PO_LOG.d_stmt) THEN
2482: PO_LOG.stmt(d_module, d_position, 'l_archiving...');
2483: END IF;
2484:
2485: archive_po
2486: ( p_doc_rec => p_doc_rec
2508: /*END IF; --if approval method is NONE
2509: END IF;
2510:
2511:
2512: IF (PO_LOG.d_proc) THEN
2513: PO_LOG.proc_end(d_module);
2514: END IF;
2515:
2516: EXCEPTION
2509: END IF;
2510:
2511:
2512: IF (PO_LOG.d_proc) THEN
2513: PO_LOG.proc_end(d_module);
2514: END IF;
2515:
2516: EXCEPTION
2517: WHEN OTHERS THEN
2548:
2549: BEGIN
2550:
2551: d_position := 0;
2552: IF (PO_LOG.d_proc) THEN
2553: PO_LOG.proc_begin(d_module);
2554: END IF;
2555:
2556: l_expiration_date := p_doc_rec.intf_start_date - 1;
2549: BEGIN
2550:
2551: d_position := 0;
2552: IF (PO_LOG.d_proc) THEN
2553: PO_LOG.proc_begin(d_module);
2554: END IF;
2555:
2556: l_expiration_date := p_doc_rec.intf_start_date - 1;
2557:
2554: END IF;
2555:
2556: l_expiration_date := p_doc_rec.intf_start_date - 1;
2557:
2558: IF (PO_LOG.d_stmt) THEN
2559: PO_LOG.stmt(d_module, d_position, 'l_expiration_date', l_expiration_date);
2560: END IF;
2561:
2562: UPDATE po_headers_all
2555:
2556: l_expiration_date := p_doc_rec.intf_start_date - 1;
2557:
2558: IF (PO_LOG.d_stmt) THEN
2559: PO_LOG.stmt(d_module, d_position, 'l_expiration_date', l_expiration_date);
2560: END IF;
2561:
2562: UPDATE po_headers_all
2563: SET start_date = NVL(start_date, l_expiration_date),
2565: last_updated_by = FND_GLOBAL.user_id,
2566: last_update_date = SYSDATE
2567: WHERE po_header_id = p_doc_rec.orig_po_header_id;
2568:
2569: IF (PO_LOG.d_proc) THEN
2570: PO_LOG.proc_end(d_module);
2571: END IF;
2572: EXCEPTION
2573: WHEN OTHERS THEN
2566: last_update_date = SYSDATE
2567: WHERE po_header_id = p_doc_rec.orig_po_header_id;
2568:
2569: IF (PO_LOG.d_proc) THEN
2570: PO_LOG.proc_end(d_module);
2571: END IF;
2572: EXCEPTION
2573: WHEN OTHERS THEN
2574: PO_MESSAGE_S.add_exc_msg
2605:
2606: BEGIN
2607:
2608: d_position := 0;
2609: IF (PO_LOG.d_proc) THEN
2610: PO_LOG.proc_begin(d_module);
2611: END IF;
2612:
2613: -- bug5024833
2606: BEGIN
2607:
2608: d_position := 0;
2609: IF (PO_LOG.d_proc) THEN
2610: PO_LOG.proc_begin(d_module);
2611: END IF;
2612:
2613: -- bug5024833
2614: -- Do not generate the po number from the system if number generation
2623: PO_PDOI_PARAMS.g_sys.user_defined_po_num_code = 'MANUAL')) THEN
2624:
2625: d_position := 10;
2626:
2627: IF (PO_LOG.d_stmt) THEN
2628: PO_LOG.stmt(d_module, d_position, 'Manual numbering. No need to generate new number');
2629: END IF;
2630:
2631: ELSIF (p_doc_rec.doc_num_provided = 'Y') THEN
2624:
2625: d_position := 10;
2626:
2627: IF (PO_LOG.d_stmt) THEN
2628: PO_LOG.stmt(d_module, d_position, 'Manual numbering. No need to generate new number');
2629: END IF;
2630:
2631: ELSIF (p_doc_rec.doc_num_provided = 'Y') THEN
2632: -- bug5028275
2632: -- bug5028275
2633: -- If user provides their own document number, use the one they provide
2634: d_position := 20;
2635:
2636: IF (PO_LOG.d_stmt) THEN
2637: PO_LOG.stmt(d_module, d_position, 'User provides document number. No need to generate new number');
2638: END IF;
2639:
2640: ELSE
2633: -- If user provides their own document number, use the one they provide
2634: d_position := 20;
2635:
2636: IF (PO_LOG.d_stmt) THEN
2637: PO_LOG.stmt(d_module, d_position, 'User provides document number. No need to generate new number');
2638: END IF;
2639:
2640: ELSE
2641: d_position := 30;
2654: ( x_table_name => 'PO_HEADERS'
2655: );
2656: END IF;
2657:
2658: IF (PO_LOG.d_stmt) THEN
2659: PO_LOG.stmt(d_module, d_position, 'Get new document number');
2660: PO_LOG.stmt(d_module, d_position, 'l_document_num', l_document_num);
2661: END IF;
2662:
2655: );
2656: END IF;
2657:
2658: IF (PO_LOG.d_stmt) THEN
2659: PO_LOG.stmt(d_module, d_position, 'Get new document number');
2660: PO_LOG.stmt(d_module, d_position, 'l_document_num', l_document_num);
2661: END IF;
2662:
2663: d_position := 40;
2656: END IF;
2657:
2658: IF (PO_LOG.d_stmt) THEN
2659: PO_LOG.stmt(d_module, d_position, 'Get new document number');
2660: PO_LOG.stmt(d_module, d_position, 'l_document_num', l_document_num);
2661: END IF;
2662:
2663: d_position := 40;
2664:
2670: WHERE po_header_id = p_doc_rec.po_header_id;
2671:
2672: END IF;
2673:
2674: IF (PO_LOG.d_proc) THEN
2675: PO_LOG.proc_end(d_module);
2676: END IF;
2677:
2678: EXCEPTION
2671:
2672: END IF;
2673:
2674: IF (PO_LOG.d_proc) THEN
2675: PO_LOG.proc_end(d_module);
2676: END IF;
2677:
2678: EXCEPTION
2679: WHEN OTHERS THEN
2707: d_position NUMBER;
2708:
2709: BEGIN
2710: d_position := 0;
2711: IF (PO_LOG.d_proc) THEN
2712: PO_LOG.proc_begin(d_module);
2713: END IF;
2714:
2715: IF ( NVL(p_doc_rec.load_sourcing_rules_flag,
2708:
2709: BEGIN
2710: d_position := 0;
2711: IF (PO_LOG.d_proc) THEN
2712: PO_LOG.proc_begin(d_module);
2713: END IF;
2714:
2715: IF ( NVL(p_doc_rec.load_sourcing_rules_flag,
2716: PO_PDOI_PARAMS.g_request.create_sourcing_rules_flag) = 'Y') THEN
2753: d_position NUMBER;
2754:
2755: BEGIN
2756: d_position := 0;
2757: IF (PO_LOG.d_proc) THEN
2758: PO_LOG.proc_begin(d_module);
2759: END IF;
2760:
2761: --SQL What: Select columns needed for calling sourcing rule/asl creation
2754:
2755: BEGIN
2756: d_position := 0;
2757: IF (PO_LOG.d_proc) THEN
2758: PO_LOG.proc_begin(d_module);
2759: END IF;
2760:
2761: --SQL What: Select columns needed for calling sourcing rule/asl creation
2762: -- API. Lines that are in draft but not transaction table will
2796: (SELECT 1
2797: FROM po_lines_all PLA
2798: WHERE PLD.po_line_id = PLA.po_line_id);
2799:
2800: IF (PO_LOG.d_proc) THEN
2801: PO_LOG.proc_end(d_module);
2802: END IF;
2803: EXCEPTION
2804: WHEN OTHERS THEN
2797: FROM po_lines_all PLA
2798: WHERE PLD.po_line_id = PLA.po_line_id);
2799:
2800: IF (PO_LOG.d_proc) THEN
2801: PO_LOG.proc_end(d_module);
2802: END IF;
2803: EXCEPTION
2804: WHEN OTHERS THEN
2805: PO_MESSAGE_S.add_exc_msg
2847: l_msg_data VARCHAR2(2000);
2848: BEGIN
2849:
2850: d_position := 0;
2851: IF (PO_LOG.d_proc) THEN
2852: PO_LOG.proc_begin(d_module);
2853: END IF;
2854:
2855: IF (p_lines.po_line_id_tbl IS NULL) THEN
2848: BEGIN
2849:
2850: d_position := 0;
2851: IF (PO_LOG.d_proc) THEN
2852: PO_LOG.proc_begin(d_module);
2853: END IF;
2854:
2855: IF (p_lines.po_line_id_tbl IS NULL) THEN
2856: d_position := 10;
2866:
2867: FOR i IN 1..p_lines.po_line_id_tbl.COUNT LOOP
2868: d_position := 30;
2869:
2870: IF (PO_LOG.d_stmt) THEN
2871: PO_LOG.stmt(d_module, d_position, 'processing po_line_id: ' ||
2872: p_lines.po_line_id_tbl(i));
2873: END IF;
2874:
2867: FOR i IN 1..p_lines.po_line_id_tbl.COUNT LOOP
2868: d_position := 30;
2869:
2870: IF (PO_LOG.d_stmt) THEN
2871: PO_LOG.stmt(d_module, d_position, 'processing po_line_id: ' ||
2872: p_lines.po_line_id_tbl(i));
2873: END IF;
2874:
2875: PO_CREATE_SR_ASL.create_sourcing_rules_asl
2903: );
2904:
2905: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2906: d_position := 40;
2907: IF (PO_LOG.d_stmt) THEN
2908: PO_LOG.stmt(d_module, d_position, 'Sourcing rule creation failed' ||
2909: ' with status: ' || l_return_status || '. Continue to ' ||
2910: 'process.' );
2911: END IF;
2904:
2905: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2906: d_position := 40;
2907: IF (PO_LOG.d_stmt) THEN
2908: PO_LOG.stmt(d_module, d_position, 'Sourcing rule creation failed' ||
2909: ' with status: ' || l_return_status || '. Continue to ' ||
2910: 'process.' );
2911: END IF;
2912:
2913: END IF;
2914: END LOOP;
2915: END IF;
2916:
2917: IF (PO_LOG.d_proc) THEN
2918: PO_LOG.proc_end(d_module);
2919: END IF;
2920: EXCEPTION
2921: WHEN OTHERS THEN
2914: END LOOP;
2915: END IF;
2916:
2917: IF (PO_LOG.d_proc) THEN
2918: PO_LOG.proc_end(d_module);
2919: END IF;
2920: EXCEPTION
2921: WHEN OTHERS THEN
2922: PO_MESSAGE_S.add_exc_msg
2951: l_return_status VARCHAR2(1);
2952:
2953: BEGIN
2954: d_position := 0;
2955: IF (PO_LOG.d_proc) THEN
2956: PO_LOG.proc_begin(d_module);
2957: END IF;
2958:
2959: -- bug5149827
2952:
2953: BEGIN
2954: d_position := 0;
2955: IF (PO_LOG.d_proc) THEN
2956: PO_LOG.proc_begin(d_module);
2957: END IF;
2958:
2959: -- bug5149827
2960: -- Delete draft if buyer initiates PDOI or document is not GA
2987:
2988: PO_PDOI_UTL.commit_work;
2989: SAVEPOINT po_pdoi_doc_postproc_sp;
2990:
2991: IF (PO_LOG.d_proc) THEN
2992: PO_LOG.proc_end(d_module);
2993: END IF;
2994: EXCEPTION
2995: WHEN OTHERS THEN
2988: PO_PDOI_UTL.commit_work;
2989: SAVEPOINT po_pdoi_doc_postproc_sp;
2990:
2991: IF (PO_LOG.d_proc) THEN
2992: PO_LOG.proc_end(d_module);
2993: END IF;
2994: EXCEPTION
2995: WHEN OTHERS THEN
2996: PO_MESSAGE_S.add_exc_msg
3030:
3031: l_intended_approval_status PO_HEADERS_INTERFACE.approval_status%TYPE;
3032: BEGIN
3033: d_position := 0;
3034: IF (PO_LOG.d_proc) THEN
3035: PO_LOG.proc_begin(d_module);
3036: END IF;
3037:
3038: x_approval_method := PO_PDOI_CONSTANTS.g_appr_method_NONE;
3031: l_intended_approval_status PO_HEADERS_INTERFACE.approval_status%TYPE;
3032: BEGIN
3033: d_position := 0;
3034: IF (PO_LOG.d_proc) THEN
3035: PO_LOG.proc_begin(d_module);
3036: END IF;
3037:
3038: x_approval_method := PO_PDOI_CONSTANTS.g_appr_method_NONE;
3039: --
3084: END IF;
3085:
3086: END IF;
3087:
3088: IF (PO_LOG.d_proc) THEN
3089: PO_LOG.proc_end(d_module);
3090: END IF;
3091: EXCEPTION
3092: WHEN OTHERS THEN
3085:
3086: END IF;
3087:
3088: IF (PO_LOG.d_proc) THEN
3089: PO_LOG.proc_end(d_module);
3090: END IF;
3091: EXCEPTION
3092: WHEN OTHERS THEN
3093: PO_MESSAGE_S.add_exc_msg
3128: l_msg_data VARCHAR2(2000);
3129:
3130: BEGIN
3131: d_position := 0;
3132: IF (PO_LOG.d_proc) THEN
3133: PO_LOG.proc_begin(d_module);
3134: END IF;
3135:
3136: PO_PDOI_UTL.get_processing_doctype_info
3129:
3130: BEGIN
3131: d_position := 0;
3132: IF (PO_LOG.d_proc) THEN
3133: PO_LOG.proc_begin(d_module);
3134: END IF;
3135:
3136: PO_PDOI_UTL.get_processing_doctype_info
3137: ( x_doc_type => l_doc_type,
3151: );
3152:
3153: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3154: d_position := 20;
3155: IF (PO_LOG.d_stmt) THEN
3156: PO_LOG.stmt(d_module, d_position, 'Archiving failed');
3157: END IF;
3158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3159: END IF;
3152:
3153: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3154: d_position := 20;
3155: IF (PO_LOG.d_stmt) THEN
3156: PO_LOG.stmt(d_module, d_position, 'Archiving failed');
3157: END IF;
3158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3159: END IF;
3160:
3157: END IF;
3158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3159: END IF;
3160:
3161: IF (PO_LOG.d_proc) THEN
3162: PO_LOG.proc_end(d_module);
3163: END IF;
3164: EXCEPTION
3165: WHEN OTHERS THEN
3158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3159: END IF;
3160:
3161: IF (PO_LOG.d_proc) THEN
3162: PO_LOG.proc_end(d_module);
3163: END IF;
3164: EXCEPTION
3165: WHEN OTHERS THEN
3166: PO_MESSAGE_S.add_exc_msg
3202:
3203: BEGIN
3204:
3205: d_position := 0;
3206: IF (PO_LOG.d_proc) THEN
3207: PO_LOG.proc_begin(d_module);
3208: END IF;
3209:
3210: IF (PO_PDOI_PARAMS.g_request.document_type IN
3203: BEGIN
3204:
3205: d_position := 0;
3206: IF (PO_LOG.d_proc) THEN
3207: PO_LOG.proc_begin(d_module);
3208: END IF;
3209:
3210: IF (PO_PDOI_PARAMS.g_request.document_type IN
3211: (PO_PDOI_CONSTANTS.g_DOC_TYPE_BLANKET,
3238: l_approved_flag := NULL;
3239: l_approved_date := NULL;
3240: END IF;
3241:
3242: IF (PO_LOG.d_stmt) THEN
3243: PO_LOG.stmt(d_module, d_position, 'p_auth_status', p_auth_status);
3244: PO_LOG.stmt(d_module, d_position, 'l_approved_flag', l_approved_flag);
3245: PO_LOG.stmt(d_module, d_position, 'l_approved_date', l_approved_date);
3246: END IF;
3239: l_approved_date := NULL;
3240: END IF;
3241:
3242: IF (PO_LOG.d_stmt) THEN
3243: PO_LOG.stmt(d_module, d_position, 'p_auth_status', p_auth_status);
3244: PO_LOG.stmt(d_module, d_position, 'l_approved_flag', l_approved_flag);
3245: PO_LOG.stmt(d_module, d_position, 'l_approved_date', l_approved_date);
3246: END IF;
3247:
3240: END IF;
3241:
3242: IF (PO_LOG.d_stmt) THEN
3243: PO_LOG.stmt(d_module, d_position, 'p_auth_status', p_auth_status);
3244: PO_LOG.stmt(d_module, d_position, 'l_approved_flag', l_approved_flag);
3245: PO_LOG.stmt(d_module, d_position, 'l_approved_date', l_approved_date);
3246: END IF;
3247:
3248: d_position := 10;
3241:
3242: IF (PO_LOG.d_stmt) THEN
3243: PO_LOG.stmt(d_module, d_position, 'p_auth_status', p_auth_status);
3244: PO_LOG.stmt(d_module, d_position, 'l_approved_flag', l_approved_flag);
3245: PO_LOG.stmt(d_module, d_position, 'l_approved_date', l_approved_date);
3246: END IF;
3247:
3248: d_position := 10;
3249: UPDATE po_headers_all
3258: WHERE po_header_id = p_doc_rec.po_header_id;
3259:
3260: IF (p_auth_status = 'APPROVED') THEN
3261: d_position := 20;
3262: IF (PO_LOG.d_stmt) THEN
3263: PO_LOG.stmt(d_module, d_position, 'Update shipment approval status');
3264: END IF;
3265:
3266: -- Shipments/Price Breaks should be marked as APPROVED if the document
3259:
3260: IF (p_auth_status = 'APPROVED') THEN
3261: d_position := 20;
3262: IF (PO_LOG.d_stmt) THEN
3263: PO_LOG.stmt(d_module, d_position, 'Update shipment approval status');
3264: END IF;
3265:
3266: -- Shipments/Price Breaks should be marked as APPROVED if the document
3267: -- is imported as approved
3275: AND shipment_type IN ('STANDARD', 'PRICE BREAK')
3276: AND NVL(approved_flag, 'N') <> 'Y';
3277:
3278: d_position := 30;
3279: IF (PO_LOG.d_stmt) THEN
3280: PO_LOG.stmt(d_module, d_position, 'Update action history');
3281: END IF;
3282: -- need to update action history when we approve
3283: PO_FORWARD_SV1.update_action_history
3276: AND NVL(approved_flag, 'N') <> 'Y';
3277:
3278: d_position := 30;
3279: IF (PO_LOG.d_stmt) THEN
3280: PO_LOG.stmt(d_module, d_position, 'Update action history');
3281: END IF;
3282: -- need to update action history when we approve
3283: PO_FORWARD_SV1.update_action_history
3284: ( x_object_id => p_doc_rec.po_header_id,
3295: ( p_po_header_id => p_doc_rec.po_header_id
3296: );
3297: END IF;
3298:
3299: IF (PO_LOG.d_proc) THEN
3300: PO_LOG.proc_end(d_module);
3301: END IF;
3302: EXCEPTION
3303: WHEN OTHERS THEN
3296: );
3297: END IF;
3298:
3299: IF (PO_LOG.d_proc) THEN
3300: PO_LOG.proc_end(d_module);
3301: END IF;
3302: EXCEPTION
3303: WHEN OTHERS THEN
3304: PO_MESSAGE_S.add_exc_msg
3343: l_online_report_id NUMBER;
3344:
3345: BEGIN
3346: d_position := 0;
3347: IF (PO_LOG.d_proc) THEN
3348: PO_LOG.proc_begin(d_module);
3349: END IF;
3350:
3351: x_result := FND_API.G_TRUE; -- bug4907624
3344:
3345: BEGIN
3346: d_position := 0;
3347: IF (PO_LOG.d_proc) THEN
3348: PO_LOG.proc_begin(d_module);
3349: END IF;
3350:
3351: x_result := FND_API.G_TRUE; -- bug4907624
3352:
3382:
3383: IF (l_return_status IN (FND_API.G_RET_STS_ERROR,
3384: FND_API.G_RET_STS_UNEXP_ERROR)) THEN
3385: d_position := 30;
3386: IF (PO_LOG.d_stmt) THEN
3387: PO_LOG.stmt(d_module, d_position, 'Encumbrance returned system error');
3388: END IF;
3389:
3390: x_result := FND_API.G_FALSE; -- bug4907624
3383: IF (l_return_status IN (FND_API.G_RET_STS_ERROR,
3384: FND_API.G_RET_STS_UNEXP_ERROR)) THEN
3385: d_position := 30;
3386: IF (PO_LOG.d_stmt) THEN
3387: PO_LOG.stmt(d_module, d_position, 'Encumbrance returned system error');
3388: END IF;
3389:
3390: x_result := FND_API.G_FALSE; -- bug4907624
3391: ELSE
3392: IF (l_po_return_code IN (PO_DOCUMENT_FUNDS_PVT.g_return_SUCCESS,
3393: PO_DOCUMENT_FUNDS_PVT.g_return_WARNING)) THEN
3394:
3395: d_position := 40;
3396: IF (PO_LOG.d_stmt) THEN
3397: PO_LOG.stmt(d_module, d_position, 'l_po_return_code', l_po_return_code);
3398: END IF;
3399:
3400: ELSE
3393: PO_DOCUMENT_FUNDS_PVT.g_return_WARNING)) THEN
3394:
3395: d_position := 40;
3396: IF (PO_LOG.d_stmt) THEN
3397: PO_LOG.stmt(d_module, d_position, 'l_po_return_code', l_po_return_code);
3398: END IF;
3399:
3400: ELSE
3401: d_position := 50;
3398: END IF;
3399:
3400: ELSE
3401: d_position := 50;
3402: IF (PO_LOG.d_stmt) THEN
3403: PO_LOG.stmt(d_module, d_position, 'Fund Reservation failed');
3404: END IF;
3405: x_result := FND_API.G_FALSE; -- bug4907624
3406: END IF;
3399:
3400: ELSE
3401: d_position := 50;
3402: IF (PO_LOG.d_stmt) THEN
3403: PO_LOG.stmt(d_module, d_position, 'Fund Reservation failed');
3404: END IF;
3405: x_result := FND_API.G_FALSE; -- bug4907624
3406: END IF;
3407:
3406: END IF;
3407:
3408: END IF;
3409:
3410: IF (PO_LOG.d_proc) THEN
3411: PO_LOG.proc_end(d_module);
3412: END IF;
3413: EXCEPTION
3414: WHEN OTHERS THEN
3407:
3408: END IF;
3409:
3410: IF (PO_LOG.d_proc) THEN
3411: PO_LOG.proc_end(d_module);
3412: END IF;
3413: EXCEPTION
3414: WHEN OTHERS THEN
3415: PO_MESSAGE_S.add_exc_msg
3449: l_need_to_encumber VARCHAR2(1);
3450:
3451: BEGIN
3452: d_position := 0;
3453: IF (PO_LOG.d_proc) THEN
3454: PO_LOG.proc_begin(d_module);
3455: END IF;
3456:
3457: -- Encumbrance is required when:
3450:
3451: BEGIN
3452: d_position := 0;
3453: IF (PO_LOG.d_proc) THEN
3454: PO_LOG.proc_begin(d_module);
3455: END IF;
3456:
3457: -- Encumbrance is required when:
3458: -- For standard PO: If document is approved and po encumbrance is turned on
3487: -- for other documents, we do not need to encumber
3488: l_need_to_encumber := FND_API.G_FALSE;
3489: END IF;
3490:
3491: IF (PO_LOG.d_stmt) THEN
3492: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
3493: END IF;
3494:
3495: IF (PO_LOG.d_proc) THEN
3488: l_need_to_encumber := FND_API.G_FALSE;
3489: END IF;
3490:
3491: IF (PO_LOG.d_stmt) THEN
3492: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
3493: END IF;
3494:
3495: IF (PO_LOG.d_proc) THEN
3496: PO_LOG.proc_end(d_module);
3491: IF (PO_LOG.d_stmt) THEN
3492: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
3493: END IF;
3494:
3495: IF (PO_LOG.d_proc) THEN
3496: PO_LOG.proc_end(d_module);
3497: END IF;
3498:
3499: RETURN l_need_to_encumber;
3492: PO_LOG.stmt(d_module, d_position, 'l_need_to_encumber', l_need_to_encumber);
3493: END IF;
3494:
3495: IF (PO_LOG.d_proc) THEN
3496: PO_LOG.proc_end(d_module);
3497: END IF;
3498:
3499: RETURN l_need_to_encumber;
3500: EXCEPTION
3542:
3543: l_current_employee_id per_workforce_current_x.person_id%TYPE :=NULL; --Bug 13627272
3544: BEGIN
3545: d_position := 0;
3546: IF (PO_LOG.d_proc) THEN
3547: PO_LOG.proc_begin(d_module);
3548: END IF;
3549:
3550: PO_PDOI_UTL.get_processing_doctype_info
3543: l_current_employee_id per_workforce_current_x.person_id%TYPE :=NULL; --Bug 13627272
3544: BEGIN
3545: d_position := 0;
3546: IF (PO_LOG.d_proc) THEN
3547: PO_LOG.proc_begin(d_module);
3548: END IF;
3549:
3550: PO_PDOI_UTL.get_processing_doctype_info
3551: ( x_doc_type => l_doc_type,
3654: ReleaseGenMethod => PO_PDOI_PARAMS.g_request.rel_gen_method,
3655: UpdateSourcingRule => PO_PDOI_PARAMS.g_request.create_sourcing_rules_flag
3656: );
3657:
3658: IF (PO_LOG.d_proc) THEN
3659: PO_LOG.proc_end(d_module);
3660: END IF;
3661: EXCEPTION
3662: WHEN OTHERS THEN
3655: UpdateSourcingRule => PO_PDOI_PARAMS.g_request.create_sourcing_rules_flag
3656: );
3657:
3658: IF (PO_LOG.d_proc) THEN
3659: PO_LOG.proc_end(d_module);
3660: END IF;
3661: EXCEPTION
3662: WHEN OTHERS THEN
3663: PO_MESSAGE_S.add_exc_msg
3694:
3695: l_return_status BOOLEAN;
3696: BEGIN
3697: d_position := 0;
3698: IF (PO_LOG.d_proc) THEN
3699: PO_LOG.proc_begin(d_module);
3700: END IF;
3701:
3702: l_return_status := PO_SUPPLY.po_req_supply
3695: l_return_status BOOLEAN;
3696: BEGIN
3697: d_position := 0;
3698: IF (PO_LOG.d_proc) THEN
3699: PO_LOG.proc_begin(d_module);
3700: END IF;
3701:
3702: l_return_status := PO_SUPPLY.po_req_supply
3703: ( p_docid => p_doc_rec.po_header_id,
3710: );
3711:
3712: IF (NOT l_return_status) THEN
3713: d_position := 10;
3714: IF (PO_LOG.d_stmt) THEN
3715: PO_LOG.stmt(d_module, d_position, 'Supply creation failed');
3716: END IF;
3717:
3718: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3711:
3712: IF (NOT l_return_status) THEN
3713: d_position := 10;
3714: IF (PO_LOG.d_stmt) THEN
3715: PO_LOG.stmt(d_module, d_position, 'Supply creation failed');
3716: END IF;
3717:
3718: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3719: END IF;
3717:
3718: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3719: END IF;
3720:
3721: IF (PO_LOG.d_proc) THEN
3722: PO_LOG.proc_end(d_module);
3723: END IF;
3724: EXCEPTION
3725: WHEN OTHERS THEN
3718: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3719: END IF;
3720:
3721: IF (PO_LOG.d_proc) THEN
3722: PO_LOG.proc_end(d_module);
3723: END IF;
3724: EXCEPTION
3725: WHEN OTHERS THEN
3726: PO_MESSAGE_S.add_exc_msg
3758:
3759: BEGIN
3760: d_position := 0;
3761:
3762: IF (PO_LOG.d_proc) THEN
3763: PO_LOG.proc_begin(d_module);
3764: END IF;
3765:
3766: PO_DELREC_PVT.create_update_delrec
3759: BEGIN
3760: d_position := 0;
3761:
3762: IF (PO_LOG.d_proc) THEN
3763: PO_LOG.proc_begin(d_module);
3764: END IF;
3765:
3766: PO_DELREC_PVT.create_update_delrec
3767: ( p_api_version => 1.0,
3777: );
3778:
3779: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3780: d_position := 10;
3781: IF (PO_LOG.d_stmt) THEN
3782: PO_LOG.stmt(d_module, d_position, 'create delivery record failed');
3783: END IF;
3784: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3785: END IF;
3778:
3779: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3780: d_position := 10;
3781: IF (PO_LOG.d_stmt) THEN
3782: PO_LOG.stmt(d_module, d_position, 'create delivery record failed');
3783: END IF;
3784: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3785: END IF;
3786:
3783: END IF;
3784: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3785: END IF;
3786:
3787: IF (PO_LOG.d_proc) THEN
3788: PO_LOG.proc_end(d_module);
3789: END IF;
3790: EXCEPTION
3791: WHEN OTHERS THEN
3784: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3785: END IF;
3786:
3787: IF (PO_LOG.d_proc) THEN
3788: PO_LOG.proc_end(d_module);
3789: END IF;
3790: EXCEPTION
3791: WHEN OTHERS THEN
3792: PO_MESSAGE_S.add_exc_msg
3821: l_return_code VARCHAR2(100);
3822:
3823: BEGIN
3824: d_position := 0;
3825: IF (PO_LOG.d_proc) THEN
3826: PO_LOG.proc_begin(d_module);
3827: END IF;
3828:
3829: l_result := PO_ACTIONS.close_po
3822:
3823: BEGIN
3824: d_position := 0;
3825: IF (PO_LOG.d_proc) THEN
3826: PO_LOG.proc_begin(d_module);
3827: END IF;
3828:
3829: l_result := PO_ACTIONS.close_po
3830: ( p_docid => p_doc_rec.po_header_id,
3849: p_column_name => 'CLOSED_CODE',
3850: p_column_value => ''
3851: );
3852:
3853: IF (PO_LOG.d_stmt) THEN
3854: PO_LOG.stmt(d_module, d_position, 'PO Closing failed');
3855: END IF;
3856:
3857: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3850: p_column_value => ''
3851: );
3852:
3853: IF (PO_LOG.d_stmt) THEN
3854: PO_LOG.stmt(d_module, d_position, 'PO Closing failed');
3855: END IF;
3856:
3857: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3858: END IF;
3856:
3857: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3858: END IF;
3859:
3860: IF (PO_LOG.d_proc) THEN
3861: PO_LOG.proc_end(d_module);
3862: END IF;
3863: EXCEPTION
3864: WHEN OTHERS THEN
3857: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3858: END IF;
3859:
3860: IF (PO_LOG.d_proc) THEN
3861: PO_LOG.proc_end(d_module);
3862: END IF;
3863: EXCEPTION
3864: WHEN OTHERS THEN
3865: PO_MESSAGE_S.add_exc_msg
3896: d_position NUMBER;
3897:
3898: BEGIN
3899: d_position := 0;
3900: IF (PO_LOG.d_proc) THEN
3901: PO_LOG.proc_begin(d_module);
3902: END IF;
3903:
3904: -- bug5027915
3897:
3898: BEGIN
3899: d_position := 0;
3900: IF (PO_LOG.d_proc) THEN
3901: PO_LOG.proc_begin(d_module);
3902: END IF;
3903:
3904: -- bug5027915
3905: -- populate parameter p_po_header_id rather than p_po_header_ids,
3914: d_position := 10;
3915: ICX_CAT_INTERMEDIA_INDEX_PVT.rebuild_index;
3916: EXCEPTION
3917: WHEN OTHERS THEN
3918: IF (PO_LOG.d_stmt) THEN
3919: PO_LOG.stmt(d_module, d_position, 'Exception while call to ICX_CAT_INTERMEDIA_INDEX_PVT.rebuild_index and erorr encountered is '
3920: ||SQLCODE||' -ERROR- '||SQLERRM );
3921: END IF;
3922: END;
3915: ICX_CAT_INTERMEDIA_INDEX_PVT.rebuild_index;
3916: EXCEPTION
3917: WHEN OTHERS THEN
3918: IF (PO_LOG.d_stmt) THEN
3919: PO_LOG.stmt(d_module, d_position, 'Exception while call to ICX_CAT_INTERMEDIA_INDEX_PVT.rebuild_index and erorr encountered is '
3920: ||SQLCODE||' -ERROR- '||SQLERRM );
3921: END IF;
3922: END;
3923: END IF;
3920: ||SQLCODE||' -ERROR- '||SQLERRM );
3921: END IF;
3922: END;
3923: END IF;
3924: IF (PO_LOG.d_proc) THEN
3925: PO_LOG.proc_end(d_module);
3926: END IF;
3927:
3928: EXCEPTION
3921: END IF;
3922: END;
3923: END IF;
3924: IF (PO_LOG.d_proc) THEN
3925: PO_LOG.proc_end(d_module);
3926: END IF;
3927:
3928: EXCEPTION
3929: WHEN OTHERS THEN
3960: d_position NUMBER;
3961:
3962: BEGIN
3963: d_position := 0;
3964: IF (PO_LOG.d_proc) THEN
3965: PO_LOG.proc_begin(d_module);
3966: END IF;
3967:
3968: PO_TAX_INTERFACE_PVT.calculate_tax
3961:
3962: BEGIN
3963: d_position := 0;
3964: IF (PO_LOG.d_proc) THEN
3965: PO_LOG.proc_begin(d_module);
3966: END IF;
3967:
3968: PO_TAX_INTERFACE_PVT.calculate_tax
3969: ( p_po_header_id => p_doc_rec.po_header_id,
3983: p_column_name => NULL
3984: );
3985: END IF;
3986:
3987: IF (PO_LOG.d_proc) THEN
3988: PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
3989: END IF;
3990:
3991:
3984: );
3985: END IF;
3986:
3987: IF (PO_LOG.d_proc) THEN
3988: PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
3989: END IF;
3990:
3991:
3992: EXCEPTION
4031: l_document_type VARCHAR2(30);
4032:
4033: BEGIN
4034: d_position := 0;
4035: IF (PO_LOG.d_proc) THEN
4036: PO_LOG.proc_begin(d_module);
4037: END IF;
4038:
4039: IF p_doc_rec.document_type = 'STANDARD' THEN
4032:
4033: BEGIN
4034: d_position := 0;
4035: IF (PO_LOG.d_proc) THEN
4036: PO_LOG.proc_begin(d_module);
4037: END IF;
4038:
4039: IF p_doc_rec.document_type = 'STANDARD' THEN
4040: l_document_type := 'PO';
4065: end if;
4066:
4067: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS OR x_online_report_id IS NOT null) THEN
4068: -- write the error into log
4069: --PO_LOG.stmt(d_module, d_position,'Submission Check Failed');
4070: x_count := 0;
4071:
4072:
4073: FOR i IN (SELECT MESSAGE_NAME, TEXT_LINE, MESSAGE_TYPE FROM po_online_report_text_gt WHERE online_report_id = x_online_report_id)
4077: --Incrementing the error count ignoring the warnings.
4078: IF NVL(i.MESSAGE_TYPE,'E') = 'E' THEN
4079: x_count := x_count + 1;
4080: END IF;
4081: IF (PO_LOG.d_stmt) THEN
4082: PO_LOG.stmt(d_module, d_position, 'Error in Submission Check #'||x_count||' --'||i.TEXT_LINE);
4083: END IF;
4084: END LOOP;
4085:
4078: IF NVL(i.MESSAGE_TYPE,'E') = 'E' THEN
4079: x_count := x_count + 1;
4080: END IF;
4081: IF (PO_LOG.d_stmt) THEN
4082: PO_LOG.stmt(d_module, d_position, 'Error in Submission Check #'||x_count||' --'||i.TEXT_LINE);
4083: END IF;
4084: END LOOP;
4085:
4086: /* BUG 8490582 Added the else condition to check for update action. If an incomplete purchase document
4113: x_return_status := FND_API.G_RET_STS_ERROR;
4114: end if;
4115: END IF;
4116:
4117: IF (PO_LOG.d_proc) THEN
4118: PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
4119: END IF;
4120:
4121:
4114: end if;
4115: END IF;
4116:
4117: IF (PO_LOG.d_proc) THEN
4118: PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
4119: END IF;
4120:
4121:
4122: EXCEPTION
4176: FROM po_headers_draft_all
4177: WHERE po_header_id = p_po_header_id
4178: AND Nvl(draft_id,-1) = p_draft_id;
4179:
4180: IF (PO_LOG.d_stmt) THEN
4181: PO_LOG.stmt(d_module, d_position,'l_style_id : ' || l_style_id);
4182: END IF;
4183: EXCEPTION
4184: WHEN No_Data_Found THEN
4177: WHERE po_header_id = p_po_header_id
4178: AND Nvl(draft_id,-1) = p_draft_id;
4179:
4180: IF (PO_LOG.d_stmt) THEN
4181: PO_LOG.stmt(d_module, d_position,'l_style_id : ' || l_style_id);
4182: END IF;
4183: EXCEPTION
4184: WHEN No_Data_Found THEN
4185: PO_MESSAGE_S.add_exc_msg
4198: SYSDATE,
4199: x_return_status,
4200: x_msg_data
4201: );
4202: IF (PO_LOG.d_stmt) THEN
4203: PO_LOG.stmt(d_module, d_position,'l_template_id was null in postproc: ' || l_template_id);
4204: END IF;
4205:
4206: --Update the template_id to po_headers_all
4199: x_return_status,
4200: x_msg_data
4201: );
4202: IF (PO_LOG.d_stmt) THEN
4203: PO_LOG.stmt(d_module, d_position,'l_template_id was null in postproc: ' || l_template_id);
4204: END IF;
4205:
4206: --Update the template_id to po_headers_all
4207: UPDATE po_headers_draft_all SET
4217: SYSDATE,
4218: x_return_status,
4219: x_msg_data
4220: );
4221: IF (PO_LOG.d_stmt) THEN
4222: PO_LOG.stmt(d_module, d_position,'l_line_template_id was null in postproc: ' || l_line_template_id);
4223: END IF;
4224: --Update the templated id in po_lines_all
4225: UPDATE po_lines_draft_all SET
4218: x_return_status,
4219: x_msg_data
4220: );
4221: IF (PO_LOG.d_stmt) THEN
4222: PO_LOG.stmt(d_module, d_position,'l_line_template_id was null in postproc: ' || l_line_template_id);
4223: END IF;
4224: --Update the templated id in po_lines_all
4225: UPDATE po_lines_draft_all SET
4226: uda_template_id = l_line_template_id
4235: SYSDATE,
4236: x_return_status,
4237: x_msg_data
4238: );
4239: IF (PO_LOG.d_stmt) THEN
4240: PO_LOG.stmt(d_module, d_position,'l_shipment_template_id was null in postproc: ' || l_shipment_template_id);
4241: END IF;
4242:
4243: --Update the templated id in po_line_locations_all
4236: x_return_status,
4237: x_msg_data
4238: );
4239: IF (PO_LOG.d_stmt) THEN
4240: PO_LOG.stmt(d_module, d_position,'l_shipment_template_id was null in postproc: ' || l_shipment_template_id);
4241: END IF;
4242:
4243: --Update the templated id in po_line_locations_all
4244: UPDATE po_line_locations_draft_all SET
4252: p_doc_type => 'PO',
4253: x_external_attr_value_pairs => x_external_attr_value_pairs,
4254: x_return_status => x_return_status
4255: );
4256: IF (PO_LOG.d_stmt) THEN
4257: PO_LOG.stmt(d_module, d_position,'x_return_status after defaulting non rendered ags : '|| x_return_status);
4258: END IF;
4259:
4260: --loop through all uda intf lines for one header and import uda attrs
4253: x_external_attr_value_pairs => x_external_attr_value_pairs,
4254: x_return_status => x_return_status
4255: );
4256: IF (PO_LOG.d_stmt) THEN
4257: PO_LOG.stmt(d_module, d_position,'x_return_status after defaulting non rendered ags : '|| x_return_status);
4258: END IF;
4259:
4260: --loop through all uda intf lines for one header and import uda attrs
4261: FOR i IN 1..p_uda_lines_tbl.Count
4280: x_return_status,
4281: x_errorcode,
4282: x_msg_count,
4283: x_msg_data);
4284: IF (PO_LOG.d_stmt) THEN
4285: PO_LOG.stmt(d_module, d_position,'x_return_status after IMPORT_UDA_ATTRS : '|| x_return_status);
4286: END IF;
4287: IF Nvl(x_return_status, FND_API.G_RET_STS_SUCCESS) <> FND_API.G_RET_STS_SUCCESS
4288: THEN
4281: x_errorcode,
4282: x_msg_count,
4283: x_msg_data);
4284: IF (PO_LOG.d_stmt) THEN
4285: PO_LOG.stmt(d_module, d_position,'x_return_status after IMPORT_UDA_ATTRS : '|| x_return_status);
4286: END IF;
4287: IF Nvl(x_return_status, FND_API.G_RET_STS_SUCCESS) <> FND_API.G_RET_STS_SUCCESS
4288: THEN
4289: l_invalid_line_count := l_invalid_line_count + 1;
4351: l_info_slin_num VARCHAR2 (10);
4352: l_priced_slin_num VARCHAR2 (10);
4353: BEGIN
4354: d_position := 0;
4355: IF (PO_LOG.d_proc) THEN
4356: PO_LOG.proc_begin(d_module);
4357: END IF;
4358:
4359: --Fetch the max clin line num display
4352: l_priced_slin_num VARCHAR2 (10);
4353: BEGIN
4354: d_position := 0;
4355: IF (PO_LOG.d_proc) THEN
4356: PO_LOG.proc_begin(d_module);
4357: END IF;
4358:
4359: --Fetch the max clin line num display
4360: SELECT Nvl(Max(line_num_display),'0000')
4429: END LOOP;
4430:
4431: d_position := 60;
4432:
4433: IF (PO_LOG.d_proc) THEN
4434: PO_LOG.proc_end(d_module);
4435: END IF;
4436:
4437: EXCEPTION
4430:
4431: d_position := 60;
4432:
4433: IF (PO_LOG.d_proc) THEN
4434: PO_LOG.proc_end(d_module);
4435: END IF;
4436:
4437: EXCEPTION
4438: WHEN OTHERS THEN
4461: l_error_count NUMBER :=0;
4462: BEGIN
4463:
4464: d_position := 0;
4465: IF (PO_LOG.d_proc) THEN
4466: PO_LOG.proc_begin(d_module);
4467: END IF;
4468:
4469: x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
4462: BEGIN
4463:
4464: d_position := 0;
4465: IF (PO_LOG.d_proc) THEN
4466: PO_LOG.proc_begin(d_module);
4467: END IF;
4468:
4469: x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
4470:
4521: ELSE
4522: x_return_status := FND_API.G_RET_STS_SUCCESS;
4523: END IF;
4524:
4525: IF (PO_LOG.d_stmt) THEN
4526: PO_LOG.stmt(d_module, d_position,'x_return_status :'|| x_return_status);
4527: END IF;
4528: EXCEPTION
4529: WHEN OTHERS THEN
4522: x_return_status := FND_API.G_RET_STS_SUCCESS;
4523: END IF;
4524:
4525: IF (PO_LOG.d_stmt) THEN
4526: PO_LOG.stmt(d_module, d_position,'x_return_status :'|| x_return_status);
4527: END IF;
4528: EXCEPTION
4529: WHEN OTHERS THEN
4530: IF PO_LOG.d_exc THEN
4526: PO_LOG.stmt(d_module, d_position,'x_return_status :'|| x_return_status);
4527: END IF;
4528: EXCEPTION
4529: WHEN OTHERS THEN
4530: IF PO_LOG.d_exc THEN
4531: PO_LOG.exc(d_module,0,SQLERRM);
4532: END IF;
4533: RAISE;
4534:
4527: END IF;
4528: EXCEPTION
4529: WHEN OTHERS THEN
4530: IF PO_LOG.d_exc THEN
4531: PO_LOG.exc(d_module,0,SQLERRM);
4532: END IF;
4533: RAISE;
4534:
4535: END validate_complex_pricing;
4547: l_org_id NUMBER;
4548: BEGIN
4549:
4550: d_position := 0;
4551: IF (PO_LOG.d_proc) THEN
4552: PO_LOG.proc_begin(d_module);
4553: END IF;
4554:
4555: --x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
4548: BEGIN
4549:
4550: d_position := 0;
4551: IF (PO_LOG.d_proc) THEN
4552: PO_LOG.proc_begin(d_module);
4553: END IF;
4554:
4555: --x_results := PO_VALIDATION_RESULTS_TYPE.new_instance();
4556:
4600: );
4601:
4602: EXCEPTION
4603: WHEN OTHERS THEN
4604: IF PO_LOG.d_exc THEN
4605: PO_LOG.exc(d_module,0,SQLERRM);
4606: END IF;
4607: RAISE;
4608:
4601:
4602: EXCEPTION
4603: WHEN OTHERS THEN
4604: IF PO_LOG.d_exc THEN
4605: PO_LOG.exc(d_module,0,SQLERRM);
4606: END IF;
4607: RAISE;
4608:
4609: END set_fpdsng_report_info;
4628:
4629: BEGIN
4630:
4631: d_position := 0;
4632: IF (PO_LOG.d_proc) THEN
4633: PO_LOG.proc_begin(d_module);
4634: END IF;
4635:
4636: SELECT uda_template_id INTO l_template_id
4629: BEGIN
4630:
4631: d_position := 0;
4632: IF (PO_LOG.d_proc) THEN
4633: PO_LOG.proc_begin(d_module);
4634: END IF;
4635:
4636: SELECT uda_template_id INTO l_template_id
4637: FROM po_headers_all
4637: FROM po_headers_all
4638: WHERE po_header_id = p_doc_rec.po_header_id
4639: AND Nvl(draft_id,-1) = -1;
4640:
4641: IF (PO_LOG.d_stmt) THEN
4642: PO_LOG.stmt(d_module, d_position, 'l_template_id: ' || l_template_id);
4643: END IF;
4644:
4645: l_source_org_owned := PO_DOC_NUMBERING_PKG.get_owned_by_issuing_org(p_doc_rec.clm_source_document_id);
4638: WHERE po_header_id = p_doc_rec.po_header_id
4639: AND Nvl(draft_id,-1) = -1;
4640:
4641: IF (PO_LOG.d_stmt) THEN
4642: PO_LOG.stmt(d_module, d_position, 'l_template_id: ' || l_template_id);
4643: END IF;
4644:
4645: l_source_org_owned := PO_DOC_NUMBERING_PKG.get_owned_by_issuing_org(p_doc_rec.clm_source_document_id);
4646:
4643: END IF;
4644:
4645: l_source_org_owned := PO_DOC_NUMBERING_PKG.get_owned_by_issuing_org(p_doc_rec.clm_source_document_id);
4646:
4647: IF (PO_LOG.d_stmt) THEN
4648: PO_LOG.stmt(d_module, d_position, 'l_source_org_owned : ' || l_source_org_owned);
4649: END IF;
4650:
4651: --Check if doc_numbering record exists in po_headers_all_ext_b
4644:
4645: l_source_org_owned := PO_DOC_NUMBERING_PKG.get_owned_by_issuing_org(p_doc_rec.clm_source_document_id);
4646:
4647: IF (PO_LOG.d_stmt) THEN
4648: PO_LOG.stmt(d_module, d_position, 'l_source_org_owned : ' || l_source_org_owned);
4649: END IF;
4650:
4651: --Check if doc_numbering record exists in po_headers_all_ext_b
4652: SELECT Count(attr_group_id)
4661: AND ATTRIBUTE1 = 'Base Document'
4662: AND ATTRIBUTE2 = l_source_org_owned
4663: AND ATTRIBUTE3 = 'DEFAULT'
4664: );
4665: IF (PO_LOG.d_stmt) THEN
4666: PO_LOG.stmt(d_module, d_position, 'l_count to indicate whether doc_numbering record exists in po_headers_all_ext_b: ' || l_count);
4667: END IF;
4668: --Default doc number only if user has not input any data in uda_interface table
4669: IF l_count = 0
4662: AND ATTRIBUTE2 = l_source_org_owned
4663: AND ATTRIBUTE3 = 'DEFAULT'
4664: );
4665: IF (PO_LOG.d_stmt) THEN
4666: PO_LOG.stmt(d_module, d_position, 'l_count to indicate whether doc_numbering record exists in po_headers_all_ext_b: ' || l_count);
4667: END IF;
4668: --Default doc number only if user has not input any data in uda_interface table
4669: IF l_count = 0
4670: THEN
4676: p_source_org_owned => l_source_org_owned,
4677: p_caller => 'PO',
4678: x_doc_number => l_doc_number,
4679: x_return_status => x_return_status);
4680: IF (PO_LOG.d_stmt) THEN
4681: PO_LOG.stmt(d_module, d_position, 'x_return_status After DEFAULT_DOC_NUMBER_UDA : ' || x_return_status);
4682: PO_LOG.stmt(d_module, d_position, 'Document Number : ' || l_doc_number);
4683: END IF;
4684:
4677: p_caller => 'PO',
4678: x_doc_number => l_doc_number,
4679: x_return_status => x_return_status);
4680: IF (PO_LOG.d_stmt) THEN
4681: PO_LOG.stmt(d_module, d_position, 'x_return_status After DEFAULT_DOC_NUMBER_UDA : ' || x_return_status);
4682: PO_LOG.stmt(d_module, d_position, 'Document Number : ' || l_doc_number);
4683: END IF;
4684:
4685: l_delimiter := PO_DOC_NUMBERING_PKG.GET_DELIMITER_FOR_DOC (p_doc_rec.po_header_id, -1);
4678: x_doc_number => l_doc_number,
4679: x_return_status => x_return_status);
4680: IF (PO_LOG.d_stmt) THEN
4681: PO_LOG.stmt(d_module, d_position, 'x_return_status After DEFAULT_DOC_NUMBER_UDA : ' || x_return_status);
4682: PO_LOG.stmt(d_module, d_position, 'Document Number : ' || l_doc_number);
4683: END IF;
4684:
4685: l_delimiter := PO_DOC_NUMBERING_PKG.GET_DELIMITER_FOR_DOC (p_doc_rec.po_header_id, -1);
4686: --Stamp the clm doc number