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