1 PACKAGE BODY Bom_Default_Bom_Component AS
2 /* $Header: BOMDCMPB.pls 120.3 2007/02/22 12:38:52 vhymavat ship $ */
3
4 /****************************************************************************
5 --
6 -- Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
7 -- All rights reserved.
8 --
9 -- FILENAME
10 --
11 -- BOMDCMPB.pls
12 --
13 -- DESCRIPTION
14 --
15 -- Body of package Bom_Default_Bom_Component
16 --
17 -- NOTES
18 --
19 -- HISTORY
20 -- 08-JUL-1999 Rahul Chitko Initial Creation
21 --
22 -- 31-AUG-01 Refai Farook One To Many support changes
23 --
24 -- 15-NOV-02 Anirban Dey Added Auto_Request_Material Defaulting
25 --
26 ****************************************************************************/
27
28 g_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type;
29 g_Rev_Comp_Unexp_Rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type;
30 x_text VARCHAR2(80);
31
32 /*******************************************************************
33 * Following are all get functions which will be used by the attribute
34 * defaulting procedure. Each column needing to be defaulted has one GET
35 * function.
36 ********************************************************************/
37
38
39 -- Added in 11.5.9 by ADEY
40
41 FUNCTION Get_Auto_Request_Material
42 RETURN VARCHAR2
43 IS
44 BEGIN
45
46 RETURN 'Y'; -- Return YES
47
48 END Get_Auto_Request_Material;
49
50
51 FUNCTION Get_Required_For_Revenue
52 RETURN NUMBER
53 IS
54 BEGIN
55
56 RETURN 2; -- Return FALSE which is 2
57
58 END Get_Required_For_Revenue;
59
60 FUNCTION Get_Component_Sequence
61 RETURN NUMBER
62 IS
63 CURSOR Comp_Seq IS
64 SELECT Bom_Inventory_Components_S.NEXTVAL Component_Sequence
65 FROM SYS.DUAL;
66 BEGIN
67
68 FOR c_Comp_Seq IN Comp_Seq LOOP
69 RETURN c_Comp_Seq.Component_Sequence;
70 END LOOP ;
71 RETURN NULL;
72 END Get_Component_Sequence;
73
74 -- Added by AS on 07/08 as part of adding unit effectivity capability
75 -- into the packages.
76
77 FUNCTION Get_To_End_Item_Number
78 RETURN VARCHAR2
79 IS
80 CURSOR c_To_End_Item_Number IS
81 SELECT To_End_Item_Unit_Number
82 FROM BOM_Inventory_Components
83 WHERE component_sequence_id =
84 g_rev_comp_unexp_rec.old_component_sequence_id;
85 BEGIN
86 FOR To_End_Item_Number IN c_To_End_Item_Number
87 LOOP
88 RETURN To_End_Item_Number.To_End_Item_Unit_Number;
89 END LOOP;
90 RETURN NULL;
91 END Get_To_End_Item_Number;
92
93 FUNCTION Get_Operation_Seq_Num
94 RETURN NUMBER
95 IS
96 BEGIN
97
98 RETURN 1;
99
100 END Get_Operation_Seq_Num;
101
102 FUNCTION Get_Item_Num
103 RETURN NUMBER
104 IS
105 p_Item_Seq_Increment NUMBER;
106 CURSOR GetItemSeq IS
107 SELECT nvl(max(item_num), 0) + P_Item_Seq_Increment default_seq
108 FROM bom_inventory_components
109 WHERE bill_sequence_id = g_rev_Comp_Unexp_rec.Bill_Sequence_Id;
110 BEGIN
111 p_Item_Seq_Increment :=
112 fnd_profile.value('BOM:ITEM_SEQUENCE_INCREMENT');
113
114 FOR l_Def_Item_Seq IN GetItemSeq LOOP
115 RETURN l_Def_Item_Seq.Default_Seq;
116 END LOOP;
117
118 -- If for some reason the For loop does not execute then default the
119 -- Item num to 10
120 RETURN 10;
121
122 END Get_Item_Num;
123
124 FUNCTION Get_Pick_Components
125 RETURN NUMBER
126 IS
127 l_pick_components NUMBER;
128 CURSOR GetPickComps IS
129 SELECT decode(pick_components_flag, 'Y', 1, 2) pick_comps
130 FROM mtl_system_items
131 WHERE inventory_item_id = g_rev_comp_Unexp_rec.component_item_id
132 AND organization_id = g_rev_comp_Unexp_rec.organization_id;
133 BEGIN
134
135 for pick_comps_loop in GetPickComps loop
136 l_pick_components := pick_comps_loop.pick_comps;
137 end loop;
138
139 RETURN (l_pick_components);
140 END Get_Pick_Components;
141
142 FUNCTION Get_Component_Quantity
143 RETURN NUMBER
144 IS
145 l_component_quantity NUMBER;
146 l_Structure_Type_Name VARCHAR2(30);
147 l_Assembly_Item_Id NUMBER;
148 l_Organization_Id NUMBER;
149 BEGIN
150 IF (g_rev_component_rec.inverse_quantity IS NOT NULL
151 AND g_rev_component_rec.inverse_quantity <> FND_API.G_MISS_NUM)
152 THEN
153 IF (g_rev_component_rec.inverse_quantity = 0)
154 THEN
155 l_component_quantity := 0;
156 ELSE
157 l_component_quantity := 1/g_rev_component_rec.inverse_quantity;
158 END IF;
159 ELSE
160 SELECT STRUCTURE_TYPE_NAME,
161 ASSEMBLY_ITEM_ID,
162 ORGANIZATION_ID
163 INTO
164 l_Structure_Type_Name,
165 l_Assembly_Item_Id,
166 l_Organization_Id
167 FROM BOM_STRUCTURE_TYPES_B STRUCT_TYPE,
168 BOM_STRUCTURES_B BOM_STRUCT
169 WHERE BOM_STRUCT.STRUCTURE_TYPE_ID = STRUCT_TYPE.STRUCTURE_TYPE_ID
170 AND BOM_STRUCT.BILL_SEQUENCE_ID = g_Rev_Comp_Unexp_Rec.BILL_SEQUENCE_ID;
171
172 IF (l_Structure_Type_Name ='Packaging Hierarchy') THEN
173 l_component_quantity := Bom_GTIN_Rules.Get_Suggested_Quantity(
174 p_organization_id => l_Organization_Id,
175 p_assembly_item_id => l_Assembly_Item_Id,
176 p_component_item_id => g_Rev_Comp_Unexp_Rec.Component_Item_Id);
177 ELSE
178 l_component_quantity := 1;
179 END IF;
180 END IF;
181
182 RETURN l_component_quantity;
183
184 END Get_Component_Quantity;
185
186 FUNCTION Get_Component_Yield_Factor
187 RETURN NUMBER
188 IS
189 BEGIN
190
191 RETURN 1;
192
193 END Get_Component_Yield_Factor;
194
195 FUNCTION Get_Effectivity_Date
196 RETURN DATE
197 IS
198 CURSOR c_EffectiveDate IS
199 SELECT scheduled_date
200 FROM eng_revised_items
201 WHERE revised_item_sequence_id =
202 g_Rev_Comp_Unexp_Rec.revised_item_sequence_id;
203 BEGIN
204
205 FOR x_EffectiveDate IN c_EffectiveDate LOOP
206 RETURN x_EffectiveDate.scheduled_date;
207 END LOOP;
208
209 RETURN SYSDATE;
210
211 END Get_Effectivity_Date;
212
213 FUNCTION Get_Planning_Factor
214 RETURN NUMBER
215 IS
216 BEGIN
217
218 RETURN 100;
219
220 END Get_Planning_Factor;
221
222 FUNCTION Get_Quantity_Related
223 RETURN NUMBER
224 IS
225 BEGIN
226 RETURN 2;
227
228 END Get_Quantity_Related;
229
230 FUNCTION Get_So_Basis
231 RETURN NUMBER
232 IS
233 BEGIN
234
235 RETURN 2;
236
237 END Get_So_Basis;
238
239 FUNCTION Get_Optional
240 RETURN NUMBER
241 IS
242 BEGIN
243
244 RETURN 2;
245
246 END Get_Optional;
247
248 FUNCTION Get_Mutually_Exclusive
249 RETURN NUMBER
250 IS
251 BEGIN
252
253 RETURN 2;
254
255 END Get_Mutually_Exclusive;
256
257 /**************************************************************
258 * If the item attribute Default_Include_In_Cost_Rollup IS NULL or
259 * Yes then Include_In_Cost_Rollup is YES (1)
260 * Else Include_In_Cost_Rollup is NO (2)
261 ***************************************************************/
262 FUNCTION Get_Include_In_Cost_Rollup
263 RETURN NUMBER
264 IS
265 CURSOR c_DefaultRollup is
266 SELECT default_include_in_rollup_flag
267 FROM mtl_system_items
268 WHERE inventory_item_id = g_Rev_Comp_Unexp_Rec.component_item_id
269 AND organization_id = g_Rev_Comp_Unexp_Rec.organization_id;
270 BEGIN
271
272 -- The default for this value comes from the Mtl_System_Items
273 -- Table field Default_Include_In_Rollup_Flag
274 FOR l_DefaultRollup in c_DefaultRollup LOOP
275 IF l_DefaultRollup.Default_include_in_rollup_flag
276 IS NULL OR
277 l_DefaultRollup.Default_include_in_rollup_flag = 'N'
278 THEN
279 RETURN 2;
280 ELSE
281 RETURN 1;
282 END IF;
283 END LOOP;
284
285 END Get_Include_In_Cost_Rollup;
286
287 /*********************************************************************
288 * If the Assembly item has ATP Components flag as yes and the component
289 * item attribute is Check_ATP yes then ECO can allow Check_ATP
290 * as YES (1) else Check_ATP is NO (2)
291 * Bug 2820312,2243418: Defaulting the component's ATP value from items is
292 * not dependent on the assembly (commented the ATP check on assembly)
293 **********************************************************************/
294
295 FUNCTION Get_Check_Atp
296 RETURN NUMBER
297 IS
298 CURSOR c_CheckATP IS
299 SELECT 1 atp_allowed
300 FROM mtl_system_items assy,
301 mtl_system_items comp
302 WHERE assy.organization_id=g_Rev_Comp_Unexp_Rec.organization_id
303 AND assy.inventory_item_id= g_Rev_Comp_Unexp_Rec.Revised_item_id
304 --AND assy.atp_components_flag = 'Y'
305 AND comp.organization_id = g_Rev_Comp_Unexp_Rec.organization_id
306 AND comp.inventory_item_id =
307 g_Rev_Comp_Unexp_Rec.component_item_id
308 AND comp.atp_flag IN ( 'Y', 'C', 'R');
309
310 BEGIN
311
312 FOR CheckAtp IN c_CheckATP LOOP
313 IF CheckAtp.atp_allowed = 1 THEN
314 RETURN 1;
315 ELSE
316 RETURN 2;
317 END IF;
318 END LOOP;
319
320 RETURN 2; -- If no records are retrived.
321 END Get_Check_Atp;
322
323 FUNCTION Get_Shipping_Allowed
324 RETURN NUMBER
325 IS
326 BEGIN
327
328 RETURN 2;
329
330 END Get_Shipping_Allowed;
331
332 FUNCTION Get_Required_To_Ship
333 RETURN NUMBER
334 IS
335 BEGIN
336
337 RETURN 2;
338
339 END Get_Required_To_Ship;
340
341 FUNCTION Get_Include_On_Ship_Docs
342 RETURN NUMBER
343 IS
344 BEGIN
345
346 RETURN 2;
347
348 END Get_Include_On_Ship_Docs;
349
350 FUNCTION get_bom_item_type
351 RETURN NUMBER
352 IS
353 l_bom_item_type NUMBER;
354 BEGIN
355 SELECT bom_item_type
356 INTO l_bom_item_type
357 FROM mtl_system_items msi
358 WHERE msi.inventory_item_id =
359 g_Rev_Comp_Unexp_rec.component_item_id
360 AND msi.organization_id = g_Rev_Comp_Unexp_rec.organization_id;
361
362 RETURN l_bom_item_type;
363
364 END;
365
366 FUNCTION get_unit_price
367 RETURN NUMBER
368 IS
369 l_unit_price NUMBER;
370 BEGIN
371 SELECT list_price_per_unit
372 INTO l_unit_price
373 FROM mtl_system_items msi
374 WHERE msi.inventory_item_id =
375 g_Rev_Comp_Unexp_rec.component_item_id
376 AND msi.organization_id = g_Rev_Comp_Unexp_rec.organization_id
377 AND msi.inventory_item_flag = 'Y' --- to check whether this is a direct item
378 AND msi.stock_enabled_flag = 'N'
379 AND msi.eam_item_type is NOT NULL; -- to check if it is an eAM item
380
381 RETURN l_unit_price;
382 EXCEPTION WHEN NO_DATA_FOUND THEN
383 RETURN NULL;
384 END;
385
386 /*******************************************************************
387 * Check if revised_item has a bill_sequence_id.
388 * If it does then retun that as the default value, if not then
389 * generate the Bill_Sequence_Id from the Sequence.
390 **********************************************************************/
391 FUNCTION Get_Bill_Sequence
392 RETURN NUMBER
393 IS
394 CURSOR c_CheckForNew IS
395 SELECT Bill_Sequence_Id
396 FROM bom_bill_of_materials bom
397 WHERE bom.assembly_item_id =
398 g_Rev_Comp_Unexp_Rec.revised_item_id
399 AND bom.organization_id =
400 g_Rev_Comp_Unexp_Rec.organization_id
401 AND NVL(bom.alternate_bom_designator, 'NONE') =
402 NVL(g_rev_component_rec.alternate_bom_code, 'NONE');
403
404 CURSOR c_CheckBillInRevisedItem IS
405 SELECT bill_sequence_id
406 FROM eng_revised_items
407 WHERE revised_item_sequence_id =
408 g_rev_comp_unexp_rec.revised_item_sequence_id;
409
410 l_bill_sequence_id NUMBER;
411 BEGIN
412
413 FOR CheckBill IN c_CheckBillInRevisedItem LOOP
414 IF CheckBill.Bill_Sequence_Id IS NOT NULL THEN
415 l_Bill_Sequence_Id :=
416 CheckBill.Bill_Sequence_Id;
417 RETURN l_Bill_Sequence_Id;
418 END IF;
419 END LOOP;
420
421 --
422 -- If bill sequence id is not found in Eng_Revised_Items
423 -- Only then go to the Bom Table to look for Bill_Sequence_Id
424 --
425 OPEN c_CheckForNew;
426 FETCH c_CheckForNew INTO l_bill_sequence_id;
427 CLOSE c_CheckForNew;
428
429 IF l_Bill_Sequence_Id IS NULL
430 THEN
431 SELECT BOM_INVENTORY_COMPONENTS_S.NextVal
432 INTO l_Bill_Sequence_Id
433 FROM SYS.DUAL;
434
435 RETURN l_Bill_Sequence_id;
436 ELSE
437 Return l_bill_sequence_id;
438
439 END IF;
440 END;
441
442 PROCEDURE Get_Flex_Rev_Component
443 IS
444 BEGIN
445
446 -- In the future call Flex APIs for defaults
447
448 IF g_rev_component_rec.attribute_category = FND_API.G_MISS_CHAR THEN
449 g_rev_component_rec.attribute_category := NULL;
450 END IF;
451
452 IF g_rev_component_rec.attribute1 = FND_API.G_MISS_CHAR THEN
453 g_rev_component_rec.attribute1 := NULL;
454 END IF;
455
456 IF g_rev_component_rec.attribute2 = FND_API.G_MISS_CHAR THEN
457 g_rev_component_rec.attribute2 := NULL;
458 END IF;
459
460 IF g_rev_component_rec.attribute3 = FND_API.G_MISS_CHAR THEN
461 g_rev_component_rec.attribute3 := NULL;
462 END IF;
463
464 IF g_rev_component_rec.attribute4 = FND_API.G_MISS_CHAR THEN
465 g_rev_component_rec.attribute4 := NULL;
466 END IF;
467
468 IF g_rev_component_rec.attribute5 = FND_API.G_MISS_CHAR THEN
469 g_rev_component_rec.attribute5 := NULL;
470 END IF;
471
472 IF g_rev_component_rec.attribute6 = FND_API.G_MISS_CHAR THEN
473 g_rev_component_rec.attribute6 := NULL;
474 END IF;
475
476 IF g_rev_component_rec.attribute7 = FND_API.G_MISS_CHAR THEN
477 g_rev_component_rec.attribute7 := NULL;
478 END IF;
479
480 IF g_rev_component_rec.attribute8 = FND_API.G_MISS_CHAR THEN
481 g_rev_component_rec.attribute8 := NULL;
482 END IF;
483
484 IF g_rev_component_rec.attribute9 = FND_API.G_MISS_CHAR THEN
485 g_rev_component_rec.attribute9 := NULL;
486 END IF;
487
488 IF g_rev_component_rec.attribute10 = FND_API.G_MISS_CHAR THEN
489 g_rev_component_rec.attribute10 := NULL;
490 END IF;
491
492 IF g_rev_component_rec.attribute11 = FND_API.G_MISS_CHAR THEN
493 g_rev_component_rec.attribute11 := NULL;
494 END IF;
495
496 IF g_rev_component_rec.attribute12 = FND_API.G_MISS_CHAR THEN
497 g_rev_component_rec.attribute12 := NULL;
498 END IF;
499
500 IF g_rev_component_rec.attribute13 = FND_API.G_MISS_CHAR THEN
501 g_rev_component_rec.attribute13 := NULL;
502 END IF;
503
504 IF g_rev_component_rec.attribute14 = FND_API.G_MISS_CHAR THEN
505 g_rev_component_rec.attribute14 := NULL;
506 END IF;
507
508 IF g_rev_component_rec.attribute15 = FND_API.G_MISS_CHAR THEN
509 g_rev_component_rec.attribute15 := NULL;
510 END IF;
511
512 END Get_Flex_Rev_Component;
513
514
515 /********************************************************************
516 * Function : Get_EnforceInteger_Value
517 * Returns : VARCHAR2
518 * Purpose : Will convert the value of enforce integer requirements code
519 * into enforce integer requirements value
520 * If the conversion fails then the function will return
521 * a NULL otherwise will return the code.
522 * For an unexpected error function will return a
523 * missing value.
524 *********************************************************************/
525 FUNCTION Get_EnforceInteger_Value
526 ( p_enforce_integer IN NUMBER)
527 RETURN VARCHAR2
528 IS
529 l_enforce_int_reqvalue varchar2(80);
530 BEGIN
531 SELECT meaning INTO l_enforce_int_reqvalue FROM mfg_lookups WHERE
532 lookup_type = 'BOM_ENFORCE_INT_REQUIREMENTS' AND
533 lookup_code = p_enforce_integer;
534 Return l_enforce_int_reqvalue;
535 EXCEPTION WHEN OTHERS THEN
536 Return NULL;
537 END;
538
539
540
541 /********************************************************************
542 * Parameters IN : Revised component exposed column record
543 * Revised Component unexposed column record
544 * Parameters OUT: Revised Component record after defaulting
545 * Revised component unexposed columns record
546 * Mesg Token Table
547 * Return_Status
548 * Purpose : Attribute defaulting proc. defualts columns to
549 * appropriate values. Defualting will happen for
550 * exposed as well as unexposed columns.
551 *********************************************************************/
552 PROCEDURE Attribute_Defaulting
553 ( p_rev_component_rec IN Bom_Bo_Pub.Rev_Component_Rec_Type
554 , p_Rev_Comp_Unexp_Rec IN Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
555 , p_control_rec IN Bom_Bo_Pub.Control_Rec_Type
556 := Bom_Bo_Pub.G_DEFAULT_CONTROL_REC
557 , x_rev_component_rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Component_Rec_Type
558 , x_Rev_Comp_Unexp_Rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
559 , x_Mesg_Token_Tbl IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
560 , x_Return_Status IN OUT NOCOPY VARCHAR2
561 )
562 IS
563 l_pick_components NUMBER := 0;
564 l_to_end_item_unit_number VARCHAR2(30) := NULL;
565 l_Mesg_Token_Tbl Error_Handler.Mesg_Token_Tbl_Type;
566 l_Token_Tbl Error_Handler.Token_Tbl_Type;
567 l_default_wip_values NUMBER;
568 l_assy_item_type NUMBER; --* Added for Bug 4568522
569 CURSOR default_wip_values IS
570 SELECT wip_supply_type,
571 wip_supply_subinventory,
572 wip_supply_locator_id
573 FROM mtl_system_items
574 WHERE inventory_item_id = p_rev_comp_unexp_rec.component_item_id
575 AND organization_id = p_rev_comp_unexp_rec.organization_id;
576 BEGIN
577
578 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Within the Rev. Component Defaulting...'); END IF;
579
580 -- Initialize package global records
581
582 g_rev_component_rec := p_rev_component_rec;
583 g_Rev_Comp_Unexp_Rec := p_Rev_Comp_Unexp_Rec;
584
585 x_return_status := fnd_api.g_ret_sts_success;
586
587 -- Get the profile value which indicates whether
588 -- wip values should be defaulted from those that of an
589 -- item.
590 l_default_wip_values := fnd_profile.value('BOM:DEFAULT_WIP_VALUES');
591
592 -- Default missing attributes.
593
594
595 /***********************************************************
596 --
597 -- Default Component_Sequence_Id
598 --
599 ***********************************************************/
600 IF g_Rev_Comp_Unexp_Rec.component_sequence_id IS NULL OR
601 g_Rev_Comp_Unexp_Rec.component_sequence_id = FND_API.G_MISS_NUM
602 THEN
603 g_Rev_Comp_Unexp_Rec.component_sequence_id :=
604 Get_Component_Sequence;
605 END IF;
606
607 /*************************************************************
608 --
609 -- Default Bill_Sequence_Id
610 --
611 **************************************************************/
612
613 IF g_Rev_Comp_Unexp_rec.bill_sequence_id IS NULL THEN
614
615 g_Rev_Comp_Unexp_Rec.bill_sequence_id :=
616 get_bill_sequence;
617 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Generated Bill Sequence_id...' || to_char(g_rev_comp_Unexp_rec.bill_sequence_id)); END IF;
618 END IF;
619
620 /*********************************************************
621 --
622 -- Default Required_For_Revenue
626 IF g_rev_component_rec.required_for_revenue IS NULL THEN
623 --
624 ***********************************************************/
625
627
628 g_rev_component_rec.required_for_revenue :=
629 Get_Required_For_Revenue;
630 END IF;
631
632 /************************************************************
633 --
634 -- Default To_End_Item_Unit_Number
635 --
636 ************************************************************/
637
638 IF NVL(g_rev_component_rec.acd_type, FND_API.G_MISS_NUM) = 3 AND
639 g_rev_comp_unexp_rec.old_component_sequence_id IS NOT NULL AND
640 ((p_control_rec.caller_type = 'FORM' AND
641 p_control_rec.unit_controlled_item)
642 OR
643 p_control_rec.caller_type <> 'FORM')
644 THEN
645 -- Log warning if to_end_item_unit_number is being overwritten
646 -- Added warning and code to overwrite unit number
647 -- on 11/17/99 (By AS - to accomodate call from ECO form)
648
649 l_to_end_item_unit_number :=
650 Get_To_End_Item_Number;
651
652 IF (NVL(g_rev_component_rec.to_end_item_unit_number,
653 FND_API.G_MISS_CHAR) <>
654 NVL(l_to_end_item_unit_number, FND_API.G_MISS_CHAR))
655 AND l_to_end_item_unit_number IS NOT NULL
656 THEN
657 l_Token_Tbl(1).Token_Name := 'REVISED_COMPONENT_NAME';
658 l_Token_Tbl(1).Token_Value := g_rev_component_rec.component_item_name;
659 Error_Handler.Add_Error_Token
660 ( p_Message_Name => 'BOM_COMP_END_UNIT_OVERWRITTEN'
661 , p_Mesg_Token_Tbl => l_mesg_token_tbl
662 , x_Mesg_Token_Tbl => l_mesg_token_tbl
663 , p_Token_Tbl => l_token_tbl
664 , p_Message_Type => 'W'
665 );
666 END IF;
667
668 g_rev_component_rec.to_end_item_unit_number :=
669 l_to_end_item_unit_number;
670 END IF;
671
672 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting to_end_item_unit_num..'); END IF;
673
674 --* Added for Bug 4568522
675 SELECT Bom_Item_Type
676 INTO l_assy_item_type
677 FROM Mtl_system_items_b
678 WHERE organization_id = g_Rev_Comp_Unexp_Rec.organization_id
679 AND inventory_item_id= g_Rev_Comp_Unexp_Rec.Revised_item_id;
680 --* End of Bug 4568522
681
682 /************************************************************
683 --
684 -- Default Item_Num
685 --
686 *************************************************************/
687
688 -- Put in extra check for acd_type in order to handle records
689 -- that come in thru the ECO form
690 -- By AS on 07/28/99
691 -- Added an OR condition so that the defaulting happens for BOM
692 -- BO as well, since ACD_type is null when coming thru BOM - By RC
693
694 IF ( g_rev_component_rec.acd_type IS NOT NULL AND
695 g_rev_component_rec.acd_type <> FND_API.G_MISS_NUM
696 ) OR
697 Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_BOM_BO
698 THEN
699
700 /************************************************************
701 --
702 -- Default Item_Num
703 --
704 *************************************************************/
705
706 IF ((g_rev_component_rec.item_sequence_number IS NULL) OR
707 (g_rev_component_rec.item_sequence_number =
708 fnd_api.g_miss_num))
709 AND l_assy_item_type <> Bom_Globals.G_PRODUCT_FAMILY --* Added for Bug 4568522
710 THEN
711
712 g_rev_component_rec.item_sequence_number :=
713 Get_Item_Num;
714
715 --* Added for Bug 4568522
716 ELSE
717 IF l_assy_item_type = Bom_Globals.G_PRODUCT_FAMILY THEN
718 g_rev_component_rec.item_sequence_number := 1;
719 END IF;
720 END IF;
721 --* End of Bug 4568522
722
723 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting item num . . . '); END IF;
724
725 /**********************************************************
726 --
727 -- Default Operation_Seq_Num
728 --
729 ***********************************************************/
730
731 IF g_rev_component_rec.operation_sequence_number IS NULL THEN
732
733 g_rev_component_rec.operation_sequence_number :=
734 Get_Operation_Seq_Num;
735 END IF;
736
737 --
738 -- make sure that new_operation_sequence is set to null if the
739 -- has not entered any value.
740 --
741 IF g_rev_component_rec.new_operation_sequence_number = FND_API.G_MISS_NUM
742 THEN
743 g_rev_component_rec.new_operation_sequence_number := null;
744 END IF;
745
746 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting operation seq num...'); END IF;
747
748 IF g_rev_component_rec.acd_type = 3 AND
749 g_rev_component_rec.disable_date IS NULL
750 THEN
751 g_rev_component_rec.disable_date :=
752 g_rev_component_rec.start_effective_date;
756 END IF;
753 END IF;
754
755 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting disable_date...'); END IF;
757
758 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting operation seq num...'); END IF;
759
760 /************************************************************
761 --
762 -- Default Component_Quantity
763 --
764 *************************************************************/
765
766 IF g_rev_component_rec.quantity_per_assembly IS NULL
767 THEN
768 g_rev_component_rec.quantity_per_assembly :=
769 Get_Component_Quantity;
770 /* Commented as part of bug#3310077.
771 ELSIF g_rev_component_rec.quantity_per_assembly <> FND_API.G_MISS_NUM THEN -- added for bug 2442791
772 g_rev_component_rec.quantity_per_assembly :=
773 round(g_rev_component_rec.quantity_per_assembly, 7);
774 */
775 END IF;
776
777 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting component qunatity...'); END IF;
778
779 /************************************************************
780 --
781 -- Default Pick_Components
782 --
783 *************************************************************/
784
785 IF g_Rev_Comp_Unexp_Rec.pick_components IS NULL OR
786 g_rev_comp_unexp_rec.pick_components = FND_API.G_MISS_NUM
787 THEN
788 g_Rev_Comp_Unexp_Rec.pick_components :=
789 Get_Pick_Components;
790 END IF;
791
792 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting pick components . . .'); END IF;
793
794 /*************************************************************
795 --
796 -- Default Effectivity Date
797 --
798 **************************************************************/
799
800 IF g_rev_component_rec.start_effective_date IS NULL THEN
801
802 g_rev_component_rec.start_effective_date :=
803 Get_Effectivity_Date;
804 END IF;
805
806 /*
807 IF Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_BOM_BO
808 THEN
809 IF trunc(g_rev_component_rec.start_effective_date) = trunc(SYSDATE)
810 AND g_rev_component_rec.start_effective_date < SYSDATE
811 THEN
812 g_rev_component_rec.start_effective_date := SYSDATE;
813 END IF;
814 END IF;
815 */
816
817 /*************************************************************
818 --
819 -- Default Disable Date
820 --
821 **************************************************************/
822 IF g_rev_component_rec.disable_date = FND_API.G_MISS_DATE THEN
823 g_rev_component_rec.disable_date := NULL;
824 END IF;
825
826 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After Effectivity Defaulted . . .'); END IF;
827
828 /************************************************************
829 --
830 -- Default Planning Factor (Planning_Percent)
831 --
832 **************************************************************/
833
834 IF g_rev_component_rec.planning_percent IS NULL THEN
835
836 g_rev_component_rec.planning_percent :=
837 Get_Planning_Factor;
838 END IF;
839
840 /*************************************************************
841 --
842 -- Default Quantity Related
843 --
844 **************************************************************/
845
846 IF g_rev_component_rec.quantity_related IS NULL THEN
847
848 g_rev_component_rec.quantity_related :=
849 Get_Quantity_Related;
850 END IF;
851
852 /*************************************************************
853 --
854 -- Default SO_Basis
855 --
856 **************************************************************/
857 IF g_rev_component_rec.so_basis IS NULL THEN
858 g_rev_component_rec.so_basis := Get_So_Basis;
859 END IF;
860
861 /*************************************************************
862 --
863 -- Default Optional
864 --
865 **************************************************************/
866 IF g_rev_component_rec.optional IS NULL THEN
867 g_rev_component_rec.optional := Get_Optional;
868 END IF;
869
870 /*************************************************************
871 --
872 -- Default Mutually_Exclusive_Options (Mutually_Exclusive)
873 --
874 **************************************************************/
875 IF g_rev_component_rec.mutually_exclusive IS NULL THEN
876
877 g_rev_component_rec.mutually_exclusive :=
878 Get_Mutually_Exclusive;
879 END IF;
880
881 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After Mutually Exclusive defualting...'); END IF;
882
883
884 -- Added extra IF condition for component_item_id to accomodate
885 -- records that come in thru the ECO form.
886 -- By AS on 07/28/99
887
888 IF g_rev_comp_unexp_rec.component_item_id IS NOT NULL AND
889 g_rev_comp_unexp_rec.component_item_id <> FND_API.G_MISS_NUM
890 THEN
891
895 --
892 /************************************************************
893 --
894 -- Default Include_In_Cost_Rollup
896 *************************************************************/
897
898 IF g_rev_component_rec.include_in_cost_rollup IS NULL
899 THEN
900 g_rev_component_rec.include_in_cost_rollup :=
901 Get_Include_In_Cost_Rollup;
902 END IF;
903
904 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After include in cost rollup defualting . . . '); END IF;
905
906 /***********************************************************
907 --
908 -- Default Check_ATP
909 --
910 *************************************************************/
911
912 IF g_rev_component_rec.check_atp IS NULL
913 THEN
914 g_rev_component_rec.check_atp := Get_Check_Atp;
915 END IF;
916
917 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After Check ATP Defualted . . . '); END IF;
918
919 IF g_rev_comp_Unexp_rec.bom_item_type IS NULL OR
920 g_rev_comp_unexp_rec.bom_item_type = FND_API.G_MISS_NUM
921 THEN
922 g_rev_comp_Unexp_rec.bom_item_type := get_bom_item_type;
923 END IF;
924
925 /***********************************************************
926 --
927 -- Default Component_Yield_Factor (Projected_Yield)
928 --
929 ************************************************************/
930
931 IF g_rev_component_rec.projected_yield IS NULL THEN
932
933 g_rev_component_rec.projected_yield :=
934 Get_Component_Yield_Factor;
935 END IF;
936
937 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('After defaulting component yeild factor . . .'); END IF;
938
939 END IF;
940
941 -- Defaulting used by the ECO form
942 -- Added by AS on 07/29/99
943
944 IF g_rev_comp_unexp_rec.component_item_id IS NULL OR
945 g_rev_comp_unexp_rec.component_item_id = FND_API.G_MISS_NUM
946 THEN
947 g_rev_component_rec.check_atp := 2;
948 END IF;
949
950 /************************************************************
951 --
952 -- Default Shipping Allowed
953 --
954 **************************************************************/
955 IF g_rev_component_rec.shipping_allowed IS NULL THEN
956 g_rev_component_rec.shipping_allowed :=
957 Get_Shipping_Allowed;
958 END IF;
959
960 /*************************************************************
961 --
962 -- Default Required_To_Ship
963 --
964 **************************************************************/
965 IF g_rev_component_rec.required_to_ship IS NULL THEN
966 g_rev_component_rec.required_to_ship :=
967 Get_Required_To_Ship;
968 END IF;
969
970 /*************************************************************
971 --
972 -- Default Include_On_Ship_Docs
973 --
974 **************************************************************/
975 IF g_rev_component_rec.include_on_ship_docs IS NULL THEN
976 g_rev_component_rec.include_on_ship_docs :=
977 Get_Include_On_Ship_Docs;
978 END IF;
979
980 /*************************************************************
981 --
982 -- Default Supply Subinventory
983 -- If the user is trying to NULL to subinventory, then NULL out
984 -- Supply Locator also.
985 --
986 **************************************************************/
987 IF g_rev_component_rec.supply_subinventory =
988 FND_API.G_MISS_CHAR THEN
989 g_rev_component_rec.supply_subinventory := NULL;
990 g_Rev_Comp_Unexp_Rec.Supply_Locator_Id := NULL;
991 END IF;
992
993 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Subinventory . . . ' || g_rev_component_rec.supply_subinventory ); END IF;
994
995
996 /*********************************************************
997 --
998 -- Default Auto_Request_Material
999 -- Added in 11.5.9 by ADEY
1000 ***********************************************************/
1001
1002 IF (g_rev_component_rec.auto_request_material IS NULL
1003 OR g_rev_component_rec.auto_request_material = FND_API.G_MISS_CHAR)
1004 AND l_assy_item_type <> Bom_Globals.G_PRODUCT_FAMILY --* Added for Bug 4568522
1005 THEN
1006
1007 g_rev_component_rec.auto_request_material :=
1008 Get_Auto_Request_Material;
1009
1010 --* Added for Bug 4568522
1011 ELSE
1012 IF l_assy_item_type = Bom_Globals.G_PRODUCT_FAMILY THEN
1013 g_rev_component_rec.auto_request_material := NULL;
1014 END IF;
1015 --* End of Bug 4568522
1016
1017 END IF;
1018
1019 /*************************************************************
1020 --
1024
1021 -- Default Unit_Price for direct items
1022 --
1023 **************************************************************/
1025 IF g_rev_component_rec.Unit_Price IS NULL
1026 OR g_rev_component_rec.Unit_Price = FND_API.G_MISS_NUM THEN
1027 g_rev_component_rec.Unit_Price := get_unit_price;
1028 END IF;
1029
1030 IF g_rev_component_rec.location_name =
1031 FND_API.G_MISS_CHAR THEN
1032 g_rev_component_rec.location_name := NULL;
1033 g_rev_comp_unexp_rec.Supply_Locator_Id := NULL;
1034 END IF;
1035
1036 IF g_rev_component_rec.minimum_allowed_quantity =
1037 FND_API.G_MISS_NUM THEN
1038 g_rev_component_rec.minimum_allowed_quantity := NULL;
1039 END IF;
1040
1041 IF g_rev_component_rec.maximum_allowed_quantity =
1042 FND_API.G_MISS_NUM THEN
1043 g_rev_component_rec.maximum_allowed_quantity := NULL;
1044 END IF;
1045
1046
1047 IF g_rev_component_rec.comments = FND_API.G_MISS_CHAR THEN
1048 g_rev_component_rec.comments := NULL;
1049 END IF;
1050
1051 IF g_rev_component_rec.wip_supply_type = FND_API.G_MISS_NUM THEN
1052 g_rev_component_rec.wip_supply_type := NULL;
1053 END IF;
1054
1055 IF g_rev_component_rec.Suggested_Vendor_Name =
1056 FND_API.G_MISS_CHAR THEN --- Deepu
1057 g_rev_component_rec.Suggested_Vendor_Name := NULL;
1058 END IF;
1059 /*
1060 IF g_rev_component_rec.Purchasing_Category =
1061 FND_API.G_MISS_CHAR THEN --- Deepu
1062 g_rev_component_rec.Purchasing_Category := NULL;
1063 END IF;
1064
1065 */
1066
1067 -- verify if the profile value that indicates default wip
1068 -- values from those that of an item is set. If it is then
1069 -- copy these values from the item record.
1070 IF (l_default_wip_values = 1)
1071 THEN
1072 FOR c_default IN default_wip_values
1073 LOOP
1074 IF g_rev_component_rec.wip_supply_type IS NULL
1075 OR
1076 g_rev_component_rec.wip_supply_type =
1077 FND_API.G_MISS_NUM
1078 THEN
1079 g_rev_component_rec.wip_supply_type :=
1080 c_default.wip_supply_type;
1081 END IF;
1082
1083 IF g_rev_component_rec.supply_subinventory IS NULL
1084 OR
1085 g_rev_component_rec.supply_subinventory =
1086 FND_API.G_MISS_CHAR
1087 THEN
1088 g_rev_component_rec.supply_subinventory :=
1089 c_default.wip_supply_subinventory;
1090 END IF;
1091
1092 IF g_rev_comp_unexp_rec.supply_locator_id IS NULL
1093 OR
1094 g_rev_comp_unexp_rec.supply_locator_id =
1095 FND_API.G_MISS_NUM
1096 THEN
1097 g_rev_comp_unexp_rec.supply_locator_id
1098 :=
1099 c_default.wip_supply_locator_id;
1100 END IF;
1101
1102 END LOOP;
1103
1104 END IF;
1105
1106 IF g_rev_component_rec.acd_type = FND_API.G_MISS_NUM THEN
1107 g_rev_component_rec.acd_type := NULL;
1108 END IF;
1109
1110 IF g_rev_comp_unexp_rec.supply_locator_id = FND_API.G_MISS_NUM
1111 THEN
1112 g_rev_comp_unexp_rec.supply_locator_id := NULL;
1113 END IF;
1114
1115 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute defaulting enforce_int_requirements_code...'); END IF;
1116
1117 /* bug2758790, form defaults the enforce req code to 0 and value to 'none' */
1118
1119 IF( g_rev_comp_unexp_rec.enforce_int_requirements_code = FND_API.G_MISS_NUM
1120 or g_rev_comp_unexp_rec.enforce_int_requirements_code is NULL)
1121 AND l_assy_item_type <> Bom_Globals.G_PRODUCT_FAMILY --* Added for Bug 4568522
1122 THEN
1123 g_rev_comp_unexp_rec.enforce_int_requirements_code := 0;
1124 END IF;
1125
1126 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute defaulting enforce_int_requirements...'); END IF;
1127 IF (g_rev_component_rec.enforce_int_requirements = FND_API.G_MISS_CHAR
1128 or g_rev_component_rec.enforce_int_requirements is NULL)
1129 AND l_assy_item_type <> Bom_Globals.G_PRODUCT_FAMILY --* Added for Bug 4568522
1130 THEN
1131 g_rev_component_rec.enforce_int_requirements := Get_EnforceInteger_Value(
1132 p_enforce_integer => 0);
1133
1134 --* Added for Bug 4568522
1135 ELSE
1136 IF l_assy_item_type = Bom_Globals.G_PRODUCT_FAMILY THEN
1137 g_rev_component_rec.enforce_int_requirements := NULL;
1138 END IF;
1139 --* End of Bug 4568522
1140
1141 END IF;
1142
1143 IF g_rev_component_rec.attribute_category = FND_API.G_MISS_CHAR
1144 OR g_rev_component_rec.attribute1 = FND_API.G_MISS_CHAR
1145 OR g_rev_component_rec.attribute2 = FND_API.G_MISS_CHAR
1146 OR g_rev_component_rec.attribute3 = FND_API.G_MISS_CHAR
1147 OR g_rev_component_rec.attribute4 = FND_API.G_MISS_CHAR
1148 OR g_rev_component_rec.attribute5 = FND_API.G_MISS_CHAR
1149 OR g_rev_component_rec.attribute6 = FND_API.G_MISS_CHAR
1153 OR g_rev_component_rec.attribute10 = FND_API.G_MISS_CHAR
1150 OR g_rev_component_rec.attribute7 = FND_API.G_MISS_CHAR
1151 OR g_rev_component_rec.attribute8 = FND_API.G_MISS_CHAR
1152 OR g_rev_component_rec.attribute9 = FND_API.G_MISS_CHAR
1154 OR g_rev_component_rec.attribute11 = FND_API.G_MISS_CHAR
1155 OR g_rev_component_rec.attribute12 = FND_API.G_MISS_CHAR
1156 OR g_rev_component_rec.attribute13 = FND_API.G_MISS_CHAR
1157 OR g_rev_component_rec.attribute14 = FND_API.G_MISS_CHAR
1158 OR g_rev_component_rec.attribute15 = FND_API.G_MISS_CHAR
1159 THEN
1160
1161 Get_Flex_Rev_Component;
1162
1163 END IF;
1164
1165 x_rev_component_rec := g_rev_component_rec;
1166 x_Rev_Comp_Unexp_Rec := g_Rev_Comp_Unexp_Rec;
1167
1168 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Getting out of Attribute Defualting...'); END IF;
1169
1170 END Attribute_Defaulting;
1171
1172 /*********************************************************************
1173 * Procedure : Attribute_Defaulting
1174 * Parameters IN : Inventory Component Exposed column record
1175 * Inventory Component unexposed column record
1176 * Parameters OUT: Components exposed column record after defaulting
1177 * Component unexposed column record after defaulting
1178 * Message Token Table
1179 * Return Status
1180 * Purpose : This procedure will default values in all the comp.
1181 * fields that the user has left unfilled. This procedure
1182 * will share code with the Engineering Business Object
1183 * Revised Component Attribute Defaulting Code.
1184 **********************************************************************/
1185 PROCEDURE Attribute_Defaulting
1186 ( p_bom_component_rec IN Bom_Bo_Pub.Bom_Comps_Rec_Type
1187 , p_bom_Comp_unexp_rec IN Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
1188 , x_bom_Component_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Rec_Type
1189 , x_bom_Comp_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
1190 , x_mesg_token_tbl IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
1191 , x_return_status IN OUT NOCOPY VARCHAR2
1192 )
1193 IS
1194 l_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type;
1195 l_rev_comp_unexp_rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type;
1196 l_return_status VARCHAR2(1):=FND_API.G_RET_STS_SUCCESS;
1197 l_Mesg_Token_tbl Error_Handler.Mesg_Token_Tbl_Type;
1198 BEGIN
1199
1200 --
1201 -- The record definition of Revised Component in ECO BO is
1202 -- slightly different than the component definition of BOM BO
1203 -- So, we will copy the values of BOM BO Record into an ECO
1204 -- BO compatible record before we make a call to the
1205 -- Attribute Defaulting procedure.
1206 --
1207
1208 Bom_Bo_Pub.Convert_BomComp_To_EcoComp
1209 ( p_bom_component_rec => p_bom_component_rec
1210 , p_bom_comp_unexp_rec => p_bom_comp_unexp_rec
1211 , x_rev_component_rec => l_rev_component_rec
1212 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1213 );
1214
1215 -- Once the record transfer is done call the ECO BO's
1216 -- revised component attribute defaulting
1217 --
1218 Bom_Default_Bom_Component.Attribute_Defaulting
1219 ( p_rev_component_rec => l_rev_component_rec
1220 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1221 , x_rev_component_rec => l_rev_component_rec
1222 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1223 , x_mesg_token_tbl => l_mesg_token_tbl
1224 , x_return_status => l_return_status
1225 );
1226
1227
1228 --
1229 -- On return from the Attribute Defualting, save the defaulted
1230 -- record back in the BOM BO's records
1231 --
1232 Bom_Bo_Pub.Convert_EcoComp_To_BomComp
1233 ( p_rev_component_rec => l_rev_component_rec
1234 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1235 , x_bom_component_rec => x_bom_component_rec
1236 , x_bom_comp_unexp_rec => x_bom_comp_unexp_rec
1237 );
1238
1239 x_return_status := l_return_Status;
1240 x_mesg_token_Tbl := l_mesg_token_tbl;
1241
1242 END Attribute_Defaulting;
1243
1244 /*******************************************************************
1245 * Procedure : Populate_Null_Columns (earlier called Complete_Record)
1246 * Parameters IN : Revised Component exposed column record
1247 * Revised Component DB record of exposed columns
1248 * Revised Component unexposed column record
1249 * Revised Component DB record of unexposed columns
1250 * Parameters OUT: Revised Component exposed Record
1251 * Revised Component Unexposed Record
1252 * Purpose : Complete record will compare the database record with
1253 * the user given record and will complete the user
1254 * record with values from the database record, for all
1255 * columns that the user has left NULL.
1256 ********************************************************************/
1257 PROCEDURE Populate_Null_Columns
1258 ( p_rev_component_rec IN Bom_Bo_Pub.Rev_Component_Rec_Type
1259 , p_old_rev_component_rec IN Bom_Bo_Pub.Rev_Component_Rec_Type
1260 , p_Rev_Comp_Unexp_Rec IN Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
1261 , p_Old_Rev_Comp_Unexp_Rec IN Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
1262 , x_Rev_Component_Rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Component_Rec_Type
1263 , x_Rev_Comp_Unexp_Rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
1267 p_rev_component_rec;
1264 )
1265 IS
1266 l_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type :=
1268 l_Rev_Comp_Unexp_Rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type :=
1269 p_Rev_Comp_Unexp_Rec;
1270 BEGIN
1271
1272 IF l_rev_component_rec.supply_subinventory = FND_API.G_MISS_CHAR THEN
1273 l_rev_component_rec.supply_subinventory := NULL;
1274 l_rev_component_rec.location_name := NULL;
1275 l_rev_comp_unexp_rec.supply_locator_id := NULL;
1276 ELSIF l_rev_component_rec.supply_subinventory IS NULL THEN
1277 l_rev_component_rec.supply_subinventory :=
1278 p_old_rev_component_rec.supply_subinventory;
1279 /* Bug 2694107 */
1280 If (p_rev_comp_unexp_rec.supply_locator_id IS NULL) or
1281 (p_rev_comp_unexp_rec.supply_locator_id = FND_API.G_MISS_NUM) THEN
1282 l_rev_comp_unexp_rec.supply_locator_id :=
1283 p_old_rev_comp_unexp_rec.supply_locator_id;
1284 End if;
1285 /* Bug 2694107 */
1286 ELSIF l_rev_component_rec.Supply_Subinventory IS NOT NULL AND
1287 l_rev_component_rec.Supply_Subinventory <>
1288 p_old_rev_component_rec.supply_subinventory AND
1289 ( ( l_rev_comp_unexp_rec.supply_locator_id IS NOT NULL
1290 AND
1291 p_old_rev_comp_unexp_rec.supply_locator_id IS NOT
1292 NULL
1293 ) AND
1294 ( l_rev_comp_unexp_rec.supply_locator_id =
1295 p_old_rev_comp_unexp_rec.supply_locator_id OR
1296 ( l_rev_comp_unexp_rec.supply_locator_id IS NOT
1297 NULL AND
1298 l_rev_comp_unexp_rec.supply_locator_id =
1299 FND_API.G_MISS_NUM
1300 )
1301 )
1302 )
1303 THEN
1304 l_rev_comp_unexp_rec.supply_locator_id := NULL;
1305 -- Give out a warning indicating the locator has been
1306 -- made NULL.
1307
1308 ELSIF l_rev_component_rec.Supply_Subinventory IS NOT NULL AND
1309 l_rev_component_rec.Supply_Subinventory <>
1310 p_old_rev_component_rec.supply_subinventory AND
1311 l_rev_comp_unexp_rec.supply_locator_id =
1312 FND_API.G_MISS_NUM
1313 THEN
1314 -- dbms_output.put_line('Supply Locator made NULL . . .');
1315
1316 l_rev_comp_unexp_rec.supply_locator_id := NULL;
1317 -- Give out a warning indicating the locator has been
1318 --made NULL.
1319 ELSIF l_rev_component_rec.Supply_Subinventory IS NOT NULL AND
1320 l_rev_component_rec.Supply_Subinventory =
1321 p_old_rev_component_rec.supply_subinventory AND
1322 p_rev_comp_unexp_rec.supply_locator_id IS NULL
1323 THEN
1324 l_rev_comp_unexp_rec.supply_locator_id :=
1325 p_old_rev_comp_unexp_rec.supply_locator_id;
1326 END IF;
1327
1328 IF l_rev_comp_unexp_rec.supply_locator_id = FND_API.G_MISS_NUM THEN
1329 l_rev_comp_unexp_rec.supply_locator_id := NULL;
1330 l_rev_component_rec.location_name := NULL;
1331 END IF;
1332
1333 IF l_rev_component_rec.required_for_revenue IS NULL
1334 THEN
1335 l_rev_component_rec.required_for_revenue :=
1336 p_old_rev_component_rec.required_for_revenue;
1337 END IF;
1338
1339 IF l_rev_component_rec.maximum_allowed_quantity IS NULL
1340 THEN
1341 l_rev_component_rec.maximum_allowed_quantity :=
1342 p_old_rev_component_rec.maximum_allowed_quantity;
1343 END IF;
1344
1345 IF l_rev_component_rec.wip_supply_type IS NULL THEN
1346 l_rev_component_rec.wip_supply_type :=
1347 p_old_rev_component_rec.wip_supply_type;
1348 /* Added for bug3221540 */
1349 ELSIF l_rev_component_rec.wip_supply_type = FND_API.G_MISS_NUM
1350 THEN
1351 l_rev_component_rec.wip_supply_type := NULL;
1352 END IF;
1353
1354 IF l_rev_component_rec.operation_sequence_number IS NULL
1355 THEN
1356 l_rev_component_rec.operation_sequence_number :=
1357 p_old_rev_component_rec.operation_sequence_number;
1358 END IF;
1359
1360 IF l_rev_component_rec.item_sequence_number IS NULL THEN
1361 l_rev_component_rec.item_sequence_number :=
1362 p_old_rev_component_rec.item_sequence_number;
1363 END IF;
1364
1365 IF l_rev_component_rec.basis_type IS NULL THEN
1366 l_rev_component_rec.basis_type:=
1367 p_old_rev_component_rec.basis_type;
1368 END IF;
1369
1370 IF l_rev_component_rec.quantity_per_assembly IS NULL
1371 AND (l_rev_component_rec.inverse_quantity = FND_API.G_MISS_NUM
1372 OR l_rev_component_rec.inverse_quantity IS NULL
1373 OR l_rev_component_rec.inverse_quantity = 0)
1374 THEN
1375 l_rev_component_rec.quantity_per_assembly :=
1376 p_old_rev_component_rec.quantity_per_assembly;
1377 /* Commented as part of bug#3310077
1378 ELSIF l_rev_component_rec.quantity_per_assembly <> FND_API.G_MISS_NUM THEN -- added for bug 2442791
1379 l_rev_component_rec.quantity_per_assembly :=
1380 round(l_rev_component_rec.quantity_per_assembly, 7);
1381 */
1382 END IF;
1383
1384 IF l_rev_component_rec.projected_yield IS NULL
1385 THEN
1386 l_rev_component_rec.projected_yield :=
1390 IF l_rev_component_rec.comments IS NULL
1387 p_old_rev_component_rec.projected_yield;
1388 END IF;
1389
1391 THEN
1392 l_rev_component_rec.comments :=
1393 p_old_rev_component_rec.comments ;
1394 END IF;
1395
1396 IF l_rev_component_rec.disable_date IS NULL THEN
1397 l_rev_component_rec.disable_date :=
1398 p_old_rev_component_rec.disable_date;
1399 /* Added for bug 3486547 */
1400 ELSIF l_rev_component_rec.disable_date = FND_API.G_MISS_DATE
1401 then
1402 l_rev_component_rec.disable_date := NULL;
1403 END IF;
1404
1405 IF l_rev_component_rec.attribute_category IS NULL THEN
1406 l_rev_component_rec.attribute_category :=
1407 p_old_rev_component_rec.attribute_category;
1408 END IF;
1409
1410 IF l_rev_component_rec.attribute1 IS NULL THEN
1411 l_rev_component_rec.attribute1 :=
1412 p_old_rev_component_rec.attribute1;
1413 END IF;
1414
1415 IF l_rev_component_rec.attribute2 IS NULL THEN
1416 l_rev_component_rec.attribute2 :=
1417 p_old_rev_component_rec.attribute2;
1418 END IF;
1419
1420 IF l_rev_component_rec.attribute3 IS NULL THEN
1421 l_rev_component_rec.attribute3 :=
1422 p_old_rev_component_rec.attribute3;
1423 END IF;
1424
1425 IF l_rev_component_rec.attribute4 IS NULL THEN
1426 l_rev_component_rec.attribute4 :=
1427 p_old_rev_component_rec.attribute4;
1428 END IF;
1429
1430 IF l_rev_component_rec.attribute5 IS NULL THEN
1431 l_rev_component_rec.attribute5 :=
1432 p_old_rev_component_rec.attribute5;
1433 END IF;
1434
1435 IF l_rev_component_rec.attribute6 IS NULL THEN
1436 l_rev_component_rec.attribute6 :=
1437 p_old_rev_component_rec.attribute6;
1438 END IF;
1439
1440 IF l_rev_component_rec.attribute7 IS NULL THEN
1441 l_rev_component_rec.attribute7 :=
1442 p_old_rev_component_rec.attribute7;
1443 END IF;
1444
1445 IF l_rev_component_rec.attribute8 IS NULL THEN
1446 l_rev_component_rec.attribute8 :=
1447 p_old_rev_component_rec.attribute8;
1448 END IF;
1449
1450 IF l_rev_component_rec.attribute9 IS NULL THEN
1451 l_rev_component_rec.attribute9 :=
1452 p_old_rev_component_rec.attribute9;
1453 END IF;
1454
1455 IF l_rev_component_rec.attribute10 IS NULL THEN
1456 l_rev_component_rec.attribute10 :=
1457 p_old_rev_component_rec.attribute10;
1458 END IF;
1459
1460 IF l_rev_component_rec.attribute11 IS NULL THEN
1461 l_rev_component_rec.attribute11 :=
1462 p_old_rev_component_rec.attribute11;
1463 END IF;
1464
1465 IF l_rev_component_rec.attribute12 IS NULL THEN
1466 l_rev_component_rec.attribute12 :=
1467 p_old_rev_component_rec.attribute12;
1468 END IF;
1469
1470 IF l_rev_component_rec.attribute13 IS NULL THEN
1471 l_rev_component_rec.attribute13 :=
1472 p_old_rev_component_rec.attribute13;
1473 END IF;
1474
1475 IF l_rev_component_rec.attribute14 IS NULL THEN
1476 l_rev_component_rec.attribute14 :=
1477 p_old_rev_component_rec.attribute14;
1478 END IF;
1479
1480 IF l_rev_component_rec.attribute15 IS NULL THEN
1481 l_rev_component_rec.attribute15 :=
1482 p_old_rev_component_rec.attribute15;
1483 END IF;
1484
1485 /* Assign NULL to the attribute fields if they are MISSING */
1486
1487 g_rev_component_rec := l_rev_component_rec;
1488 Get_Flex_Rev_Component;
1489 l_rev_component_rec := g_rev_component_rec;
1490
1491 IF l_rev_component_rec.planning_percent IS NULL
1492 THEN
1493 l_rev_component_rec.planning_percent :=
1494 p_old_rev_component_rec.planning_percent;
1495 END IF;
1496
1497 IF l_rev_component_rec.quantity_related IS NULL THEN
1498 l_rev_component_rec.quantity_related :=
1499 p_old_rev_component_rec.quantity_related;
1500 END IF;
1501
1502 IF l_rev_component_rec.so_basis IS NULL THEN
1503 l_rev_component_rec.so_basis :=
1504 p_old_rev_component_rec.so_basis;
1505 END IF;
1506
1507 IF l_rev_component_rec.optional IS NULL THEN
1508 l_rev_component_rec.optional :=
1509 p_old_rev_component_rec.optional;
1510 END IF;
1511
1512 IF l_rev_component_rec.mutually_exclusive IS NULL THEN
1513 l_rev_component_rec.mutually_exclusive :=
1514 p_old_rev_component_rec.mutually_exclusive;
1515 END IF;
1516
1517 IF l_rev_component_rec.include_in_cost_rollup IS NULL THEN
1518 l_rev_component_rec.include_in_cost_rollup :=
1519 p_old_rev_component_rec.include_in_cost_rollup;
1520 END IF;
1521
1522 IF l_rev_component_rec.check_atp IS NULL THEN
1523 l_rev_component_rec.check_atp :=
1524 p_old_rev_component_rec.check_atp;
1525 END IF;
1526
1527 IF l_rev_component_rec.shipping_allowed IS NULL THEN
1528 l_rev_component_rec.shipping_allowed :=
1529 p_old_rev_component_rec.shipping_allowed;
1530 END IF;
1531
1535 END IF;
1532 IF l_rev_component_rec.required_to_ship IS NULL THEN
1533 l_rev_component_rec.required_to_ship :=
1534 p_old_rev_component_rec.required_to_ship;
1536
1537 IF l_rev_component_rec.include_on_ship_docs IS NULL THEN
1538 l_rev_component_rec.include_on_ship_docs :=
1539 p_old_rev_component_rec.include_on_ship_docs;
1540 END IF;
1541
1542 IF l_rev_component_rec.minimum_allowed_quantity IS NULL THEN
1543 l_rev_component_rec.minimum_allowed_quantity :=
1544 p_old_rev_component_rec.minimum_allowed_quantity;
1545 END IF;
1546
1547 IF l_rev_component_rec.acd_type IS NULL THEN
1548 l_rev_component_rec.acd_type :=
1549 p_old_rev_component_rec.acd_type;
1550 END IF;
1551
1552 IF l_rev_component_rec.from_end_item_unit_number = FND_API.G_MISS_CHAR
1553 THEN
1554 l_rev_component_rec.from_end_item_unit_number := null;
1555 ELSIF l_rev_component_rec.from_end_item_unit_number IS NULL
1556 THEN
1557 l_rev_component_rec.from_end_item_unit_number :=
1558 p_old_rev_component_rec.from_end_item_unit_number;
1559 END IF;
1560
1561 IF l_rev_component_rec.to_end_item_unit_number = FND_API.G_MISS_CHAR
1562 THEN
1563 l_rev_component_rec.to_end_item_unit_number := null;
1564 ELSIF l_rev_component_rec.to_end_item_unit_number IS NULL
1565 THEN
1566 l_rev_component_rec.to_end_item_unit_number :=
1567 p_old_rev_component_rec.to_end_item_unit_number;
1568 END IF;
1569
1570 -- Added in 11.5.9 by ADEY
1571 IF l_rev_component_rec.auto_request_material IS NULL
1572 THEN
1573 l_rev_component_rec.auto_request_material :=
1574 p_old_rev_component_rec.auto_request_material;
1575 END IF;
1576
1577 IF l_rev_component_rec.Suggested_Vendor_Name IS NULL --- Deepu
1578 THEN
1579 l_rev_component_rec.Suggested_Vendor_Name :=
1580 p_old_rev_component_rec.Suggested_Vendor_Name;
1581 l_Rev_Comp_Unexp_Rec.Vendor_Id :=
1582 p_Old_Rev_Comp_Unexp_Rec.Vendor_Id;
1583 END IF;
1584 /*
1585
1586 IF l_rev_component_rec.Purchasing_Category_Id IS NULL --- Deepu
1587 THEN
1588 l_rev_component_rec.Purchasing_Category_Id :=
1589 p_old_rev_component_rec.Purchasing_Category_Id;
1590 END IF;
1591 */
1592 IF l_rev_component_rec.Unit_Price IS NULL --- Deepu
1593 THEN
1594 l_rev_component_rec.Unit_Price :=
1595 p_old_rev_component_rec.Unit_Price;
1596 END IF;
1597
1598 --
1599 -- Also copy the Unexposed Columns from Database to New record
1600 --
1601 IF l_rev_component_rec.transaction_type <>
1602 BOM_GLOBALS.G_OPR_CREATE
1603 THEN
1604
1605 l_Rev_Comp_Unexp_Rec.component_sequence_id :=
1606 p_Old_Rev_Comp_Unexp_Rec.component_sequence_id;
1607
1608 l_Rev_Comp_Unexp_Rec.old_component_Sequence_id :=
1609 p_Old_Rev_Comp_Unexp_Rec.old_component_Sequence_id;
1610
1611 l_Rev_Comp_Unexp_Rec.Revised_Item_Sequence_Id :=
1612 p_Old_Rev_Comp_Unexp_Rec.Revised_Item_Sequence_Id;
1613
1614 l_Rev_Comp_Unexp_Rec.Rowid :=
1615 p_Old_Rev_Comp_Unexp_Rec.Rowid;
1616
1617 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp Seq: ' || to_char(l_Rev_Comp_Unexp_Rec.component_sequence_id)); END IF;
1618 ELSIF l_rev_component_rec.transaction_type =
1619 BOM_GLOBALS.G_OPR_CREATE
1620 THEN
1621 /***********************************************
1622 --
1623 -- Default Component_Sequence_Id
1624 --
1625 **************************************************/
1626
1627 IF l_Rev_Comp_Unexp_Rec.component_sequence_id IS NULL OR
1628 l_Rev_Comp_Unexp_Rec.component_sequence_id =
1629 FND_API.G_MISS_NUM
1630 THEN
1631 l_Rev_Comp_Unexp_Rec.component_sequence_id :=
1632 Get_Component_Sequence;
1633
1634 END IF;
1635 END IF;
1636
1637 l_Rev_Comp_Unexp_Rec.Bom_Item_Type :=
1638 p_Old_Rev_Comp_Unexp_Rec.Bom_Item_Type;
1639
1640 l_Rev_Comp_Unexp_Rec.Include_On_Bill_Docs :=
1641 p_Old_Rev_Comp_Unexp_Rec.Include_On_Bill_Docs;
1642
1643 l_rev_comp_unexp_rec.pick_components :=
1644 p_old_rev_comp_unexp_rec.pick_components;
1645
1646 IF l_rev_component_rec.enforce_int_requirements = FND_API.G_MISS_CHAR THEN
1647 l_rev_comp_unexp_rec.enforce_int_requirements_code := 0;
1648 l_rev_component_rec.enforce_int_requirements := Get_EnforceInteger_Value(
1649 p_enforce_integer => 0);
1650 ELSIF l_rev_component_rec.enforce_int_requirements IS NULL THEN
1651 l_rev_comp_unexp_rec.enforce_int_requirements_code :=
1652 p_old_rev_comp_unexp_rec.enforce_int_requirements_code;
1653 l_rev_component_rec.enforce_int_requirements :=
1654 p_old_rev_component_rec.enforce_int_requirements;
1655 END IF;
1656
1660 END Populate_Null_Columns;
1657 x_Rev_Component_Rec := l_rev_component_rec;
1658 x_Rev_Comp_Unexp_Rec := l_Rev_Comp_Unexp_Rec;
1659
1661 /******************************************************************
1662 * Procedure : Populate_Null_Columns
1663 * Parameters IN : Bom Component Exposed Column record
1664 * Bom Component unexposed column record
1665 * Old Bom Component exposed column record
1666 * Old Bom Component unexposed column record
1667 * Parameters OUT: Bom Componet exposed column record
1668 * Bom Component unexposed column record
1669 * Purpose : Will populate the NULL columns from the record that
1670 * is queried from the database.
1671 ********************************************************************/
1672 PROCEDURE Populate_Null_Columns
1673 ( p_bom_Component_rec IN Bom_Bo_Pub.Bom_Comps_Rec_Type
1674 , p_bom_Comp_unexp_rec IN Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
1675 , p_old_bom_Component_rec IN Bom_Bo_Pub.Bom_Comps_Rec_Type
1676 , p_old_bom_Comp_unexp_rec IN Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
1677 , x_bom_Component_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Rec_Type
1678 , x_bom_Comp_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
1679 )
1680 IS
1681 l_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type;
1682 l_rev_comp_unexp_rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type;
1683 l_old_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type;
1684 l_old_rev_comp_unexp_rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type;
1685 BEGIN
1686 --
1687 -- The record definition of Revised Component in ECO BO is
1688 -- slightly different than the component definition of BOM BO
1689 -- So, we will copy the values of BOM BO Record into an ECO
1690 -- BO compatible record before we make a call to the
1691 -- Attribute Defaulting procedure.
1692 --
1693
1694 Bom_Bo_Pub.Convert_BomComp_To_EcoComp
1695 ( p_bom_component_rec => p_bom_component_rec
1696 , p_bom_comp_unexp_rec => p_bom_comp_unexp_rec
1697 , x_rev_component_rec => l_rev_component_rec
1698 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1699 );
1700
1701 --
1702 -- Also convert the old component information from BOM Bo
1703 -- To ECO Bo
1704 --
1705 Bom_Bo_Pub.Convert_BomComp_To_EcoComp
1706 ( p_bom_component_rec => p_old_bom_component_rec
1707 , p_bom_comp_unexp_rec => p_old_bom_comp_unexp_rec
1708 , x_rev_component_rec => l_old_rev_component_rec
1709 , x_rev_comp_unexp_rec => l_old_rev_comp_unexp_rec
1710 );
1711
1712
1713 -- Once the record transfer is done call the ECO BO's
1714 -- revised component attribute defaulting
1715 --
1716 Bom_Default_Bom_Component.Populate_Null_Columns
1717 ( p_rev_component_rec => l_rev_component_rec
1718 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1719 , p_old_rev_component_rec => l_old_rev_component_rec
1720 , p_old_rev_comp_unexp_rec => l_old_rev_comp_unexp_rec
1721 , x_rev_component_rec => l_rev_component_rec
1722 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1723 );
1724
1725
1726 --
1727 -- On return from the Attribute Defualting, save the defaulted
1728 -- record back in the BOM BO's records
1729 --
1730 Bom_Bo_Pub.Convert_EcoComp_To_BomComp
1731 ( p_rev_component_rec => l_rev_component_rec
1732 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1733 , x_bom_component_rec => x_bom_component_rec
1734 , x_bom_comp_unexp_rec => x_bom_comp_unexp_rec
1735 );
1736
1737 END Populate_Null_Columns;
1738
1739
1740 /******************************************************************
1741 * Procedure : Entity_Defaulting
1742 * Parameters IN : Revised Component Exposed Column Record
1743 * Revised Component Unexposed Column Record
1744 * Parameters OUT: Revised Component Exposed Column Record
1745 * Purpose : This procedure will default all those attribute that
1746 * require help of external values and conditions for
1747 * defaulting and cannot be simply defaulted.
1748 ********************************************************************/
1749 PROCEDURE Entity_Defaulting
1750 ( p_rev_component_rec IN Bom_Bo_Pub.Rev_Component_Rec_Type
1751 , p_old_rev_component_rec IN Bom_Bo_Pub.Rev_Component_Rec_Type :=
1752 Bom_Bo_Pub.G_MISS_REV_COMPONENT_REC
1753 , x_rev_component_rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Component_Rec_Type
1754 )
1755 IS
1756 BEGIN
1757
1758 -- Load out record
1759 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Within entity defaulting . . .'); END IF;
1760
1761 x_rev_component_rec := p_rev_component_rec;
1762
1763 IF (p_rev_component_rec.quantity_per_assembly) IS NULL
1764 THEN
1768 IF (p_rev_component_rec.inverse_quantity = 0)
1765 IF (p_rev_component_rec.inverse_quantity IS NOT NULL
1766 AND p_rev_component_rec.inverse_quantity <> FND_API.G_MISS_NUM)
1767 THEN
1769 THEN
1770 x_rev_component_rec.quantity_per_assembly := 0;
1771 ELSE
1772 x_rev_component_rec.quantity_per_assembly :=
1773 1/p_rev_component_rec.inverse_quantity;
1774 END IF;
1775 END IF;
1776 END IF;
1777
1778 IF p_rev_component_rec.maximum_allowed_quantity IS NOT NULL AND
1779 p_rev_component_rec.minimum_allowed_quantity IS NULL
1780 THEN
1781 x_rev_component_rec.minimum_allowed_quantity :=
1782 p_rev_component_rec.quantity_per_assembly;
1783 END IF;
1784
1785 IF p_rev_component_rec.maximum_allowed_quantity IS NULL AND
1786 p_rev_component_rec.minimum_allowed_quantity IS NOT NULL
1787 THEN
1788 x_rev_component_rec.maximum_allowed_quantity :=
1789 p_rev_component_rec.quantity_per_assembly;
1790 END IF;
1791 IF Bom_Globals.Get_Debug = 'Y' THEN error_handler.write_debug('exiting defaulting . . .'); END IF;
1792
1793 END Entity_Defaulting;
1794
1795 /******************************************************************
1796 * Procedure : Entity_Defaulting
1797 * Parameters IN : Bom Inventory Component Exposed Column Record
1798 * Bom Inventory Component Unexposed Column Record
1799 * Parameters OUT: Bom Inventory Component Exposed Column Record
1800 * Purpose : This procedure will default all those attribute that
1801 * require help of external values and conditions for
1802 * defaulting and cannot be simply defaulted.
1803 ********************************************************************/
1804 PROCEDURE Entity_Defaulting
1805 ( p_bom_component_rec IN Bom_Bo_Pub.Bom_Comps_Rec_Type
1806 , p_old_bom_component_rec IN Bom_Bo_Pub.Bom_Comps_Rec_Type :=
1807 Bom_Bo_Pub.G_MISS_BOM_COMPONENT_REC
1808 , x_bom_component_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Rec_Type
1809 )
1810 IS
1811 l_rev_component_rec Bom_Bo_Pub.Rev_Component_Rec_Type;
1812 l_old_rev_component_Rec Bom_Bo_Pub.Rev_Component_Rec_Type;
1813 l_rev_comp_unexp_rec Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type :=
1814 Bom_Bo_Pub.G_MISS_REV_COMP_UNEXP_REC;
1815 l_bom_comp_unexp_rec Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type;
1816 BEGIN
1817 --
1818 -- The record definition of Revised Component in ECO BO is
1819 -- slightly different than the component definition of BOM BO
1820 -- So, we will copy the values of BOM BO Record into an ECO
1821 -- BO compatible record before we make a call to the
1822 -- Attribute Defaulting procedure.
1823 --
1824
1825 Bom_Bo_Pub.Convert_BomComp_To_EcoComp
1826 ( p_bom_component_rec => p_bom_component_rec
1827 , x_rev_component_rec => l_rev_component_rec
1828 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1829 );
1830
1831 --
1832 -- Also convert the old component information from BOM Bo
1833 -- To ECO Bo
1834 --
1835 Bom_Bo_Pub.Convert_BomComp_To_EcoComp
1836 ( p_bom_component_rec => p_old_bom_component_rec
1837 , x_rev_component_rec => l_old_rev_component_rec
1838 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
1839 );
1840
1841
1842 --
1843 -- Once the record transfer is done call the ECO BO's
1844 -- revised component Entity Defaulting
1845 --
1846 Entity_Defaulting
1847 ( p_rev_component_rec => l_rev_component_rec
1848 , p_old_rev_component_rec => l_old_rev_component_rec
1849 , x_rev_component_rec => l_rev_component_rec
1850 );
1851
1852 --
1853 -- Convert the ECO Record back to BOM before returning
1854 --
1855 Bom_Bo_Pub.Convert_EcoComp_To_BomComp
1856 ( p_rev_component_rec => l_rev_component_rec
1857 , x_bom_component_rec => x_bom_component_rec
1858 , x_bom_comp_unexp_rec => l_bom_comp_unexp_rec
1859 );
1860
1861 END Entity_Defaulting;
1862
1863 END Bom_Default_Bom_Component;