1: PACKAGE BODY PO_PDOI_MAINPROC_UTL_PVT AS
2: /* $Header: PO_PDOI_MAINPROC_UTL_PVT.plb 120.14.12010000.2 2008/08/04 08:39:15 rramasam ship $ */
3:
4: d_pkg_name CONSTANT VARCHAR2(50) :=
5: PO_LOG.get_package_base('PO_PDOI_MAINPROC_UTL_PVT');
6:
7: -- max line number for each document
8: g_max_line_num_tbl DBMS_SQL.number_table;
9:
54:
55: BEGIN
56: d_position := 0;
57:
58: IF (PO_LOG.d_proc) THEN
59: PO_LOG.proc_begin(d_module);
60: END IF;
61:
62: g_max_line_num_tbl.DELETE;
55: BEGIN
56: d_position := 0;
57:
58: IF (PO_LOG.d_proc) THEN
59: PO_LOG.proc_begin(d_module);
60: END IF;
61:
62: g_max_line_num_tbl.DELETE;
63:
66: g_max_dist_num_tbl.DELETE;
67:
68: g_max_price_diff_num_tbl.DELETE;
69:
70: IF (PO_LOG.d_proc) THEN
71: PO_LOG.proc_end (d_module);
72: END IF;
73:
74: EXCEPTION
67:
68: g_max_price_diff_num_tbl.DELETE;
69:
70: IF (PO_LOG.d_proc) THEN
71: PO_LOG.proc_end (d_module);
72: END IF;
73:
74: EXCEPTION
75: WHEN OTHERS THEN
117:
118: BEGIN
119: d_position := 0;
120:
121: IF (PO_LOG.d_proc) THEN
122: PO_LOG.proc_begin(d_module, 'p_doc_subtype', p_doc_subtype);
123: END IF;
124:
125: IF (g_quotation_class_code_tbl.COUNT = 0 OR
118: BEGIN
119: d_position := 0;
120:
121: IF (PO_LOG.d_proc) THEN
122: PO_LOG.proc_begin(d_module, 'p_doc_subtype', p_doc_subtype);
123: END IF;
124:
125: IF (g_quotation_class_code_tbl.COUNT = 0 OR
126: g_quotation_class_code_tbl.EXISTS(p_doc_subtype) = FALSE) THEN
132: FROM po_document_types
133: WHERE document_type_code = PO_PDOI_CONSTANTS.g_DOC_TYPE_QUOTATION
134: AND document_subtype = p_doc_subtype;
135:
136: IF (PO_LOG.d_stmt) THEN
137: PO_LOG.stmt(d_module, d_position, 'l_quotation_class_code',
138: l_quotation_class_code);
139: END IF;
140:
133: WHERE document_type_code = PO_PDOI_CONSTANTS.g_DOC_TYPE_QUOTATION
134: AND document_subtype = p_doc_subtype;
135:
136: IF (PO_LOG.d_stmt) THEN
137: PO_LOG.stmt(d_module, d_position, 'l_quotation_class_code',
138: l_quotation_class_code);
139: END IF;
140:
141: d_position := 20;
143: -- save the result in cache
144: g_quotation_class_code_tbl(p_doc_subtype) := l_quotation_class_code;
145: END IF;
146:
147: IF (PO_LOG.d_proc) THEN
148: PO_LOG.proc_return (d_module, g_quotation_class_code_tbl(p_doc_subtype));
149: END IF;
150:
151: RETURN g_quotation_class_code_tbl(p_doc_subtype);
144: g_quotation_class_code_tbl(p_doc_subtype) := l_quotation_class_code;
145: END IF;
146:
147: IF (PO_LOG.d_proc) THEN
148: PO_LOG.proc_return (d_module, g_quotation_class_code_tbl(p_doc_subtype));
149: END IF;
150:
151: RETURN g_quotation_class_code_tbl(p_doc_subtype);
152:
202: l_po_header_id_no_dup_tbl DBMS_SQL.number_table;
203: BEGIN
204: d_position := 0;
205:
206: IF (PO_LOG.d_proc) THEN
207: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
208: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
209: END IF;
210:
203: BEGIN
204: d_position := 0;
205:
206: IF (PO_LOG.d_proc) THEN
207: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
208: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
209: END IF;
210:
211: -- No need to calculate max line number for following two cases:
204: d_position := 0;
205:
206: IF (PO_LOG.d_proc) THEN
207: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
208: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
209: END IF;
210:
211: -- No need to calculate max line number for following two cases:
212: -- 1. the max line number has already been cached before;
213: -- 2. same po_header_id appears more than once, then the max line
214: -- number only needs to be calculated once
215: FOR i IN 1..p_po_header_id_tbl.COUNT
216: LOOP
217: IF (PO_LOG.d_stmt) THEN
218: PO_LOG.stmt(d_module, d_position, 'index', i);
219: PO_LOG.stmt(d_module, d_position, 'calculated already?',
220: g_max_line_num_tbl.EXISTS(p_po_header_id_tbl(i)));
221: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
214: -- number only needs to be calculated once
215: FOR i IN 1..p_po_header_id_tbl.COUNT
216: LOOP
217: IF (PO_LOG.d_stmt) THEN
218: PO_LOG.stmt(d_module, d_position, 'index', i);
219: PO_LOG.stmt(d_module, d_position, 'calculated already?',
220: g_max_line_num_tbl.EXISTS(p_po_header_id_tbl(i)));
221: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
222: l_po_header_id_no_dup_tbl.EXISTS(p_po_header_id_tbl(i)));
215: FOR i IN 1..p_po_header_id_tbl.COUNT
216: LOOP
217: IF (PO_LOG.d_stmt) THEN
218: PO_LOG.stmt(d_module, d_position, 'index', i);
219: PO_LOG.stmt(d_module, d_position, 'calculated already?',
220: g_max_line_num_tbl.EXISTS(p_po_header_id_tbl(i)));
221: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
222: l_po_header_id_no_dup_tbl.EXISTS(p_po_header_id_tbl(i)));
223: END IF;
217: IF (PO_LOG.d_stmt) THEN
218: PO_LOG.stmt(d_module, d_position, 'index', i);
219: PO_LOG.stmt(d_module, d_position, 'calculated already?',
220: g_max_line_num_tbl.EXISTS(p_po_header_id_tbl(i)));
221: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
222: l_po_header_id_no_dup_tbl.EXISTS(p_po_header_id_tbl(i)));
223: END IF;
224:
225: IF (g_max_line_num_tbl.EXISTS(p_po_header_id_tbl(i))) THEN
289: DELETE FROM po_session_gt
290: WHERE key = l_key
291: RETURNING num1, num2 BULK COLLECT INTO l_po_header_id_tbl, l_max_line_num_tbl;
292:
293: IF (PO_LOG.d_stmt) THEN
294: PO_LOG.stmt(d_module, d_position, 'l_po_header_id_tbl', l_po_header_id_tbl);
295: PO_LOG.stmt(d_module, d_position, 'l_max_line_num_tbl', l_max_line_num_tbl);
296: END IF;
297:
290: WHERE key = l_key
291: RETURNING num1, num2 BULK COLLECT INTO l_po_header_id_tbl, l_max_line_num_tbl;
292:
293: IF (PO_LOG.d_stmt) THEN
294: PO_LOG.stmt(d_module, d_position, 'l_po_header_id_tbl', l_po_header_id_tbl);
295: PO_LOG.stmt(d_module, d_position, 'l_max_line_num_tbl', l_max_line_num_tbl);
296: END IF;
297:
298: FOR i IN 1..l_po_header_id_tbl.COUNT
291: RETURNING num1, num2 BULK COLLECT INTO l_po_header_id_tbl, l_max_line_num_tbl;
292:
293: IF (PO_LOG.d_stmt) THEN
294: PO_LOG.stmt(d_module, d_position, 'l_po_header_id_tbl', l_po_header_id_tbl);
295: PO_LOG.stmt(d_module, d_position, 'l_max_line_num_tbl', l_max_line_num_tbl);
296: END IF;
297:
298: FOR i IN 1..l_po_header_id_tbl.COUNT
299: LOOP
296: END IF;
297:
298: FOR i IN 1..l_po_header_id_tbl.COUNT
299: LOOP
300: IF (PO_LOG.d_stmt) THEN
301: PO_LOG.stmt(d_module, d_position, 'index', i);
302: END IF;
303:
304: IF (g_max_line_num_tbl.EXISTS(l_po_header_id_tbl(i))) THEN
297:
298: FOR i IN 1..l_po_header_id_tbl.COUNT
299: LOOP
300: IF (PO_LOG.d_stmt) THEN
301: PO_LOG.stmt(d_module, d_position, 'index', i);
302: END IF;
303:
304: IF (g_max_line_num_tbl.EXISTS(l_po_header_id_tbl(i))) THEN
305: IF (l_max_line_num_tbl(i) > g_max_line_num_tbl(l_po_header_id_tbl(i))) THEN
309: g_max_line_num_tbl(l_po_header_id_tbl(i)) := l_max_line_num_tbl(i);
310: END IF;
311: END LOOP;
312:
313: IF (PO_LOG.d_proc) THEN
314: PO_LOG.proc_end (d_module);
315: END IF;
316:
317: EXCEPTION
310: END IF;
311: END LOOP;
312:
313: IF (PO_LOG.d_proc) THEN
314: PO_LOG.proc_end (d_module);
315: END IF;
316:
317: EXCEPTION
318: WHEN OTHERS THEN
359:
360: BEGIN
361: d_position := 0;
362:
363: IF (PO_LOG.d_proc) THEN
364: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
365: END IF;
366:
367: IF (g_max_line_num_tbl.EXISTS(p_po_header_id)) THEN
360: BEGIN
361: d_position := 0;
362:
363: IF (PO_LOG.d_proc) THEN
364: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
365: END IF;
366:
367: IF (g_max_line_num_tbl.EXISTS(p_po_header_id)) THEN
368: g_max_line_num_tbl(p_po_header_id) := g_max_line_num_tbl(p_po_header_id) + 1;
369: ELSE
370: g_max_line_num_tbl(p_po_header_id) := 1;
371: END IF;
372:
373: IF (PO_LOG.d_proc) THEN
374: PO_LOG.proc_return (d_module, g_max_line_num_tbl(p_po_header_id));
375: END IF;
376:
377: RETURN g_max_line_num_tbl(p_po_header_id);
370: g_max_line_num_tbl(p_po_header_id) := 1;
371: END IF;
372:
373: IF (PO_LOG.d_proc) THEN
374: PO_LOG.proc_return (d_module, g_max_line_num_tbl(p_po_header_id));
375: END IF;
376:
377: RETURN g_max_line_num_tbl(p_po_header_id);
378: EXCEPTION
415: l_next_po_line_id NUMBER;
416: BEGIN
417: d_position := 0;
418:
419: IF (PO_LOG.d_proc) THEN
420: PO_LOG.proc_begin(d_module);
421: END IF;
422:
423: SELECT po_lines_s.nextval
416: BEGIN
417: d_position := 0;
418:
419: IF (PO_LOG.d_proc) THEN
420: PO_LOG.proc_begin(d_module);
421: END IF;
422:
423: SELECT po_lines_s.nextval
424: INTO l_next_po_line_id
423: SELECT po_lines_s.nextval
424: INTO l_next_po_line_id
425: FROM DUAL;
426:
427: IF (PO_LOG.d_proc) THEN
428: PO_LOG.proc_return(d_module, l_next_po_line_id);
429: END IF;
430:
431: RETURN l_next_po_line_id;
424: INTO l_next_po_line_id
425: FROM DUAL;
426:
427: IF (PO_LOG.d_proc) THEN
428: PO_LOG.proc_return(d_module, l_next_po_line_id);
429: END IF;
430:
431: RETURN l_next_po_line_id;
432: END get_next_po_line_id;
477: l_key po_session_gt.key%TYPE;
478: BEGIN
479: d_position := 0;
480:
481: IF (PO_LOG.d_proc) THEN
482: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
483: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
484: PO_LOG.proc_begin(d_module, 'p_intf_line_id_tbl', p_intf_line_id_tbl);
485: PO_LOG.proc_begin(d_module, 'p_line_num_tbl', p_line_num_tbl);
478: BEGIN
479: d_position := 0;
480:
481: IF (PO_LOG.d_proc) THEN
482: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
483: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
484: PO_LOG.proc_begin(d_module, 'p_intf_line_id_tbl', p_intf_line_id_tbl);
485: PO_LOG.proc_begin(d_module, 'p_line_num_tbl', p_line_num_tbl);
486: END IF;
479: d_position := 0;
480:
481: IF (PO_LOG.d_proc) THEN
482: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
483: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
484: PO_LOG.proc_begin(d_module, 'p_intf_line_id_tbl', p_intf_line_id_tbl);
485: PO_LOG.proc_begin(d_module, 'p_line_num_tbl', p_line_num_tbl);
486: END IF;
487:
480:
481: IF (PO_LOG.d_proc) THEN
482: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
483: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
484: PO_LOG.proc_begin(d_module, 'p_intf_line_id_tbl', p_intf_line_id_tbl);
485: PO_LOG.proc_begin(d_module, 'p_line_num_tbl', p_line_num_tbl);
486: END IF;
487:
488: x_line_num_unique_tbl := PO_TBL_VARCHAR1();
481: IF (PO_LOG.d_proc) THEN
482: PO_LOG.proc_begin(d_module, 'p_po_header_id_tbl', p_po_header_id_tbl);
483: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
484: PO_LOG.proc_begin(d_module, 'p_intf_line_id_tbl', p_intf_line_id_tbl);
485: PO_LOG.proc_begin(d_module, 'p_line_num_tbl', p_line_num_tbl);
486: END IF;
487:
488: x_line_num_unique_tbl := PO_TBL_VARCHAR1();
489: x_line_num_unique_tbl.EXTEND(p_line_num_tbl.COUNT);
544: RETURNING num1 BULK COLLECT INTO l_index_tbl;
545:
546: FOR i IN 1..l_index_tbl.COUNT
547: LOOP
548: IF (PO_LOG.d_stmt) THEN
549: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
550: PO_LOG.stmt(d_module, d_position, 'line num is not unique',
551: p_line_num_tbl(l_index_tbl(i)));
552: END IF;
545:
546: FOR i IN 1..l_index_tbl.COUNT
547: LOOP
548: IF (PO_LOG.d_stmt) THEN
549: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
550: PO_LOG.stmt(d_module, d_position, 'line num is not unique',
551: p_line_num_tbl(l_index_tbl(i)));
552: END IF;
553:
546: FOR i IN 1..l_index_tbl.COUNT
547: LOOP
548: IF (PO_LOG.d_stmt) THEN
549: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
550: PO_LOG.stmt(d_module, d_position, 'line num is not unique',
551: p_line_num_tbl(l_index_tbl(i)));
552: END IF;
553:
554: x_line_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
553:
554: x_line_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
555: END LOOP;
556:
557: IF (PO_LOG.d_proc) THEN
558: PO_LOG.proc_end (d_module);
559: END IF;
560:
561: EXCEPTION
554: x_line_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
555: END LOOP;
556:
557: IF (PO_LOG.d_proc) THEN
558: PO_LOG.proc_end (d_module);
559: END IF;
560:
561: EXCEPTION
562: WHEN OTHERS THEN
610: l_po_line_id_no_dup_tbl DBMS_SQL.number_table;
611: BEGIN
612: d_position := 0;
613:
614: IF (PO_LOG.d_proc) THEN
615: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
616: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
617: END IF;
618:
611: BEGIN
612: d_position := 0;
613:
614: IF (PO_LOG.d_proc) THEN
615: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
616: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
617: END IF;
618:
619: -- No need to calculate max shipment number for following two cases:
612: d_position := 0;
613:
614: IF (PO_LOG.d_proc) THEN
615: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
616: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
617: END IF;
618:
619: -- No need to calculate max shipment number for following two cases:
620: -- 1. the max shipment number has already been cached before;
621: -- 2. same po_line_id appears more than once, then the max shipment
622: -- number only needs to be calculated once
623: FOR i IN 1..p_po_line_id_tbl.COUNT
624: LOOP
625: IF (PO_LOG.d_stmt) THEN
626: PO_LOG.stmt(d_module, d_position, 'index', i);
627: PO_LOG.stmt(d_module, d_position, 'already calculated?',
628: g_max_shipment_num_tbl.EXISTS(p_po_line_id_tbl(i)));
629: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
622: -- number only needs to be calculated once
623: FOR i IN 1..p_po_line_id_tbl.COUNT
624: LOOP
625: IF (PO_LOG.d_stmt) THEN
626: PO_LOG.stmt(d_module, d_position, 'index', i);
627: PO_LOG.stmt(d_module, d_position, 'already calculated?',
628: g_max_shipment_num_tbl.EXISTS(p_po_line_id_tbl(i)));
629: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
630: l_po_line_id_no_dup_tbl.EXISTS(p_po_line_id_tbl(i)));
623: FOR i IN 1..p_po_line_id_tbl.COUNT
624: LOOP
625: IF (PO_LOG.d_stmt) THEN
626: PO_LOG.stmt(d_module, d_position, 'index', i);
627: PO_LOG.stmt(d_module, d_position, 'already calculated?',
628: g_max_shipment_num_tbl.EXISTS(p_po_line_id_tbl(i)));
629: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
630: l_po_line_id_no_dup_tbl.EXISTS(p_po_line_id_tbl(i)));
631: END IF;
625: IF (PO_LOG.d_stmt) THEN
626: PO_LOG.stmt(d_module, d_position, 'index', i);
627: PO_LOG.stmt(d_module, d_position, 'already calculated?',
628: g_max_shipment_num_tbl.EXISTS(p_po_line_id_tbl(i)));
629: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
630: l_po_line_id_no_dup_tbl.EXISTS(p_po_line_id_tbl(i)));
631: END IF;
632:
633: IF (g_max_shipment_num_tbl.EXISTS(p_po_line_id_tbl(i))) THEN
727: RETURNING num1, num2 BULK COLLECT INTO l_po_line_id_tbl, l_max_shipment_num_tbl;
728:
729: FOR i IN 1..l_po_line_id_tbl.COUNT
730: LOOP
731: IF (PO_LOG.d_stmt) THEN
732: PO_LOG.stmt(d_module, d_position, 'index', i);
733: IF (g_max_shipment_num_tbl.EXISTS(l_po_line_id_tbl(i))) THEN
734: PO_LOG.stmt(d_module, d_position, 'current max shipment num',
735: g_max_shipment_num_tbl(l_po_line_id_tbl(i)));
728:
729: FOR i IN 1..l_po_line_id_tbl.COUNT
730: LOOP
731: IF (PO_LOG.d_stmt) THEN
732: PO_LOG.stmt(d_module, d_position, 'index', i);
733: IF (g_max_shipment_num_tbl.EXISTS(l_po_line_id_tbl(i))) THEN
734: PO_LOG.stmt(d_module, d_position, 'current max shipment num',
735: g_max_shipment_num_tbl(l_po_line_id_tbl(i)));
736: END IF;
730: LOOP
731: IF (PO_LOG.d_stmt) THEN
732: PO_LOG.stmt(d_module, d_position, 'index', i);
733: IF (g_max_shipment_num_tbl.EXISTS(l_po_line_id_tbl(i))) THEN
734: PO_LOG.stmt(d_module, d_position, 'current max shipment num',
735: g_max_shipment_num_tbl(l_po_line_id_tbl(i)));
736: END IF;
737: PO_LOG.stmt(d_module, d_position, 'max shipment num',
738: l_max_shipment_num_tbl(i));
733: IF (g_max_shipment_num_tbl.EXISTS(l_po_line_id_tbl(i))) THEN
734: PO_LOG.stmt(d_module, d_position, 'current max shipment num',
735: g_max_shipment_num_tbl(l_po_line_id_tbl(i)));
736: END IF;
737: PO_LOG.stmt(d_module, d_position, 'max shipment num',
738: l_max_shipment_num_tbl(i));
739: END IF;
740:
741: IF (g_max_shipment_num_tbl.EXISTS(l_po_line_id_tbl(i))) THEN
746: g_max_shipment_num_tbl(l_po_line_id_tbl(i)) := l_max_shipment_num_tbl(i);
747: END IF;
748: END LOOP;
749:
750: IF (PO_LOG.d_proc) THEN
751: PO_LOG.proc_end (d_module);
752: END IF;
753:
754: EXCEPTION
747: END IF;
748: END LOOP;
749:
750: IF (PO_LOG.d_proc) THEN
751: PO_LOG.proc_end (d_module);
752: END IF;
753:
754: EXCEPTION
755: WHEN OTHERS THEN
796:
797: BEGIN
798: d_position := 0;
799:
800: IF (PO_LOG.d_proc) THEN
801: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
802: END IF;
803:
804: IF (g_max_shipment_num_tbl.EXISTS(p_po_line_id)) THEN
797: BEGIN
798: d_position := 0;
799:
800: IF (PO_LOG.d_proc) THEN
801: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
802: END IF;
803:
804: IF (g_max_shipment_num_tbl.EXISTS(p_po_line_id)) THEN
805: g_max_shipment_num_tbl(p_po_line_id) := g_max_shipment_num_tbl(p_po_line_id) + 1;
806: ELSE
807: g_max_shipment_num_tbl(p_po_line_id) := 1;
808: END IF;
809:
810: IF (PO_LOG.d_proc) THEN
811: PO_LOG.proc_return(d_module, g_max_shipment_num_tbl(p_po_line_id));
812: END IF;
813:
814: RETURN g_max_shipment_num_tbl(p_po_line_id);
807: g_max_shipment_num_tbl(p_po_line_id) := 1;
808: END IF;
809:
810: IF (PO_LOG.d_proc) THEN
811: PO_LOG.proc_return(d_module, g_max_shipment_num_tbl(p_po_line_id));
812: END IF;
813:
814: RETURN g_max_shipment_num_tbl(p_po_line_id);
815:
845: l_next_line_loc_id NUMBER;
846: BEGIN
847: d_position := 0;
848:
849: IF (PO_LOG.d_proc) THEN
850: PO_LOG.proc_begin(d_module);
851: END IF;
852:
853: SELECT po_line_locations_s.nextval
846: BEGIN
847: d_position := 0;
848:
849: IF (PO_LOG.d_proc) THEN
850: PO_LOG.proc_begin(d_module);
851: END IF;
852:
853: SELECT po_line_locations_s.nextval
854: INTO l_next_line_loc_id
853: SELECT po_line_locations_s.nextval
854: INTO l_next_line_loc_id
855: FROM DUAL;
856:
857: IF (PO_LOG.d_proc) THEN
858: PO_LOG.proc_return(d_module, l_next_line_loc_id);
859: END IF;
860:
861: RETURN l_next_line_loc_id;
854: INTO l_next_line_loc_id
855: FROM DUAL;
856:
857: IF (PO_LOG.d_proc) THEN
858: PO_LOG.proc_return(d_module, l_next_line_loc_id);
859: END IF;
860:
861: RETURN l_next_line_loc_id;
862: END get_next_line_loc_id;
905: l_key po_session_gt.key%TYPE;
906: BEGIN
907: d_position := 0;
908:
909: IF (PO_LOG.d_proc) THEN
910: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
911: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
912: PO_LOG.proc_begin(d_module, 'p_intf_line_loc_id_tbl', p_intf_line_loc_id_tbl);
913: PO_LOG.proc_begin(d_module, 'p_shipment_num_tbl', p_shipment_num_tbl);
906: BEGIN
907: d_position := 0;
908:
909: IF (PO_LOG.d_proc) THEN
910: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
911: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
912: PO_LOG.proc_begin(d_module, 'p_intf_line_loc_id_tbl', p_intf_line_loc_id_tbl);
913: PO_LOG.proc_begin(d_module, 'p_shipment_num_tbl', p_shipment_num_tbl);
914: END IF;
907: d_position := 0;
908:
909: IF (PO_LOG.d_proc) THEN
910: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
911: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
912: PO_LOG.proc_begin(d_module, 'p_intf_line_loc_id_tbl', p_intf_line_loc_id_tbl);
913: PO_LOG.proc_begin(d_module, 'p_shipment_num_tbl', p_shipment_num_tbl);
914: END IF;
915:
908:
909: IF (PO_LOG.d_proc) THEN
910: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
911: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
912: PO_LOG.proc_begin(d_module, 'p_intf_line_loc_id_tbl', p_intf_line_loc_id_tbl);
913: PO_LOG.proc_begin(d_module, 'p_shipment_num_tbl', p_shipment_num_tbl);
914: END IF;
915:
916: x_shipment_num_unique_tbl := PO_TBL_VARCHAR1();
909: IF (PO_LOG.d_proc) THEN
910: PO_LOG.proc_begin(d_module, 'p_po_line_id_tbl', p_po_line_id_tbl);
911: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
912: PO_LOG.proc_begin(d_module, 'p_intf_line_loc_id_tbl', p_intf_line_loc_id_tbl);
913: PO_LOG.proc_begin(d_module, 'p_shipment_num_tbl', p_shipment_num_tbl);
914: END IF;
915:
916: x_shipment_num_unique_tbl := PO_TBL_VARCHAR1();
917: x_shipment_num_unique_tbl.EXTEND(p_shipment_num_tbl.COUNT);
970: RETURNING num1 BULK COLLECT INTO l_index_tbl;
971:
972: FOR i IN 1..l_index_tbl.COUNT
973: LOOP
974: IF (PO_LOG.d_stmt) THEN
975: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
976: PO_LOG.stmt(d_module, d_position, 'shipment num is not unique',
977: p_shipment_num_tbl(l_index_tbl(i)));
978: END IF;
971:
972: FOR i IN 1..l_index_tbl.COUNT
973: LOOP
974: IF (PO_LOG.d_stmt) THEN
975: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
976: PO_LOG.stmt(d_module, d_position, 'shipment num is not unique',
977: p_shipment_num_tbl(l_index_tbl(i)));
978: END IF;
979:
972: FOR i IN 1..l_index_tbl.COUNT
973: LOOP
974: IF (PO_LOG.d_stmt) THEN
975: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
976: PO_LOG.stmt(d_module, d_position, 'shipment num is not unique',
977: p_shipment_num_tbl(l_index_tbl(i)));
978: END IF;
979:
980: x_shipment_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
979:
980: x_shipment_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
981: END LOOP;
982:
983: IF (PO_LOG.d_proc) THEN
984: PO_LOG.proc_end (d_module);
985: END IF;
986:
987: EXCEPTION
980: x_shipment_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
981: END LOOP;
982:
983: IF (PO_LOG.d_proc) THEN
984: PO_LOG.proc_end (d_module);
985: END IF;
986:
987: EXCEPTION
988: WHEN OTHERS THEN
1036: l_line_loc_id_no_dup_tbl DBMS_SQL.number_table;
1037: BEGIN
1038: d_position := 0;
1039:
1040: IF (PO_LOG.d_proc) THEN
1041: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1042: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1043: END IF;
1044:
1037: BEGIN
1038: d_position := 0;
1039:
1040: IF (PO_LOG.d_proc) THEN
1041: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1042: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1043: END IF;
1044:
1045: -- No need to calculate max dist number for following two cases:
1038: d_position := 0;
1039:
1040: IF (PO_LOG.d_proc) THEN
1041: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1042: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1043: END IF;
1044:
1045: -- No need to calculate max dist number for following two cases:
1046: -- 1. the max dist number has already been cached before;
1047: -- 2. same line_loc_id appears more than once, then the max dist
1048: -- number only needs to be calculated once
1049: FOR i IN 1..p_line_loc_id_tbl.COUNT
1050: LOOP
1051: IF (PO_LOG.d_stmt) THEN
1052: PO_LOG.stmt(d_module, d_position, 'index', i);
1053: PO_LOG.stmt(d_module, d_position, 'already calculated?',
1054: g_max_dist_num_tbl.EXISTS(p_line_loc_id_tbl(i)));
1055: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
1048: -- number only needs to be calculated once
1049: FOR i IN 1..p_line_loc_id_tbl.COUNT
1050: LOOP
1051: IF (PO_LOG.d_stmt) THEN
1052: PO_LOG.stmt(d_module, d_position, 'index', i);
1053: PO_LOG.stmt(d_module, d_position, 'already calculated?',
1054: g_max_dist_num_tbl.EXISTS(p_line_loc_id_tbl(i)));
1055: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
1056: l_line_loc_id_no_dup_tbl.EXISTS(p_line_loc_id_tbl(i)));
1049: FOR i IN 1..p_line_loc_id_tbl.COUNT
1050: LOOP
1051: IF (PO_LOG.d_stmt) THEN
1052: PO_LOG.stmt(d_module, d_position, 'index', i);
1053: PO_LOG.stmt(d_module, d_position, 'already calculated?',
1054: g_max_dist_num_tbl.EXISTS(p_line_loc_id_tbl(i)));
1055: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
1056: l_line_loc_id_no_dup_tbl.EXISTS(p_line_loc_id_tbl(i)));
1057: END IF;
1051: IF (PO_LOG.d_stmt) THEN
1052: PO_LOG.stmt(d_module, d_position, 'index', i);
1053: PO_LOG.stmt(d_module, d_position, 'already calculated?',
1054: g_max_dist_num_tbl.EXISTS(p_line_loc_id_tbl(i)));
1055: PO_LOG.stmt(d_module, d_position, 'duplicate id?',
1056: l_line_loc_id_no_dup_tbl.EXISTS(p_line_loc_id_tbl(i)));
1057: END IF;
1058:
1059: IF (g_max_dist_num_tbl.EXISTS(p_line_loc_id_tbl(i))) THEN
1122: RETURNING num1, num2 BULK COLLECT INTO l_line_loc_id_tbl, l_max_dist_num_tbl;
1123:
1124: FOR i IN 1..l_line_loc_id_tbl.COUNT
1125: LOOP
1126: IF (PO_LOG.d_stmt) THEN
1127: PO_LOG.stmt(d_module, d_position, 'index', i);
1128: IF (g_max_dist_num_tbl.EXISTS(l_line_loc_id_tbl(i))) THEN
1129: PO_LOG.stmt(d_module, d_position, 'current max dist num',
1130: g_max_dist_num_tbl(l_line_loc_id_tbl(i)));
1123:
1124: FOR i IN 1..l_line_loc_id_tbl.COUNT
1125: LOOP
1126: IF (PO_LOG.d_stmt) THEN
1127: PO_LOG.stmt(d_module, d_position, 'index', i);
1128: IF (g_max_dist_num_tbl.EXISTS(l_line_loc_id_tbl(i))) THEN
1129: PO_LOG.stmt(d_module, d_position, 'current max dist num',
1130: g_max_dist_num_tbl(l_line_loc_id_tbl(i)));
1131: END IF;
1125: LOOP
1126: IF (PO_LOG.d_stmt) THEN
1127: PO_LOG.stmt(d_module, d_position, 'index', i);
1128: IF (g_max_dist_num_tbl.EXISTS(l_line_loc_id_tbl(i))) THEN
1129: PO_LOG.stmt(d_module, d_position, 'current max dist num',
1130: g_max_dist_num_tbl(l_line_loc_id_tbl(i)));
1131: END IF;
1132: PO_LOG.stmt(d_module, d_position, 'max dist num',
1133: l_max_dist_num_tbl(i));
1128: IF (g_max_dist_num_tbl.EXISTS(l_line_loc_id_tbl(i))) THEN
1129: PO_LOG.stmt(d_module, d_position, 'current max dist num',
1130: g_max_dist_num_tbl(l_line_loc_id_tbl(i)));
1131: END IF;
1132: PO_LOG.stmt(d_module, d_position, 'max dist num',
1133: l_max_dist_num_tbl(i));
1134: END IF;
1135:
1136: IF (g_max_dist_num_tbl.EXISTS(l_line_loc_id_tbl(i))) THEN
1141: g_max_dist_num_tbl(l_line_loc_id_tbl(i)) := l_max_dist_num_tbl(i);
1142: END IF;
1143: END LOOP;
1144:
1145: IF (PO_LOG.d_proc) THEN
1146: PO_LOG.proc_end (d_module);
1147: END IF;
1148:
1149: EXCEPTION
1142: END IF;
1143: END LOOP;
1144:
1145: IF (PO_LOG.d_proc) THEN
1146: PO_LOG.proc_end (d_module);
1147: END IF;
1148:
1149: EXCEPTION
1150: WHEN OTHERS THEN
1193:
1194: BEGIN
1195: d_position := 0;
1196:
1197: IF (PO_LOG.d_proc) THEN
1198: PO_LOG.proc_begin(d_module, 'p_line_loc_id', p_line_loc_id);
1199: END IF;
1200:
1201: IF (g_max_dist_num_tbl.EXISTS(p_line_loc_id)) THEN
1194: BEGIN
1195: d_position := 0;
1196:
1197: IF (PO_LOG.d_proc) THEN
1198: PO_LOG.proc_begin(d_module, 'p_line_loc_id', p_line_loc_id);
1199: END IF;
1200:
1201: IF (g_max_dist_num_tbl.EXISTS(p_line_loc_id)) THEN
1202: g_max_dist_num_tbl(p_line_loc_id) := g_max_dist_num_tbl(p_line_loc_id) + 1;
1203: ELSE
1204: g_max_dist_num_tbl(p_line_loc_id) := 1;
1205: END IF;
1206:
1207: IF (PO_LOG.d_proc) THEN
1208: PO_LOG.proc_return(d_module, g_max_dist_num_tbl(p_line_loc_id));
1209: END IF;
1210:
1211: RETURN g_max_dist_num_tbl(p_line_loc_id);
1204: g_max_dist_num_tbl(p_line_loc_id) := 1;
1205: END IF;
1206:
1207: IF (PO_LOG.d_proc) THEN
1208: PO_LOG.proc_return(d_module, g_max_dist_num_tbl(p_line_loc_id));
1209: END IF;
1210:
1211: RETURN g_max_dist_num_tbl(p_line_loc_id);
1212: END get_next_dist_num;
1241: l_next_dist_id NUMBER;
1242: BEGIN
1243: d_position := 0;
1244:
1245: IF (PO_LOG.d_proc) THEN
1246: PO_LOG.proc_begin(d_module);
1247: END IF;
1248:
1249: SELECT po_distributions_s.nextval
1242: BEGIN
1243: d_position := 0;
1244:
1245: IF (PO_LOG.d_proc) THEN
1246: PO_LOG.proc_begin(d_module);
1247: END IF;
1248:
1249: SELECT po_distributions_s.nextval
1250: INTO l_next_dist_id
1249: SELECT po_distributions_s.nextval
1250: INTO l_next_dist_id
1251: FROM DUAL;
1252:
1253: IF (PO_LOG.d_proc) THEN
1254: PO_LOG.proc_return(d_module, l_next_dist_id);
1255: END IF;
1256:
1257: RETURN l_next_dist_id;
1250: INTO l_next_dist_id
1251: FROM DUAL;
1252:
1253: IF (PO_LOG.d_proc) THEN
1254: PO_LOG.proc_return(d_module, l_next_dist_id);
1255: END IF;
1256:
1257: RETURN l_next_dist_id;
1258: EXCEPTION
1313: l_index_tbl DBMS_SQL.NUMBER_TABLE;
1314: BEGIN
1315: d_position := 0;
1316:
1317: IF (PO_LOG.d_proc) THEN
1318: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1319: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1320: PO_LOG.proc_begin(d_module, 'p_intf_dist_id_tbl', p_intf_dist_id_tbl);
1321: PO_LOG.proc_begin(d_module, 'p_dist_num_tbl', p_dist_num_tbl);
1314: BEGIN
1315: d_position := 0;
1316:
1317: IF (PO_LOG.d_proc) THEN
1318: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1319: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1320: PO_LOG.proc_begin(d_module, 'p_intf_dist_id_tbl', p_intf_dist_id_tbl);
1321: PO_LOG.proc_begin(d_module, 'p_dist_num_tbl', p_dist_num_tbl);
1322: END IF;
1315: d_position := 0;
1316:
1317: IF (PO_LOG.d_proc) THEN
1318: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1319: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1320: PO_LOG.proc_begin(d_module, 'p_intf_dist_id_tbl', p_intf_dist_id_tbl);
1321: PO_LOG.proc_begin(d_module, 'p_dist_num_tbl', p_dist_num_tbl);
1322: END IF;
1323:
1316:
1317: IF (PO_LOG.d_proc) THEN
1318: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1319: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1320: PO_LOG.proc_begin(d_module, 'p_intf_dist_id_tbl', p_intf_dist_id_tbl);
1321: PO_LOG.proc_begin(d_module, 'p_dist_num_tbl', p_dist_num_tbl);
1322: END IF;
1323:
1324: x_dist_num_unique_tbl := PO_TBL_VARCHAR1();
1317: IF (PO_LOG.d_proc) THEN
1318: PO_LOG.proc_begin(d_module, 'p_line_loc_id_tbl', p_line_loc_id_tbl);
1319: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1320: PO_LOG.proc_begin(d_module, 'p_intf_dist_id_tbl', p_intf_dist_id_tbl);
1321: PO_LOG.proc_begin(d_module, 'p_dist_num_tbl', p_dist_num_tbl);
1322: END IF;
1323:
1324: x_dist_num_unique_tbl := PO_TBL_VARCHAR1();
1325: x_dist_num_unique_tbl.EXTEND(p_dist_num_tbl.COUNT);
1375: RETURNING num1 BULK COLLECT INTO l_index_tbl;
1376:
1377: FOR i IN 1..l_index_tbl.COUNT
1378: LOOP
1379: IF (PO_LOG.d_stmt) THEN
1380: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1381: PO_LOG.stmt(d_module, d_position, 'dist number is not unique',
1382: p_dist_num_tbl(l_index_tbl(i)));
1383: END IF;
1376:
1377: FOR i IN 1..l_index_tbl.COUNT
1378: LOOP
1379: IF (PO_LOG.d_stmt) THEN
1380: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1381: PO_LOG.stmt(d_module, d_position, 'dist number is not unique',
1382: p_dist_num_tbl(l_index_tbl(i)));
1383: END IF;
1384:
1377: FOR i IN 1..l_index_tbl.COUNT
1378: LOOP
1379: IF (PO_LOG.d_stmt) THEN
1380: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1381: PO_LOG.stmt(d_module, d_position, 'dist number is not unique',
1382: p_dist_num_tbl(l_index_tbl(i)));
1383: END IF;
1384:
1385: x_dist_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
1384:
1385: x_dist_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
1386: END LOOP;
1387:
1388: IF (PO_LOG.d_proc) THEN
1389: PO_LOG.proc_end (d_module);
1390: END IF;
1391:
1392: EXCEPTION
1385: x_dist_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
1386: END LOOP;
1387:
1388: IF (PO_LOG.d_proc) THEN
1389: PO_LOG.proc_end (d_module);
1390: END IF;
1391:
1392: EXCEPTION
1393: WHEN OTHERS THEN
1448:
1449: BEGIN
1450: d_position := 0;
1451:
1452: IF (PO_LOG.d_proc) THEN
1453: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1454: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1455: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1456: END IF;
1449: BEGIN
1450: d_position := 0;
1451:
1452: IF (PO_LOG.d_proc) THEN
1453: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1454: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1455: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1456: END IF;
1457:
1450: d_position := 0;
1451:
1452: IF (PO_LOG.d_proc) THEN
1453: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1454: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1455: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1456: END IF;
1457:
1458: -- pick a new key for temp table
1451:
1452: IF (PO_LOG.d_proc) THEN
1453: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1454: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1455: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1456: END IF;
1457:
1458: -- pick a new key for temp table
1459: l_key := PO_CORE_S.get_session_gt_nextval;
1496: WHERE key = l_key
1497: RETURNING char1, num1, num2 BULK COLLECT INTO
1498: l_entity_type_tbl, l_entity_id_tbl, l_max_price_diff_num_tbl;
1499:
1500: IF (PO_LOG.d_stmt) THEN
1501: PO_LOG.stmt(d_module, d_position, 'l_entity_type_tbl', l_entity_type_tbl);
1502: PO_LOG.stmt(d_module, d_position, 'l_entity_id_tbl', l_entity_id_tbl);
1503: PO_LOG.stmt(d_module, d_position, 'l_max_price_diff_num_tbl',
1504: l_max_price_diff_num_tbl);
1497: RETURNING char1, num1, num2 BULK COLLECT INTO
1498: l_entity_type_tbl, l_entity_id_tbl, l_max_price_diff_num_tbl;
1499:
1500: IF (PO_LOG.d_stmt) THEN
1501: PO_LOG.stmt(d_module, d_position, 'l_entity_type_tbl', l_entity_type_tbl);
1502: PO_LOG.stmt(d_module, d_position, 'l_entity_id_tbl', l_entity_id_tbl);
1503: PO_LOG.stmt(d_module, d_position, 'l_max_price_diff_num_tbl',
1504: l_max_price_diff_num_tbl);
1505: END IF;
1498: l_entity_type_tbl, l_entity_id_tbl, l_max_price_diff_num_tbl;
1499:
1500: IF (PO_LOG.d_stmt) THEN
1501: PO_LOG.stmt(d_module, d_position, 'l_entity_type_tbl', l_entity_type_tbl);
1502: PO_LOG.stmt(d_module, d_position, 'l_entity_id_tbl', l_entity_id_tbl);
1503: PO_LOG.stmt(d_module, d_position, 'l_max_price_diff_num_tbl',
1504: l_max_price_diff_num_tbl);
1505: END IF;
1506:
1499:
1500: IF (PO_LOG.d_stmt) THEN
1501: PO_LOG.stmt(d_module, d_position, 'l_entity_type_tbl', l_entity_type_tbl);
1502: PO_LOG.stmt(d_module, d_position, 'l_entity_id_tbl', l_entity_id_tbl);
1503: PO_LOG.stmt(d_module, d_position, 'l_max_price_diff_num_tbl',
1504: l_max_price_diff_num_tbl);
1505: END IF;
1506:
1507: d_position := 40;
1544: END LOOP;
1545:
1546: d_position := 60;
1547:
1548: IF (PO_LOG.d_proc) THEN
1549: PO_LOG.proc_end (d_module);
1550: END IF;
1551:
1552: EXCEPTION
1545:
1546: d_position := 60;
1547:
1548: IF (PO_LOG.d_proc) THEN
1549: PO_LOG.proc_end (d_module);
1550: END IF;
1551:
1552: EXCEPTION
1553: WHEN OTHERS THEN
1601:
1602: BEGIN
1603: d_position := 0;
1604:
1605: IF (PO_LOG.d_proc) THEN
1606: PO_LOG.proc_begin(d_module, 'p_entity_id', p_entity_id);
1607: PO_LOG.proc_begin(d_module, 'p_entity_type', p_entity_type);
1608: END IF;
1609:
1602: BEGIN
1603: d_position := 0;
1604:
1605: IF (PO_LOG.d_proc) THEN
1606: PO_LOG.proc_begin(d_module, 'p_entity_id', p_entity_id);
1607: PO_LOG.proc_begin(d_module, 'p_entity_type', p_entity_type);
1608: END IF;
1609:
1610: IF (p_entity_type IS NOT NULL AND p_entity_id IS NOT NULL) THEN
1603: d_position := 0;
1604:
1605: IF (PO_LOG.d_proc) THEN
1606: PO_LOG.proc_begin(d_module, 'p_entity_id', p_entity_id);
1607: PO_LOG.proc_begin(d_module, 'p_entity_type', p_entity_type);
1608: END IF;
1609:
1610: IF (p_entity_type IS NOT NULL AND p_entity_id IS NOT NULL) THEN
1611: IF (g_max_price_diff_num_tbl.EXISTS(p_entity_type) AND
1615: ELSE
1616: g_max_price_diff_num_tbl(p_entity_type)(p_entity_id) := 1;
1617: END IF;
1618:
1619: IF (PO_LOG.d_proc) THEN
1620: PO_LOG.proc_return(d_module, g_max_price_diff_num_tbl(p_entity_type)(p_entity_id));
1621: END IF;
1622:
1623: RETURN g_max_price_diff_num_tbl(p_entity_type)(p_entity_id);
1616: g_max_price_diff_num_tbl(p_entity_type)(p_entity_id) := 1;
1617: END IF;
1618:
1619: IF (PO_LOG.d_proc) THEN
1620: PO_LOG.proc_return(d_module, g_max_price_diff_num_tbl(p_entity_type)(p_entity_id));
1621: END IF;
1622:
1623: RETURN g_max_price_diff_num_tbl(p_entity_type)(p_entity_id);
1624: ELSE
1621: END IF;
1622:
1623: RETURN g_max_price_diff_num_tbl(p_entity_type)(p_entity_id);
1624: ELSE
1625: IF (PO_LOG.d_proc) THEN
1626: PO_LOG.proc_return(d_module, 'NULL');
1627: END IF;
1628:
1629: RETURN NULL;
1622:
1623: RETURN g_max_price_diff_num_tbl(p_entity_type)(p_entity_id);
1624: ELSE
1625: IF (PO_LOG.d_proc) THEN
1626: PO_LOG.proc_return(d_module, 'NULL');
1627: END IF;
1628:
1629: RETURN NULL;
1630: END IF;
1685: l_price_diff_num_exist_tbl three_dimension_table_type;
1686: BEGIN
1687: d_position := 0;
1688:
1689: IF (PO_LOG.d_proc) THEN
1690: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1686: BEGIN
1687: d_position := 0;
1688:
1689: IF (PO_LOG.d_proc) THEN
1690: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1694: p_intf_price_diff_id_tbl);
1687: d_position := 0;
1688:
1689: IF (PO_LOG.d_proc) THEN
1690: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1694: p_intf_price_diff_id_tbl);
1695: PO_LOG.proc_begin(d_module, 'p_price_diff_num_tbl', p_price_diff_num_tbl);
1688:
1689: IF (PO_LOG.d_proc) THEN
1690: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1694: p_intf_price_diff_id_tbl);
1695: PO_LOG.proc_begin(d_module, 'p_price_diff_num_tbl', p_price_diff_num_tbl);
1696: END IF;
1689: IF (PO_LOG.d_proc) THEN
1690: PO_LOG.proc_begin(d_module, 'p_entity_type_tbl', p_entity_type_tbl);
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1694: p_intf_price_diff_id_tbl);
1695: PO_LOG.proc_begin(d_module, 'p_price_diff_num_tbl', p_price_diff_num_tbl);
1696: END IF;
1697:
1691: PO_LOG.proc_begin(d_module, 'p_entity_id_tbl', p_entity_id_tbl);
1692: PO_LOG.proc_begin(d_module, 'p_draft_id_tbl', p_draft_id_tbl);
1693: PO_LOG.proc_begin(d_module, 'p_intf_price_diff_id_tbl',
1694: p_intf_price_diff_id_tbl);
1695: PO_LOG.proc_begin(d_module, 'p_price_diff_num_tbl', p_price_diff_num_tbl);
1696: END IF;
1697:
1698: x_price_diff_num_unique_tbl := PO_TBL_VARCHAR1();
1699: x_price_diff_num_unique_tbl.EXTEND(p_price_diff_num_tbl.COUNT);
1740: d_position := 30;
1741:
1742: FOR i IN 1..l_index_tbl.COUNT
1743: LOOP
1744: IF (PO_LOG.d_stmt) THEN
1745: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1746: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1747: p_price_diff_num_tbl(l_index_tbl(i)));
1748: END IF;
1741:
1742: FOR i IN 1..l_index_tbl.COUNT
1743: LOOP
1744: IF (PO_LOG.d_stmt) THEN
1745: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1746: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1747: p_price_diff_num_tbl(l_index_tbl(i)));
1748: END IF;
1749:
1742: FOR i IN 1..l_index_tbl.COUNT
1743: LOOP
1744: IF (PO_LOG.d_stmt) THEN
1745: PO_LOG.stmt(d_module, d_position, 'index', l_index_tbl(i));
1746: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1747: p_price_diff_num_tbl(l_index_tbl(i)));
1748: END IF;
1749:
1750: x_price_diff_num_unique_tbl(l_index_tbl(i)) := FND_API.g_FALSE;
1762: IF (l_price_diff_num_exist_tbl.EXISTS(p_entity_type_tbl(i)) AND
1763: l_price_diff_num_exist_tbl(p_entity_type_tbl(i)).EXISTS(p_entity_id_tbl(i)) AND
1764: l_price_diff_num_exist_tbl(p_entity_type_tbl(i))(p_entity_id_tbl(i)).EXISTS
1765: (p_price_diff_num_tbl(i))) THEN
1766: IF (PO_LOG.d_stmt) THEN
1767: PO_LOG.stmt(d_module, d_position, 'index', i);
1768: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1769: p_price_diff_num_tbl(i));
1770: END IF;
1763: l_price_diff_num_exist_tbl(p_entity_type_tbl(i)).EXISTS(p_entity_id_tbl(i)) AND
1764: l_price_diff_num_exist_tbl(p_entity_type_tbl(i))(p_entity_id_tbl(i)).EXISTS
1765: (p_price_diff_num_tbl(i))) THEN
1766: IF (PO_LOG.d_stmt) THEN
1767: PO_LOG.stmt(d_module, d_position, 'index', i);
1768: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1769: p_price_diff_num_tbl(i));
1770: END IF;
1771:
1764: l_price_diff_num_exist_tbl(p_entity_type_tbl(i))(p_entity_id_tbl(i)).EXISTS
1765: (p_price_diff_num_tbl(i))) THEN
1766: IF (PO_LOG.d_stmt) THEN
1767: PO_LOG.stmt(d_module, d_position, 'index', i);
1768: PO_LOG.stmt(d_module, d_position, 'price diff number is not unique',
1769: p_price_diff_num_tbl(i));
1770: END IF;
1771:
1772: x_price_diff_num_unique_tbl(i) := FND_API.g_FALSE;
1779: END LOOP;
1780:
1781: d_position := 50;
1782:
1783: IF (PO_LOG.d_proc) THEN
1784: PO_LOG.proc_end (d_module);
1785: END IF;
1786:
1787: EXCEPTION
1780:
1781: d_position := 50;
1782:
1783: IF (PO_LOG.d_proc) THEN
1784: PO_LOG.proc_end (d_module);
1785: END IF;
1786:
1787: EXCEPTION
1788: WHEN OTHERS THEN
1848:
1849: BEGIN
1850: d_position := 0;
1851:
1852: IF (PO_LOG.d_proc) THEN
1853: PO_LOG.proc_begin(d_module);
1854: END IF;
1855:
1856: FOR i IN 1..x_last_update_date_tbl.COUNT
1849: BEGIN
1850: d_position := 0;
1851:
1852: IF (PO_LOG.d_proc) THEN
1853: PO_LOG.proc_begin(d_module);
1854: END IF;
1855:
1856: FOR i IN 1..x_last_update_date_tbl.COUNT
1857: LOOP
1865: x_program_id_tbl(i) := NVL(x_program_id_tbl(i), FND_GLOBAL.conc_program_id);
1866: x_program_update_date_tbl(i) := NVL(x_program_update_date_tbl(i), sysdate);
1867: END LOOP;
1868:
1869: IF (PO_LOG.d_proc) THEN
1870: PO_LOG.proc_end (d_module);
1871: END IF;
1872:
1873: EXCEPTION
1866: x_program_update_date_tbl(i) := NVL(x_program_update_date_tbl(i), sysdate);
1867: END LOOP;
1868:
1869: IF (PO_LOG.d_proc) THEN
1870: PO_LOG.proc_end (d_module);
1871: END IF;
1872:
1873: EXCEPTION
1874: WHEN OTHERS THEN
1911: l_next_set_process_id NUMBER;
1912: BEGIN
1913: d_position := 0;
1914:
1915: IF (PO_LOG.d_proc) THEN
1916: PO_LOG.proc_begin(d_module);
1917: END IF;
1918:
1919: SELECT po_items_interface_sets_s.nextval
1912: BEGIN
1913: d_position := 0;
1914:
1915: IF (PO_LOG.d_proc) THEN
1916: PO_LOG.proc_begin(d_module);
1917: END IF;
1918:
1919: SELECT po_items_interface_sets_s.nextval
1920: INTO l_next_set_process_id
1919: SELECT po_items_interface_sets_s.nextval
1920: INTO l_next_set_process_id
1921: FROM DUAL;
1922:
1923: IF (PO_LOG.d_proc) THEN
1924: PO_LOG.proc_return(d_module, l_next_set_process_id);
1925: END IF;
1926:
1927: RETURN l_next_set_process_id;
1920: INTO l_next_set_process_id
1921: FROM DUAL;
1922:
1923: IF (PO_LOG.d_proc) THEN
1924: PO_LOG.proc_return(d_module, l_next_set_process_id);
1925: END IF;
1926:
1927: RETURN l_next_set_process_id;
1928: END get_next_set_process_id;
1955: l_precision NUMBER;
1956: BEGIN
1957: d_position := 0;
1958:
1959: IF (PO_LOG.d_proc) THEN
1960: PO_LOG.proc_begin(d_module, 'p_currency_code', p_currency_code);
1961: END IF;
1962:
1963: IF (x_precision_tbl.EXISTS(p_currency_code)) THEN
1956: BEGIN
1957: d_position := 0;
1958:
1959: IF (PO_LOG.d_proc) THEN
1960: PO_LOG.proc_begin(d_module, 'p_currency_code', p_currency_code);
1961: END IF;
1962:
1963: IF (x_precision_tbl.EXISTS(p_currency_code)) THEN
1964: d_position := 10;
1962:
1963: IF (x_precision_tbl.EXISTS(p_currency_code)) THEN
1964: d_position := 10;
1965:
1966: IF (PO_LOG.d_proc) THEN
1967: PO_LOG.proc_return(d_module, x_precision_tbl(p_currency_code));
1968: END IF;
1969:
1970: return x_precision_tbl(p_currency_code);
1963: IF (x_precision_tbl.EXISTS(p_currency_code)) THEN
1964: d_position := 10;
1965:
1966: IF (PO_LOG.d_proc) THEN
1967: PO_LOG.proc_return(d_module, x_precision_tbl(p_currency_code));
1968: END IF;
1969:
1970: return x_precision_tbl(p_currency_code);
1971: ELSE
1978:
1979: -- set new value in hashtable
1980: x_precision_tbl(p_currency_code) := l_precision;
1981:
1982: IF (PO_LOG.d_proc) THEN
1983: PO_LOG.proc_return(d_module, l_precision);
1984: END IF;
1985:
1986: return l_precision;
1979: -- set new value in hashtable
1980: x_precision_tbl(p_currency_code) := l_precision;
1981:
1982: IF (PO_LOG.d_proc) THEN
1983: PO_LOG.proc_return(d_module, l_precision);
1984: END IF;
1985:
1986: return l_precision;
1987: END IF;