DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_COPYDOC_S3

Source


1 PACKAGE BODY po_copydoc_s3 AS
2 /* $Header: POXCPO3B.pls 120.10.12020000.8 2013/05/02 03:57:58 jictang ship $*/
3 
4 -- <INVCONV R12>
5 g_chktype_TRACKING_QTY_IND CONSTANT
6    MTL_SYSTEM_ITEMS_B.TRACKING_QUANTITY_IND%TYPE := 'PS';
7 
8 -- Private function prototypes
9 
10 PROCEDURE validate_line_type_id(
11   x_line_type_id        IN OUT NOCOPY  po_lines.line_type_id%TYPE,
12   x_wip_install_status  IN      VARCHAR2,
13   x_online_report_id    IN      po_online_report_text.online_report_id%TYPE,
14   x_sequence            IN OUT NOCOPY  po_online_report_text.sequence%TYPE,
15   x_line_num            IN      po_online_report_text.line_num%TYPE,
16   x_return_code         OUT NOCOPY     NUMBER
17 );
18 
19 PROCEDURE validate_trx_reason_code(
20   x_transaction_reason_code  IN OUT NOCOPY  po_lines.transaction_reason_code%TYPE,
21   x_online_report_id         IN      po_online_report_text.online_report_id%TYPE,
22   x_sequence                 IN OUT NOCOPY  po_online_report_text.sequence%TYPE,
23   x_line_num                 IN      po_online_report_text.line_num%TYPE,
24   x_return_code              OUT NOCOPY     NUMBER
25 );
26 -- End of Private function prototypes
27 
28 PROCEDURE validate_line_type_id(
29   x_line_type_id        IN OUT NOCOPY  po_lines.line_type_id%TYPE,
30   x_wip_install_status  IN      VARCHAR2,
31   x_online_report_id    IN      po_online_report_text.online_report_id%TYPE,
32   x_sequence            IN OUT NOCOPY  po_online_report_text.sequence%TYPE,
33   x_line_num            IN      po_online_report_text.line_num%TYPE,
34   x_return_code         OUT NOCOPY     NUMBER
35 ) IS
36 
37   x_progress    VARCHAR2(4);
38   x_valid_flag  VARCHAR2(2);
39 
40 BEGIN
41 
42   x_progress := '001';
43   SELECT distinct 'Y'
44   INTO   x_valid_flag
45   FROM   PO_LINE_TYPES
46   WHERE  line_type_id = x_line_type_id
47   AND    SYSDATE < nvl(inactive_date, SYSDATE+1)
48   AND    ((nvl(outside_operation_flag,'N') = 'Y' AND x_wip_install_status = 'I')
49           OR (nvl(outside_operation_flag, 'N') <> 'Y'));
50 
51   x_return_code := 0;
52 
53 EXCEPTION
54   WHEN NO_DATA_FOUND THEN
55     x_line_type_id := NULL;
56     po_copydoc_s1.online_report(x_online_report_id,
57                                 x_sequence,
58                                 'Invalid Line type',
59                                 x_line_num, 0, 0);
60     x_return_code := -1;
61   WHEN OTHERS THEN
62     x_line_type_id := NULL;
63     po_copydoc_s1.copydoc_sql_error('validate_line_type_id', x_progress, sqlcode,
64                                     x_online_report_id,
65                                     x_sequence,
66                                     x_line_num, 0, 0);
67     x_return_code := -1;
68 END validate_line_type_id;
69 
70 
71 
72 PROCEDURE validate_trx_reason_code(
73   x_transaction_reason_code  IN OUT NOCOPY  po_lines.transaction_reason_code%TYPE,
74   x_online_report_id         IN      po_online_report_text.online_report_id%TYPE,
75   x_sequence                 IN OUT NOCOPY  po_online_report_text.sequence%TYPE,
76   x_line_num                 IN      po_online_report_text.line_num%TYPE,
77   x_return_code              OUT NOCOPY     NUMBER
78 ) IS
79 
80   x_progress    VARCHAR2(4);
81   x_valid_flag  VARCHAR2(2);
82 
83 BEGIN
84 
85   IF (x_transaction_reason_code IS NULL) THEN
86     x_return_code := 0;
87     RETURN;
88   END IF;
89 
90 
91   SELECT distinct 'Y'
92   INTO   x_valid_flag
93   FROM   PO_LOOKUP_CODES
94   WHERE  lookup_type = 'TRANSACTION REASON'
95   AND    lookup_code = x_transaction_reason_code
96   AND    SYSDATE < nvl(inactive_date, SYSDATE+1);
97 
98   x_return_code := 0;
99 
100 EXCEPTION
101   WHEN NO_DATA_FOUND THEN
102     x_transaction_reason_code := NULL;
103     po_copydoc_s1.online_report(x_online_report_id,
104                                 x_sequence,
105                                 'Invalid Transaction reason code',
106                                 x_line_num, 0, 0);
107     x_return_code := 0;
108   WHEN OTHERS THEN
109     x_transaction_reason_code := NULL;
110     po_copydoc_s1.copydoc_sql_error('validate_trx_reason_code', x_progress, sqlcode,
111                                     x_online_report_id,
112                                     x_sequence,
113                                     x_line_num, 0, 0);
114     x_return_code := -1;
115 END validate_trx_reason_code;
116 
117 /*************************************************************
118  ** Initialize date info
119  ** Nullify some attributes which will be inserted from other places
120  ** Validate for correct line_type_id (may not need it ?)
121  ** Validate individual item on line
122  ** Validate transaction reason code
123  ** Get next po_line_id
124 *************************************************************/
125 PROCEDURE validate_line(
126   x_action_code         IN      VARCHAR2,
127   x_to_doc_subtype      IN      po_headers.type_lookup_code%TYPE,
128   x_po_line_record      IN OUT NOCOPY  po_lines%ROWTYPE,
129   x_orig_po_line_id     IN      po_lines.po_line_id%TYPE,
130   x_wip_install_status  IN      VARCHAR2,
131   x_sob_id              IN      financials_system_parameters.set_of_books_id%TYPE,
132   x_inv_org_id          IN      financials_system_parameters.inventory_organization_id%TYPE,
133   x_po_header_id        IN      po_lines.po_header_id%TYPE,
134   x_online_report_id    IN      po_online_report_text.online_report_id%TYPE,
135   x_sequence            IN OUT NOCOPY  po_online_report_text.sequence%TYPE,
136   x_copy_price          IN      BOOLEAN,
137   x_return_code         OUT NOCOPY     NUMBER,
138   p_is_complex_work_po  IN      BOOLEAN,    -- <Complex Work R12>
139   p_is_clm_doc          IN      VARCHAR2 DEFAULT 'N'--<Bug 14370174>
140 ) IS
141 
142   COPYDOC_LINE_FAILURE    EXCEPTION;
143   x_progress              VARCHAR2(4) := NULL;
144   x_internal_return_code  NUMBER := NULL;
145   x_quotation_class_code  VARCHAR2(10) := NULL;
146   x_orig_po_header_id     po_lines.po_header_id%TYPE := NULL;
147   x_qty                   po_lines.quantity%type := NULL;
148   x_blanket_price         po_lines.unit_price%type := NULL;
149   x_order_type_lookup_code po_line_types.order_type_lookup_code%type;
150 -- start of 1548597
151   x_secondary_qty         po_lines.secondary_quantity%type := NULL;
152   x_item_number           VARCHAR2(240);
153   x_process_org           VARCHAR2(1);
154   x_dummy     VARCHAR2(240);
155   x_product   VARCHAR2(3) := 'GMI';
156   x_opm_installed    VARCHAR2(1);
157   x_retvar    BOOLEAN;
158   ic_item_mst_rec IC_ITEM_MST%ROWTYPE;
159   ic_item_cpg_rec IC_ITEM_CPG%ROWTYPE;
160   x_order_opm_um          ic_item_mst.item_um%type := NULL;
161  -- end of 1548597
162 
163   x_quote_type  po_headers.type_lookup_code%type;
164   x_quote_sub_type  po_headers.quote_type_lookup_code%type;
165   --<INVCONV R12 START>
166   x_secondary_unit_fsp		MTL_UNITS_OF_MEASURE.UNIT_OF_MEASURE%TYPE;
167   x_secondary_uom_fsp		MTL_UNITS_OF_MEASURE.UOM_CODE%TYPE;
168   x_secondary_quantity_fsp	po_lines.quantity%type;
169   --<INVCONV R12 END>
170 
171   --Bug 16559524
172   x_valid_flag  VARCHAR2(2);
173   l_validate_flag   mtl_category_sets_v.validate_flag%TYPE;
174   l_category_set_id mtl_category_sets_v.category_set_id%TYPE;
175   --Bug 16559524
176 BEGIN
177 
178   po_copydoc_s1.copydoc_debug('validate_line()');
179 
180   /******  Unchanged Attributes
181   note_to_vendor
182   qty_rcv_tolerance
183   hazard_class_id
184   note_to_vendor
188   taxable_flag
185   over_tolerance_error_flag
186   unordered_flag
187   vendor_product_num
189   tax_code_id
190   type_1099 (what is this?)
191   attribute{1-15}
192   qc_grade (what is this?)
193   base_{uom, qty}
194   secondary_{uom, qty}
195   line_type_id
196   line_num
197   item_{id, revision, description}
198   category_id
199   unit_meas_lookup_code
200   unit_price
201   un_number_id
202   global_attribute{category, _1-20}
203   line_reference_num
204   project_id (?)
205   task_id (?)
206   ******/
207 
208   --Bug 16559524 Start
209   x_progress := '00';
210   --Bug 16690546
211   IF x_to_doc_subtype IN ('BLANKET','STANDARD','PLANNED') AND NVL(x_po_line_record.clm_info_flag, 'N') <> 'Y' THEN
212   --Bug 16690546
213     IF PO_DEBUG.is_debug_stmt_on THEN
214       PO_DEBUG.debug_stmt
215           ('po.plsql.PO_COPYDOC_S3.validate_line',
216            x_progress,
217            'category id is: '|| x_po_line_record.category_id);
218     END IF;
219 
220     BEGIN
221       BEGIN
222         SELECT validate_flag,
223                category_set_id
224         INTO   l_validate_flag,
225                l_category_set_id
226         FROM   MTL_DEFAULT_SETS_VIEW MDSV
227         WHERE  MDSV.functional_area_id = 2;
228         IF PO_DEBUG.is_debug_stmt_on THEN
229           PO_DEBUG.debug_stmt
230             ('po.plsql.PO_COPYDOC_S3.validate_line',
231              x_progress,
232              'category set id is: '|| l_category_set_id
233              || ', l_validate_flag: '||l_validate_flag);
234         END IF;
235       EXCEPTION
236         WHEN OTHERS THEN
237           l_validate_flag := 'N';
238           l_category_set_id := -1;
239       END;
240 
241       IF l_validate_flag = 'Y' THEN
242         SELECT distinct 'Y'
243         INTO   x_valid_flag
244         FROM   MTL_CATEGORY_SET_VALID_CATS MCSVC,
245                MTL_CATEGORIES_VL MCV
246         WHERE  MCSVC.category_id = x_po_line_record.category_id
247         AND    MCSVC.category_set_id = l_category_set_id
248         AND    MCV.category_id = MCSVC.category_id
249         AND    sysdate < nvl(MCV.disable_date, sysdate+1)
250         AND    MCV.enabled_flag = 'Y';
251       ELSE
252         SELECT distinct 'Y'
253         INTO   x_valid_flag
254         FROM   MTL_CATEGORIES_VL MCV
255         WHERE  MCV.category_id = x_po_line_record.category_id
256         AND    sysdate < nvl(MCV.disable_date, sysdate+1)
257         AND    MCV.enabled_flag = 'Y';
258       END IF;
259       IF PO_DEBUG.is_debug_stmt_on THEN
260         PO_DEBUG.debug_stmt
261           ('po.plsql.PO_COPYDOC_S3.validate_line',
262            x_progress,
263            'x_valid_flag is: '|| x_valid_flag);
264       END IF;
265     EXCEPTION
266       WHEN NO_DATA_FOUND THEN
267         IF PO_DEBUG.is_debug_stmt_on THEN
268           PO_DEBUG.debug_stmt
269             (p_log_head => 'validate_category',
270              p_token    => x_progress,
271              p_message  => 'category id is invalid: '|| x_po_line_record.category_id);
272         END IF;
273 
274         FND_MESSAGE.set_name('PO', 'PO_RI_INVALID_CATEGORY_ID');
275         PO_COPYDOC_S1.online_report(x_online_report_id,
276                                     x_sequence,
277                                     substr(fnd_message.get, 1, 240),
278                                     x_po_line_record.line_num, 0, 0);
279         x_return_code := -1;
280         RETURN;
281       WHEN OTHERS THEN
282         PO_COPYDOC_S1.copydoc_sql_error('validate_category',
283                                       x_progress,
284                                       sqlcode,
285                                       x_online_report_id,
286                                       x_sequence,
287                                       x_po_line_record.line_num, 0, 0);
288         x_return_code := -1;
289         RETURN;
290     END;
291   END IF;
292   --Bug 16559524 End
293 
294   /* store original info */
295   -- bug877084: don't need to override in po_lines
296 
297   SELECT po_header_id
298   INTO   x_orig_po_header_id
299   FROM   po_lines
300   WHERE  po_line_id = x_orig_po_line_id;
301 
302  /* 1780903 : When a bid quotation is copied to a standard or planned PO
303     we need to copy the quote reference to the PO . For this we copy the
304     from header and from line from the quote to the PO */
305 
306    select quote_type_lookup_code,
307           type_lookup_code
308    into x_quote_sub_type,
309         x_quote_type
310    from po_headers
311    where po_header_id = x_orig_po_header_id;
312 
313 --For Bug 13580685
314   --Allowing copy doc feature to copy the the quotation
315   --to the document created.
316  if x_quote_type = 'QUOTATION' and x_quote_sub_type IN ('BID','CATALOG','STANDARD')
317     and x_to_doc_subtype in ('STANDARD','PLANNED','BLANKET') then
318     x_po_line_record.from_header_id := x_orig_po_header_id;
319    x_po_line_record.from_line_id := x_orig_po_line_id;
320  end if;
321 
322 
323   IF (x_action_code in ('QUOTATION','RFQ')) THEN
324 /* It's the same for Blanket, Planned, or Standard PO */
325       SELECT quotation_class_code
326       INTO   x_quotation_class_code
327       FROM   po_headers
328       WHERE  po_header_id = x_orig_po_header_id;
329 
330       IF (x_quotation_class_code = 'CATALOG') THEN
331 
332          x_po_line_record.min_order_quantity := NULL;
333          x_po_line_record.max_order_quantity := NULL;
334          x_po_line_record.min_release_amount := NULL;
335          x_po_line_record.price_type_lookup_code := NULL;
336          x_po_line_record.market_price := NULL;
337          x_po_line_record.firm_status_lookup_code := 'N';
338          x_po_line_record.firm_date           := NULL;
339          x_po_line_record.contract_num        := NULL;
340          x_po_line_record.capital_expense_flag := 'N';
341 
342          -- bug3610606
343          -- We no longer set negotiated_by_preparer_flag to 'N' when
344          -- copying from catalog quotation
345          -- x_po_line_record.negotiated_by_preparer_flag := 'N';
346 
347          x_po_line_record.quantity_committed := NULL;
348          x_po_line_record.committed_amount   := NULL;
349          x_po_line_record.allow_price_override_flag := 'N';
350          x_po_line_record.quantity           := NULL;
351       END IF;
352   END IF;
353 
354 /*  Functionality for PA->RFQ Copy : dreddy
355     line related fields are processed */
356   IF (x_action_code = 'RFQ') THEN
357      -- based on the value of copy_price ,the price from
358      -- the blanket is either copied or left blank.
359      begin
360       SELECT unit_price
361       INTO   x_blanket_price
362       FROM   po_lines
363       WHERE  po_header_id = x_orig_po_header_id
364       AND    po_line_id = x_orig_po_line_id;
365      exception
366       when others then
367        x_blanket_price := null;
368      end;
369 
370      --Bug# 1567872
371      --togeorge 01/19/2001
372      --Select the order type and if it is 'AMOUNT' copy the price even
373      --if x_copy_price is 'FALSE'. Amount based line should always have a price 1.
374      x_progress := '001';
375      begin
376       SELECT order_type_lookup_code
377       INTO   x_order_type_lookup_code
378       FROM   po_line_types
379       WHERE  line_type_id = x_po_line_record.line_type_id;
380      exception
381       when others then
382        po_copydoc_s1.copydoc_sql_error('validate_line', x_progress, sqlcode,
383                                     x_online_report_id,
384                                     x_sequence,
385                                     x_po_line_record.line_num, 0, 0);
386        x_return_code := -1;
387      end;
388      --
389        if(x_copy_price) then
390            x_po_line_record.unit_price := x_blanket_price;
391        else
392        --Bug# 1567872
393        --togeorge 01/19/2001
394        --Select the order type and if it is 'AMOUNT' copy the price even
395        --if x_copy_price is 'FALSE'. Amount based line should always have a price 1.
396         if x_order_type_lookup_code = 'AMOUNT' then
397 	   x_po_line_record.unit_price := x_blanket_price; --which would be 1.
398         else
399           x_po_line_record.unit_price := NULL;
400 	end if;
401         --x_po_line_record.unit_price := NULL;
402        --
403        end if;
404   END IF;
405 
406   -- Bug 2694883. Copy the po line expiration date over from the original.
407 
408   -- We now use the expiration date as the assignment end date for std PO's for
409   -- service lines
410   -- so if the to document is std PO we null out the value otherwise copy over.
411 
412     IF (x_to_doc_subtype = 'STANDARD') THEN             -- SERVICES FPJ
413        x_po_line_record.expiration_date   := NULL;
414     END IF;
415 
416   -- SERVICES FPJ Start
417   -- Also for service lines we need to null out other contractor specific fields
418   x_po_line_record.contractor_first_name := NULL;
419   x_po_line_record.contractor_last_name  := NULL;
420 
421   -- As start date is mandatory we need to default it with some value.
422   -- We will be defaulting sysdate.
423   IF (x_to_doc_subtype = 'STANDARD') AND
424      x_po_line_record.start_date is not null THEN
425 
426      x_po_line_record.start_date     := trunc(sysdate); -- Bug 3266584
427 
428   END IF;
429 
430   -- SERVICES FPJ End
431 
432   x_po_line_record.last_updated_by   := fnd_global.user_id;
433   x_po_line_record.last_update_date  := SYSDATE;
434   x_po_line_record.last_update_login := fnd_global.login_id;
435   x_po_line_record.created_by        := fnd_global.user_id;
436   x_po_line_record.creation_date     := SYSDATE;
437 
438   -- Standard WHO columns, not inserted
439   x_po_line_record.program_application_id := NULL;
440   x_po_line_record.program_id             := NULL;
441   x_po_line_record.program_update_date    := NULL;
442   x_po_line_record.request_id             := NULL;
443 
444   validate_trx_reason_code(x_po_line_record.transaction_reason_code,
445                            x_online_report_id,
446                            x_sequence,
447                            x_po_line_record.line_num,
448                            x_internal_return_code);
449   IF (x_internal_return_code < 0) THEN
450     RAISE COPYDOC_LINE_FAILURE;
451   END IF;
452 
453   x_po_line_record.closed_by     := NULL;
454   x_po_line_record.closed_code   := NULL;
455   x_po_line_record.closed_date   := NULL;
456   x_po_line_record.closed_flag   := 'N';
457   x_po_line_record.closed_reason := NULL;
458 
459   x_po_line_record.cancelled_by  := NULL;
460   x_po_line_record.cancel_date   := NULL;
461   x_po_line_record.cancel_flag   := 'N';
462   x_po_line_record.cancel_reason := NULL;
463 
464   -- PO DBI FPJ ** Start
465   -- For Blanket, Standard and Planned the negotiated_by_preparer_flag should be
466   -- 'Y' at the time of copying quotation document.
467 
468   -- Bug 3602147: x_quote_sub_type should be either STANDARD or CATALOG
469   -- bug3610606: x_quote_sub_type can be 'BID' as well.
470 
471   IF x_to_doc_subtype IN ('BLANKET', 'STANDARD', 'PLANNED')
472     AND x_quote_sub_type IN ('STANDARD', 'CATALOG', 'BID') THEN
473 	--AND x_quote_sub_type NOT IN ('BLANKET', 'STANDARD', 'PLANNED') THEN
474 
475     x_po_line_record.negotiated_by_preparer_flag := 'Y';
476 
477   END IF;
478   -- PO DBI FPJ ** End
479 
480 
481   -- Should be obselete
482   x_po_line_record.user_hold_flag := NULL;
483 
484   /* bug 969442: when a po is cancelled the quantity on a line is modified.
485      so when copying from it the original quantity is not copied onto the po_line.
486      To fix this, the sum of the quantities from the shipment lines is copied
487      to the new po instead.and also the note to vendor field is nulled because
488      it is specific to a PO and also for a cancelled po case it contains the
489      reason for cancel. */
490   /* bug 1056086 : but when adding the shipment lines,we should not add the
491      release shipments . also if its a blanket PO copy null into the qty field
492      as quantity does not make sense for a blanket */
493 
494     IF (x_to_doc_subtype = 'BLANKET') THEN
495       --<Bug 14370174 Starts> Need to set the correct qty in case clm docs
496       IF (p_is_clm_doc = 'Y')
497       THEN
498         x_qty := x_po_line_record.quantity;
499       ELSE
500         x_qty := NULL;
501       END IF;
502       --<Bug 14370174 Ends>
503       x_secondary_qty := NULL;  --Bug 1548597
504 
505     ELSIF (x_po_line_record.order_type_lookup_code in ('QUANTITY','AMOUNT'))
506     THEN
507 
508       --<Complex Work R12 START>
509       IF (p_is_complex_work_po) THEN
510         --For the Quantity Milestone case, do not sum the line location
511         --quantities.
512         x_qty := x_po_line_record.quantity;
513         x_secondary_qty := NULL;
514       ELSE
515         -- Bug# 3842550 START
516         -- If line has no shipments resulting in null values for the sum of
517         -- quantities and secondary quantities of shipments, set them back to
518         -- their original values.
519         -- Note: The following issue has been resolved by this bug fix.
520         /* If Common Receiving is not installed the above sum of
521            secondary_Quantity will return a null. so we need to override it */
522 
523         select nvl(sum(poll.quantity), x_po_line_record.quantity)
524         into   x_qty
525         from   po_line_locations poll
526         where  poll.po_line_id = x_po_line_record.po_line_id
527         and    poll.po_release_id is null
528         and    poll.payment_type <> 'PREPAYMENT';  -- <Complex Work R12>
529 
530       END IF; --If Complex Work PO
531       --<Complex Work R12 END>
532 
533     END IF; --If Blanket or if Qty-based PO line
534 
535   --<INVCONV R12 START>
536   IF x_po_line_record.quantity <> x_qty THEN
537       X_po_line_record.secondary_quantity := NULL ;
538       X_po_line_record.secondary_unit_of_measure := NULL ;
539   END IF;
540   x_po_line_record.quantity := x_qty;
541 
542    -- calculate secondary quantity and UOM based on FSP org
543    -- <Complex Work R12>: Null out secondary qty/uom for complex work POs
544    IF ((NOT p_is_complex_work_po) AND
545           (x_to_doc_subtype in ('STANDARD','PLANNED','BLANKET'))) THEN
546        IF x_po_line_record.item_id is not null THEN
547            PO_UOM_S.get_secondary_uom( x_po_line_record.item_id,
548                                        x_inv_org_id,
549                                        X_secondary_uom_fsp,
550                                        X_secondary_unit_fsp);
551 
552      	   IF X_secondary_unit_fsp IS NOT NULL AND x_to_doc_subtype <> 'BLANKET' THEN
553               PO_UOM_S.uom_convert (x_po_line_record.quantity,x_po_line_record.unit_meas_lookup_code,
554                   x_po_line_record.item_id, x_secondary_unit_fsp, x_secondary_quantity_fsp) ;
555            END IF;
556            X_po_line_record.secondary_quantity := x_secondary_quantity_fsp ;
557            X_po_line_record.secondary_unit_of_measure := x_secondary_unit_fsp ;
558     	ELSE
559 	   X_po_line_record.secondary_quantity := NULL ;
560            X_po_line_record.secondary_unit_of_measure := NULL ;
561         END IF;
562    ELSE
563           X_po_line_record.secondary_quantity := NULL ;
564           X_po_line_record.secondary_unit_of_measure := NULL ;
565    END IF;
566 
567   --<INVCONV R12 END>
568 
569 /* Bug# 1523449  draising
570   While using 'Copy Document' functionality from
571   Quotation to PO  below line was nullifying the note_to_vendor field
572   in copied PO form. It shouldn't happen while copying from Quotation
573   to PO.Addded if condition that when x_action_code is 'QUOTATION' then
574   it will not nullify the note_to_vendor field  */
575 
576 IF (x_action_code <> 'QUOTATION') THEN
577   x_po_line_record.note_to_vendor := NULL;
578 END IF;
579 
580   x_po_line_record.po_header_id := x_po_header_id;
581 
582   x_progress := '001';
583   BEGIN
584     SELECT po_lines_s.nextval
585     INTO   x_po_line_record.po_line_id
586     FROM   SYS.DUAL;
587   EXCEPTION
588     WHEN OTHERS THEN
589       x_po_line_record.po_line_id := NULL;
590       po_copydoc_s1.copydoc_sql_error('validate_line', x_progress, sqlcode,
591                                       x_online_report_id,
592                                       x_sequence,
593                                       x_po_line_record.line_num, 0, 0);
594       RAISE COPYDOC_LINE_FAILURE;
595   END;
596 
597     -- Global Agreements (FP-I): Do not copy over Cumulative Price field.
598     --
599     IF ( PO_GA_PVT.is_global_agreement( x_po_line_record.po_header_id ) ) THEN
600 	x_po_line_record.price_break_lookup_code := NULL;
601     END IF;
602 
603     x_return_code := 0;
604     po_copydoc_s1.copydoc_debug('End: validate_line()');
605 
606 EXCEPTION
607   WHEN COPYDOC_LINE_FAILURE THEN
608     x_return_code := -1;
609   WHEN OTHERS THEN
610     po_copydoc_s1.copydoc_sql_error('validate_line', x_progress, sqlcode,
611                                     x_online_report_id,
612                                     x_sequence,
613                                     x_po_line_record.line_num, 0, 0);
614     x_return_code := -1;
615 END validate_line;
616 
617 
618 END po_copydoc_s3;
619