DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_COPYDOC_S4

Source


4 --< Shared Proc FPJ Start >
1 PACKAGE BODY po_copydoc_s4 AS
2 /* $Header: POXCPO4B.pls 120.6 2011/01/13 17:55:29 yawang ship $*/
3 
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
126 
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
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 
207     /*Bug 9336785: Get the match_option value from the supplier site if its null
208       then get the value from the supplier set up if it is null then get the
209       value from the payables set up*/
210 
211     IF (l_vendor_site_id is NOT NULL) THEN
212        l_progress := '003';
213       SELECT match_option
214       INTO   l_invoice_match_option
215       FROM   po_vendor_sites
216       WHERE  vendor_site_id = l_vendor_site_id;
217     END IF;
218 
219     IF (l_invoice_match_option is NULL) THEN
220       IF (l_vendor_id is NOT NULL) THEN
221         l_progress := '004';
222         SELECT match_option
223         INTO   l_invoice_match_option
224         FROM   po_vendors
225         WHERE  vendor_id = l_vendor_id;
226       END IF;
227     END IF;
228 
229     IF (l_invoice_match_option is NULL) THEN
230        l_progress := '005';
231       SELECT match_option
232       INTO   l_invoice_match_option
233       FROM   financials_system_parameters;
234     END IF;
235 
236 
237     IF (l_quotation_class_code = 'CATALOG') THEN
238       x_po_shipment_record.inspection_required_flag := NULL;
239       x_po_shipment_record.receipt_required_flag := NULL;
240       x_po_shipment_record.qty_rcv_tolerance := NULL;
241       x_po_shipment_record.qty_rcv_exception_code := NULL;
242       x_po_shipment_record.shipment_type := 'PRICE BREAK';
243     ELSIF (l_quotation_class_code = 'BID') THEN
244       -- Bug 2761415 The following is now defaulted in the logic above.
245       --x_po_shipment_record.invoice_close_tolerance := NULL;
246       --x_po_shipment_record.receive_close_tolerance := NULL;
247 
248       /* depend on the type of PO, sets to the same */
249       x_po_shipment_record.shipment_type := p_to_doc_subtype;
250       -- bug896729:  bid quotation has only last_accept_date. convert
251       -- this to promised_date
252       x_po_shipment_record.promised_date := x_po_shipment_record.last_accept_date;
253       x_po_shipment_record.last_accept_date := NULL;
254       x_po_shipment_record.match_option := l_invoice_match_option;
255 --bug#2754766: only NULL out pb effective dates for Bid Quotations
256       x_po_shipment_record.start_date := NULL;
257       x_po_shipment_record.end_date := NULL;
258 
259       -- Bug 2750604. Copy these over at shipment level for bid quotations to
260       -- be consistent with GA FPI changes
261       IF (p_to_doc_subtype IN ('STANDARD', 'PLANNED')) THEN
262         x_po_shipment_record.from_header_id := l_orig_po_header_id;
263         x_po_shipment_record.from_line_id   := l_orig_po_line_id;
264       END IF;
265 
266     END IF;
267 
268     l_progress := '006';
269     x_po_shipment_record.accrue_on_receipt_flag := 'N';
270     x_po_shipment_record.encumber_now  := NULL;
271     x_po_shipment_record.fob_lookup_code := NULL;
272     x_po_shipment_record.freight_terms_lookup_code := NULL;
273 --bug#2754766: removed statement nulling out pb start/end dates.
274 --moved this up into the if block for Bid Quotations only.
275     x_po_shipment_record.lead_time := NULL;
276     x_po_shipment_record.lead_time_unit := NULL;
277     x_po_shipment_record.terms_id := NULL;
278     x_po_shipment_record.ship_via_lookup_code := NULL;
279 
280   END IF;
281 
282    /*  Functionality for PA->RFQ Copy : dreddy 1388111
283     shipment related fields are processed */
284    IF (p_action_code = 'RFQ') THEN
285     -- payment terms are defaulted from the header
286     begin
287 
288       SELECT terms_id,
289              ship_via_lookup_code,
290              fob_lookup_code,
291              freight_terms_lookup_code
292       INTO   l_terms_id,
293              l_ship_via_lookup_code,
294              l_fob,
295              l_freight_terms
296       FROM   po_headers
297       WHERE  po_header_id = l_orig_po_header_id ;
298 
299     exception
300       when others then
301        null;
302     end;
303 
304     -- quantity tolerence and exception code are defaulted from the system level.
305      begin
306 
307       SELECT rcv.qty_rcv_tolerance,
308              rcv.qty_rcv_exception_code
309       INTO   l_qty_tolerance,
310              l_qty_exception_code
311       FROM   rcv_parameters rcv,
312              financials_system_parameters fsp
313       WHERE  rcv.organization_id  = fsp.inventory_organization_id;
314 
315     exception
316       when others then
317        null;
318     end;
319 
320      -- match option is defaulted from the system level based on the receiving
321      -- and inspection flags
322      begin
323 
324       SELECT receiving_flag,
325              inspection_required_flag
326       INTO   l_rcv_flag,
327              l_insp_flag
328       FROM   po_system_parameters;
329 
330     exception
331       when others then
332        null;
333     end;
334 
335 
336     x_po_shipment_record.inspection_required_flag := NULL;
337     x_po_shipment_record.receipt_required_flag := NULL;
338     x_po_shipment_record.qty_rcv_tolerance := l_qty_tolerance;
339     x_po_shipment_record.qty_rcv_exception_code := l_qty_exception_code;
340     x_po_shipment_record.shipment_type := 'RFQ';
341     x_po_shipment_record.accrue_on_receipt_flag := 'N';
342     x_po_shipment_record.encumber_now  := NULL;
343     x_po_shipment_record.fob_lookup_code := l_fob;
344     x_po_shipment_record.freight_terms_lookup_code := l_freight_terms;
345     /* Bug 2695110.
346      * Comment out the following code which makes start_date and
347      * end_date to be null since we need to copy them over to RFQ.
348     x_po_shipment_record.start_date := NULL;
349     x_po_shipment_record.end_date := NULL;
350     */
351     x_po_shipment_record.lead_time := NULL;
352     x_po_shipment_record.lead_time_unit := NULL;
353     x_po_shipment_record.terms_id := l_terms_id;
354     x_po_shipment_record.ship_via_lookup_code := l_ship_via_lookup_code;
355     x_po_shipment_record.receipt_required_flag := l_rcv_flag;
356     x_po_shipment_record.inspection_required_flag := l_insp_flag;
357 
358     if not (p_copy_price) then
359       x_po_shipment_record.price_override := NULL;
360       x_po_shipment_record.price_discount := NULL;
361     end if;
362 
363   END IF;
364 
365   x_po_shipment_record.last_updated_by   := fnd_global.user_id;
366   x_po_shipment_record.last_update_date  := SYSDATE;
367   x_po_shipment_record.last_update_login := fnd_global.login_id;
368   x_po_shipment_record.created_by        := fnd_global.user_id;
369   x_po_shipment_record.creation_date     := SYSDATE;
370 
371   l_progress := '007';
372   -- if promised_date or need_by_date has already passed, set to sysdate
373   if (x_po_shipment_record.promised_date is not null) and
374      (x_po_shipment_record.promised_date < SYSDATE) then
375     --< NBD TZ/Timestamp FPJ Start >
376     --x_po_shipment_record.promised_date := trunc(SYSDATE);
377     x_po_shipment_record.promised_date := SYSDATE;
378     --< NBD TZ/Timestamp FPJ End >
379   end if;
380 
381   l_progress := '008';
382   if (x_po_shipment_record.need_by_date is not null) and
383      (x_po_shipment_record.need_by_date < SYSDATE) then
384     --< NBD TZ/Timestamp FPJ Start >
385     --x_po_shipment_record.need_by_date := trunc(SYSDATE);
386     x_po_shipment_record.need_by_date := SYSDATE;
387     --< NBD TZ/Timestamp FPJ End >
388   end if;
389 
390   -- in bid quotation, last_accept_date and need_by_date are not mandatory
391   -- fields.  However in PO, they are. so default trunc(sysdate) if both
392   -- fields are null.
393   l_progress := '009';
394 
395   /*Bug6851594 - Commented the following lines as this was setting the NEED-BY-DATE
396     to SYSDATE even when the there was no DATE populated for NEED-BY-DATE in original document*/
397 
398 /* Bug: 2825147 Populate need_by_date only for STANDARD and
399    PLANNED Purchase Orders */
400 
401  /* if (x_po_shipment_record.need_by_date is null) and
402 	(x_po_shipment_record.promised_date is null) and
403           (x_po_shipment_record.shipment_type in ('STANDARD','PLANNED'))then
404     --< NBD TZ/Timestamp FPJ Start >
405     --x_po_shipment_record.need_by_date := trunc(SYSDATE);
406     x_po_shipment_record.need_by_date := SYSDATE;
407     --< NBD TZ/Timestamp FPJ End >
408   end if; */
409 
410   --
411   -- <R12 eTax Integration>
412   -- Removed reference to ap ta(x) code table
413   --
414   x_po_shipment_record.tax_code_id := NULL;
415 
416   /* bug 1346241 : for standard and planned PO's the shipment price
417      should be same as the line price
418      this should not be done for a copy to RFQ  */
419      -- <Complex Work R12>: For complex work POs also, do not get
420      -- the price from the line.  It is on the payitem itself.
421    IF ((NOT p_is_complex_work_po) AND (p_action_code <> 'RFQ')) THEN
422     IF x_po_shipment_record.price_override is null
423       OR (p_to_doc_subtype in ('STANDARD','PLANNED')) THEN
424 
425        l_progress := '011';
426      begin
427        select unit_price
428        into l_price_from_line
429        from po_lines
430        where po_header_id = p_po_header_id
431        and po_line_id = p_po_line_id;
432      exception
433       when others then
434        null;
435      end;
436 
437      x_po_shipment_record.price_override := l_price_from_line;
438 
439     END IF;
440    END IF;
441 
442 
443     l_progress := '012';
444   -- Standard WHO columns, not inserted
445   x_po_shipment_record.program_application_id := NULL;
446   x_po_shipment_record.program_id             := NULL;
447   x_po_shipment_record.program_update_date    := NULL;
448   x_po_shipment_record.request_id             := NULL;
449 
450   x_po_shipment_record.cancelled_by  := NULL;
451   x_po_shipment_record.cancel_date   := NULL;
452   x_po_shipment_record.cancel_flag   := 'N';
453   x_po_shipment_record.cancel_reason := NULL;
454   x_po_shipment_record.closed_by     := NULL;
455   x_po_shipment_record.closed_code   := 'OPEN';
456   x_po_shipment_record.closed_date   := NULL;
457   x_po_shipment_record.closed_flag   := NULL;
458   x_po_shipment_record.closed_reason := NULL;
459 
460   x_po_shipment_record.approved_date := NULL;
461   x_po_shipment_record.approved_flag := 'N';
462 
463   x_po_shipment_record.po_release_id := NULL;
464 
465   x_po_shipment_record.po_header_id := p_po_header_id;
466   x_po_shipment_record.po_line_id   := p_po_line_id;
467 
468   x_po_shipment_record.unencumbered_quantity := NULL;
469   x_po_shipment_record.encumbered_date       := NULL;
470   x_po_shipment_record.encumbered_flag       := 'N';
471   x_po_shipment_record.quantity_accepted  := 0;
472   x_po_shipment_record.quantity_billed    := 0;
473   x_po_shipment_record.quantity_cancelled := 0;
474   x_po_shipment_record.quantity_received  := 0;
475   x_po_shipment_record.quantity_rejected  := 0;
476   x_po_shipment_record.quantity_shipped   := NULL;
477 
478   l_progress := '013';
479 
480   --< Shared Proc FPJ Start >
481   IF (p_to_doc_subtype = 'STANDARD') AND
482      (NVL(x_po_shipment_record.consigned_flag,'N') = 'N') AND
483      (NVL(x_po_shipment_record.accrue_on_receipt_flag, 'N') = 'Y') --<Shared Proc FPJ>
484   THEN
485 
486       l_progress := '014';
487 
488       -- Validate the ship-to org, and derive a transaction flow
489       PO_SHARED_PROC_PVT.validate_ship_to_org
490           (p_init_msg_list    => FND_API.g_false,
491            x_return_status    => l_return_status,
492            p_ship_to_org_id   => x_po_shipment_record.ship_to_organization_id,
493            p_item_category_id => p_item_category_id,
494            p_item_id          => p_item_id, -- Bug 3433867
495            x_is_valid         => l_is_valid,
496            x_in_current_sob   => l_in_current_sob,
497            x_check_txn_flow   => l_check_txn_flow,
498            x_transaction_flow_header_id => l_transaction_flow_header_id);
499 
500       IF (l_return_status <> FND_API.g_ret_sts_success) THEN
501           l_progress := '015';
502           FND_MESSAGE.set_encoded(encoded_message => FND_MSG_PUB.get);
503           RAISE FND_API.g_exc_error;
504       ELSIF (NOT l_is_valid) AND (NOT l_check_txn_flow) THEN
505           l_progress := '016';
506           -- This is an error because it is not allowable to use transaction
507           -- flows in this scenario, and validation failed.
508           FND_MESSAGE.set_name(application => 'PO',
509                                name => 'PO_INVALID_SHIP_TO_ORG');
510           RAISE FND_API.g_exc_error;
511       END IF;
512 
513       l_progress := '017';
514 
515       IF (l_transaction_flow_header_id IS NOT NULL) THEN
516 
517           -- A valid transaction flow was found, so set it here. If the new
518           -- flow is different than the original, new accounts will be
519           -- generated at the distributions level
520           x_po_shipment_record.transaction_flow_header_id :=
521               l_transaction_flow_header_id;
522 
523       ELSIF (x_po_shipment_record.transaction_flow_header_id IS NOT NULL)
524       THEN
525           l_progress := '018';
526 
527           -- Original PO had a txn flow, but no valid txn flow found now.
528           -- Only clear orig txn flow reference if the ship-to org is in the
529           -- current OU's SOB. Otherwise, just let it go so that it gets
530           -- caught downstream in the copydoc submission check.
531 
532           IF l_in_current_sob THEN
533               -- Remove txn flow reference, which will force new accounts
534               -- to be generated at the distribution level
535               x_po_shipment_record.transaction_flow_header_id := NULL;
536           END IF;
537 
538       END IF;  --< if txn flow header not null >
539 
540   END IF;  --< if STANDARD >
541   --< Shared Proc FPJ End >
542 
543   l_progress := '019';
544   BEGIN
545     SELECT po_line_locations_s.nextval
546     INTO   x_po_shipment_record.line_location_id
547     FROM   SYS.DUAL;
548   EXCEPTION
549     WHEN OTHERS THEN
550       x_po_shipment_record.line_location_id := NULL;
551       po_copydoc_s1.copydoc_sql_error('validate_shipment', l_progress, sqlcode,
552                                       p_online_report_id,
553                                       x_sequence,
554                                       p_line_num, x_po_shipment_record.shipment_num, 0);
555       RAISE COPYDOC_SHIPMENT_FAILURE;
556   END;
557 
558   x_return_code := 0;
559   IF g_debug_stmt THEN               --< Shared Proc FPJ > Add correct debugging
560       PO_DEBUG.debug_end
561           (p_log_head => g_module_prefix||'validate_shipment');
562   END IF;
563 
564 EXCEPTION
565   WHEN COPYDOC_SHIPMENT_FAILURE THEN
566     x_return_code := -1;
567     IF g_debug_stmt THEN             --< Shared Proc FPJ > Add correct debugging
568         PO_DEBUG.debug_stmt
569             (p_log_head => g_module_prefix||'validate_shipment',
570              p_token    => l_progress,
571              p_message  => 'COPYDOC_SHIPMENT_FAILURE exception caught.');
572     END IF;
573   --< Shared Proc FPJ Start >
574   WHEN FND_API.g_exc_error THEN
575     PO_COPYDOC_S1.online_report
576         (x_online_report_id => p_online_report_id,
577          x_sequence         => x_sequence,
578          x_message          => FND_MESSAGE.get,
579          x_line_num         => p_line_num,
580          x_shipment_num     => x_po_shipment_record.shipment_num,
581          x_distribution_num => 0);
582     x_return_code := -1;
583     IF g_debug_stmt THEN
584         PO_DEBUG.debug_stmt
585             (p_log_head => g_module_prefix||'validate_shipment',
586              p_token    => l_progress,
587              p_message  => 'FND_API.g_exc_error caught.');
588     END IF;
589   --< Shared Proc FPJ End >
590   WHEN OTHERS THEN
591     po_copydoc_s1.copydoc_sql_error('validate_shipment', l_progress, sqlcode,
592                                     p_online_report_id,
593                                     x_sequence,
594                                     p_line_num, x_po_shipment_record.shipment_num, 0);
595     x_return_code := -1;
596     IF g_debug_unexp THEN            --< Shared Proc FPJ > Add correct debugging
597         PO_DEBUG.debug_exc
598             (p_log_head => g_module_prefix||'validate_shipment',
599              p_progress => l_progress);
600     END IF;
601 END validate_shipment;
602 --< Shared Proc FPJ End >
603 
604 END po_copydoc_s4;