1: PACKAGE BODY PO_LINES_DRAFT_PVT AS
2: /* $Header: PO_LINES_DRAFT_PVT.plb 120.9.12020000.5 2013/04/19 06:45:04 pamandav ship $ */
3:
4: d_pkg_name CONSTANT varchar2(50) :=
5: PO_LOG.get_package_base('PO_LINES_DRAFT_PVT');
6:
7: -------------------------------------------------------
8: ----------- PRIVATE PROCEDURES PROTOTYPE --------------
9: -------------------------------------------------------
67: l_dft_exists_index_tbl PO_TBL_NUMBER := PO_TBL_NUMBER();
68:
69: BEGIN
70: d_position := 0;
71: IF (PO_LOG.d_proc) THEN
72: PO_LOG.proc_begin(d_module);
73: END IF;
74:
75: l_index_tbl.extend(p_draft_id_tbl.COUNT);
68:
69: BEGIN
70: d_position := 0;
71: IF (PO_LOG.d_proc) THEN
72: PO_LOG.proc_begin(d_module);
73: END IF;
74:
75: l_index_tbl.extend(p_draft_id_tbl.COUNT);
76: l_dft_exists_tbl.extend(p_draft_id_tbl.COUNT);
116: FOR i IN 1..l_dft_exists_index_tbl.COUNT LOOP
117: l_dft_exists_tbl(l_dft_exists_index_tbl(i)) := FND_API.G_TRUE;
118: END LOOP;
119:
120: IF (PO_LOG.d_stmt) THEN
121: PO_LOG.stmt(d_module, d_position, '# of records that have dft changes',
122: l_dft_exists_index_tbl.COUNT);
123: END IF;
124:
117: l_dft_exists_tbl(l_dft_exists_index_tbl(i)) := FND_API.G_TRUE;
118: END LOOP;
119:
120: IF (PO_LOG.d_stmt) THEN
121: PO_LOG.stmt(d_module, d_position, '# of records that have dft changes',
122: l_dft_exists_index_tbl.COUNT);
123: END IF;
124:
125: RETURN l_dft_exists_tbl;
169:
170: l_exists_tbl PO_TBL_VARCHAR1;
171: BEGIN
172: d_position := 0;
173: IF (PO_LOG.d_proc) THEN
174: PO_LOG.proc_begin(d_module);
175: END IF;
176:
177: l_exists_tbl :=
170: l_exists_tbl PO_TBL_VARCHAR1;
171: BEGIN
172: d_position := 0;
173: IF (PO_LOG.d_proc) THEN
174: PO_LOG.proc_begin(d_module);
175: END IF;
176:
177: l_exists_tbl :=
178: draft_changes_exist
179: ( p_draft_id_tbl => PO_TBL_NUMBER(p_draft_id),
180: p_po_line_id_tbl => PO_TBL_NUMBER(p_po_line_id)
181: );
182:
183: IF (PO_LOG.d_stmt) THEN
184: PO_LOG.stmt(d_module, d_position, 'exists', l_exists_tbl(1));
185: END IF;
186:
187: RETURN l_exists_tbl(1);
180: p_po_line_id_tbl => PO_TBL_NUMBER(p_po_line_id)
181: );
182:
183: IF (PO_LOG.d_stmt) THEN
184: PO_LOG.stmt(d_module, d_position, 'exists', l_exists_tbl(1));
185: END IF;
186:
187: RETURN l_exists_tbl(1);
188:
237: l_clm_document varchar2(1);
238:
239: BEGIN
240: d_position := 0;
241: IF (PO_LOG.d_proc) THEN
242: PO_LOG.proc_begin(d_module);
243: END IF;
244:
245: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
238:
239: BEGIN
240: d_position := 0;
241: IF (PO_LOG.d_proc) THEN
242: PO_LOG.proc_begin(d_module);
243: END IF;
244:
245: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
246: IF (PO_LOG.d_stmt) THEN
242: PO_LOG.proc_begin(d_module);
243: END IF;
244:
245: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
246: IF (PO_LOG.d_stmt) THEN
247: PO_LOG.stmt(d_module, d_position, 'no change-no need to apply');
248: END IF;
249:
250: RETURN;
243: END IF;
244:
245: IF (p_draft_info.lines_changed = FND_API.G_FALSE) THEN
246: IF (PO_LOG.d_stmt) THEN
247: PO_LOG.stmt(d_module, d_position, 'no change-no need to apply');
248: END IF;
249:
250: RETURN;
251: END IF;
260:
261: d_position := 20;
262: IF (l_delete_list.COUNT > 0) THEN
263:
264: IF (PO_LOG.d_stmt) THEN
265: PO_LOG.stmt(d_module, d_position, 'Deleted Lines Found');
266: END IF;
267:
268: BEGIN
261: d_position := 20;
262: IF (l_delete_list.COUNT > 0) THEN
263:
264: IF (PO_LOG.d_stmt) THEN
265: PO_LOG.stmt(d_module, d_position, 'Deleted Lines Found');
266: END IF;
267:
268: BEGIN
269: SELECT 'Y'
281: l_clm_document := 'N';
282: END;
283:
284: d_position := 20;
285: IF (PO_LOG.d_stmt) THEN
286: PO_LOG.stmt(d_module, d_position, 'l_clm_document:'||l_clm_document);
287: END IF;
288:
289: -- Bug: 13948625
282: END;
283:
284: d_position := 20;
285: IF (PO_LOG.d_stmt) THEN
286: PO_LOG.stmt(d_module, d_position, 'l_clm_document:'||l_clm_document);
287: END IF;
288:
289: -- Bug: 13948625
290: -- Call update_req_for_linked_po_count, where the linked_po_count is updated for unlinked requisitions
294:
295: IF (p_draft_info.doc_subtype = 'STANDARD' AND l_clm_document = 'Y') THEN
296:
297: d_position := 30;
298: IF (PO_LOG.d_stmt) THEN
299: PO_LOG.stmt(d_module, d_position, 'Calling update_req_for_linked_po_count');
300: END IF;
301:
302: PO_REQ_LINES_SV.update_req_for_linked_po_count (l_delete_list, 'LINE');
295: IF (p_draft_info.doc_subtype = 'STANDARD' AND l_clm_document = 'Y') THEN
296:
297: d_position := 30;
298: IF (PO_LOG.d_stmt) THEN
299: PO_LOG.stmt(d_module, d_position, 'Calling update_req_for_linked_po_count');
300: END IF;
301:
302: PO_REQ_LINES_SV.update_req_for_linked_po_count (l_delete_list, 'LINE');
303:
316: END ;
317:
318:
319: d_position := 40;
320: IF (PO_LOG.d_stmt) THEN
321: PO_LOG.stmt(d_module, d_position, 'Calling send_line_deleted_notif');
322: END IF;
323:
324: -- Options Enhancement:
317:
318:
319: d_position := 40;
320: IF (PO_LOG.d_stmt) THEN
321: PO_LOG.stmt(d_module, d_position, 'Calling send_line_deleted_notif');
322: END IF;
323:
324: -- Options Enhancement:
325: -- Sending the notification to Requseter , if the priced slin/option line is deleted
343: FROM po_lines_all
344: WHERE po_line_id = l_delete_list(i) ;
345:
346: d_position := 40;
347: IF (PO_LOG.d_stmt) THEN
348: PO_LOG.stmt(d_module, d_position, 'l_info_flag:'||l_info_flag);
349: END IF ;
350:
351: IF(l_info_flag LIKE 'Y') THEN --Call the remove req from po only info lines.
344: WHERE po_line_id = l_delete_list(i) ;
345:
346: d_position := 40;
347: IF (PO_LOG.d_stmt) THEN
348: PO_LOG.stmt(d_module, d_position, 'l_info_flag:'||l_info_flag);
349: END IF ;
350:
351: IF(l_info_flag LIKE 'Y') THEN --Call the remove req from po only info lines.
352: PO_REQ_LINES_SV.remove_req_from_po (l_delete_list(i), 'LINE');
354:
355: END IF;
356:
357: d_position := 40;
358: IF (PO_LOG.d_stmt) THEN
359: PO_LOG.stmt(d_module, d_position, 'Calling delete_attachments');
360: END IF;
361:
362: --Bug 13938456 Conc Mod attachments
355: END IF;
356:
357: d_position := 40;
358: IF (PO_LOG.d_stmt) THEN
359: PO_LOG.stmt(d_module, d_position, 'Calling delete_attachments');
360: END IF;
361:
362: --Bug 13938456 Conc Mod attachments
363: --Passing null for automatically_added_flag instead of Y
421: l_update_retro_date_flag_tbl PO_TBL_VARCHAR1;
422:
423: BEGIN
424: d_position := 0;
425: IF (PO_LOG.d_proc) THEN
426: PO_LOG.proc_begin(d_module);
427: END IF;
428:
429: IF ((NOT (p_draft_info.doc_type = 'PO' AND
422:
423: BEGIN
424: d_position := 0;
425: IF (PO_LOG.d_proc) THEN
426: PO_LOG.proc_begin(d_module);
427: END IF;
428:
429: IF ((NOT (p_draft_info.doc_type = 'PO' AND
430: p_draft_info.doc_subtype = 'STANDARD') AND
466: AND po_line_id = l_po_line_id_tbl(i)
467: AND l_update_retro_date_flag_tbl(i) = 'Y';
468:
469:
470: IF (PO_LOG.d_proc) THEN
471: PO_LOG.proc_end(d_module);
472: END IF;
473:
474: EXCEPTION
467: AND l_update_retro_date_flag_tbl(i) = 'Y';
468:
469:
470: IF (PO_LOG.d_proc) THEN
471: PO_LOG.proc_end(d_module);
472: END IF;
473:
474: EXCEPTION
475: WHEN OTHERS THEN
528: l_txn_exists_list PO_TBL_VARCHAR1;
529:
530: BEGIN
531: d_position := 0;
532: IF (PO_LOG.d_proc) THEN
533: PO_LOG.proc_begin(d_module);
534: END IF;
535:
536: x_delete_list := PO_TBL_NUMBER();
529:
530: BEGIN
531: d_position := 0;
532: IF (PO_LOG.d_proc) THEN
533: PO_LOG.proc_begin(d_module);
534: END IF;
535:
536: x_delete_list := PO_TBL_NUMBER();
537: x_insert_list := PO_TBL_NUMBER();
612: d_position NUMBER;
613: BEGIN
614:
615: d_position := 0;
616: IF (PO_LOG.d_proc) THEN
617: PO_LOG.proc_begin(d_module);
618: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
619: PO_LOG.proc_begin(d_module, 'p_par_draft_id', p_par_draft_id);
620: END IF;
613: BEGIN
614:
615: d_position := 0;
616: IF (PO_LOG.d_proc) THEN
617: PO_LOG.proc_begin(d_module);
618: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
619: PO_LOG.proc_begin(d_module, 'p_par_draft_id', p_par_draft_id);
620: END IF;
621:
614:
615: d_position := 0;
616: IF (PO_LOG.d_proc) THEN
617: PO_LOG.proc_begin(d_module);
618: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
619: PO_LOG.proc_begin(d_module, 'p_par_draft_id', p_par_draft_id);
620: END IF;
621:
622: -- Select Line Nums which have been added by other Modifications
615: d_position := 0;
616: IF (PO_LOG.d_proc) THEN
617: PO_LOG.proc_begin(d_module);
618: PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
619: PO_LOG.proc_begin(d_module, 'p_par_draft_id', p_par_draft_id);
620: END IF;
621:
622: -- Select Line Nums which have been added by other Modifications
623: --
636: --This condition applies only for PAR autocreate
637: AND draft_id <> Nvl(p_par_draft_id, -999);
638:
639: d_position := 10;
640: IF (PO_LOG.d_stmt) THEN
641: PO_LOG.stmt(d_module, d_position, 'l_oth_line_num_arr', l_oth_line_num_arr);
642: END IF;
643:
644: -- Get a distinct union of current Mod Line Nums and other Mods Line Nums
637: AND draft_id <> Nvl(p_par_draft_id, -999);
638:
639: d_position := 10;
640: IF (PO_LOG.d_stmt) THEN
641: PO_LOG.stmt(d_module, d_position, 'l_oth_line_num_arr', l_oth_line_num_arr);
642: END IF;
643:
644: -- Get a distinct union of current Mod Line Nums and other Mods Line Nums
645: l_merged_line_num_arr := p_line_num_arr MULTISET UNION DISTINCT
645: l_merged_line_num_arr := p_line_num_arr MULTISET UNION DISTINCT
646: l_oth_line_num_arr;
647:
648: d_position := 20;
649: IF (PO_LOG.d_stmt) THEN
650: PO_LOG.stmt(d_module, d_position, 'l_merged_line_num_arr', l_merged_line_num_arr);
651: END IF;
652: IF (PO_LOG.d_proc) THEN
653: PO_LOG.proc_end(d_module);
646: l_oth_line_num_arr;
647:
648: d_position := 20;
649: IF (PO_LOG.d_stmt) THEN
650: PO_LOG.stmt(d_module, d_position, 'l_merged_line_num_arr', l_merged_line_num_arr);
651: END IF;
652: IF (PO_LOG.d_proc) THEN
653: PO_LOG.proc_end(d_module);
654: END IF;
648: d_position := 20;
649: IF (PO_LOG.d_stmt) THEN
650: PO_LOG.stmt(d_module, d_position, 'l_merged_line_num_arr', l_merged_line_num_arr);
651: END IF;
652: IF (PO_LOG.d_proc) THEN
653: PO_LOG.proc_end(d_module);
654: END IF;
655:
656: RETURN PON_CLO_RENUMBER_PKG.next_clin_num(l_merged_line_num_arr);
649: IF (PO_LOG.d_stmt) THEN
650: PO_LOG.stmt(d_module, d_position, 'l_merged_line_num_arr', l_merged_line_num_arr);
651: END IF;
652: IF (PO_LOG.d_proc) THEN
653: PO_LOG.proc_end(d_module);
654: END IF;
655:
656: RETURN PON_CLO_RENUMBER_PKG.next_clin_num(l_merged_line_num_arr);
657: END get_next_clin_num;
693: d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
694: d_position NUMBER;
695: BEGIN
696: d_position := 0;
697: IF (PO_LOG.d_proc) THEN
698: PO_LOG.proc_begin(d_module);
699: END IF;
700:
701: -- Get the max line num display for the line id p_po_line_id from
694: d_position NUMBER;
695: BEGIN
696: d_position := 0;
697: IF (PO_LOG.d_proc) THEN
698: PO_LOG.proc_begin(d_module);
699: END IF;
700:
701: -- Get the max line num display for the line id p_po_line_id from
702: -- po_lines_merge_v. If this is greater than p_max_slin_num use it,
709: AND draft_id <>p_draft_id
710: AND NVL(clm_info_flag, 'N') = p_info_flag;
711:
712: d_position := 10;
713: IF (PO_LOG.d_stmt) THEN
714: PO_LOG.stmt(d_module, d_position, 'l_max_slin_num', l_max_slin_num);
715: END IF;
716:
717: IF NVL(l_max_slin_num,'-1') < NVL(p_max_slin_num,'-1') THEN
710: AND NVL(clm_info_flag, 'N') = p_info_flag;
711:
712: d_position := 10;
713: IF (PO_LOG.d_stmt) THEN
714: PO_LOG.stmt(d_module, d_position, 'l_max_slin_num', l_max_slin_num);
715: END IF;
716:
717: IF NVL(l_max_slin_num,'-1') < NVL(p_max_slin_num,'-1') THEN
718: l_max_slin_num := p_max_slin_num;
717: IF NVL(l_max_slin_num,'-1') < NVL(p_max_slin_num,'-1') THEN
718: l_max_slin_num := p_max_slin_num;
719: END IF;
720: d_position := 20;
721: IF (PO_LOG.d_stmt) THEN
722: PO_LOG.stmt(d_module, d_position, 'l_max_slin_num', l_max_slin_num);
723: END IF;
724:
725: IF l_max_slin_num is null then
718: l_max_slin_num := p_max_slin_num;
719: END IF;
720: d_position := 20;
721: IF (PO_LOG.d_stmt) THEN
722: PO_LOG.stmt(d_module, d_position, 'l_max_slin_num', l_max_slin_num);
723: END IF;
724:
725: IF l_max_slin_num is null then
726:
740: PON_CLO_RENUMBER_PKG.increment_priced_slin_number(l_max_slin_num);
741: END IF;
742:
743: d_position := 40;
744: IF (PO_LOG.d_stmt) THEN
745: PO_LOG.stmt(d_module, d_position, 'l_next_slin_num', l_next_slin_num);
746: END IF;
747: IF (PO_LOG.d_proc) THEN
748: PO_LOG.proc_end(d_module);
741: END IF;
742:
743: d_position := 40;
744: IF (PO_LOG.d_stmt) THEN
745: PO_LOG.stmt(d_module, d_position, 'l_next_slin_num', l_next_slin_num);
746: END IF;
747: IF (PO_LOG.d_proc) THEN
748: PO_LOG.proc_end(d_module);
749: END IF;
743: d_position := 40;
744: IF (PO_LOG.d_stmt) THEN
745: PO_LOG.stmt(d_module, d_position, 'l_next_slin_num', l_next_slin_num);
746: END IF;
747: IF (PO_LOG.d_proc) THEN
748: PO_LOG.proc_end(d_module);
749: END IF;
750: RETURN l_next_slin_num;
751:
744: IF (PO_LOG.d_stmt) THEN
745: PO_LOG.stmt(d_module, d_position, 'l_next_slin_num', l_next_slin_num);
746: END IF;
747: IF (PO_LOG.d_proc) THEN
748: PO_LOG.proc_end(d_module);
749: END IF;
750: RETURN l_next_slin_num;
751:
752: END;