DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_DEFAULT_SUB_COMPONENT

Source


1 PACKAGE BODY BOM_Default_Sub_Component AS
2 /* $Header: BOMDSBCB.pls 120.2 2005/12/29 00:21:49 dikrishn noship $ */
3 /***************************************************************************
4 --
5 --  Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      BOMDSBCB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package BOM_Default_Sub_Component
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --  17-JUL-1999	Rahul Chitko	Initial Creation
20 --
21 --
22 ***************************************************************************/
23 --  Global constant holding the package name
24 
25 G_PKG_NAME                    CONSTANT VARCHAR2(30) :=
26 			      'BOM_Default_Sub_Component';
27 ret_code		      NUMBER;
28 
29 --  Package global used within the package.
30 
31 g_sub_component_rec           Bom_Bo_Pub.Sub_Component_Rec_Type;
32 
33 /******************************************************************
34 * Local Function: Get_Substitute_Item_Quantity
35 * Parameter IN	: Substitute Component unexposed Record
36 * Parameter OUT	: Return_Status
37 *		  Mesg_Token_Tbl
38 * Purpose	: Function will fetch the item quantity using the
39 *		  component sequence id key, from bom_inventory_components
40 *		  table and return it as the default value for
41 *		  Substitute_Item_Quantity
42 *******************************************************************/
43 FUNCTION Get_Substitute_Item_Quantity
44 	 (  x_return_status	  IN OUT NOCOPY VARCHAR2
45   	  , x_Mesg_Token_Tbl	  IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
46 	  , p_Sub_Comp_Unexp_Rec  IN  Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
47 	  )
48 RETURN NUMBER
49 IS
50 l_sub_item_quantity  NUMBER;
51 l_Mesg_Token_Tbl     Error_Handler.Mesg_Token_Tbl_Type;
52 BEGIN
53 	   --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 	   --  Get Substitute Item quantity from the parent component
55 	   -- using the component sequence id.
56 	   ---+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57 	SELECT component_quantity
58           INTO l_sub_item_quantity
59           FROM bom_inventory_components
60          WHERE component_sequence_id =
61 		 p_Sub_Comp_Unexp_Rec.component_sequence_id;
62 
63        RETURN (l_sub_item_quantity);
64 
65        EXCEPTION
66              WHEN OTHERS THEN
67 		Error_Handler.Add_Error_Token
68 		(  x_Mesg_Token_Tbl	=> l_Mesg_Token_Tbl
69 		 , p_Mesg_Token_Tbl	=> l_Mesg_Token_Tbl
70 		 , p_message_name	=> NULL
71 		 , p_message_text	=>
72 		   'Substitute Component Attribute Validation ' ||
73 		   TO_CHAR(SQLCODE) || ' ' || SUBSTR(SQLERRM, 1, 100)
74 		 );
75 		x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
76         	RETURN FND_API.G_RET_STS_UNEXP_ERROR;
77 
78 END Get_Substitute_Item_Quantity;
79 
80 PROCEDURE Get_Flex_Sub_Component
81 IS
82 BEGIN
83 
84     --  In the future call Flex APIs for defaults
85 
86     IF g_sub_component_rec.attribute_category = FND_API.G_MISS_CHAR THEN
87         g_sub_component_rec.attribute_category := NULL;
88     END IF;
89 
90     IF g_sub_component_rec.attribute1 = FND_API.G_MISS_CHAR THEN
91         g_sub_component_rec.attribute1 := NULL;
92     END IF;
93 
94     IF g_sub_component_rec.attribute2 = FND_API.G_MISS_CHAR THEN
95         g_sub_component_rec.attribute2 := NULL;
96     END IF;
97 
98     IF g_sub_component_rec.attribute4 = FND_API.G_MISS_CHAR THEN
99         g_sub_component_rec.attribute4 := NULL;
100     END IF;
101 
102     IF g_sub_component_rec.attribute5 = FND_API.G_MISS_CHAR THEN
103         g_sub_component_rec.attribute5 := NULL;
104     END IF;
105 
106     IF g_sub_component_rec.attribute6 = FND_API.G_MISS_CHAR THEN
107         g_sub_component_rec.attribute6 := NULL;
108     END IF;
109 
110     IF g_sub_component_rec.attribute8 = FND_API.G_MISS_CHAR THEN
111         g_sub_component_rec.attribute8 := NULL;
112     END IF;
113 
114     IF g_sub_component_rec.attribute9 = FND_API.G_MISS_CHAR THEN
115         g_sub_component_rec.attribute9 := NULL;
116     END IF;
117 
118     IF g_sub_component_rec.attribute10 = FND_API.G_MISS_CHAR THEN
119         g_sub_component_rec.attribute10 := NULL;
120     END IF;
121 
122     IF g_sub_component_rec.attribute12 = FND_API.G_MISS_CHAR THEN
123         g_sub_component_rec.attribute12 := NULL;
124     END IF;
125 
126     IF g_sub_component_rec.attribute13 = FND_API.G_MISS_CHAR THEN
127         g_sub_component_rec.attribute13 := NULL;
128     END IF;
129 
130     IF g_sub_component_rec.attribute14 = FND_API.G_MISS_CHAR THEN
131         g_sub_component_rec.attribute14 := NULL;
132     END IF;
133 
134     IF g_sub_component_rec.attribute15 = FND_API.G_MISS_CHAR THEN
135         g_sub_component_rec.attribute15 := NULL;
136     END IF;
137 
138     IF g_sub_component_rec.attribute3 = FND_API.G_MISS_CHAR THEN
139         g_sub_component_rec.attribute3 := NULL;
140     END IF;
141 
142     IF g_sub_component_rec.attribute7 = FND_API.G_MISS_CHAR THEN
143         g_sub_component_rec.attribute7 := NULL;
144     END IF;
145 
146     IF g_sub_component_rec.attribute11 = FND_API.G_MISS_CHAR THEN
147         g_sub_component_rec.attribute11 := NULL;
148     END IF;
149 
150 END Get_Flex_Sub_Component;
151 
152 /********************************************************************
153  * Function      : Get_EnforceInteger_Value
154  * Returns       : VARCHAR2
155  * Purpose       : Will convert the value of enforce integer requirements code
156  *               into enforce integer requirements value
157  *                 If the conversion fails then the function will return
158  *                 a NULL otherwise will return the code.
159  *                 For an unexpected error function will return a
160  *                 missing value.
161  *********************************************************************/
162         FUNCTION Get_EnforceInteger_Value
163                  (  p_enforce_integer  IN  NUMBER)
164                     RETURN VARCHAR2
165         IS
166                 l_enforce_int_reqvalue  varchar2(80);
167         BEGIN
168                 SELECT meaning INTO l_enforce_int_reqvalue FROM mfg_lookups WHERE
169                         lookup_type = 'BOM_ENFORCE_INT_REQUIREMENTS' AND
170                         lookup_code = p_enforce_integer;
171                 Return l_enforce_int_reqvalue;
172                 EXCEPTION WHEN OTHERS THEN
173                         Return NULL;
174         END;
175 
176 
177 /******************************************************************
178 * Procedure	: Attribute_Defaulting
179 * Parameter IN  : Substitute Component unexposed Record
180 *		  Substitute Component Record
181 * Parameter IN OUT NOCOPY : Return_Status
182 *                 Mesg_Token_Tbl
183 *		  Substitute Component Record
184 *		  Substitute Component Unexposed Record
185 * Purpose       : Attributes will call get functions for all columns
186 *		  that need to be defaulted.
187 *		  Defualting can happen for exposed as well as
188 *		  unexposed columns.
189 *******************************************************************/
190 
191 PROCEDURE Attribute_Defaulting
192 (   p_sub_component_rec             IN  Bom_Bo_Pub.Sub_Component_Rec_Type :=
193                                         Bom_Bo_Pub.G_MISS_SUB_COMPONENT_REC
194 ,   p_Sub_Comp_Unexp_Rec	    IN  Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
195 ,   x_sub_component_rec             IN OUT NOCOPY Bom_Bo_Pub.Sub_Component_Rec_Type
196 ,   x_Sub_Comp_Unexp_Rec	    IN OUT NOCOPY Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
197 ,   x_Mesg_Token_Tbl		    IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
198 ,   x_return_status		    IN OUT NOCOPY VARCHAR2
199 )
200 IS
201 stmt_num                            NUMBER := 0;
202 l_err_text			    VARCHAR2(255);
203 l_return_status			    VARCHAR2(10);
204 l_Mesg_Token_Tbl		    Error_Handler.Mesg_Token_Tbl_Type;
205 BEGIN
206 
207     --  Initialize g_sub_component_rec
208 
209     x_return_status := FND_API.G_RET_STS_SUCCESS;
210 
211 
212 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp Seq in attrib Defaulting ' || p_Sub_Comp_Unexp_Rec.component_sequence_id); END IF;
213 
214     stmt_num := 1;
215     g_sub_component_rec := p_sub_component_rec;
216 
217    x_Sub_Comp_Unexp_Rec := p_Sub_Comp_Unexp_Rec;
218 
219    IF g_sub_component_rec.enforce_int_requirements IS NULL THEN
220         x_sub_comp_unexp_rec.enforce_int_requirements_code := 0;
221    END IF;
222 
223     stmt_num := 2;
224     IF g_sub_component_rec.substitute_item_quantity = FND_API.G_MISS_NUM OR
225       g_sub_component_rec.substitute_item_quantity IS NULL THEN
226 
227       -- Check if Inverse_Quanity value is available. If not default it from component.
228       IF g_sub_component_rec.Inverse_Quantity = FND_API.G_MISS_NUM OR
229         g_sub_component_rec.Inverse_Quantity IS NULL THEN
230 
231         g_sub_component_rec.substitute_item_quantity :=
232             Get_Substitute_Item_Quantity
233             (  x_return_status	=> l_return_status
234              , x_Mesg_Token_Tbl	=> l_Mesg_Token_Tbl
235              , p_Sub_Comp_Unexp_Rec	=> p_Sub_Comp_Unexp_Rec
236              );
237         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Quantity Defaulted to : ' || to_char(g_sub_component_rec.substitute_item_quantity)); END IF;
238 
239 
240         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
241             g_sub_component_rec.substitute_item_quantity := 0;
242             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
243         END IF;
244       ELSE
245         IF g_sub_component_rec.Inverse_Quantity = 0 THEN
246             g_sub_component_rec.substitute_item_quantity := 0;
247         ELSE
248             g_sub_component_rec.substitute_item_quantity := 1/g_sub_component_rec.Inverse_Quantity;
249         END IF;
250       END IF;
251     END IF;
252 
253     IF g_sub_component_rec.acd_type = FND_API.G_MISS_NUM THEN
254          g_sub_component_rec.acd_type := NULL;
255     END IF;
256 /* bug2758790, form defaults the enforce req code to 0 and value to 'none' */
257 
258     IF (g_sub_component_rec.enforce_int_requirements = FND_API.G_MISS_CHAR
259       or  g_sub_component_rec.enforce_int_requirements  is NULL )THEN
260          g_sub_component_rec.enforce_int_requirements :=
261 			Get_EnforceInteger_Value(p_enforce_integer => 0);
262     END IF;
263 
264 
265     stmt_num :=3;
266     IF g_sub_component_rec.attribute_category = FND_API.G_MISS_CHAR
267     OR  g_sub_component_rec.attribute1 = FND_API.G_MISS_CHAR
268     OR  g_sub_component_rec.attribute2 = FND_API.G_MISS_CHAR
269     OR  g_sub_component_rec.attribute4 = FND_API.G_MISS_CHAR
270     OR  g_sub_component_rec.attribute5 = FND_API.G_MISS_CHAR
271     OR  g_sub_component_rec.attribute6 = FND_API.G_MISS_CHAR
272     OR  g_sub_component_rec.attribute8 = FND_API.G_MISS_CHAR
273     OR  g_sub_component_rec.attribute9 = FND_API.G_MISS_CHAR
274     OR  g_sub_component_rec.attribute10 = FND_API.G_MISS_CHAR
275     OR  g_sub_component_rec.attribute12 = FND_API.G_MISS_CHAR
276     OR  g_sub_component_rec.attribute13 = FND_API.G_MISS_CHAR
277     OR  g_sub_component_rec.attribute14 = FND_API.G_MISS_CHAR
278     OR  g_sub_component_rec.attribute15 = FND_API.G_MISS_CHAR
279     OR  g_sub_component_rec.attribute3 = FND_API.G_MISS_CHAR
280     OR  g_sub_component_rec.attribute7 = FND_API.G_MISS_CHAR
281     OR  g_sub_component_rec.attribute11 = FND_API.G_MISS_CHAR
282     THEN
283 
284         Get_Flex_Sub_Component;
285 
286     END IF;
287 
288    --  Done defaulting attributes
289 
290    x_sub_component_rec := g_sub_component_rec;
291 
292 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Sub Comps Attrib Defaulting Done . . .'); END IF;
293 
294 EXCEPTION
295 
296     WHEN FND_API.G_EXC_ERROR THEN
297 --   	dbms_output.put_line('default sub_comp : ' || to_char(stmt_num));
298 	x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
299         x_return_status := FND_API.G_RET_STS_ERROR;
300 
301     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
302 --	dbms_output.put_line('default sub_comp : ' || to_char(stmt_num));
303 	x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
304         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
305 
306     WHEN OTHERS THEN
307         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
308 	x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
309 --        dbms_output.put_line('default sub_comp : ' || to_char(stmt_num));
310 
311 END Attribute_Defaulting;
312 
313 /******************************************************************************
314 * Procedure     : Populate_Null_Columns (earlier called Complete_Record)
315 * Parameters IN : Substitute Component exposed column record
316 *                 Substitute Component DB record of exposed columns
317 *                 Substitute Component unexposed column record
318 *                 Substitute Component DB record of unexposed columns
319 * Parameters OUT: Substitute Component exposed Record
320 *                 Substitute Component Unexposed Record
321 * Purpose       : Complete record will compare the database record with the
322 *                 user given record and will complete the user record with
323 *                 values from the database record, for all columns that the
324 *                 user has left NULL.
325 ******************************************************************************/
326 PROCEDURE Populate_Null_Columns
327 ( p_sub_component_rec           IN  Bom_Bo_Pub.Sub_Component_Rec_Type
328 , p_old_sub_component_rec       IN  Bom_Bo_Pub.Sub_Component_Rec_Type
329 , p_sub_Comp_Unexp_Rec          IN  Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
330 , p_Old_sub_Comp_Unexp_Rec      IN  Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
331 , x_sub_Component_Rec           IN OUT NOCOPY Bom_Bo_Pub.Sub_Component_Rec_Type
332 , x_sub_Comp_Unexp_Rec          IN OUT NOCOPY Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
333 )
334 IS
335 	l_sub_component_rec 	Bom_Bo_Pub.Sub_Component_Rec_Type :=
336 				p_sub_component_rec;
337 	l_sub_comp_Unexp_rec 	Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type :=
338 				p_old_sub_comp_Unexp_rec;
339 BEGIN
340 
341     IF (l_sub_component_rec.substitute_item_quantity = FND_API.G_MISS_NUM OR
342           l_sub_component_rec.substitute_item_quantity IS NULL)
343     THEN
344         IF (l_sub_component_rec.Inverse_Quantity = FND_API.G_MISS_NUM OR
345           l_sub_component_rec.Inverse_Quantity IS NULL)
346         THEN
347           l_sub_component_rec.substitute_item_quantity :=
348             p_old_sub_component_rec.substitute_item_quantity;
349         ELSE
350            IF l_sub_component_rec.Inverse_Quantity = 0 THEN
351               l_sub_component_rec.substitute_item_quantity := 0;
352            ELSE
353               l_sub_component_rec.substitute_item_quantity := 1/l_sub_component_rec.Inverse_Quantity;
354            END IF;
355         END IF;
356     END IF;
357 
358     -- Bug 4913211. If clause incorrectly has a check for NOT NULL.
359     -- Modified the if clause of all attributes to check for NULL
360 
361     IF l_sub_component_rec.attribute_category  IS NULL  THEN
362         l_sub_component_rec.attribute_category :=
363         p_old_sub_component_rec.attribute_category;
364     END IF;
365 
366     IF l_sub_component_rec.attribute1  IS NULL  THEN
367         l_sub_component_rec.attribute1 :=
368         p_old_sub_component_rec.attribute1;
369     END IF;
370 
371     IF l_sub_component_rec.attribute2  IS NULL  THEN
372         l_sub_component_rec.attribute2 := p_old_sub_component_rec.attribute2;
373     END IF;
374 
375     IF l_sub_component_rec.attribute4  IS NULL  THEN
376         l_sub_component_rec.attribute4 := p_old_sub_component_rec.attribute4;
377     END IF;
378 
379     IF l_sub_component_rec.attribute5  IS NULL  THEN
380         l_sub_component_rec.attribute5 := p_old_sub_component_rec.attribute5;
381     END IF;
382 
383     IF l_sub_component_rec.attribute6  IS NULL  THEN
384         l_sub_component_rec.attribute6 := p_old_sub_component_rec.attribute6;
385     END IF;
386 
387     IF l_sub_component_rec.attribute8  IS NULL  THEN
388         l_sub_component_rec.attribute8 := p_old_sub_component_rec.attribute8;
389     END IF;
390 
391     IF l_sub_component_rec.attribute9  IS NULL  THEN
392         l_sub_component_rec.attribute9 := p_old_sub_component_rec.attribute9;
393     END IF;
394 
395     IF l_sub_component_rec.attribute10  IS NULL  THEN
396         l_sub_component_rec.attribute10 := p_old_sub_component_rec.attribute10;
397     END IF;
398 
399     IF l_sub_component_rec.attribute12  IS NULL  THEN
400         l_sub_component_rec.attribute12 := p_old_sub_component_rec.attribute12;
401     END IF;
402 
403     IF l_sub_component_rec.attribute13  IS NULL  THEN
404         l_sub_component_rec.attribute13 := p_old_sub_component_rec.attribute13;
405     END IF;
406 
407     IF l_sub_component_rec.attribute14  IS NULL  THEN
408         l_sub_component_rec.attribute14 := p_old_sub_component_rec.attribute14;
409     END IF;
410 
411     IF l_sub_component_rec.attribute15  IS NULL  THEN
412         l_sub_component_rec.attribute15 := p_old_sub_component_rec.attribute15;
413     END IF;
414 /*
415     IF l_sub_component_rec.program_id IS NOT NULL THEN
416         l_sub_component_rec.program_id := p_old_sub_component_rec.program_id;
417     END IF;
418 */
419 
420     IF l_sub_component_rec.attribute3  IS NULL  THEN
421         l_sub_component_rec.attribute3 := p_old_sub_component_rec.attribute3;
422     END IF;
423 
424     IF l_sub_component_rec.attribute7  IS NULL  THEN
425         l_sub_component_rec.attribute7 := p_old_sub_component_rec.attribute7;
426     END IF;
427 
428     IF l_sub_component_rec.attribute11  IS NULL  THEN
429         l_sub_component_rec.attribute11 := p_old_sub_component_rec.attribute11;
430     END IF;
431 
432     /* Assign NULL if the values are MISSING */
433 
434     g_sub_component_rec := l_sub_component_rec;
435     Get_Flex_Sub_Component;
436     l_sub_component_rec := g_sub_component_rec;
437 
438     l_sub_comp_unexp_rec := p_Old_sub_Comp_Unexp_Rec; -- p_sub_comp_unexp_rec;
439     If(p_sub_comp_unexp_rec.new_substitute_component_id is not null) then
440      l_sub_comp_unexp_rec.new_substitute_component_id :=p_sub_comp_unexp_rec.new_substitute_component_id;
441     end if;
442 
443     IF l_sub_component_rec.enforce_int_requirements = FND_API.G_MISS_CHAR THEN
444 	l_sub_comp_unexp_rec.enforce_int_requirements_code := NULL;
445         l_sub_component_rec.enforce_int_requirements := NULL;
446     ELSIF l_sub_component_rec.enforce_int_requirements IS NULL THEN
447         l_sub_comp_unexp_rec.enforce_int_requirements_code := p_old_sub_comp_unexp_rec.enforce_int_requirements_code;
448         l_sub_component_rec.enforce_int_requirements := p_old_sub_component_rec.enforce_int_requirements;
449     ELSE
450 	l_sub_comp_unexp_rec.enforce_int_requirements_code := p_sub_comp_unexp_rec.enforce_int_requirements_code;
451     END IF;
452 
453     x_Sub_Component_Rec  := l_sub_component_rec;
454     x_Sub_Comp_Unexp_Rec  := l_sub_Comp_Unexp_rec;
455 
456 END Populate_Null_Columns;
457 
458 PROCEDURE Entity_Defaulting
459 (   p_sub_component_rec             IN  Bom_Bo_Pub.Sub_Component_Rec_Type
460 ,   p_old_sub_component_rec         IN  Bom_Bo_Pub.Sub_Component_Rec_Type :=
461                                         Bom_Bo_Pub.G_MISS_Sub_COMPONENT_REC
462 ,   x_sub_component_rec             IN OUT NOCOPY Bom_Bo_Pub.Sub_Component_Rec_Type
463 )
464 IS
465 BEGIN
466 	NULL;
467 END Entity_Defaulting;
468 
469 /*
470 ** Procedures for BOM Business Object
471 */
472 PROCEDURE Attribute_Defaulting
473 (   p_bom_sub_component_rec       IN  Bom_Bo_Pub.Bom_Sub_Component_Rec_Type :=
474                                   Bom_Bo_Pub.G_MISS_Bom_SUB_COMPONENT_REC
475 ,   p_bom_Sub_Comp_Unexp_Rec      IN  Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
476 ,   x_bom_sub_component_rec       IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
477 ,   x_bom_Sub_Comp_Unexp_Rec      IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
478 ,   x_Mesg_Token_Tbl              IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
479 ,   x_return_status               IN OUT NOCOPY VARCHAR2
480 )
481 IS
482 	l_sub_component_rec	Bom_Bo_Pub.Sub_Component_Rec_Type;
483 	l_sub_comp_unexp_rec	Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type;
484 BEGIN
485 	--
486 	-- Convert the BOM record to ECO
487 	--
488 
489 if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Comp Seq before conversion ' || p_bom_sub_comp_unexp_rec.component_sequence_id); END IF;
490 
491 	Bom_Bo_Pub.Convert_BomSComp_to_EcoSComp
492 	(  p_bom_sub_component_rec	=> p_bom_sub_component_rec
493 	 , p_bom_sub_comp_unexp_rec	=> p_bom_sub_comp_unexp_rec
494 	 , x_sub_component_rec		=> l_sub_component_rec
495 	 , x_sub_comp_unexp_rec		=> l_sub_comp_unexp_rec
496 	 );
497 
498 	--
499 	-- Call Attribute Defaulting
500 	--
501 	Bom_Default_Sub_Component.Attribute_Defaulting
502 	(  p_sub_component_rec	=> l_sub_component_rec
503 	 , p_sub_comp_unexp_rec	=> l_sub_comp_unexp_rec
504 	 , x_sub_component_rec  => l_sub_component_rec
505          , x_sub_comp_unexp_rec => l_sub_comp_unexp_rec
506 	 , x_mesg_token_tbl	=> x_mesg_token_tbl
507 	 , x_return_status	=> x_return_status
508 	);
509 
510 
511         Bom_Bo_Pub.Convert_EcoSComp_to_BomSComp
512         (  p_sub_component_rec      => l_sub_component_rec
513          , p_sub_comp_unexp_rec     => l_sub_comp_unexp_rec
514          , x_bom_sub_component_rec  => x_bom_sub_component_rec
515          , x_bom_sub_comp_unexp_rec => x_bom_sub_comp_unexp_rec
516          );
517 if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Qty after conversion: ' || l_sub_component_rec.substitute_item_quantity); END IF;
518 
519 END Attribute_Defaulting;
520 
521 PROCEDURE Populate_Null_Columns
522 ( p_bom_sub_component_rec         IN  Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
523 , p_old_bom_sub_component_rec     IN  Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
524 , p_bom_sub_Comp_Unexp_Rec        IN  Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
525 , p_Old_bom_sub_Comp_Unexp_Rec    IN  Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
526 , x_bom_sub_Component_Rec         IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
527 , x_bom_sub_Comp_Unexp_Rec        IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
528 )
529 IS
530         l_sub_component_rec     Bom_Bo_Pub.Sub_Component_Rec_Type;
531         l_sub_comp_unexp_rec    Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type;
532 	l_old_sub_component_rec Bom_Bo_Pub.Sub_Component_Rec_Type;
533 	l_old_sub_comp_unexp_rec Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type;
534 BEGIN
535         --
536         -- Convert the BOM record to ECO
537         --
538         Bom_Bo_Pub.Convert_BomSComp_To_EcoSComp
539         (  p_bom_sub_component_rec      => p_bom_sub_component_rec
540          , p_bom_sub_comp_unexp_rec     => p_bom_sub_comp_unexp_rec
541          , x_sub_component_rec          => l_sub_component_rec
542          , x_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
543          );
544 
545 	--
546 	-- Convert the old input record
547 	--
548 
549 	Bom_Bo_Pub.Convert_BomSComp_To_EcoSComp
550 	(  p_bom_sub_component_rec      => p_old_bom_sub_component_rec
551          , p_bom_sub_comp_unexp_rec     => p_old_bom_sub_comp_unexp_rec
552          , x_sub_component_rec          => l_old_sub_component_rec
553          , x_sub_comp_unexp_rec         => l_old_sub_comp_unexp_rec
554          );
555 
556 
557 	--
558 	-- Call Populate Null Columns
559 	--
560 	Bom_Default_Sub_Component.Populate_Null_Columns
561 	(  p_sub_component_rec		=> l_sub_component_rec
562 	 , p_old_sub_component_rec	=> l_old_sub_component_rec
563 	 , p_sub_comp_unexp_rec		=> l_sub_comp_unexp_rec
564 	 , p_old_sub_comp_unexp_rec	=> l_old_sub_comp_unexp_rec
565 	 , x_sub_component_rec		=> l_sub_component_rec
566 	 , x_sub_comp_unexp_rec		=> l_sub_comp_unexp_rec
567 	);
568 
569 	--
570 	-- Convert the ECO record back to BOM
571 	--
572 
573 	Bom_Bo_Pub.Convert_EcoSComp_to_BomSComp
574 	(  p_sub_component_rec		=> l_sub_component_rec
575 	 , p_sub_comp_unexp_rec		=> l_sub_comp_unexp_rec
576 	 , x_bom_sub_component_rec	=> x_bom_sub_component_rec
577 	 , x_bom_sub_comp_unexp_rec	=> x_bom_sub_comp_unexp_rec
578 	);
579 
580 END Populate_Null_Columns;
581 
582 END BOM_Default_Sub_Component;