DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_COPYDOC_S4

Source


1 PACKAGE BODY po_copydoc_s4 AS
2 /* $Header: POXCPO4B.pls 120.5 2008/02/28 09:46:30 lswamina ship $*/
3 
4 --< Shared Proc FPJ Start >
5 -- Debugging booleans used to bypass logging when turned off
6 g_debug_stmt CONSTANT BOOLEAN := PO_DEBUG.is_debug_stmt_on;
7 g_debug_unexp CONSTANT BOOLEAN := PO_DEBUG.is_debug_unexp_on;
8 
9 g_pkg_name CONSTANT VARCHAR2(20) := 'PO_COPYDOC_S4';
10 g_module_prefix CONSTANT VARCHAR2(30) := 'po.plsql.' || g_pkg_name || '.';
11 
12 
13 PROCEDURE validate_shipment
14 (
15     p_action_code           IN     VARCHAR2,
16     p_to_doc_subtype        IN     VARCHAR2,
17     p_orig_line_location_id IN     NUMBER,
18     p_po_header_id          IN     NUMBER,
19     p_po_line_id            IN     NUMBER,
20     p_item_category_id      IN     NUMBER,      --< Shared Proc FPJ >
21     p_inv_org_id            IN     NUMBER,      -- Bug 2761415
22     p_copy_price            IN     BOOLEAN,
23     p_online_report_id      IN     NUMBER,
24     p_line_num              IN     NUMBER,
25     p_item_id               IN     NUMBER, -- Bug 3433867
26     x_po_shipment_record    IN OUT NOCOPY PO_LINE_LOCATIONS%ROWTYPE,
27     x_sequence              IN OUT NOCOPY NUMBER,
28     x_return_code           OUT    NOCOPY NUMBER,
29     p_is_complex_work_po    IN     BOOLEAN     -- <Complex Work R12>
30 ) IS
31 
32   COPYDOC_SHIPMENT_FAILURE    EXCEPTION;
33   l_progress                  VARCHAR2(4) := NULL;
34   l_internal_return_code      NUMBER := NULL;
35   l_quotation_class_code      VARCHAR2(10) := NULL;
36   l_orig_po_header_id         po_line_locations.po_header_id%TYPE := NULL;
37   l_orig_po_line_id           po_line_locations.po_line_id%TYPE := NULL;
38   l_vendor_id                 NUMBER := NULL;
39   l_vendor_site_id            NUMBER := NULL;
40   l_invoice_match_option      VARCHAR2(25) := NULL;
41   l_price_from_line           po_lines.unit_price%TYPE := NULL;
42   l_terms_id                  NUMBER := NULL;
43   l_ship_via_lookup_code      VARCHAR2(25) := NULL;
44   l_fob                       VARCHAR2(25) := NULL;
45   l_freight_terms             VARCHAR2(25) := NULL;
46   l_qty_tolerance             NUMBER := NULL;
47   l_qty_exception_code        VARCHAR2(25) := NULL;
48   l_rcv_flag                  VARCHAR2(1) := NULL;
49   l_insp_flag                 VARCHAR2(1) := NULL;
50   -- start of 1548597
51   l_secondary_qty             po_lines.secondary_quantity%type := NULL;
52   l_item_number               VARCHAR2(240);
53   l_process_org               VARCHAR2(1);
54   l_ic_item_mst_rec           IC_ITEM_MST%ROWTYPE;
55   l_ic_item_cpg_rec           IC_ITEM_CPG%ROWTYPE;
56   l_order_opm_um              ic_item_mst.item_um%type := NULL;
57 -- end of 1548597
58 
59 -- Bug: 2473335
60   l_line_type_id                 number:= null;
61   l_invoice_close_tolerance      number:= null;
62   l_receive_close_tolerance      number:= null;
63   l_item_id po_lines.item_id%TYPE := null;
64 
65   --< Shared Proc FPJ Start >
66   l_transaction_flow_header_id
67     PO_LINE_LOCATIONS_ALL.transaction_flow_header_id%TYPE;
68   l_is_valid BOOLEAN;
69   l_in_current_sob BOOLEAN;
70   l_check_txn_flow BOOLEAN;
71   l_return_status  VARCHAR2(1);
72   --< Shared Proc FPJ End >
73 
74 BEGIN
75 
76   /*****  Unchanged attributes
77   government_context
78   receiving_routing_id
79   org_id
80   attribute{1-15, _category}
81   unit_of_measure_class
82   enforce_ship_to_location_code (set to 'NONE' for quote and po, but where can this field be set)
83   allow_substitute_receipts_flag (where is this set)
84   days_{early, late}_receipt_allowed (where is this set)
85   {invoice, receive}_close_tolerance
86   ship_to_organization_id
87   shipment_num
88   source_shipment_id
89   last_accept_date
90   price_override (this is the price indicated in the price breaks)
91   estimated_tax_amount
92   price_discount
93   firm_status_lookup_code
94   firm_date
95   quantity
96   unit_meas_lookup_code
97   ship_to_location_id
98   global_attribute{_category, 1-20}
99   enforce_ship_to_location_code
100   ********************/
101    l_progress := '001';
102 
103   IF g_debug_stmt THEN               --< Shared Proc FPJ > Add correct debugging
104       PO_DEBUG.debug_stmt
105           (p_log_head => g_module_prefix||'validate_shipment',
106            p_token    => 'invoked',
107            p_message  => 'action_code: '||p_action_code||' to_doc_subtype: '||
108                    p_to_doc_subtype||' header ID: '||p_po_header_id||
109                    ' line ID: '||p_po_line_id||' ship ID: '||
110                    x_po_shipment_record.line_location_id||
111                    ' online_report ID: '||p_online_report_id);
112   END IF;
113 
114   /* store original document info into the "FROM" fields of current doc */
115   -- bug877084: don't need to override in po_line_locations
116 
117   SELECT po_header_id, po_line_id
118   INTO   l_orig_po_header_id, l_orig_po_line_id
119   FROM   po_line_locations
120   WHERE  line_location_id = p_orig_line_location_id;
121 
122   -- Bug 2761415 START
123   -- Moved bug fix 2473335 here, since invoice/receipt close tolerance
124   -- defaulting should only happen when copying from quotations and RFQ's.
125   IF (x_po_shipment_record.shipment_type IN ('QUOTATION', 'RFQ')) THEN
126 
127     -- Bug 2473335 start: Get the invoice close tolerance and
128     -- receive close tolerance
129     select line_type_id, item_id
130            into l_line_type_id, l_item_id
131     from   po_lines
132     where  po_line_id=p_po_line_id; -- Bug 2761415
133 
134     begin
135           SELECT msi.invoice_close_tolerance,
136                  msi.receive_close_tolerance
137             INTO l_invoice_close_tolerance,
138                  l_receive_close_tolerance
139             FROM mtl_system_items msi
140            WHERE msi.inventory_item_id = l_item_id
141              AND msi.organization_id   = x_po_shipment_record.ship_to_organization_id;
142     exception
143           when others then null;
144     end;
145     begin
146           SELECT nvl(l_invoice_close_tolerance,msi.invoice_close_tolerance),
147                  nvl(l_receive_close_tolerance,msi.receive_close_tolerance)
148             INTO l_invoice_close_tolerance,
149                  l_receive_close_tolerance
150             FROM mtl_system_items msi
151            WHERE msi.inventory_item_id = l_item_id
152              AND msi.organization_id = p_inv_org_id;
153     exception
154           when others then null;
155     end;
156 
157     begin
158           SELECT nvl(l_receive_close_tolerance,receipt_close)
159             INTO l_receive_close_tolerance
160             FROM po_line_types_v
161            WHERE line_type_id = l_line_type_id;
162     exception
163           when others then null;
164     end;
165 
166     begin
167           SELECT nvl(l_invoice_close_tolerance, posp.INVOICE_CLOSE_TOLERANCE),
168                  nvl(l_receive_close_tolerance, posp.RECEIVE_CLOSE_TOLERANCE)
169             INTO l_invoice_close_tolerance,
170                  l_receive_close_tolerance
171             FROM po_system_parameters posp;
172     exception
173         when others then null;
174     end;
175 
176     IF (l_invoice_close_tolerance is NULL) THEN
177             l_invoice_close_tolerance := 0;
178     END IF;
179 
180     IF (l_receive_close_tolerance is NULL) THEN
181             l_receive_close_tolerance := 0;
182     END IF;
183 
184     -- Bug 2473335 End
185 
186     x_po_shipment_record.invoice_close_tolerance := l_invoice_close_tolerance;
187     x_po_shipment_record.receive_close_tolerance := l_receive_close_tolerance;
188   END IF; -- from shipment type is quotation or RFQ
189   -- Bug 2761415 END
190 
191    l_progress := '002';
192   IF (p_action_code = 'QUOTATION') THEN
193     SELECT quotation_class_code,
194            vendor_site_id,
195            vendor_id
196     INTO   l_quotation_class_code,
197            l_vendor_site_id,
198            l_vendor_id
199     FROM   po_headers
200     WHERE  po_header_id = l_orig_po_header_id;
201 
202     /* a copied PO needs to have a defaulted value for the invoice match
203      * option.  we look at the vendor site, vendor, and the financials
204      * system parameters.
205      */
206     IF (l_vendor_site_id is NOT NULL) THEN
207        l_progress := '003';
208       SELECT match_option
209       INTO   l_invoice_match_option
210       FROM   po_vendor_sites
211       WHERE  vendor_site_id = l_vendor_site_id;
212     ELSE
213       IF (l_vendor_id is NOT NULL) THEN
214         l_progress := '004';
215         SELECT match_option
216         INTO   l_invoice_match_option
217         FROM   po_vendors
218         WHERE  vendor_id = l_vendor_id;
219       END IF;
220     END IF;
221 
222     IF (l_invoice_match_option is NULL) THEN
223        l_progress := '005';
224       SELECT match_option
225       INTO   l_invoice_match_option
226       FROM   financials_system_parameters;
227     END IF;
228 
229 
230     IF (l_quotation_class_code = 'CATALOG') THEN
231       x_po_shipment_record.inspection_required_flag := NULL;
232       x_po_shipment_record.receipt_required_flag := NULL;
233       x_po_shipment_record.qty_rcv_tolerance := NULL;
234       x_po_shipment_record.qty_rcv_exception_code := NULL;
235       x_po_shipment_record.shipment_type := 'PRICE BREAK';
236     ELSIF (l_quotation_class_code = 'BID') THEN
237       -- Bug 2761415 The following is now defaulted in the logic above.
238       --x_po_shipment_record.invoice_close_tolerance := NULL;
239       --x_po_shipment_record.receive_close_tolerance := NULL;
240 
241       /* depend on the type of PO, sets to the same */
242       x_po_shipment_record.shipment_type := p_to_doc_subtype;
243       -- bug896729:  bid quotation has only last_accept_date. convert
244       -- this to promised_date
245       x_po_shipment_record.promised_date := x_po_shipment_record.last_accept_date;
246       x_po_shipment_record.last_accept_date := NULL;
247       x_po_shipment_record.match_option := l_invoice_match_option;
248 --bug#2754766: only NULL out pb effective dates for Bid Quotations
249       x_po_shipment_record.start_date := NULL;
250       x_po_shipment_record.end_date := NULL;
251 
252       -- Bug 2750604. Copy these over at shipment level for bid quotations to
253       -- be consistent with GA FPI changes
254       IF (p_to_doc_subtype IN ('STANDARD', 'PLANNED')) THEN
255         x_po_shipment_record.from_header_id := l_orig_po_header_id;
256         x_po_shipment_record.from_line_id   := l_orig_po_line_id;
257       END IF;
258 
259     END IF;
260 
261     l_progress := '006';
262     x_po_shipment_record.accrue_on_receipt_flag := 'N';
263     x_po_shipment_record.encumber_now  := NULL;
264     x_po_shipment_record.fob_lookup_code := NULL;
265     x_po_shipment_record.freight_terms_lookup_code := NULL;
266 --bug#2754766: removed statement nulling out pb start/end dates.
267 --moved this up into the if block for Bid Quotations only.
268     x_po_shipment_record.lead_time := NULL;
269     x_po_shipment_record.lead_time_unit := NULL;
270     x_po_shipment_record.terms_id := NULL;
271     x_po_shipment_record.ship_via_lookup_code := NULL;
272 
273   END IF;
274 
275    /*  Functionality for PA->RFQ Copy : dreddy 1388111
276     shipment related fields are processed */
277    IF (p_action_code = 'RFQ') THEN
278     -- payment terms are defaulted from the header
279     begin
280 
281       SELECT terms_id,
282              ship_via_lookup_code,
283              fob_lookup_code,
284              freight_terms_lookup_code
285       INTO   l_terms_id,
286              l_ship_via_lookup_code,
287              l_fob,
288              l_freight_terms
289       FROM   po_headers
290       WHERE  po_header_id = l_orig_po_header_id ;
291 
292     exception
293       when others then
294        null;
295     end;
296 
297     -- quantity tolerence and exception code are defaulted from the system level.
298      begin
299 
300       SELECT rcv.qty_rcv_tolerance,
301              rcv.qty_rcv_exception_code
302       INTO   l_qty_tolerance,
303              l_qty_exception_code
304       FROM   rcv_parameters rcv,
305              financials_system_parameters fsp
306       WHERE  rcv.organization_id  = fsp.inventory_organization_id;
307 
308     exception
309       when others then
310        null;
311     end;
312 
313      -- match option is defaulted from the system level based on the receiving
314      -- and inspection flags
315      begin
316 
317       SELECT receiving_flag,
318              inspection_required_flag
319       INTO   l_rcv_flag,
320              l_insp_flag
321       FROM   po_system_parameters;
322 
323     exception
324       when others then
325        null;
326     end;
327 
328 
329     x_po_shipment_record.inspection_required_flag := NULL;
330     x_po_shipment_record.receipt_required_flag := NULL;
331     x_po_shipment_record.qty_rcv_tolerance := l_qty_tolerance;
332     x_po_shipment_record.qty_rcv_exception_code := l_qty_exception_code;
333     x_po_shipment_record.shipment_type := 'RFQ';
334     x_po_shipment_record.accrue_on_receipt_flag := 'N';
335     x_po_shipment_record.encumber_now  := NULL;
336     x_po_shipment_record.fob_lookup_code := l_fob;
337     x_po_shipment_record.freight_terms_lookup_code := l_freight_terms;
338     /* Bug 2695110.
339      * Comment out the following code which makes start_date and
340      * end_date to be null since we need to copy them over to RFQ.
341     x_po_shipment_record.start_date := NULL;
342     x_po_shipment_record.end_date := NULL;
343     */
344     x_po_shipment_record.lead_time := NULL;
345     x_po_shipment_record.lead_time_unit := NULL;
346     x_po_shipment_record.terms_id := l_terms_id;
347     x_po_shipment_record.ship_via_lookup_code := l_ship_via_lookup_code;
348     x_po_shipment_record.receipt_required_flag := l_rcv_flag;
349     x_po_shipment_record.inspection_required_flag := l_insp_flag;
350 
351     if not (p_copy_price) then
352       x_po_shipment_record.price_override := NULL;
353       x_po_shipment_record.price_discount := NULL;
354     end if;
355 
356   END IF;
357 
358   x_po_shipment_record.last_updated_by   := fnd_global.user_id;
359   x_po_shipment_record.last_update_date  := SYSDATE;
360   x_po_shipment_record.last_update_login := fnd_global.login_id;
361   x_po_shipment_record.created_by        := fnd_global.user_id;
362   x_po_shipment_record.creation_date     := SYSDATE;
363 
364   l_progress := '007';
365   -- if promised_date or need_by_date has already passed, set to sysdate
366   if (x_po_shipment_record.promised_date is not null) and
367      (x_po_shipment_record.promised_date < SYSDATE) then
368     --< NBD TZ/Timestamp FPJ Start >
369     --x_po_shipment_record.promised_date := trunc(SYSDATE);
370     x_po_shipment_record.promised_date := SYSDATE;
371     --< NBD TZ/Timestamp FPJ End >
372   end if;
373 
374   l_progress := '008';
375   if (x_po_shipment_record.need_by_date is not null) and
376      (x_po_shipment_record.need_by_date < SYSDATE) then
377     --< NBD TZ/Timestamp FPJ Start >
378     --x_po_shipment_record.need_by_date := trunc(SYSDATE);
379     x_po_shipment_record.need_by_date := SYSDATE;
380     --< NBD TZ/Timestamp FPJ End >
381   end if;
382 
383   -- in bid quotation, last_accept_date and need_by_date are not mandatory
384   -- fields.  However in PO, they are. so default trunc(sysdate) if both
385   -- fields are null.
386   l_progress := '009';
387 
391 /* Bug: 2825147 Populate need_by_date only for STANDARD and
388   /*Bug6851594 - Commented the following lines as this was setting the NEED-BY-DATE
389     to SYSDATE even when the there was no DATE populated for NEED-BY-DATE in original document*/
390 
392    PLANNED Purchase Orders */
393 
394  /* if (x_po_shipment_record.need_by_date is null) and
395 	(x_po_shipment_record.promised_date is null) and
396           (x_po_shipment_record.shipment_type in ('STANDARD','PLANNED'))then
397     --< NBD TZ/Timestamp FPJ Start >
398     --x_po_shipment_record.need_by_date := trunc(SYSDATE);
399     x_po_shipment_record.need_by_date := SYSDATE;
400     --< NBD TZ/Timestamp FPJ End >
401   end if; */
402 
403   --
404   -- <R12 eTax Integration>
405   -- Removed reference to ap ta(x) code table
406   --
407   x_po_shipment_record.tax_code_id := NULL;
408 
409   /* bug 1346241 : for standard and planned PO's the shipment price
410      should be same as the line price
411      this should not be done for a copy to RFQ  */
412      -- <Complex Work R12>: For complex work POs also, do not get
413      -- the price from the line.  It is on the payitem itself.
414    IF ((NOT p_is_complex_work_po) AND (p_action_code <> 'RFQ')) THEN
415     IF x_po_shipment_record.price_override is null
416       OR (p_to_doc_subtype in ('STANDARD','PLANNED')) THEN
417 
418        l_progress := '011';
419      begin
420        select unit_price
421        into l_price_from_line
422        from po_lines
423        where po_header_id = p_po_header_id
424        and po_line_id = p_po_line_id;
425      exception
426       when others then
427        null;
428      end;
429 
430      x_po_shipment_record.price_override := l_price_from_line;
431 
432     END IF;
433    END IF;
434 
435 
436     l_progress := '012';
437   -- Standard WHO columns, not inserted
438   x_po_shipment_record.program_application_id := NULL;
439   x_po_shipment_record.program_id             := NULL;
440   x_po_shipment_record.program_update_date    := NULL;
441   x_po_shipment_record.request_id             := NULL;
442 
443   x_po_shipment_record.cancelled_by  := NULL;
444   x_po_shipment_record.cancel_date   := NULL;
445   x_po_shipment_record.cancel_flag   := 'N';
446   x_po_shipment_record.cancel_reason := NULL;
447   x_po_shipment_record.closed_by     := NULL;
448   x_po_shipment_record.closed_code   := 'OPEN';
449   x_po_shipment_record.closed_date   := NULL;
450   x_po_shipment_record.closed_flag   := NULL;
451   x_po_shipment_record.closed_reason := NULL;
452 
453   x_po_shipment_record.approved_date := NULL;
454   x_po_shipment_record.approved_flag := 'N';
455 
456   x_po_shipment_record.po_release_id := NULL;
457 
458   x_po_shipment_record.po_header_id := p_po_header_id;
459   x_po_shipment_record.po_line_id   := p_po_line_id;
460 
461   x_po_shipment_record.unencumbered_quantity := NULL;
462   x_po_shipment_record.encumbered_date       := NULL;
463   x_po_shipment_record.encumbered_flag       := 'N';
464   x_po_shipment_record.quantity_accepted  := 0;
465   x_po_shipment_record.quantity_billed    := 0;
466   x_po_shipment_record.quantity_cancelled := 0;
467   x_po_shipment_record.quantity_received  := 0;
468   x_po_shipment_record.quantity_rejected  := 0;
469   x_po_shipment_record.quantity_shipped   := NULL;
470 
471   l_progress := '013';
472 
473   --< Shared Proc FPJ Start >
474   IF (p_to_doc_subtype = 'STANDARD') AND
475      (NVL(x_po_shipment_record.consigned_flag,'N') = 'N') AND
476      (NVL(x_po_shipment_record.accrue_on_receipt_flag, 'N') = 'Y') --<Shared Proc FPJ>
477   THEN
478 
479       l_progress := '014';
480 
481       -- Validate the ship-to org, and derive a transaction flow
482       PO_SHARED_PROC_PVT.validate_ship_to_org
483           (p_init_msg_list    => FND_API.g_false,
484            x_return_status    => l_return_status,
485            p_ship_to_org_id   => x_po_shipment_record.ship_to_organization_id,
486            p_item_category_id => p_item_category_id,
487            p_item_id          => p_item_id, -- Bug 3433867
488            x_is_valid         => l_is_valid,
489            x_in_current_sob   => l_in_current_sob,
490            x_check_txn_flow   => l_check_txn_flow,
491            x_transaction_flow_header_id => l_transaction_flow_header_id);
492 
493       IF (l_return_status <> FND_API.g_ret_sts_success) THEN
494           l_progress := '015';
495           FND_MESSAGE.set_encoded(encoded_message => FND_MSG_PUB.get);
496           RAISE FND_API.g_exc_error;
497       ELSIF (NOT l_is_valid) AND (NOT l_check_txn_flow) THEN
498           l_progress := '016';
499           -- This is an error because it is not allowable to use transaction
500           -- flows in this scenario, and validation failed.
501           FND_MESSAGE.set_name(application => 'PO',
502                                name => 'PO_INVALID_SHIP_TO_ORG');
503           RAISE FND_API.g_exc_error;
504       END IF;
505 
506       l_progress := '017';
507 
508       IF (l_transaction_flow_header_id IS NOT NULL) THEN
509 
510           -- A valid transaction flow was found, so set it here. If the new
511           -- flow is different than the original, new accounts will be
512           -- generated at the distributions level
513           x_po_shipment_record.transaction_flow_header_id :=
517       THEN
514               l_transaction_flow_header_id;
515 
516       ELSIF (x_po_shipment_record.transaction_flow_header_id IS NOT NULL)
518           l_progress := '018';
519 
520           -- Original PO had a txn flow, but no valid txn flow found now.
521           -- Only clear orig txn flow reference if the ship-to org is in the
522           -- current OU's SOB. Otherwise, just let it go so that it gets
523           -- caught downstream in the copydoc submission check.
524 
525           IF l_in_current_sob THEN
526               -- Remove txn flow reference, which will force new accounts
527               -- to be generated at the distribution level
528               x_po_shipment_record.transaction_flow_header_id := NULL;
529           END IF;
530 
531       END IF;  --< if txn flow header not null >
532 
533   END IF;  --< if STANDARD >
534   --< Shared Proc FPJ End >
535 
536   l_progress := '019';
537   BEGIN
538     SELECT po_line_locations_s.nextval
539     INTO   x_po_shipment_record.line_location_id
540     FROM   SYS.DUAL;
541   EXCEPTION
542     WHEN OTHERS THEN
543       x_po_shipment_record.line_location_id := NULL;
544       po_copydoc_s1.copydoc_sql_error('validate_shipment', l_progress, sqlcode,
545                                       p_online_report_id,
546                                       x_sequence,
547                                       p_line_num, x_po_shipment_record.shipment_num, 0);
548       RAISE COPYDOC_SHIPMENT_FAILURE;
549   END;
550 
551   x_return_code := 0;
552   IF g_debug_stmt THEN               --< Shared Proc FPJ > Add correct debugging
553       PO_DEBUG.debug_end
554           (p_log_head => g_module_prefix||'validate_shipment');
555   END IF;
556 
557 EXCEPTION
558   WHEN COPYDOC_SHIPMENT_FAILURE THEN
559     x_return_code := -1;
560     IF g_debug_stmt THEN             --< Shared Proc FPJ > Add correct debugging
561         PO_DEBUG.debug_stmt
562             (p_log_head => g_module_prefix||'validate_shipment',
563              p_token    => l_progress,
564              p_message  => 'COPYDOC_SHIPMENT_FAILURE exception caught.');
565     END IF;
566   --< Shared Proc FPJ Start >
567   WHEN FND_API.g_exc_error THEN
568     PO_COPYDOC_S1.online_report
569         (x_online_report_id => p_online_report_id,
570          x_sequence         => x_sequence,
571          x_message          => FND_MESSAGE.get,
572          x_line_num         => p_line_num,
573          x_shipment_num     => x_po_shipment_record.shipment_num,
574          x_distribution_num => 0);
575     x_return_code := -1;
576     IF g_debug_stmt THEN
577         PO_DEBUG.debug_stmt
578             (p_log_head => g_module_prefix||'validate_shipment',
579              p_token    => l_progress,
580              p_message  => 'FND_API.g_exc_error caught.');
581     END IF;
582   --< Shared Proc FPJ End >
583   WHEN OTHERS THEN
584     po_copydoc_s1.copydoc_sql_error('validate_shipment', l_progress, sqlcode,
585                                     p_online_report_id,
586                                     x_sequence,
587                                     p_line_num, x_po_shipment_record.shipment_num, 0);
588     x_return_code := -1;
589     IF g_debug_unexp THEN            --< Shared Proc FPJ > Add correct debugging
590         PO_DEBUG.debug_exc
591             (p_log_head => g_module_prefix||'validate_shipment',
592              p_progress => l_progress);
593     END IF;
594 END validate_shipment;
595 --< Shared Proc FPJ End >
596 
597 END po_copydoc_s4;