DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_HEADERS_DRAFT_PKG

Source


1 PACKAGE BODY PO_HEADERS_DRAFT_PKG AS
2 /* $Header: PO_HEADERS_DRAFT_PKG.plb 120.8.12010000.3 2008/11/20 10:02:11 vdurbhak ship $ */
3 
4 d_pkg_name CONSTANT varchar2(50) :=
5   PO_LOG.get_package_base('PO_HEADERS_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 headers based on the information given
16 --  If only draft_id is provided, then all headers for the draft will be
17 --  deleted
18 --  If po_header_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_po_header_id
25 --  po header 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_po_header_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_headers_draft_all
48   WHERE draft_id = p_draft_id
49   AND po_header_id = NVL(p_po_header_id, po_header_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_po_header_id_tbl
76 --  table of po header 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_po_header_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_HEADERS_DRAFT_PVT.draft_changes_exist
113     ( p_draft_id_tbl => p_draft_id_tbl,
114       p_po_header_id_tbl => p_po_header_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_po_header_id_tbl.COUNT);
122 
123   FOR i IN 1..p_po_header_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_po_header_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_po_header_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 
142   d_position := 10;
143   IF (PO_LOG.d_stmt) THEN
144     PO_LOG.stmt(d_module, d_position, 'transfer records from txn to dft');
145   END IF;
146 
147   FORALL i IN 1..p_po_header_id_tbl.COUNT
148     INSERT INTO po_headers_draft_all
149     ( draft_id,
150       delete_flag,
151       change_accepted_flag,
152       po_header_id,
153       agent_id,
154       type_lookup_code,
155       last_update_date,
156       last_updated_by,
157       segment1,
158       summary_flag,
159       enabled_flag,
160       segment2,
161       segment3,
162       segment4,
163       segment5,
164       start_date_active,
165       end_date_active,
166       last_update_login,
167       creation_date,
168       created_by,
169       vendor_id,
170       vendor_site_id,
171       vendor_contact_id,
172       ship_to_location_id,
173       bill_to_location_id,
174       terms_id,
175       ship_via_lookup_code,
176       fob_lookup_code,
177       freight_terms_lookup_code,
178       status_lookup_code,
179       currency_code,
180       rate_type,
181       rate_date,
182       rate,
183       from_header_id,
184       from_type_lookup_code,
185       start_date,
186       end_date,
187       blanket_total_amount,
188       authorization_status,
189       revision_num,
190       revised_date,
191       approved_flag,
192       approved_date,
193       amount_limit,
194       min_release_amount,
195       note_to_authorizer,
196       note_to_vendor,
197       note_to_receiver,
198       print_count,
199       printed_date,
200       vendor_order_num,
201       confirming_order_flag,
202       comments,
203       reply_date,
204       reply_method_lookup_code,
205       rfq_close_date,
206       quote_type_lookup_code,
207       quotation_class_code,
208       quote_warning_delay_unit,
209       quote_warning_delay,
210       quote_vendor_quote_number,
211       acceptance_required_flag,
212       acceptance_due_date,
213       closed_date,
214       user_hold_flag,
215       approval_required_flag,
216       cancel_flag,
217       firm_status_lookup_code,
218       firm_date,
219       frozen_flag,
220       supply_agreement_flag,
221       edi_processed_flag,
222       edi_processed_status,
223       attribute_category,
224       attribute1,
225       attribute2,
226       attribute3,
227       attribute4,
228       attribute5,
229       attribute6,
230       attribute7,
231       attribute8,
232       attribute9,
233       attribute10,
234       attribute11,
235       attribute12,
236       attribute13,
237       attribute14,
238       attribute15,
239       closed_code,
240       ussgl_transaction_code,
241       government_context,
242       request_id,
243       program_application_id,
244       program_id,
245       program_update_date,
246       org_id,
247       global_attribute_category,
248       global_attribute1,
249       global_attribute2,
250       global_attribute3,
251       global_attribute4,
252       global_attribute5,
253       global_attribute6,
254       global_attribute7,
255       global_attribute8,
256       global_attribute9,
257       global_attribute10,
258       global_attribute11,
259       global_attribute12,
260       global_attribute13,
261       global_attribute14,
262       global_attribute15,
263       global_attribute16,
264       global_attribute17,
265       global_attribute18,
266       global_attribute19,
267       global_attribute20,
268       interface_source_code,
269       reference_num,
270       wf_item_type,
271       wf_item_key,
272       mrc_rate_type,
273       mrc_rate_date,
274       mrc_rate,
275       pcard_id,
276       price_update_tolerance,
277       pay_on_code,
278       xml_flag,
279       xml_send_date,
280       xml_change_send_date,
281       global_agreement_flag,
282       consigned_consumption_flag,
283       cbc_accounting_date,
284       consume_req_demand_flag,
285       change_requested_by,
286       shipping_control,
287       conterms_exist_flag,
288       conterms_articles_upd_date,
289       conterms_deliv_upd_date,
290       encumbrance_required_flag,
291       pending_signature_flag,
292       change_summary,
293       document_creation_method,
294       submit_date,
295       supplier_notif_method,
296       fax,
297       email_address,
298       retro_price_comm_updates_flag,
299       retro_price_apply_updates_flag,
300       update_sourcing_rules_flag,
301       auto_sourcing_flag,
302       created_language,
303       cpa_reference,
304       style_id,
305       tax_attribute_update_code, -- <ETAX INTEGRATION R12>
306       supplier_auth_enabled_flag,  -- bug5022835
307       cat_admin_auth_enabled_flag,  -- bug5022835
308       pay_when_paid -- E and C ER
309     )
310     SELECT
311       p_draft_id_tbl(i),
312       p_delete_flag_tbl(i),
313       NULL,
314       po_header_id,
315       agent_id,
316       type_lookup_code,
317       last_update_date,
318       last_updated_by,
319       segment1,
320       summary_flag,
321       enabled_flag,
322       segment2,
323       segment3,
324       segment4,
325       segment5,
326       start_date_active,
327       end_date_active,
328       last_update_login,
329       creation_date,
330       created_by,
331       vendor_id,
332       vendor_site_id,
333       vendor_contact_id,
334       ship_to_location_id,
335       bill_to_location_id,
336       terms_id,
337       ship_via_lookup_code,
338       fob_lookup_code,
339       freight_terms_lookup_code,
340       status_lookup_code,
341       currency_code,
342       rate_type,
343       rate_date,
344       rate,
345       from_header_id,
346       from_type_lookup_code,
347       start_date,
348       end_date,
349       blanket_total_amount,
350       authorization_status,
351       revision_num,
352       revised_date,
353       approved_flag,
354       approved_date,
355       amount_limit,
356       min_release_amount,
357       note_to_authorizer,
358       note_to_vendor,
359       note_to_receiver,
360       print_count,
361       printed_date,
362       vendor_order_num,
363       confirming_order_flag,
364       comments,
365       reply_date,
366       reply_method_lookup_code,
367       rfq_close_date,
368       quote_type_lookup_code,
369       quotation_class_code,
370       quote_warning_delay_unit,
371       quote_warning_delay,
372       quote_vendor_quote_number,
373       acceptance_required_flag,
374       acceptance_due_date,
375       closed_date,
376       user_hold_flag,
377       approval_required_flag,
378       cancel_flag,
379       firm_status_lookup_code,
380       firm_date,
381       frozen_flag,
382       supply_agreement_flag,
383       edi_processed_flag,
384       edi_processed_status,
385       attribute_category,
386       attribute1,
387       attribute2,
388       attribute3,
389       attribute4,
390       attribute5,
391       attribute6,
392       attribute7,
393       attribute8,
394       attribute9,
395       attribute10,
396       attribute11,
397       attribute12,
398       attribute13,
399       attribute14,
400       attribute15,
401       closed_code,
402       ussgl_transaction_code,
403       government_context,
404       request_id,
405       program_application_id,
406       program_id,
407       program_update_date,
408       org_id,
409       global_attribute_category,
410       global_attribute1,
411       global_attribute2,
412       global_attribute3,
413       global_attribute4,
414       global_attribute5,
415       global_attribute6,
416       global_attribute7,
417       global_attribute8,
418       global_attribute9,
419       global_attribute10,
420       global_attribute11,
421       global_attribute12,
422       global_attribute13,
423       global_attribute14,
424       global_attribute15,
425       global_attribute16,
426       global_attribute17,
427       global_attribute18,
428       global_attribute19,
429       global_attribute20,
430       interface_source_code,
431       reference_num,
432       wf_item_type,
433       wf_item_key,
434       mrc_rate_type,
435       mrc_rate_date,
436       mrc_rate,
437       pcard_id,
438       price_update_tolerance,
439       pay_on_code,
440       xml_flag,
441       xml_send_date,
442       xml_change_send_date,
443       global_agreement_flag,
444       consigned_consumption_flag,
445       cbc_accounting_date,
446       consume_req_demand_flag,
447       change_requested_by,
448       shipping_control,
449       conterms_exist_flag,
450       conterms_articles_upd_date,
451       conterms_deliv_upd_date,
452       encumbrance_required_flag,
453       pending_signature_flag,
454       change_summary,
455       document_creation_method,
456       submit_date,
457       supplier_notif_method,
458       fax,
459       email_address,
460       retro_price_comm_updates_flag,
461       retro_price_apply_updates_flag,
462       update_sourcing_rules_flag,
463       auto_sourcing_flag,
464       created_language,
465       cpa_reference,
466       style_id,
467       tax_attribute_update_code, -- <ETAX INTEGRATION R12>
468       supplier_auth_enabled_flag, -- bug5022835
469       cat_admin_auth_enabled_flag, -- bug5022835
470       pay_when_paid -- E and C ER
471     FROM po_headers_all
472     WHERE po_header_id = p_po_header_id_tbl(i)
473     AND x_record_already_exist_tbl(i) = FND_API.G_FALSE
474     AND l_duplicate_flag_tbl(i) = FND_API.G_FALSE;
475 
476   d_position := 20;
477   IF (PO_LOG.d_stmt) THEN
478     PO_LOG.stmt(d_module, d_position, 'transfer count = ' || SQL%ROWCOUNT);
479   END IF;
480 
481   FORALL i IN 1..p_po_header_id_tbl.COUNT
482     UPDATE po_headers_draft_all
483     SET    delete_flag = p_delete_flag_tbl(i)
484     WHERE  po_header_id = p_po_header_id_tbl(i)
485     AND    draft_id = p_draft_id_tbl(i)
486     AND    NVL(delete_flag, 'N') <> 'Y'  -- bug5570989
487     AND    x_record_already_exist_tbl(i) = FND_API.G_TRUE;
488 
489   d_position := 30;
490 
491   IF (PO_LOG.d_stmt) THEN
492     PO_LOG.stmt(d_module, d_position, 'update draft records that are already' ||
493                 ' in draft table. Count = ' || SQL%ROWCOUNT);
494   END IF;
495 
496   d_position := 40;
500   END IF;
497 
498   IF (PO_LOG.d_proc) THEN
499     PO_LOG.proc_end(d_module);
501 
502 EXCEPTION
503   WHEN OTHERS THEN
504     PO_MESSAGE_S.add_exc_msg
505     ( p_pkg_name => d_pkg_name,
506       p_procedure_name => d_api_name || '.' || d_position
507     );
508     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
509 END sync_draft_from_txn;
510 
511 -----------------------------------------------------------------------
512 --Start of Comments
513 --Name: sync_draft_from_txn
514 --Pre-reqs: None
515 --Modifies:
516 --Locks:
517 --  None
518 --Function:
519 --  Same functionality as the bulk version of this procedure
520 --Parameters:
521 --IN:
522 --p_po_header_id
523 --  po header unique identifier
524 --p_draft_id
525 --  the draft this sync up will be done for
526 --p_delete_flag
527 --  flag to indicate whether the draft record should be maked as "to be
528 --  deleted"
529 --IN OUT:
530 --OUT:
531 --x_record_already_exist
532 --  Returns whether the record was already in draft table or not
533 --Returns:
534 --Notes:
535 --Testing:
536 --End of Comments
537 ------------------------------------------------------------------------
538 PROCEDURE sync_draft_from_txn
539 ( p_po_header_id IN NUMBER,
540   p_draft_id IN NUMBER,
541   p_delete_flag IN VARCHAR2,
542   x_record_already_exist OUT NOCOPY VARCHAR2
543 ) IS
544 
545 d_api_name CONSTANT VARCHAR2(30) := 'sync_draft_from_txn';
546 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
547 d_position NUMBER;
548 
549 l_record_already_exist_tbl PO_TBL_VARCHAR1;
550 
551 BEGIN
552   d_position := 0;
553   IF (PO_LOG.d_proc) THEN
554     PO_LOG.proc_begin(d_module);
555     PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
556   END IF;
557 
558   sync_draft_from_txn
559   ( p_po_header_id_tbl         => PO_TBL_NUMBER(p_po_header_id),
560     p_draft_id_tbl             => PO_TBL_NUMBER(p_draft_id),
561     p_delete_flag_tbl          => PO_TBL_VARCHAR1(p_delete_flag),
562     x_record_already_exist_tbl => l_record_already_exist_tbl
563   );
564 
565   x_record_already_exist := l_record_already_exist_tbl(1);
566 
567   d_position := 10;
568   IF (PO_LOG.d_proc) THEN
569     PO_LOG.proc_end(d_module);
570     PO_LOG.proc_end(d_module, 'x_record_already_exist', x_record_already_exist);
571   END IF;
572 
573 EXCEPTION
574   WHEN OTHERS THEN
575     PO_MESSAGE_S.add_exc_msg
576     ( p_pkg_name => d_pkg_name,
577       p_procedure_name => d_api_name || '.' || d_position
578     );
579     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
580 END sync_draft_from_txn;
581 
582 -----------------------------------------------------------------------
583 --Start of Comments
584 --Name: merge_changes
585 --Pre-reqs: None
586 --Modifies:
587 --Locks:
588 --  None
589 --Function:
590 --  Merge the records in draft table to transaction table
591 --  Either insert, update or delete will be performed on top of transaction
592 --  table, depending on the delete_flag on the draft record and whether the
593 --  record already exists in transaction table
594 --
595 --Parameters:
596 --IN:
597 --p_draft_id
598 --  draft unique identifier
599 --IN OUT:
600 --OUT:
601 --Returns:
602 --Notes:
603 --Testing:
604 --End of Comments
605 ------------------------------------------------------------------------
606 PROCEDURE merge_changes
607 ( p_draft_id IN NUMBER
608 ) IS
609 
610 d_api_name CONSTANT VARCHAR2(30) := 'merge_changes';
611 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
612 d_position NUMBER;
613 
614 BEGIN
615   d_position := 0;
616   IF (PO_LOG.d_proc) THEN
617     PO_LOG.proc_begin(d_module);
618   END IF;
619 
620   -- Since putting DELETE within MERGE statement is causing database
621   -- to thrown internal error, for now we just separate the DELETE statement.
622   -- Once this is fixed we'll move the delete statement back to the merge
623   -- statement
624 
625   -- bug5187544
626   -- Delete only lines that have not been rejected
627 
628   DELETE FROM po_headers_all PH
629   WHERE PH.po_header_id IN
630          ( SELECT PHD.po_header_id
631            FROM   po_headers_draft_all PHD
632            WHERE  PHD.draft_id = p_draft_id
633            AND    PHD.delete_flag = 'Y'
634            AND    NVL(PHD.change_accepted_flag, 'Y') = 'Y');
635 
636   -- Merge PO Header changes
637   -- For update case, the following columns will be skipped:
638   --      PH.po_header_id
639   --      PH.creation_date
640   --      PH.created_by
641   --      PH.interface_source_code
642   --      PH.reference_num
643   --      PH.wf_item_type
644   --      PH.wf_item_key
645   --      PH.mrc_rate_type
646   --      PH.mrc_rate_date
647   --      PH.mrc_rate
648   --      PH.xml_flag
649   --      PH.xml_send_date
650   --      PH.xml_change_send_date
651   --      PH.global_agreement_flag
652   --      PH.consigned_consumption_flag
653   --      PH.cbc_accounting_date
657   --      PH.change_summary
654   --      PH.consume_req_demand_flag
655   --      PH.conterms_exist_flag
656   --      PH.pending_signature_flag
658   --      PH.document_creation_method
659   --      PH.submit_date
660   --      PH.edi_processed_flag
661   --      PH.edi_processed_status,
662   --      PH.created_language
663   --      PH.cpa_reference
664   --      PH.style_id
665   --      PH.supplier_auth_enabled_flag
666   --      PH.cat_admin_auth_enabled_flag
667   MERGE INTO po_headers_all PH
668   USING (
669     SELECT
670       PHD.draft_id,
671       PHD.delete_flag,
672       PHD.change_accepted_flag,
673       PHD.po_header_id,
674       PHD.agent_id,
675       PHD.type_lookup_code,
676       PHD.last_update_date,
677       PHD.last_updated_by,
678       PHD.segment1,
679       PHD.summary_flag,
680       PHD.enabled_flag,
681       PHD.segment2,
682       PHD.segment3,
683       PHD.segment4,
684       PHD.segment5,
685       PHD.start_date_active,
686       PHD.end_date_active,
687       PHD.last_update_login,
688       PHD.creation_date,
689       PHD.created_by,
690       PHD.vendor_id,
691       PHD.vendor_site_id,
692       PHD.vendor_contact_id,
693       PHD.ship_to_location_id,
694       PHD.bill_to_location_id,
695       PHD.terms_id,
696       PHD.ship_via_lookup_code,
697       PHD.fob_lookup_code,
698       PHD.freight_terms_lookup_code,
699       PHD.status_lookup_code,
700       PHD.currency_code,
701       PHD.rate_type,
702       PHD.rate_date,
703       PHD.rate,
704       PHD.from_header_id,
705       PHD.from_type_lookup_code,
706       PHD.start_date,
707       PHD.end_date,
708       PHD.blanket_total_amount,
709       PHD.authorization_status,
710       PHD.revision_num,
711       PHD.revised_date,
712       PHD.approved_flag,
713       PHD.approved_date,
714       PHD.amount_limit,
715       PHD.min_release_amount,
716       PHD.note_to_authorizer,
717       PHD.note_to_vendor,
718       PHD.note_to_receiver,
719       PHD.print_count,
720       PHD.printed_date,
721       PHD.vendor_order_num,
722       PHD.confirming_order_flag,
723       PHD.comments,
724       PHD.reply_date,
725       PHD.reply_method_lookup_code,
726       PHD.rfq_close_date,
727       PHD.quote_type_lookup_code,
728       PHD.quotation_class_code,
729       PHD.quote_warning_delay_unit,
730       PHD.quote_warning_delay,
731       PHD.quote_vendor_quote_number,
732       PHD.acceptance_required_flag,
733       PHD.acceptance_due_date,
734       PHD.closed_date,
735       PHD.user_hold_flag,
736       PHD.approval_required_flag,
737       PHD.cancel_flag,
738       PHD.firm_status_lookup_code,
739       PHD.firm_date,
740       PHD.frozen_flag,
741       PHD.supply_agreement_flag,
742       PHD.edi_processed_flag,
743       PHD.edi_processed_status,
744       PHD.attribute_category,
745       PHD.attribute1,
746       PHD.attribute2,
747       PHD.attribute3,
748       PHD.attribute4,
749       PHD.attribute5,
750       PHD.attribute6,
751       PHD.attribute7,
752       PHD.attribute8,
753       PHD.attribute9,
754       PHD.attribute10,
755       PHD.attribute11,
756       PHD.attribute12,
757       PHD.attribute13,
758       PHD.attribute14,
759       PHD.attribute15,
760       PHD.closed_code,
761       PHD.ussgl_transaction_code,
762       PHD.government_context,
763       PHD.request_id,
764       PHD.program_application_id,
765       PHD.program_id,
766       PHD.program_update_date,
767       PHD.org_id,
768       PHD.global_attribute_category,
769       PHD.global_attribute1,
770       PHD.global_attribute2,
771       PHD.global_attribute3,
772       PHD.global_attribute4,
773       PHD.global_attribute5,
774       PHD.global_attribute6,
775       PHD.global_attribute7,
776       PHD.global_attribute8,
777       PHD.global_attribute9,
778       PHD.global_attribute10,
779       PHD.global_attribute11,
780       PHD.global_attribute12,
781       PHD.global_attribute13,
782       PHD.global_attribute14,
783       PHD.global_attribute15,
784       PHD.global_attribute16,
785       PHD.global_attribute17,
786       PHD.global_attribute18,
787       PHD.global_attribute19,
788       PHD.global_attribute20,
789       PHD.interface_source_code,
790       PHD.reference_num,
791       PHD.wf_item_type,
792       PHD.wf_item_key,
793       PHD.mrc_rate_type,
794       PHD.mrc_rate_date,
795       PHD.mrc_rate,
796       PHD.pcard_id,
797       PHD.price_update_tolerance,
798       PHD.pay_on_code,
799       PHD.xml_flag,
800       PHD.xml_send_date,
801       PHD.xml_change_send_date,
802       PHD.global_agreement_flag,
803       PHD.consigned_consumption_flag,
804       PHD.cbc_accounting_date,
805       PHD.consume_req_demand_flag,
806       PHD.change_requested_by,
807       PHD.shipping_control,
808       PHD.conterms_exist_flag,
809       PHD.conterms_articles_upd_date,
813       PHD.change_summary,
810       PHD.conterms_deliv_upd_date,
811       PHD.encumbrance_required_flag,
812       PHD.pending_signature_flag,
814       PHD.document_creation_method,
815       PHD.submit_date,
816       PHD.supplier_notif_method,
817       PHD.fax,
818       PHD.email_address,
819       PHD.retro_price_comm_updates_flag,
820       PHD.retro_price_apply_updates_flag,
821       PHD.update_sourcing_rules_flag,
822       PHD.auto_sourcing_flag,
823       PHD.created_language,
824       PHD.cpa_reference,
825       PHD.style_id,
826       PHD.tax_attribute_update_code, -- <ETAX INTEGRATION R12>
827       PHD.pay_when_paid -- E and C ER
828     FROM po_headers_draft_all PHD
829     WHERE PHD.draft_id = p_draft_id
830     AND NVL(PHD.change_accepted_flag, 'Y') = 'Y'
831     ) PHDV
832   ON (PH.po_header_id = PHDV.po_header_id)
833   WHEN MATCHED THEN
834     UPDATE
835     SET
836       PH.agent_id = PHDV.agent_id,
837       PH.type_lookup_code = PHDV.type_lookup_code,
838       PH.last_update_date = PHDV.last_update_date,
839       PH.last_updated_by = PHDV.last_updated_by,
840       PH.segment1 = PHDV.segment1,
841       PH.summary_flag = PHDV.summary_flag,
842       PH.enabled_flag = PHDV.enabled_flag,
843       PH.segment2 = PHDV.segment2,
844       PH.segment3 = PHDV.segment3,
845       PH.segment4 = PHDV.segment4,
846       PH.segment5 = PHDV.segment5,
847       PH.start_date_active = PHDV.start_date_active,
848       PH.end_date_active = PHDV.end_date_active,
849       PH.last_update_login = PHDV.last_update_login,
850       PH.vendor_id = PHDV.vendor_id,
851       PH.vendor_site_id = PHDV.vendor_site_id,
852       PH.vendor_contact_id = PHDV.vendor_contact_id,
853       PH.ship_to_location_id = PHDV.ship_to_location_id,
854       PH.bill_to_location_id = PHDV.bill_to_location_id,
855       PH.terms_id = PHDV.terms_id,
856       PH.ship_via_lookup_code = PHDV.ship_via_lookup_code,
857       PH.fob_lookup_code = PHDV.fob_lookup_code,
858       PH.freight_terms_lookup_code = PHDV.freight_terms_lookup_code,
859       PH.status_lookup_code = PHDV.status_lookup_code,
860       PH.currency_code = PHDV.currency_code,
861       PH.rate_type = PHDV.rate_type,
862       PH.rate_date = PHDV.rate_date,
863       PH.rate = PHDV.rate,
864       PH.from_header_id = PHDV.from_header_id,
865       PH.from_type_lookup_code = PHDV.from_type_lookup_code,
866       PH.start_date = PHDV.start_date,
867       PH.end_date = PHDV.end_date,
868       PH.blanket_total_amount = PHDV.blanket_total_amount,
869       PH.authorization_status = PHDV.authorization_status,
870       PH.revision_num = PHDV.revision_num,
871       PH.revised_date = PHDV.revised_date,
872       PH.approved_flag = PHDV.approved_flag,
873       PH.approved_date = PHDV.approved_date,
874       PH.amount_limit = PHDV.amount_limit,
875       PH.min_release_amount = PHDV.min_release_amount,
876       PH.note_to_authorizer = PHDV.note_to_authorizer,
877       PH.note_to_vendor = PHDV.note_to_vendor,
878       PH.note_to_receiver = PHDV.note_to_receiver,
879       PH.print_count = PHDV.print_count,
880       PH.printed_date = PHDV.printed_date,
881       PH.vendor_order_num = PHDV.vendor_order_num,
882       PH.confirming_order_flag = PHDV.confirming_order_flag,
883       PH.comments = PHDV.comments,
884       PH.reply_date = PHDV.reply_date,
885       PH.reply_method_lookup_code = PHDV.reply_method_lookup_code,
886       PH.rfq_close_date = PHDV.rfq_close_date,
887       PH.quote_type_lookup_code = PHDV.quote_type_lookup_code,
888       PH.quotation_class_code = PHDV.quotation_class_code,
889       PH.quote_warning_delay_unit = PHDV.quote_warning_delay_unit,
890       PH.quote_warning_delay = PHDV.quote_warning_delay,
891       PH.quote_vendor_quote_number = PHDV.quote_vendor_quote_number,
892       PH.acceptance_required_flag = PHDV.acceptance_required_flag,
893       PH.acceptance_due_date = PHDV.acceptance_due_date,
894       PH.closed_date = PHDV.closed_date,
895       PH.user_hold_flag = PHDV.user_hold_flag,
896       PH.approval_required_flag = PHDV.approval_required_flag,
897       PH.cancel_flag = PHDV.cancel_flag,
898       PH.firm_status_lookup_code = PHDV.firm_status_lookup_code,
899       PH.firm_date = PHDV.firm_date,
900       PH.frozen_flag = PHDV.frozen_flag,
901       PH.supply_agreement_flag = PHDV.supply_agreement_flag,
902       PH.attribute_category = PHDV.attribute_category,
903       PH.attribute1 = PHDV.attribute1,
904       PH.attribute2 = PHDV.attribute2,
905       PH.attribute3 = PHDV.attribute3,
906       PH.attribute4 = PHDV.attribute4,
907       PH.attribute5 = PHDV.attribute5,
908       PH.attribute6 = PHDV.attribute6,
909       PH.attribute7 = PHDV.attribute7,
910       PH.attribute8 = PHDV.attribute8,
911       PH.attribute9 = PHDV.attribute9,
912       PH.attribute10 = PHDV.attribute10,
913       PH.attribute11 = PHDV.attribute11,
914       PH.attribute12 = PHDV.attribute12,
915       PH.attribute13 = PHDV.attribute13,
916       PH.attribute14 = PHDV.attribute14,
917       PH.attribute15 = PHDV.attribute15,
918       PH.closed_code = PHDV.closed_code,
919       PH.ussgl_transaction_code = PHDV.ussgl_transaction_code,
920       PH.government_context = PHDV.government_context,
921       PH.request_id = PHDV.request_id,
925       PH.org_id = PHDV.org_id,
922       PH.program_application_id = PHDV.program_application_id,
923       PH.program_id = PHDV.program_id,
924       PH.program_update_date = PHDV.program_update_date,
926       PH.global_attribute_category = PHDV.global_attribute_category,
927       PH.global_attribute1 = PHDV.global_attribute1,
928       PH.global_attribute2 = PHDV.global_attribute2,
929       PH.global_attribute3 = PHDV.global_attribute3,
930       PH.global_attribute4 = PHDV.global_attribute4,
931       PH.global_attribute5 = PHDV.global_attribute5,
932       PH.global_attribute6 = PHDV.global_attribute6,
933       PH.global_attribute7 = PHDV.global_attribute7,
934       PH.global_attribute8 = PHDV.global_attribute8,
935       PH.global_attribute9 = PHDV.global_attribute9,
936       PH.global_attribute10 = PHDV.global_attribute10,
937       PH.global_attribute11 = PHDV.global_attribute11,
938       PH.global_attribute12 = PHDV.global_attribute12,
939       PH.global_attribute13 = PHDV.global_attribute13,
940       PH.global_attribute14 = PHDV.global_attribute14,
941       PH.global_attribute15 = PHDV.global_attribute15,
942       PH.global_attribute16 = PHDV.global_attribute16,
943       PH.global_attribute17 = PHDV.global_attribute17,
944       PH.global_attribute18 = PHDV.global_attribute18,
945       PH.global_attribute19 = PHDV.global_attribute19,
946       PH.global_attribute20 = PHDV.global_attribute20,
947       PH.pcard_id = PHDV.pcard_id,
948       PH.price_update_tolerance = PHDV.price_update_tolerance,
949       PH.pay_on_code = PHDV.pay_on_code,
950       PH.change_requested_by = PHDV.change_requested_by,
951       PH.shipping_control = PHDV.shipping_control,
952       PH.conterms_articles_upd_date = PHDV.conterms_articles_upd_date,
953       PH.conterms_deliv_upd_date = PHDV.conterms_deliv_upd_date,
954       PH.encumbrance_required_flag = PHDV.encumbrance_required_flag,
955       PH.supplier_notif_method = PHDV.supplier_notif_method,
956       PH.fax = PHDV.fax,
957       PH.email_address = PHDV.email_address,
958       PH.retro_price_comm_updates_flag = PHDV.retro_price_comm_updates_flag,
959       PH.retro_price_apply_updates_flag = PHDV.retro_price_apply_updates_flag,
960       PH.update_sourcing_rules_flag = PHDV.update_sourcing_rules_flag,
961       PH.auto_sourcing_flag = PHDV.auto_sourcing_flag,
962       PH.tax_attribute_update_code = PHDV.tax_attribute_update_code, -- <ETAX INTEGRATION R12>
963       PH.pay_when_paid = PHDV.pay_when_paid
964   --  DELETE WHERE PHDV.delete_flag = 'Y'
965   WHEN NOT MATCHED THEN
966     INSERT
967     (
968       PH.po_header_id,
969       PH.agent_id,
970       PH.type_lookup_code,
971       PH.last_update_date,
972       PH.last_updated_by,
973       PH.segment1,
974       PH.summary_flag,
975       PH.enabled_flag,
976       PH.segment2,
977       PH.segment3,
978       PH.segment4,
979       PH.segment5,
980       PH.start_date_active,
981       PH.end_date_active,
982       PH.last_update_login,
983       PH.creation_date,
984       PH.created_by,
985       PH.vendor_id,
986       PH.vendor_site_id,
987       PH.vendor_contact_id,
988       PH.ship_to_location_id,
989       PH.bill_to_location_id,
990       PH.terms_id,
991       PH.ship_via_lookup_code,
992       PH.fob_lookup_code,
993       PH.freight_terms_lookup_code,
994       PH.status_lookup_code,
995       PH.currency_code,
996       PH.rate_type,
997       PH.rate_date,
998       PH.rate,
999       PH.from_header_id,
1000       PH.from_type_lookup_code,
1001       PH.start_date,
1002       PH.end_date,
1003       PH.blanket_total_amount,
1004       PH.authorization_status,
1005       PH.revision_num,
1006       PH.revised_date,
1007       PH.approved_flag,
1008       PH.approved_date,
1009       PH.amount_limit,
1010       PH.min_release_amount,
1011       PH.note_to_authorizer,
1012       PH.note_to_vendor,
1013       PH.note_to_receiver,
1014       PH.print_count,
1015       PH.printed_date,
1016       PH.vendor_order_num,
1017       PH.confirming_order_flag,
1018       PH.comments,
1019       PH.reply_date,
1020       PH.reply_method_lookup_code,
1021       PH.rfq_close_date,
1022       PH.quote_type_lookup_code,
1023       PH.quotation_class_code,
1024       PH.quote_warning_delay_unit,
1025       PH.quote_warning_delay,
1026       PH.quote_vendor_quote_number,
1027       PH.acceptance_required_flag,
1028       PH.acceptance_due_date,
1029       PH.closed_date,
1030       PH.user_hold_flag,
1031       PH.approval_required_flag,
1032       PH.cancel_flag,
1033       PH.firm_status_lookup_code,
1034       PH.firm_date,
1035       PH.frozen_flag,
1036       PH.supply_agreement_flag,
1037       PH.edi_processed_flag,
1038       PH.edi_processed_status,
1039       PH.attribute_category,
1040       PH.attribute1,
1041       PH.attribute2,
1042       PH.attribute3,
1043       PH.attribute4,
1044       PH.attribute5,
1045       PH.attribute6,
1046       PH.attribute7,
1047       PH.attribute8,
1048       PH.attribute9,
1049       PH.attribute10,
1050       PH.attribute11,
1051       PH.attribute12,
1052       PH.attribute13,
1056       PH.ussgl_transaction_code,
1053       PH.attribute14,
1054       PH.attribute15,
1055       PH.closed_code,
1057       PH.government_context,
1058       PH.request_id,
1059       PH.program_application_id,
1060       PH.program_id,
1061       PH.program_update_date,
1062       PH.org_id,
1063       PH.global_attribute_category,
1064       PH.global_attribute1,
1065       PH.global_attribute2,
1066       PH.global_attribute3,
1067       PH.global_attribute4,
1068       PH.global_attribute5,
1069       PH.global_attribute6,
1070       PH.global_attribute7,
1071       PH.global_attribute8,
1072       PH.global_attribute9,
1073       PH.global_attribute10,
1074       PH.global_attribute11,
1075       PH.global_attribute12,
1076       PH.global_attribute13,
1077       PH.global_attribute14,
1078       PH.global_attribute15,
1079       PH.global_attribute16,
1080       PH.global_attribute17,
1081       PH.global_attribute18,
1082       PH.global_attribute19,
1083       PH.global_attribute20,
1084       PH.interface_source_code,
1085       PH.reference_num,
1086       PH.wf_item_type,
1087       PH.wf_item_key,
1088       PH.mrc_rate_type,
1089       PH.mrc_rate_date,
1090       PH.mrc_rate,
1091       PH.pcard_id,
1092       PH.price_update_tolerance,
1093       PH.pay_on_code,
1094       PH.xml_flag,
1095       PH.xml_send_date,
1096       PH.xml_change_send_date,
1097       PH.global_agreement_flag,
1098       PH.consigned_consumption_flag,
1099       PH.cbc_accounting_date,
1100       PH.consume_req_demand_flag,
1101       PH.change_requested_by,
1102       PH.shipping_control,
1103       PH.conterms_exist_flag,
1104       PH.conterms_articles_upd_date,
1105       PH.conterms_deliv_upd_date,
1106       PH.encumbrance_required_flag,
1107       PH.pending_signature_flag,
1108       PH.change_summary,
1109       PH.document_creation_method,
1110       PH.submit_date,
1111       PH.supplier_notif_method,
1112       PH.fax,
1113       PH.email_address,
1114       PH.retro_price_comm_updates_flag,
1115       PH.retro_price_apply_updates_flag,
1116       PH.update_sourcing_rules_flag,
1117       PH.auto_sourcing_flag,
1118       PH.created_language,
1119       PH.cpa_reference,
1120       PH.style_id,
1121       PH.tax_attribute_update_code, -- <ETAX INTEGRATION R12>
1122       PH.pay_when_paid -- E and C ER
1123     )
1124     VALUES
1125     (
1126       PHDV.po_header_id,
1127       PHDV.agent_id,
1128       PHDV.type_lookup_code,
1129       PHDV.last_update_date,
1130       PHDV.last_updated_by,
1131       PHDV.segment1,
1132       PHDV.summary_flag,
1133       PHDV.enabled_flag,
1134       PHDV.segment2,
1135       PHDV.segment3,
1136       PHDV.segment4,
1137       PHDV.segment5,
1138       PHDV.start_date_active,
1139       PHDV.end_date_active,
1140       PHDV.last_update_login,
1141       PHDV.creation_date,
1142       PHDV.created_by,
1143       PHDV.vendor_id,
1144       PHDV.vendor_site_id,
1145       PHDV.vendor_contact_id,
1146       PHDV.ship_to_location_id,
1147       PHDV.bill_to_location_id,
1148       PHDV.terms_id,
1149       PHDV.ship_via_lookup_code,
1150       PHDV.fob_lookup_code,
1151       PHDV.freight_terms_lookup_code,
1152       PHDV.status_lookup_code,
1153       PHDV.currency_code,
1154       PHDV.rate_type,
1155       PHDV.rate_date,
1156       PHDV.rate,
1157       PHDV.from_header_id,
1158       PHDV.from_type_lookup_code,
1159       PHDV.start_date,
1160       PHDV.end_date,
1161       PHDV.blanket_total_amount,
1162       PHDV.authorization_status,
1163       PHDV.revision_num,
1164       PHDV.revised_date,
1165       PHDV.approved_flag,
1166       PHDV.approved_date,
1167       PHDV.amount_limit,
1168       PHDV.min_release_amount,
1169       PHDV.note_to_authorizer,
1170       PHDV.note_to_vendor,
1171       PHDV.note_to_receiver,
1172       PHDV.print_count,
1173       PHDV.printed_date,
1174       PHDV.vendor_order_num,
1175       PHDV.confirming_order_flag,
1176       PHDV.comments,
1177       PHDV.reply_date,
1178       PHDV.reply_method_lookup_code,
1179       PHDV.rfq_close_date,
1180       PHDV.quote_type_lookup_code,
1181       PHDV.quotation_class_code,
1182       PHDV.quote_warning_delay_unit,
1183       PHDV.quote_warning_delay,
1184       PHDV.quote_vendor_quote_number,
1185       PHDV.acceptance_required_flag,
1186       PHDV.acceptance_due_date,
1187       PHDV.closed_date,
1188       PHDV.user_hold_flag,
1189       PHDV.approval_required_flag,
1190       PHDV.cancel_flag,
1191       PHDV.firm_status_lookup_code,
1192       PHDV.firm_date,
1193       PHDV.frozen_flag,
1194       PHDV.supply_agreement_flag,
1195       PHDV.edi_processed_flag,
1196       PHDV.edi_processed_status,
1197       PHDV.attribute_category,
1198       PHDV.attribute1,
1199       PHDV.attribute2,
1200       PHDV.attribute3,
1201       PHDV.attribute4,
1202       PHDV.attribute5,
1203       PHDV.attribute6,
1204       PHDV.attribute7,
1205       PHDV.attribute8,
1206       PHDV.attribute9,
1210       PHDV.attribute13,
1207       PHDV.attribute10,
1208       PHDV.attribute11,
1209       PHDV.attribute12,
1211       PHDV.attribute14,
1212       PHDV.attribute15,
1213       PHDV.closed_code,
1214       PHDV.ussgl_transaction_code,
1215       PHDV.government_context,
1216       PHDV.request_id,
1217       PHDV.program_application_id,
1218       PHDV.program_id,
1219       PHDV.program_update_date,
1220       PHDV.org_id,
1221       PHDV.global_attribute_category,
1222       PHDV.global_attribute1,
1223       PHDV.global_attribute2,
1224       PHDV.global_attribute3,
1225       PHDV.global_attribute4,
1226       PHDV.global_attribute5,
1227       PHDV.global_attribute6,
1228       PHDV.global_attribute7,
1229       PHDV.global_attribute8,
1230       PHDV.global_attribute9,
1231       PHDV.global_attribute10,
1232       PHDV.global_attribute11,
1233       PHDV.global_attribute12,
1234       PHDV.global_attribute13,
1235       PHDV.global_attribute14,
1236       PHDV.global_attribute15,
1237       PHDV.global_attribute16,
1238       PHDV.global_attribute17,
1239       PHDV.global_attribute18,
1240       PHDV.global_attribute19,
1241       PHDV.global_attribute20,
1242       PHDV.interface_source_code,
1243       PHDV.reference_num,
1244       PHDV.wf_item_type,
1245       PHDV.wf_item_key,
1246       PHDV.mrc_rate_type,
1247       PHDV.mrc_rate_date,
1248       PHDV.mrc_rate,
1249       PHDV.pcard_id,
1250       PHDV.price_update_tolerance,
1251       PHDV.pay_on_code,
1252       PHDV.xml_flag,
1253       PHDV.xml_send_date,
1254       PHDV.xml_change_send_date,
1255       PHDV.global_agreement_flag,
1256       PHDV.consigned_consumption_flag,
1257       PHDV.cbc_accounting_date,
1258       PHDV.consume_req_demand_flag,
1259       PHDV.change_requested_by,
1260       PHDV.shipping_control,
1261       PHDV.conterms_exist_flag,
1262       PHDV.conterms_articles_upd_date,
1263       PHDV.conterms_deliv_upd_date,
1264       PHDV.encumbrance_required_flag,
1265       PHDV.pending_signature_flag,
1266       PHDV.change_summary,
1267       PHDV.document_creation_method,
1268       PHDV.submit_date,
1269       PHDV.supplier_notif_method,
1270       PHDV.fax,
1271       PHDV.email_address,
1272       PHDV.retro_price_comm_updates_flag,
1273       PHDV.retro_price_apply_updates_flag,
1274       PHDV.update_sourcing_rules_flag,
1275       PHDV.auto_sourcing_flag,
1276       PHDV.created_language,
1277       PHDV.cpa_reference,
1278       PHDV.style_id,
1279       PHDV.tax_attribute_update_code, -- <ETAX INTEGRATION R12>
1280       PHDV.pay_when_paid -- E and C ER
1281     ) WHERE NVL(PHDV.delete_flag, 'N') <> 'Y';
1282 
1283   d_position := 10;
1284 EXCEPTION
1285   WHEN OTHERS THEN
1286     PO_MESSAGE_S.add_exc_msg
1287     ( p_pkg_name => d_pkg_name,
1288       p_procedure_name => d_api_name || '.' || d_position
1289     );
1290     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1291 END merge_changes;
1292 
1293 -----------------------------------------------------------------------
1294 --Start of Comments
1295 --Name: lock_draft_record
1296 --Function:
1297 --  Obtain database lock for the record in draft table
1298 --Parameters:
1299 --IN:
1300 --p_po_header_id
1301 --  id for po header record
1302 --p_draft_id
1303 --  draft unique identifier
1304 --RETURN:
1305 --End of Comments
1306 ------------------------------------------------------------------------
1307 PROCEDURE lock_draft_record
1308 ( p_po_header_id IN NUMBER,
1309   p_draft_id     IN NUMBER
1310 ) IS
1311 
1312 d_api_name CONSTANT VARCHAR2(30) := 'lock_draft_record';
1313 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
1314 d_position NUMBER;
1315 
1316 l_dummy NUMBER;
1317 
1318 BEGIN
1319   d_position := 0;
1320   IF (PO_LOG.d_proc) THEN
1321     PO_LOG.proc_begin(d_module);
1322   END IF;
1323 
1324   SELECT 1
1325   INTO l_dummy
1326   FROM po_headers_draft_all
1327   WHERE po_header_id = p_po_header_id
1328   AND draft_id = p_draft_id
1329   FOR UPDATE NOWAIT;
1330 
1331   IF (PO_LOG.d_proc) THEN
1332     PO_LOG.proc_end(d_module);
1333   END IF;
1334 
1335 EXCEPTION
1336 WHEN NO_DATA_FOUND THEN
1337   NULL;
1338 END lock_draft_record;
1339 
1340 -----------------------------------------------------------------------
1341 --Start of Comments
1342 --Name: lock_transaction_record
1343 --Function:
1344 --  Obtain database lock for the record in transaction table
1345 --Parameters:
1346 --IN:
1347 --p_po_header_id
1348 --  id for po header record
1349 --RETURN:
1350 --End of Comments
1351 ------------------------------------------------------------------------
1352 PROCEDURE lock_transaction_record
1353 ( p_po_header_id IN NUMBER
1354 ) IS
1355 
1356 d_api_name CONSTANT VARCHAR2(30) := 'lock_transaction_record';
1357 d_module CONSTANT VARCHAR2(2000) := d_pkg_name || d_api_name || '.';
1358 d_position NUMBER;
1359 
1360 l_dummy NUMBER;
1361 
1362 BEGIN
1363   d_position := 0;
1364   IF (PO_LOG.d_proc) THEN
1365     PO_LOG.proc_begin(d_module);
1366   END IF;
1367 
1368   SELECT 1
1369   INTO l_dummy
1370   FROM po_headers_all
1371   WHERE po_header_id = p_po_header_id
1372   FOR UPDATE NOWAIT;
1373 
1374   IF (PO_LOG.d_proc) THEN
1375     PO_LOG.proc_end(d_module);
1376   END IF;
1377 
1378 EXCEPTION
1379 WHEN NO_DATA_FOUND THEN
1380   NULL;
1381 END lock_transaction_record;
1382 
1383 END PO_HEADERS_DRAFT_PKG;