DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_LINE_LOCATIONS_DRAFT_PKG

Source


1 PACKAGE BODY PO_LINE_LOCATIONS_DRAFT_PKG AS
2 /* $Header: PO_LINE_LOCATIONS_DRAFT_PKG.plb 120.8 2006/09/28 23:03:51 bao noship $ */
3 
4 d_pkg_name CONSTANT varchar2(50) :=
5   PO_LOG.get_package_base('PO_LINE_LOCATIONS_DRAFT_PKG');
6 
7 -----------------------------------------------------------------------
8 --Start of Comments
9 --Name: delete_rows
10 --Pre-reqs: None
11 --Modifies:
12 --Locks:
13 --  None
14 --Function:
15 --  Deletes drafts for line locations based on the information given
16 --  If only draft_id is provided, then all line locs for the draft will be
17 --  deleted
18 --  If line_location_id is also provided, then the one record that has such
19 --  primary key will be deleted
20 --Parameters:
21 --IN:
22 --p_draft_id
23 --  draft unique identifier
24 --p_line_location_id
25 --  po line location unique identifier
26 --IN OUT:
27 --OUT:
28 --Returns:
29 --Notes:
30 --Testing:
31 --End of Comments
32 ------------------------------------------------------------------------
33 PROCEDURE delete_rows
34 ( p_draft_id IN NUMBER,
35   p_line_location_id IN NUMBER
36 ) IS
37 d_api_name CONSTANT VARCHAR2(30) := 'delete_rows';
38 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
39 d_position NUMBER;
40 
41 BEGIN
42   d_position := 0;
43   IF (PO_LOG.d_proc) THEN
44     PO_LOG.proc_begin(d_module);
45   END IF;
46 
47   DELETE FROM po_line_locations_draft_all
48   WHERE draft_id = p_draft_id
49   AND line_location_id = NVL(p_line_location_id, line_location_id);
50 
51   d_position := 10;
52 EXCEPTION
53   WHEN OTHERS THEN
54     PO_MESSAGE_S.add_exc_msg
55     ( p_pkg_name => d_pkg_name,
56       p_procedure_name => d_api_name || '.' || d_position
57     );
58     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
59 END delete_rows;
60 
61 
62 -----------------------------------------------------------------------
63 --Start of Comments
64 --Name: sync_draft_from_txn
65 --Pre-reqs: None
66 --Modifies:
67 --Locks:
68 --  None
69 --Function:
70 --  Copy data from transaction table to draft table, if the corresponding
71 --  record in draft table does not exist. It also sets the delete flag of
72 --  the draft record according to the parameter.
73 --Parameters:
74 --IN:
75 --p_line_location_id_tbl
76 --  table of po line location unique identifier
77 --p_draft_id_tbl
78 --  table of draft ids this sync up will be done for
79 --p_delete_flag_tbl
80 --  table fo flags to indicate whether the draft record should be maked as
81 --  "to be deleted"
82 --IN OUT:
83 --OUT:
84 --x_record_already_exist_tbl
85 --  Returns whether the record was already in draft table or not
86 --Returns:
87 --Notes:
88 --Testing:
89 --End of Comments
90 ------------------------------------------------------------------------
91 PROCEDURE sync_draft_from_txn
92 ( p_line_location_id_tbl     IN PO_TBL_NUMBER,
93   p_draft_id_tbl             IN PO_TBL_NUMBER,
94   p_delete_flag_tbl          IN PO_TBL_VARCHAR1,
95   x_record_already_exist_tbl OUT NOCOPY PO_TBL_VARCHAR1
96 ) IS
97 
98 d_api_name CONSTANT VARCHAR2(30) := 'sync_draft_from_txn';
99 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
100 d_position NUMBER;
101 
102 l_distinct_id_list DBMS_SQL.NUMBER_TABLE;
103 l_duplicate_flag_tbl PO_TBL_VARCHAR1 := PO_TBL_VARCHAR1();
104 
105 BEGIN
106   d_position := 0;
107   IF (PO_LOG.d_proc) THEN
108     PO_LOG.proc_begin(d_module);
109   END IF;
110 
111   x_record_already_exist_tbl :=
112     PO_LINE_LOCATIONS_DRAFT_PVT.draft_changes_exist
113     ( p_draft_id_tbl => p_draft_id_tbl,
114       p_line_location_id_tbl => p_line_location_id_tbl
115     );
116 
117   -- bug5471513 START
118   -- If there're duplicate entries in the id table,
119   -- we do not want to insert multiple entries
120   -- Created an associative array to store what id has appeared.
121   l_duplicate_flag_tbl.EXTEND(p_line_location_id_tbl.COUNT);
122 
123   FOR i IN 1..p_line_location_id_tbl.COUNT LOOP
124     IF (x_record_already_exist_tbl(i) = FND_API.G_FALSE) THEN
125 
126       IF (l_distinct_id_list.EXISTS(p_line_location_id_tbl(i))) THEN
127 
128         l_duplicate_flag_tbl(i) := FND_API.G_TRUE;
129       ELSE
130         l_duplicate_flag_tbl(i) := FND_API.G_FALSE;
131 
132         l_distinct_id_list(p_line_location_id_tbl(i)) := 1;
133       END IF;
134 
135     ELSE
136 
137       l_duplicate_flag_tbl(i) := NULL;
138 
139     END IF;
140   END LOOP;
141   -- bug5471513 END
142 
143   d_position := 10;
144   IF (PO_LOG.d_stmt) THEN
145     PO_LOG.stmt(d_module, d_position, 'transfer records from txn to dft');
146   END IF;
147 
148   FORALL i IN 1..p_line_location_id_tbl.COUNT
149     INSERT INTO po_line_locations_draft_all
150     ( draft_id,
151       delete_flag,
152       change_accepted_flag,
153       line_location_id,
154       last_update_date,
155       last_updated_by,
156       po_header_id,
157       po_line_id,
158       last_update_login,
159       creation_date,
160       created_by,
161       quantity,
162       quantity_accepted,
163       quantity_received,
164       quantity_rejected,
165       quantity_billed,
166       quantity_cancelled,
167       unit_meas_lookup_code,
168       po_release_id,
169       ship_to_location_id,
170       ship_via_lookup_code,
171       need_by_date,
172       promised_date,
173       last_accept_date,
174       price_override,
175       encumbered_flag,
176       encumbered_date,
177       unencumbered_quantity,
178       fob_lookup_code,
179       freight_terms_lookup_code,
180       taxable_flag,
181       tax_name,
182       estimated_tax_amount,
183       from_header_id,
184       from_line_id,
185       from_line_location_id,
186       start_date,
187       end_date,
188       lead_time,
189       lead_time_unit,
190       price_discount,
191       terms_id,
192       approved_flag,
193       approved_date,
194       closed_flag,
195       cancel_flag,
196       cancelled_by,
197       cancel_date,
198       cancel_reason,
199       firm_status_lookup_code,
200       firm_date,
201       attribute_category,
202       attribute1,
203       attribute2,
204       attribute3,
205       attribute4,
206       attribute5,
207       attribute6,
208       attribute7,
209       attribute8,
210       attribute9,
211       attribute10,
212       unit_of_measure_class,
213       encumber_now,
214       attribute11,
215       attribute12,
216       attribute13,
217       attribute14,
218       attribute15,
219       inspection_required_flag,
220       receipt_required_flag,
221       qty_rcv_tolerance,
222       qty_rcv_exception_code,
223       enforce_ship_to_location_code,
224       allow_substitute_receipts_flag,
225       days_early_receipt_allowed,
226       days_late_receipt_allowed,
227       receipt_days_exception_code,
228       invoice_close_tolerance,
229       receive_close_tolerance,
230       ship_to_organization_id,
231       shipment_num,
232       source_shipment_id,
233       shipment_type,
234       closed_code,
235       request_id,
236       program_application_id,
237       program_id,
238       program_update_date,
239       ussgl_transaction_code,
240       government_context,
241       receiving_routing_id,
242       accrue_on_receipt_flag,
243       closed_reason,
244       closed_date,
245       closed_by,
246       org_id,
247       quantity_shipped,
248       global_attribute_category,
249       global_attribute1,
250       global_attribute2,
251       global_attribute3,
252       global_attribute4,
253       global_attribute5,
254       global_attribute6,
255       global_attribute7,
256       global_attribute8,
257       global_attribute9,
258       global_attribute10,
259       global_attribute11,
260       global_attribute12,
261       global_attribute13,
262       global_attribute14,
263       global_attribute15,
264       global_attribute16,
265       global_attribute17,
266       global_attribute18,
267       global_attribute19,
268       global_attribute20,
269       country_of_origin_code,
270       tax_user_override_flag,
271       match_option,
272       tax_code_id,
273       calculate_tax_flag,
274       change_promised_date_reason,
275       note_to_receiver,
276       secondary_quantity,
277       secondary_unit_of_measure,
278       preferred_grade,
279       secondary_quantity_received,
280       secondary_quantity_accepted,
281       secondary_quantity_rejected,
282       secondary_quantity_cancelled,
283       secondary_quantity_shipped,
284       vmi_flag,
285       consigned_flag,
286       retroactive_date,
287       supplier_order_line_number,
288       amount,
289       amount_received,
290       amount_billed,
291       amount_cancelled,
292       amount_rejected,
293       amount_accepted,
294       drop_ship_flag,
295       sales_order_update_date,
296       transaction_flow_header_id,
297       final_match_flag,
298       manual_price_change_flag,
299       shipment_closed_date,
300       closed_for_receiving_date,
301       closed_for_invoice_date,
302       -- <Complex Work R12 Start>
303       value_basis,
304       matching_basis,
305       payment_type,
306       description,
307       work_approver_id,
308       bid_payment_id,
309       quantity_financed,
310       amount_financed,
311       quantity_recouped,
312       amount_recouped,
313       retainage_withheld_amount,
314       retainage_released_amount,
315       -- <Complex Work R12 End>
316       outsourced_assembly,
317       tax_attribute_update_code -- <ETAX R12>
318     )
319     SELECT
320       p_draft_id_tbl(i),
321       p_delete_flag_tbl(i),
322       NULL,
323       line_location_id,
324       last_update_date,
325       last_updated_by,
326       po_header_id,
327       po_line_id,
328       last_update_login,
329       creation_date,
330       created_by,
331       quantity,
332       quantity_accepted,
333       quantity_received,
334       quantity_rejected,
335       quantity_billed,
336       quantity_cancelled,
337       unit_meas_lookup_code,
338       po_release_id,
339       ship_to_location_id,
340       ship_via_lookup_code,
341       need_by_date,
342       promised_date,
343       last_accept_date,
344       price_override,
345       encumbered_flag,
346       encumbered_date,
347       unencumbered_quantity,
348       fob_lookup_code,
349       freight_terms_lookup_code,
350       taxable_flag,
351       tax_name,
352       estimated_tax_amount,
353       from_header_id,
354       from_line_id,
355       from_line_location_id,
356       start_date,
357       end_date,
358       lead_time,
359       lead_time_unit,
360       price_discount,
361       terms_id,
362       approved_flag,
363       approved_date,
364       closed_flag,
365       cancel_flag,
366       cancelled_by,
367       cancel_date,
368       cancel_reason,
369       firm_status_lookup_code,
370       firm_date,
371       attribute_category,
372       attribute1,
373       attribute2,
374       attribute3,
375       attribute4,
376       attribute5,
377       attribute6,
378       attribute7,
379       attribute8,
380       attribute9,
381       attribute10,
382       unit_of_measure_class,
383       encumber_now,
384       attribute11,
385       attribute12,
386       attribute13,
387       attribute14,
388       attribute15,
389       inspection_required_flag,
390       receipt_required_flag,
391       qty_rcv_tolerance,
392       qty_rcv_exception_code,
393       enforce_ship_to_location_code,
394       allow_substitute_receipts_flag,
395       days_early_receipt_allowed,
396       days_late_receipt_allowed,
397       receipt_days_exception_code,
398       invoice_close_tolerance,
399       receive_close_tolerance,
400       ship_to_organization_id,
401       shipment_num,
402       source_shipment_id,
406       program_application_id,
403       shipment_type,
404       closed_code,
405       request_id,
407       program_id,
408       program_update_date,
409       ussgl_transaction_code,
410       government_context,
411       receiving_routing_id,
412       accrue_on_receipt_flag,
413       closed_reason,
414       closed_date,
415       closed_by,
416       org_id,
417       quantity_shipped,
418       global_attribute_category,
419       global_attribute1,
420       global_attribute2,
421       global_attribute3,
422       global_attribute4,
423       global_attribute5,
424       global_attribute6,
425       global_attribute7,
426       global_attribute8,
427       global_attribute9,
428       global_attribute10,
429       global_attribute11,
430       global_attribute12,
431       global_attribute13,
432       global_attribute14,
433       global_attribute15,
434       global_attribute16,
435       global_attribute17,
436       global_attribute18,
437       global_attribute19,
438       global_attribute20,
439       country_of_origin_code,
440       tax_user_override_flag,
441       match_option,
442       tax_code_id,
443       calculate_tax_flag,
444       change_promised_date_reason,
445       note_to_receiver,
446       secondary_quantity,
447       secondary_unit_of_measure,
448       preferred_grade,
449       secondary_quantity_received,
450       secondary_quantity_accepted,
451       secondary_quantity_rejected,
452       secondary_quantity_cancelled,
453       secondary_quantity_shipped,
454       vmi_flag,
455       consigned_flag,
456       retroactive_date,
457       supplier_order_line_number,
458       amount,
459       amount_received,
460       amount_billed,
461       amount_cancelled,
462       amount_rejected,
463       amount_accepted,
464       drop_ship_flag,
465       sales_order_update_date,
466       transaction_flow_header_id,
467       final_match_flag,
468       manual_price_change_flag,
469       shipment_closed_date,
470       closed_for_receiving_date,
471       closed_for_invoice_date,
472       -- <Complex Work R12 Start>
473       value_basis,
474       matching_basis,
475       payment_type,
476       description,
477       work_approver_id,
478       bid_payment_id,
479       quantity_financed,
480       amount_financed,
481       quantity_recouped,
482       amount_recouped,
483       retainage_withheld_amount,
484       retainage_released_amount,
485       -- <Complex Work R12 End>
486       outsourced_assembly,
487       tax_attribute_update_code -- <ETAX R12>
488     FROM po_line_locations_all
489     WHERE line_location_id = p_line_location_id_tbl(i)
490     AND x_record_already_exist_tbl(i) = FND_API.G_FALSE
491     AND l_duplicate_flag_tbl(i) = FND_API.G_FALSE;
492 
493   d_position := 20;
494   IF (PO_LOG.d_stmt) THEN
495     PO_LOG.stmt(d_module, d_position, 'transfer count = ' || SQL%ROWCOUNT);
496   END IF;
497 
498   FORALL i IN 1..p_line_location_id_tbl.COUNT
499     UPDATE po_line_locations_draft_all
500     SET    delete_flag = p_delete_flag_tbl(i)
501     WHERE  line_location_id = p_line_location_id_tbl(i)
502     AND    draft_id = p_draft_id_tbl(i)
503     AND    NVL(delete_flag, 'N') <> 'Y'  -- bug5570989
504     AND    x_record_already_exist_tbl(i) = FND_API.G_TRUE;
505 
506   d_position := 30;
507 
508   IF (PO_LOG.d_stmt) THEN
509     PO_LOG.stmt(d_module, d_position, 'update draft records that are already' ||
510                 ' in draft table. Count = ' || SQL%ROWCOUNT);
511   END IF;
512 
513   d_position := 40;
514 
515   IF (PO_LOG.d_proc) THEN
516     PO_LOG.proc_end(d_module);
517   END IF;
518 
519 EXCEPTION
520   WHEN OTHERS THEN
521     PO_MESSAGE_S.add_exc_msg
522     ( p_pkg_name => d_pkg_name,
523       p_procedure_name => d_api_name || '.' || d_position
524     );
525     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
526 END sync_draft_from_txn;
527 
528 
529 -----------------------------------------------------------------------
530 --Start of Comments
531 --Name: sync_draft_from_txn
532 --Pre-reqs: None
533 --Modifies:
534 --Locks:
535 --  None
536 --Function:
537 --  Same functionality as the bulk version of this procedure
538 --Parameters:
539 --IN:
540 --p_line_location_id
541 --  line location unique identifier
542 --p_draft_id
543 --  the draft this sync up will be done for
544 --p_delete_flag
545 --  flag to indicate whether the draft record should be maked as "to be
546 --  deleted"
547 --IN OUT:
548 --OUT:
549 --x_record_already_exist
550 --  Returns whether the record was already in draft table or not
551 --Returns:
552 --Notes:
553 --Testing:
554 --End of Comments
555 ------------------------------------------------------------------------
556 PROCEDURE sync_draft_from_txn
557 ( p_line_location_id IN NUMBER,
558   p_draft_id IN NUMBER,
559   p_delete_flag IN VARCHAR2,
560   x_record_already_exist OUT NOCOPY VARCHAR2
561 ) IS
562 
563 d_api_name CONSTANT VARCHAR2(30) := 'sync_draft_from_txn';
564 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
565 d_position NUMBER;
566 
567 l_record_already_exist_tbl PO_TBL_VARCHAR1;
568 
569 BEGIN
570   d_position := 0;
571   IF (PO_LOG.d_proc) THEN
572     PO_LOG.proc_begin(d_module);
573     PO_LOG.proc_begin(d_module, 'p_line_location_id', p_line_location_id);
574   END IF;
575 
576   sync_draft_from_txn
580     x_record_already_exist_tbl => l_record_already_exist_tbl
577   ( p_line_location_id_tbl     => PO_TBL_NUMBER(p_line_location_id),
578     p_draft_id_tbl             => PO_TBL_NUMBER(p_draft_id),
579     p_delete_flag_tbl          => PO_TBL_VARCHAR1(p_delete_flag),
581   );
582 
583   x_record_already_exist := l_record_already_exist_tbl(1);
584 
585   d_position := 10;
586   IF (PO_LOG.d_proc) THEN
587     PO_LOG.proc_end(d_module);
588     PO_LOG.proc_end(d_module, 'x_record_already_exist', x_record_already_exist);
589   END IF;
590 
591 EXCEPTION
592   WHEN OTHERS THEN
593     PO_MESSAGE_S.add_exc_msg
594     ( p_pkg_name => d_pkg_name,
595       p_procedure_name => d_api_name || '.' || d_position
596     );
597     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
598 END sync_draft_from_txn;
599 
600 -----------------------------------------------------------------------
601 --Start of Comments
602 --Name: merge_changes
603 --Pre-reqs: None
604 --Modifies:
605 --Locks:
606 --  None
607 --Function:
608 --  Merge the records in draft table to transaction table
609 --  Either insert, update or delete will be performed on top of transaction
610 --  table, depending on the delete_flag on the draft record and whether the
611 --  record already exists in transaction table
612 --
613 --Parameters:
614 --IN:
615 --p_draft_id
616 --  draft unique identifier
617 --IN OUT:
618 --OUT:
619 --Returns:
620 --Notes:
621 --Testing:
622 --End of Comments
623 ------------------------------------------------------------------------
624 PROCEDURE merge_changes
625 ( p_draft_id IN NUMBER
626 ) IS
627 
628 d_api_name CONSTANT VARCHAR2(30) := 'merge_changes';
629 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
630 d_position NUMBER;
631 
632 BEGIN
633 
634   d_position := 0;
635   IF (PO_LOG.d_proc) THEN
636     PO_LOG.proc_begin(d_module);
637   END IF;
638 
639   -- Since putting DELETE within MERGE statement is causing database
640   -- to thrown internal error, for now we just separate the DELETE statement.
641   -- Once this is fixed we'll move the delete statement back to the merge
642   -- statement
643 
644   -- bug5187544
645   -- Delete only records that have not been rejected
646 
647   DELETE FROM po_line_locations_all PLL
648   WHERE PLL.line_location_id IN
649          ( SELECT PLLD.line_location_id
650            FROM   po_line_locations_draft_all PLLD
651            WHERE  PLLD.draft_id = p_draft_id
652            AND    PLLD.delete_flag = 'Y'
653            AND    NVL(PLLD.change_accepted_flag, 'Y') = 'Y');
654 
655   d_position := 10;
656 
657   -- Merge PO Line Location changes
658   -- For update case, the following columns will be skipped:
659   --PLL.line_location_id
660   --PLL.creation_date
661   --PLL.created_by
662   --PLL.quantity_accepted
663   --PLL.quantity_received
664   --PLL.quantity_rejected
665   --PLL.quantity_billed
666   --PLL.quantity_cancelled
667   --PLL.tax_name
668   --PLL.estimated_tax_amount
669   --PLL.firm_date
670   --PLL.unit_of_measure_class
671   --PLL.encumber_now
672   --PLL.request_id
673   --PLL.program_application_id
674   --PLL.program_id
675   --PLL.program_update_date
676   --PLL.quantity_shipped
677   --PLL.change_promised_date_reason
678   --PLL.secondary_quantity_received
679   --PLL.secondary_quantity_accepted
680   --PLL.secondary_quantity_rejected
681   --PLL.secondary_quantity_cancelled
682   --PLL.secondary_quantity_shipped
683   --PLL.amount_received
684   --PLL.amount_billed
685   --PLL.amount_cancelled
686   --PLL.amount_rejected
687   --PLL.amount_accepted
688   --PLL.drop_ship_flag
689   --PLL.sales_order_update_date
690   --PLL.final_match_flag
691   --PLL.shipment_closed_date
692   --PLL.closed_for_receiving_date
693   --PLL.closed_for_invoice_date
694   -- <Complex Work R12 Start>
695   --PLL.bid_payment_id
696   --PLL.quantity_financed
697   --PLL.amount_financed
698   --PLL.quantity_recouped
699   --PLL.amount_recouped
700   --PLL.retainage_withheld_amount
701   --PLL.retainage_released_amount
702   -- <Complex Work R12 End>
703   MERGE INTO po_line_locations_all PLL
704   USING (
705     SELECT
706       PLLD.line_location_id,
707       PLLD.last_update_date,
708       PLLD.last_updated_by,
709       PLLD.po_header_id,
710       PLLD.po_line_id,
711       PLLD.last_update_login,
712       PLLD.creation_date,
713       PLLD.created_by,
714       PLLD.quantity,
715       PLLD.quantity_accepted,
716       PLLD.quantity_received,
717       PLLD.quantity_rejected,
718       PLLD.quantity_billed,
719       PLLD.quantity_cancelled,
720       PLLD.unit_meas_lookup_code,
721       PLLD.po_release_id,
722       PLLD.ship_to_location_id,
723       PLLD.ship_via_lookup_code,
724       PLLD.need_by_date,
725       PLLD.promised_date,
726       PLLD.last_accept_date,
727       PLLD.price_override,
728       PLLD.encumbered_flag,
729       PLLD.encumbered_date,
730       PLLD.unencumbered_quantity,
731       PLLD.fob_lookup_code,
732       PLLD.freight_terms_lookup_code,
733       PLLD.taxable_flag,
734       PLLD.tax_name,
735       PLLD.estimated_tax_amount,
736       PLLD.from_header_id,
737       PLLD.from_line_id,
738       PLLD.from_line_location_id,
739       PLLD.start_date,
740       PLLD.end_date,
741       PLLD.lead_time,
742       PLLD.lead_time_unit,
743       PLLD.price_discount,
744       PLLD.terms_id,
745       PLLD.approved_flag,
749       PLLD.cancelled_by,
746       PLLD.approved_date,
747       PLLD.closed_flag,
748       PLLD.cancel_flag,
750       PLLD.cancel_date,
751       PLLD.cancel_reason,
752       PLLD.firm_status_lookup_code,
753       PLLD.firm_date,
754       PLLD.attribute_category,
755       PLLD.attribute1,
756       PLLD.attribute2,
757       PLLD.attribute3,
758       PLLD.attribute4,
759       PLLD.attribute5,
760       PLLD.attribute6,
761       PLLD.attribute7,
762       PLLD.attribute8,
763       PLLD.attribute9,
764       PLLD.attribute10,
765       PLLD.unit_of_measure_class,
766       PLLD.encumber_now,
767       PLLD.attribute11,
768       PLLD.attribute12,
769       PLLD.attribute13,
770       PLLD.attribute14,
771       PLLD.attribute15,
772       PLLD.inspection_required_flag,
773       PLLD.receipt_required_flag,
774       PLLD.qty_rcv_tolerance,
775       PLLD.qty_rcv_exception_code,
776       PLLD.enforce_ship_to_location_code,
777       PLLD.allow_substitute_receipts_flag,
778       PLLD.days_early_receipt_allowed,
779       PLLD.days_late_receipt_allowed,
780       PLLD.receipt_days_exception_code,
781       PLLD.invoice_close_tolerance,
782       PLLD.receive_close_tolerance,
783       PLLD.ship_to_organization_id,
784       PLLD.shipment_num,
785       PLLD.source_shipment_id,
786       PLLD.shipment_type,
787       PLLD.closed_code,
788       PLLD.request_id,
789       PLLD.program_application_id,
790       PLLD.program_id,
791       PLLD.program_update_date,
792       PLLD.ussgl_transaction_code,
793       PLLD.government_context,
794       PLLD.receiving_routing_id,
795       PLLD.accrue_on_receipt_flag,
796       PLLD.closed_reason,
797       PLLD.closed_date,
798       PLLD.closed_by,
799       PLLD.org_id,
800       PLLD.quantity_shipped,
801       PLLD.global_attribute_category,
802       PLLD.global_attribute1,
803       PLLD.global_attribute2,
804       PLLD.global_attribute3,
805       PLLD.global_attribute4,
806       PLLD.global_attribute5,
807       PLLD.global_attribute6,
808       PLLD.global_attribute7,
809       PLLD.global_attribute8,
810       PLLD.global_attribute9,
811       PLLD.global_attribute10,
812       PLLD.global_attribute11,
813       PLLD.global_attribute12,
814       PLLD.global_attribute13,
815       PLLD.global_attribute14,
816       PLLD.global_attribute15,
817       PLLD.global_attribute16,
818       PLLD.global_attribute17,
819       PLLD.global_attribute18,
820       PLLD.global_attribute19,
821       PLLD.global_attribute20,
822       PLLD.country_of_origin_code,
823       PLLD.tax_user_override_flag,
824       PLLD.match_option,
825       PLLD.tax_code_id,
826       PLLD.calculate_tax_flag,
827       PLLD.change_promised_date_reason,
828       PLLD.note_to_receiver,
829       PLLD.secondary_quantity,
830       PLLD.secondary_unit_of_measure,
831       PLLD.preferred_grade,
832       PLLD.secondary_quantity_received,
833       PLLD.secondary_quantity_accepted,
834       PLLD.secondary_quantity_rejected,
835       PLLD.secondary_quantity_cancelled,
836       PLLD.secondary_quantity_shipped,
837       PLLD.vmi_flag,
838       PLLD.consigned_flag,
839       PLLD.retroactive_date,
840       PLLD.supplier_order_line_number,
841       PLLD.amount,
842       PLLD.amount_received,
843       PLLD.amount_billed,
844       PLLD.amount_cancelled,
845       PLLD.amount_rejected,
846       PLLD.amount_accepted,
847       PLLD.drop_ship_flag,
848       PLLD.sales_order_update_date,
849       PLLD.transaction_flow_header_id,
850       PLLD.final_match_flag,
851       PLLD.manual_price_change_flag,
852       PLLD.shipment_closed_date,
853       PLLD.closed_for_receiving_date,
854       PLLD.closed_for_invoice_date,
855       PLLD.draft_id,
856       PLLD.delete_flag,
857       PLLD.change_accepted_flag,
858       -- <Complex Work R12 Start>
859       PLLD.value_basis,
860       PLLD.matching_basis,
861       PLLD.payment_type,
862       PLLD.description,
863       PLLD.work_approver_id,
864       PLLD.bid_payment_id,
865       PLLD.quantity_financed,
866       PLLD.amount_financed,
867       PLLD.quantity_recouped,
868       PLLD.amount_recouped,
869       PLLD.retainage_withheld_amount,
870       PLLD.retainage_released_amount,
871       -- <Complex Work R12 End>
872       PLLD.outsourced_assembly,
873       PLLD.tax_attribute_update_code  -- <ETAX R12>
874     FROM po_line_locations_draft_all PLLD
875     WHERE PLLD.draft_id = p_draft_id
876     AND NVL(PLLD.change_accepted_flag, 'Y') = 'Y'
877     ) PLLDV
878   ON (PLL.line_location_id = PLLDV.line_location_id)
879   WHEN MATCHED THEN
880     UPDATE
881     SET
882       PLL.last_update_date = PLLDV.last_update_date,
883       PLL.last_updated_by = PLLDV.last_updated_by,
884       PLL.po_header_id = PLLDV.po_header_id,
885       PLL.po_line_id = PLLDV.po_line_id,
886       PLL.last_update_login = PLLDV.last_update_login,
887       PLL.quantity = PLLDV.quantity,
888       PLL.unit_meas_lookup_code = PLLDV.unit_meas_lookup_code,
889       PLL.po_release_id = PLLDV.po_release_id,
890       PLL.ship_to_location_id = PLLDV.ship_to_location_id,
891       PLL.ship_via_lookup_code = PLLDV.ship_via_lookup_code,
892       PLL.need_by_date = PLLDV.need_by_date,
893       PLL.promised_date = PLLDV.promised_date,
894       PLL.last_accept_date = PLLDV.last_accept_date,
895       PLL.price_override = PLLDV.price_override,
896       PLL.encumbered_flag = PLLDV.encumbered_flag,
897       PLL.encumbered_date = PLLDV.encumbered_date,
898       PLL.unencumbered_quantity = PLLDV.unencumbered_quantity,
902       PLL.from_header_id = PLLDV.from_header_id,
899       PLL.fob_lookup_code = PLLDV.fob_lookup_code,
900       PLL.freight_terms_lookup_code = PLLDV.freight_terms_lookup_code,
901       PLL.taxable_flag = PLLDV.taxable_flag,
903       PLL.from_line_id = PLLDV.from_line_id,
904       PLL.from_line_location_id = PLLDV.from_line_location_id,
905       PLL.start_date = PLLDV.start_date,
906       PLL.end_date = PLLDV.end_date,
907       PLL.lead_time = PLLDV.lead_time,
908       PLL.lead_time_unit = PLLDV.lead_time_unit,
909       PLL.price_discount = PLLDV.price_discount,
910       PLL.terms_id = PLLDV.terms_id,
911       PLL.approved_flag = PLLDV.approved_flag,
912       PLL.approved_date = PLLDV.approved_date,
913       PLL.closed_flag = PLLDV.closed_flag,
914       PLL.cancel_flag = PLLDV.cancel_flag,
915       PLL.cancelled_by = PLLDV.cancelled_by,
916       PLL.cancel_date = PLLDV.cancel_date,
917       PLL.cancel_reason = PLLDV.cancel_reason,
918       PLL.firm_status_lookup_code = PLLDV.firm_status_lookup_code,
919       PLL.attribute_category = PLLDV.attribute_category,
920       PLL.attribute1 = PLLDV.attribute1,
921       PLL.attribute2 = PLLDV.attribute2,
922       PLL.attribute3 = PLLDV.attribute3,
923       PLL.attribute4 = PLLDV.attribute4,
924       PLL.attribute5 = PLLDV.attribute5,
925       PLL.attribute6 = PLLDV.attribute6,
926       PLL.attribute7 = PLLDV.attribute7,
927       PLL.attribute8 = PLLDV.attribute8,
928       PLL.attribute9 = PLLDV.attribute9,
929       PLL.attribute10 = PLLDV.attribute10,
930       PLL.attribute11 = PLLDV.attribute11,
931       PLL.attribute12 = PLLDV.attribute12,
932       PLL.attribute13 = PLLDV.attribute13,
933       PLL.attribute14 = PLLDV.attribute14,
934       PLL.attribute15 = PLLDV.attribute15,
935       PLL.inspection_required_flag = PLLDV.inspection_required_flag,
936       PLL.receipt_required_flag = PLLDV.receipt_required_flag,
937       PLL.qty_rcv_tolerance = PLLDV.qty_rcv_tolerance,
938       PLL.qty_rcv_exception_code = PLLDV.qty_rcv_exception_code,
939       PLL.enforce_ship_to_location_code = PLLDV.enforce_ship_to_location_code,
940       PLL.allow_substitute_receipts_flag = PLLDV.allow_substitute_receipts_flag,
941       PLL.days_early_receipt_allowed = PLLDV.days_early_receipt_allowed,
942       PLL.days_late_receipt_allowed = PLLDV.days_late_receipt_allowed,
943       PLL.receipt_days_exception_code = PLLDV.receipt_days_exception_code,
944       PLL.invoice_close_tolerance = PLLDV.invoice_close_tolerance,
945       PLL.receive_close_tolerance = PLLDV.receive_close_tolerance,
946       PLL.ship_to_organization_id = PLLDV.ship_to_organization_id,
947       PLL.shipment_num = PLLDV.shipment_num,
948       PLL.source_shipment_id = PLLDV.source_shipment_id,
949       PLL.shipment_type = PLLDV.shipment_type,
950       PLL.closed_code = PLLDV.closed_code,
951       PLL.ussgl_transaction_code = PLLDV.ussgl_transaction_code,
952       PLL.government_context = PLLDV.government_context,
953       PLL.receiving_routing_id = PLLDV.receiving_routing_id,
954       PLL.accrue_on_receipt_flag = PLLDV.accrue_on_receipt_flag,
955       PLL.closed_reason = PLLDV.closed_reason,
956       PLL.closed_date = PLLDV.closed_date,
957       PLL.closed_by = PLLDV.closed_by,
958       PLL.org_id = PLLDV.org_id,
959       PLL.global_attribute_category = PLLDV.global_attribute_category,
960       PLL.global_attribute1 = PLLDV.global_attribute1,
961       PLL.global_attribute2 = PLLDV.global_attribute2,
962       PLL.global_attribute3 = PLLDV.global_attribute3,
963       PLL.global_attribute4 = PLLDV.global_attribute4,
964       PLL.global_attribute5 = PLLDV.global_attribute5,
965       PLL.global_attribute6 = PLLDV.global_attribute6,
966       PLL.global_attribute7 = PLLDV.global_attribute7,
967       PLL.global_attribute8 = PLLDV.global_attribute8,
968       PLL.global_attribute9 = PLLDV.global_attribute9,
969       PLL.global_attribute10 = PLLDV.global_attribute10,
970       PLL.global_attribute11 = PLLDV.global_attribute11,
971       PLL.global_attribute12 = PLLDV.global_attribute12,
972       PLL.global_attribute13 = PLLDV.global_attribute13,
973       PLL.global_attribute14 = PLLDV.global_attribute14,
974       PLL.global_attribute15 = PLLDV.global_attribute15,
975       PLL.global_attribute16 = PLLDV.global_attribute16,
976       PLL.global_attribute17 = PLLDV.global_attribute17,
977       PLL.global_attribute18 = PLLDV.global_attribute18,
978       PLL.global_attribute19 = PLLDV.global_attribute19,
979       PLL.global_attribute20 = PLLDV.global_attribute20,
980       PLL.country_of_origin_code = PLLDV.country_of_origin_code,
981       PLL.tax_user_override_flag = PLLDV.tax_user_override_flag,
982       PLL.match_option = PLLDV.match_option,
983       PLL.tax_code_id = PLLDV.tax_code_id,
984       PLL.calculate_tax_flag = PLLDV.calculate_tax_flag,
985       PLL.note_to_receiver = PLLDV.note_to_receiver,
986       PLL.secondary_quantity = PLLDV.secondary_quantity,
987       PLL.secondary_unit_of_measure = PLLDV.secondary_unit_of_measure,
988       PLL.preferred_grade = PLLDV.preferred_grade,
989       PLL.vmi_flag = PLLDV.vmi_flag,
990       PLL.consigned_flag = PLLDV.consigned_flag,
991       PLL.retroactive_date = PLLDV.retroactive_date,
992       PLL.supplier_order_line_number = PLLDV.supplier_order_line_number,
993       PLL.amount = PLLDV.amount,
994       PLL.transaction_flow_header_id = PLLDV.transaction_flow_header_id,
995       PLL.manual_price_change_flag = PLLDV.manual_price_change_flag,
996       -- <Complex Work R12 Start>
997       PLL.value_basis = PLLDV.value_basis,
998       PLL.matching_basis = PLLDV.matching_basis,
999       PLL.payment_type = PLLDV.payment_type,
1000       PLL.description = PLLDV.description,
1001       PLL.work_approver_id = PLLDV.work_approver_id,
1002       -- <Complex Work R12 End>
1003       PLL.outsourced_assembly = PLLDV.outsourced_assembly,
1004       PLL.tax_attribute_update_code = PLLDV.tax_attribute_update_code -- <ETAX R12>
1005   --  DELETE WHERE PLLDV.delete_flag = 'Y'
1006   WHEN NOT MATCHED THEN
1010       PLL.last_update_date,
1007     INSERT
1008     (
1009       PLL.line_location_id,
1011       PLL.last_updated_by,
1012       PLL.po_header_id,
1013       PLL.po_line_id,
1014       PLL.last_update_login,
1015       PLL.creation_date,
1016       PLL.created_by,
1017       PLL.quantity,
1018       PLL.quantity_accepted,
1019       PLL.quantity_received,
1020       PLL.quantity_rejected,
1021       PLL.quantity_billed,
1022       PLL.quantity_cancelled,
1023       PLL.unit_meas_lookup_code,
1024       PLL.po_release_id,
1025       PLL.ship_to_location_id,
1026       PLL.ship_via_lookup_code,
1027       PLL.need_by_date,
1028       PLL.promised_date,
1029       PLL.last_accept_date,
1030       PLL.price_override,
1031       PLL.encumbered_flag,
1032       PLL.encumbered_date,
1033       PLL.unencumbered_quantity,
1034       PLL.fob_lookup_code,
1035       PLL.freight_terms_lookup_code,
1036       PLL.taxable_flag,
1037       PLL.tax_name,
1038       PLL.estimated_tax_amount,
1039       PLL.from_header_id,
1040       PLL.from_line_id,
1041       PLL.from_line_location_id,
1042       PLL.start_date,
1043       PLL.end_date,
1044       PLL.lead_time,
1045       PLL.lead_time_unit,
1046       PLL.price_discount,
1047       PLL.terms_id,
1048       PLL.approved_flag,
1049       PLL.approved_date,
1050       PLL.closed_flag,
1051       PLL.cancel_flag,
1052       PLL.cancelled_by,
1053       PLL.cancel_date,
1054       PLL.cancel_reason,
1055       PLL.firm_status_lookup_code,
1056       PLL.firm_date,
1057       PLL.attribute_category,
1058       PLL.attribute1,
1059       PLL.attribute2,
1060       PLL.attribute3,
1061       PLL.attribute4,
1062       PLL.attribute5,
1063       PLL.attribute6,
1064       PLL.attribute7,
1065       PLL.attribute8,
1066       PLL.attribute9,
1067       PLL.attribute10,
1068       PLL.unit_of_measure_class,
1069       PLL.encumber_now,
1070       PLL.attribute11,
1071       PLL.attribute12,
1072       PLL.attribute13,
1073       PLL.attribute14,
1074       PLL.attribute15,
1075       PLL.inspection_required_flag,
1076       PLL.receipt_required_flag,
1077       PLL.qty_rcv_tolerance,
1078       PLL.qty_rcv_exception_code,
1079       PLL.enforce_ship_to_location_code,
1080       PLL.allow_substitute_receipts_flag,
1081       PLL.days_early_receipt_allowed,
1082       PLL.days_late_receipt_allowed,
1083       PLL.receipt_days_exception_code,
1084       PLL.invoice_close_tolerance,
1085       PLL.receive_close_tolerance,
1086       PLL.ship_to_organization_id,
1087       PLL.shipment_num,
1088       PLL.source_shipment_id,
1089       PLL.shipment_type,
1090       PLL.closed_code,
1091       PLL.request_id,
1092       PLL.program_application_id,
1093       PLL.program_id,
1094       PLL.program_update_date,
1095       PLL.ussgl_transaction_code,
1096       PLL.government_context,
1097       PLL.receiving_routing_id,
1098       PLL.accrue_on_receipt_flag,
1099       PLL.closed_reason,
1100       PLL.closed_date,
1101       PLL.closed_by,
1102       PLL.org_id,
1103       PLL.quantity_shipped,
1104       PLL.global_attribute_category,
1105       PLL.global_attribute1,
1106       PLL.global_attribute2,
1107       PLL.global_attribute3,
1108       PLL.global_attribute4,
1109       PLL.global_attribute5,
1110       PLL.global_attribute6,
1111       PLL.global_attribute7,
1112       PLL.global_attribute8,
1113       PLL.global_attribute9,
1114       PLL.global_attribute10,
1115       PLL.global_attribute11,
1116       PLL.global_attribute12,
1117       PLL.global_attribute13,
1118       PLL.global_attribute14,
1119       PLL.global_attribute15,
1120       PLL.global_attribute16,
1121       PLL.global_attribute17,
1122       PLL.global_attribute18,
1123       PLL.global_attribute19,
1124       PLL.global_attribute20,
1125       PLL.country_of_origin_code,
1126       PLL.tax_user_override_flag,
1127       PLL.match_option,
1128       PLL.tax_code_id,
1129       PLL.calculate_tax_flag,
1130       PLL.change_promised_date_reason,
1131       PLL.note_to_receiver,
1132       PLL.secondary_quantity,
1133       PLL.secondary_unit_of_measure,
1134       PLL.preferred_grade,
1135       PLL.secondary_quantity_received,
1136       PLL.secondary_quantity_accepted,
1137       PLL.secondary_quantity_rejected,
1138       PLL.secondary_quantity_cancelled,
1139       PLL.secondary_quantity_shipped,
1140       PLL.vmi_flag,
1141       PLL.consigned_flag,
1142       PLL.retroactive_date,
1143       PLL.supplier_order_line_number,
1144       PLL.amount,
1145       PLL.amount_received,
1146       PLL.amount_billed,
1147       PLL.amount_cancelled,
1148       PLL.amount_rejected,
1149       PLL.amount_accepted,
1150       PLL.drop_ship_flag,
1151       PLL.sales_order_update_date,
1152       PLL.transaction_flow_header_id,
1153       PLL.final_match_flag,
1154       PLL.manual_price_change_flag,
1155       PLL.shipment_closed_date,
1156       PLL.closed_for_receiving_date,
1157       PLL.closed_for_invoice_date,
1158       -- <Complex Work R12 Start>
1159       PLL.value_basis,
1160       PLL.matching_basis,
1161       PLL.payment_type,
1162       PLL.description,
1163       PLL.work_approver_id,
1164       PLL.bid_payment_id,
1165       PLL.quantity_financed,
1166       PLL.amount_financed,
1167       PLL.quantity_recouped,
1168       PLL.amount_recouped,
1169       PLL.retainage_withheld_amount,
1170       PLL.retainage_released_amount,
1171       -- <Complex Work R12 End>
1172       PLL.outsourced_assembly,
1173       PLL.tax_attribute_update_code -- <ETAX R12>
1174     )
1175     VALUES
1176     (
1177       PLLDV.line_location_id,
1178       PLLDV.last_update_date,
1179       PLLDV.last_updated_by,
1180       PLLDV.po_header_id,
1181       PLLDV.po_line_id,
1182       PLLDV.last_update_login,
1183       PLLDV.creation_date,
1184       PLLDV.created_by,
1185       PLLDV.quantity,
1186       PLLDV.quantity_accepted,
1187       PLLDV.quantity_received,
1188       PLLDV.quantity_rejected,
1189       PLLDV.quantity_billed,
1190       PLLDV.quantity_cancelled,
1191       PLLDV.unit_meas_lookup_code,
1192       PLLDV.po_release_id,
1193       PLLDV.ship_to_location_id,
1194       PLLDV.ship_via_lookup_code,
1195       PLLDV.need_by_date,
1196       PLLDV.promised_date,
1197       PLLDV.last_accept_date,
1198       PLLDV.price_override,
1199       PLLDV.encumbered_flag,
1200       PLLDV.encumbered_date,
1201       PLLDV.unencumbered_quantity,
1202       PLLDV.fob_lookup_code,
1203       PLLDV.freight_terms_lookup_code,
1204       PLLDV.taxable_flag,
1205       PLLDV.tax_name,
1206       PLLDV.estimated_tax_amount,
1207       PLLDV.from_header_id,
1208       PLLDV.from_line_id,
1209       PLLDV.from_line_location_id,
1210       PLLDV.start_date,
1211       PLLDV.end_date,
1212       PLLDV.lead_time,
1213       PLLDV.lead_time_unit,
1214       PLLDV.price_discount,
1215       PLLDV.terms_id,
1216       PLLDV.approved_flag,
1217       PLLDV.approved_date,
1218       PLLDV.closed_flag,
1219       PLLDV.cancel_flag,
1220       PLLDV.cancelled_by,
1221       PLLDV.cancel_date,
1222       PLLDV.cancel_reason,
1223       PLLDV.firm_status_lookup_code,
1224       PLLDV.firm_date,
1225       PLLDV.attribute_category,
1226       PLLDV.attribute1,
1227       PLLDV.attribute2,
1228       PLLDV.attribute3,
1229       PLLDV.attribute4,
1230       PLLDV.attribute5,
1231       PLLDV.attribute6,
1232       PLLDV.attribute7,
1233       PLLDV.attribute8,
1234       PLLDV.attribute9,
1235       PLLDV.attribute10,
1236       PLLDV.unit_of_measure_class,
1237       PLLDV.encumber_now,
1238       PLLDV.attribute11,
1239       PLLDV.attribute12,
1240       PLLDV.attribute13,
1241       PLLDV.attribute14,
1242       PLLDV.attribute15,
1243       PLLDV.inspection_required_flag,
1244       PLLDV.receipt_required_flag,
1245       PLLDV.qty_rcv_tolerance,
1246       PLLDV.qty_rcv_exception_code,
1247       PLLDV.enforce_ship_to_location_code,
1248       PLLDV.allow_substitute_receipts_flag,
1249       PLLDV.days_early_receipt_allowed,
1250       PLLDV.days_late_receipt_allowed,
1251       PLLDV.receipt_days_exception_code,
1252       PLLDV.invoice_close_tolerance,
1253       PLLDV.receive_close_tolerance,
1254       PLLDV.ship_to_organization_id,
1255       PLLDV.shipment_num,
1256       PLLDV.source_shipment_id,
1257       PLLDV.shipment_type,
1258       PLLDV.closed_code,
1259       PLLDV.request_id,
1260       PLLDV.program_application_id,
1261       PLLDV.program_id,
1262       PLLDV.program_update_date,
1263       PLLDV.ussgl_transaction_code,
1264       PLLDV.government_context,
1265       PLLDV.receiving_routing_id,
1266       PLLDV.accrue_on_receipt_flag,
1267       PLLDV.closed_reason,
1268       PLLDV.closed_date,
1269       PLLDV.closed_by,
1270       PLLDV.org_id,
1271       PLLDV.quantity_shipped,
1272       PLLDV.global_attribute_category,
1273       PLLDV.global_attribute1,
1274       PLLDV.global_attribute2,
1275       PLLDV.global_attribute3,
1276       PLLDV.global_attribute4,
1277       PLLDV.global_attribute5,
1278       PLLDV.global_attribute6,
1279       PLLDV.global_attribute7,
1280       PLLDV.global_attribute8,
1281       PLLDV.global_attribute9,
1282       PLLDV.global_attribute10,
1283       PLLDV.global_attribute11,
1284       PLLDV.global_attribute12,
1285       PLLDV.global_attribute13,
1286       PLLDV.global_attribute14,
1287       PLLDV.global_attribute15,
1288       PLLDV.global_attribute16,
1289       PLLDV.global_attribute17,
1290       PLLDV.global_attribute18,
1291       PLLDV.global_attribute19,
1292       PLLDV.global_attribute20,
1293       PLLDV.country_of_origin_code,
1294       PLLDV.tax_user_override_flag,
1295       PLLDV.match_option,
1296       PLLDV.tax_code_id,
1297       PLLDV.calculate_tax_flag,
1298       PLLDV.change_promised_date_reason,
1299       PLLDV.note_to_receiver,
1300       PLLDV.secondary_quantity,
1301       PLLDV.secondary_unit_of_measure,
1302       PLLDV.preferred_grade,
1303       PLLDV.secondary_quantity_received,
1304       PLLDV.secondary_quantity_accepted,
1305       PLLDV.secondary_quantity_rejected,
1306       PLLDV.secondary_quantity_cancelled,
1307       PLLDV.secondary_quantity_shipped,
1308       PLLDV.vmi_flag,
1309       PLLDV.consigned_flag,
1310       PLLDV.retroactive_date,
1311       PLLDV.supplier_order_line_number,
1312       PLLDV.amount,
1313       PLLDV.amount_received,
1314       PLLDV.amount_billed,
1315       PLLDV.amount_cancelled,
1316       PLLDV.amount_rejected,
1317       PLLDV.amount_accepted,
1318       PLLDV.drop_ship_flag,
1319       PLLDV.sales_order_update_date,
1320       PLLDV.transaction_flow_header_id,
1321       PLLDV.final_match_flag,
1322       PLLDV.manual_price_change_flag,
1323       PLLDV.shipment_closed_date,
1324       PLLDV.closed_for_receiving_date,
1325       PLLDV.closed_for_invoice_date,
1326       -- <Complex Work R12 Start>
1327       PLLDV.value_basis,
1328       PLLDV.matching_basis,
1329       PLLDV.payment_type,
1330       PLLDV.description,
1331       PLLDV.work_approver_id,
1332       PLLDV.bid_payment_id,
1333       PLLDV.quantity_financed,
1334       PLLDV.amount_financed,
1335       PLLDV.quantity_recouped,
1336       PLLDV.amount_recouped,
1337       PLLDV.retainage_withheld_amount,
1338       PLLDV.retainage_released_amount,
1339       -- <Complex Work R12 End>
1340       PLLDV.outsourced_assembly,
1341       PLLDV.tax_attribute_update_code -- <ETAX R12>
1342     ) WHERE NVL(PLLDV.delete_flag, 'N') <> 'Y';
1343 
1344   d_position := 10;
1345 EXCEPTION
1346   WHEN OTHERS THEN
1347     PO_MESSAGE_S.add_exc_msg
1348     ( p_pkg_name => d_pkg_name,
1349       p_procedure_name => d_api_name || '.' || d_position
1350     );
1351     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1352 END merge_changes;
1353 
1354 -----------------------------------------------------------------------
1355 --Start of Comments
1356 --Name: lock_draft_record
1357 --Function:
1358 --  Obtain database lock for the record in draft table
1359 --Parameters:
1360 --IN:
1361 --p_line_location_id
1362 --  id for po line location record
1363 --p_draft_id
1364 --  draft unique identifier
1365 --RETURN:
1366 --End of Comments
1367 ------------------------------------------------------------------------
1368 PROCEDURE lock_draft_record
1369 ( p_line_location_id IN NUMBER,
1370   p_draft_id        IN NUMBER
1371 ) IS
1372 
1373 d_api_name CONSTANT VARCHAR2(30) := 'lock_draft_record';
1374 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
1375 d_position NUMBER;
1376 
1377 l_dummy NUMBER;
1378 
1379 BEGIN
1380   d_position := 0;
1381   IF (PO_LOG.d_proc) THEN
1382     PO_LOG.proc_begin(d_module);
1383   END IF;
1384 
1385   SELECT 1
1386   INTO l_dummy
1387   FROM po_line_locations_draft_all
1388   WHERE line_location_id = p_line_location_id
1389   AND draft_id = p_draft_id
1390   FOR UPDATE NOWAIT;
1391 
1392   IF (PO_LOG.d_proc) THEN
1393     PO_LOG.proc_end(d_module);
1394   END IF;
1395 
1396 EXCEPTION
1397 WHEN NO_DATA_FOUND THEN
1398   NULL;
1399 END lock_draft_record;
1400 
1401 -----------------------------------------------------------------------
1402 --Start of Comments
1403 --Name: lock_transaction_record
1404 --Function:
1405 --  Obtain database lock for the record in transaction table
1406 --Parameters:
1407 --IN:
1408 --p_line_location_id
1409 --  id for po line location record
1410 --RETURN:
1411 --End of Comments
1412 ------------------------------------------------------------------------
1413 PROCEDURE lock_transaction_record
1414 ( p_line_location_id IN NUMBER
1415 ) IS
1416 
1417 d_api_name CONSTANT VARCHAR2(30) := 'lock_transaction_record';
1418 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
1419 d_position NUMBER;
1420 
1421 l_dummy NUMBER;
1422 
1423 BEGIN
1424   d_position := 0;
1425   IF (PO_LOG.d_proc) THEN
1426     PO_LOG.proc_begin(d_module);
1427   END IF;
1428 
1429   SELECT 1
1430   INTO l_dummy
1431   FROM po_line_locations_all
1432   WHERE line_location_id = p_line_location_id
1433   FOR UPDATE NOWAIT;
1434 
1435   IF (PO_LOG.d_proc) THEN
1436     PO_LOG.proc_end(d_module);
1437   END IF;
1438 
1439 EXCEPTION
1440 WHEN NO_DATA_FOUND THEN
1441   NULL;
1442 END lock_transaction_record;
1443 
1444 END PO_LINE_LOCATIONS_DRAFT_PKG;