DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_DEFAULT_SUB_OP_RES

Source


1 PACKAGE BODY BOM_Default_Sub_Op_Res AS
2 /* $Header: BOMDSORB.pls 120.2 2011/12/06 10:32:50 rambkond ship $ */
3 /****************************************************************************
4 --
5 --  Copyright (c) 2000 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --    BOMDSORB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package BOM_Default_Sub_Op_Res
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  22-AUG-00 Masanori Kimziuka Initial Creation
21 --
22 ****************************************************************************/
23 
24         G_Pkg_Name      VARCHAR2(30)    := 'BOM_Default_Sub_Op_Res';
25         l_ACD_ADD       CONSTANT NUMBER := 1 ;
26 
27     /*******************************************************************
28     * Following are all get functions which will be used by the attribute
29     * defaulting procedure. Each column needing to be defaulted has one GET
30     * function.
31     ********************************************************************/
32 
33 
34     -- Principle_Flag
35     FUNCTION Get_Principle_Flag
36     RETURN NUMBER
37     IS
38     BEGIN
39 
40             RETURN 2 ;   -- Return No: 2 for Sub Resource
41 
42     END Get_Principle_Flag ;
43 
44 
45     -- Get Flex Sub Operation Resource
46     PROCEDURE Get_Flex_Sub_Op_Res
47     (  p_rev_sub_resource_rec    IN  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
48      , x_rev_sub_resource_rec    IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
49     )
50     IS
51         l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
52         l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
53 
54     BEGIN
55        --  Initialize operation exp and unexp record
56        l_rev_sub_resource_rec  := p_rev_sub_resource_rec ;
57 
58         --  In the future call Flex APIs for defaults
59 
60         IF l_rev_sub_resource_rec.attribute_category = FND_API.G_MISS_CHAR THEN
61             l_rev_sub_resource_rec.attribute_category := NULL;
62         END IF;
63 
64         IF l_rev_sub_resource_rec.attribute1 = FND_API.G_MISS_CHAR THEN
65             l_rev_sub_resource_rec.attribute1 := NULL;
66         END IF;
67 
68         IF l_rev_sub_resource_rec.attribute2 = FND_API.G_MISS_CHAR THEN
69             l_rev_sub_resource_rec.attribute2 := NULL;
70         END IF;
71 
72         IF l_rev_sub_resource_rec.attribute3 = FND_API.G_MISS_CHAR THEN
73             l_rev_sub_resource_rec.attribute3 := NULL;
74         END IF;
75 
76         IF l_rev_sub_resource_rec.attribute4 = FND_API.G_MISS_CHAR THEN
77             l_rev_sub_resource_rec.attribute4 := NULL;
78         END IF;
79 
80         IF l_rev_sub_resource_rec.attribute5 = FND_API.G_MISS_CHAR THEN
81             l_rev_sub_resource_rec.attribute5 := NULL;
82         END IF;
83 
84         IF l_rev_sub_resource_rec.attribute6 = FND_API.G_MISS_CHAR THEN
85             l_rev_sub_resource_rec.attribute6 := NULL;
86         END IF;
87 
88         IF l_rev_sub_resource_rec.attribute7 = FND_API.G_MISS_CHAR THEN
89             l_rev_sub_resource_rec.attribute7 := NULL;
90         END IF;
91 
92         IF l_rev_sub_resource_rec.attribute8 = FND_API.G_MISS_CHAR THEN
93             l_rev_sub_resource_rec.attribute8 := NULL;
94         END IF;
95 
96         IF l_rev_sub_resource_rec.attribute9 = FND_API.G_MISS_CHAR THEN
97             l_rev_sub_resource_rec.attribute9 := NULL;
98         END IF;
99 
100         IF l_rev_sub_resource_rec.attribute10 = FND_API.G_MISS_CHAR THEN
101             l_rev_sub_resource_rec.attribute10 := NULL;
102         END IF;
103 
104         IF l_rev_sub_resource_rec.attribute11 = FND_API.G_MISS_CHAR THEN
105             l_rev_sub_resource_rec.attribute11 := NULL;
106         END IF;
107 
108         IF l_rev_sub_resource_rec.attribute12 = FND_API.G_MISS_CHAR THEN
109             l_rev_sub_resource_rec.attribute12 := NULL;
110         END IF;
111 
112         IF l_rev_sub_resource_rec.attribute13 = FND_API.G_MISS_CHAR THEN
113             l_rev_sub_resource_rec.attribute13 := NULL;
114         END IF;
115 
116         IF l_rev_sub_resource_rec.attribute14 = FND_API.G_MISS_CHAR THEN
117             l_rev_sub_resource_rec.attribute14 := NULL;
118         END IF;
119 
120         IF l_rev_sub_resource_rec.attribute15 = FND_API.G_MISS_CHAR THEN
121             l_rev_sub_resource_rec.attribute15 := NULL;
122         END IF;
123 
124         x_rev_sub_resource_rec := l_rev_sub_resource_rec ;
125 
126     END Get_Flex_Sub_Op_Res ;
127 
128 
129     /*********************************************************************
130     * Procedure : Attribute_Defaulting by RTG BO
131     * Parameters IN : Sub Operation Resource exposed column record
132     *                 Sub Operation Resource unexposed column record
133     * Parameters out: Sub Operation Resource exposed column record after defaulting
134     *                 Sub Operation Resource unexposed column record after defaulting
135     *                 Return Status
136     *                 Message Token Table
137     * Purpose   : Convert Routing Sub Op Resource to ECO Sub Op Resource and
138     *             Call Attribute_Defaulting for ECO Bo
139     *             This procedure will default values in all the sub operation
140     *             resource fields that the user has left unfilled.
141     **********************************************************************/
142     PROCEDURE Attribute_Defaulting
143     (  p_sub_resource_rec   IN  Bom_Rtg_Pub.Sub_Resource_Rec_Type
144      , p_sub_res_unexp_rec  IN  Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
145      , x_sub_resource_rec   IN OUT NOCOPY Bom_Rtg_Pub.Sub_Resource_Rec_Type
146      , x_sub_res_unexp_rec  IN OUT NOCOPY Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
147      , x_mesg_token_tbl     IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
148      , x_return_status      IN OUT NOCOPY VARCHAR2
149     )
150     IS
151         l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
152         l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
153 
154     BEGIN
155 
156         x_return_status := FND_API.G_RET_STS_SUCCESS;
157 
158         -- Convert Routing Op Resource to ECO Op Resource
159         Bom_Rtg_Pub.Convert_RtgSubRes_To_EcoSubRes
160         (  p_rtg_sub_resource_rec      => p_sub_resource_rec
161          , p_rtg_sub_res_unexp_rec     => p_sub_res_unexp_rec
162          , x_rev_sub_resource_rec      => l_rev_sub_resource_rec
163          , x_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
164         ) ;
165 
166 
167         -- Once the record transfer is done call the common
168         -- operation attribute defaulting
169         --
170         BOM_Default_Sub_Op_Res.Attribute_Defaulting
171         (  p_rev_sub_resource_rec     => l_rev_sub_resource_rec
172          , p_rev_sub_res_unexp_rec    => l_rev_sub_res_unexp_rec
173          , p_control_Rec              => Bom_Rtg_Pub.G_Default_Control_Rec
174          , x_rev_sub_resource_rec     => l_rev_sub_resource_rec
175          , x_rev_sub_res_unexp_rec    => l_rev_sub_res_unexp_rec
176          , x_return_status            => x_return_status
177          , x_mesg_token_tbl           => x_mesg_token_tbl
178         ) ;
179 
180 
181         -- Convert the Common record to Routing Record
182         Bom_Rtg_Pub.Convert_EcoSubRes_To_RtgSubRes
183         (  p_rev_sub_resource_rec      => l_rev_sub_resource_rec
184          , p_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
185          , x_rtg_sub_resource_rec      => x_sub_resource_rec
186          , x_rtg_sub_res_unexp_rec     => x_sub_res_unexp_rec
187          ) ;
188 
189     END Attribute_Defaulting ;
190 
191     /********************************************************************
192     * Procedure : Attribute_Defaulting by ECO BO
193     * Parameters IN : Revised Sub Op Resource exposed column record
194     *                 Revised Sub Op Resource unexposed column record
195     * Parameters out: Revised Sub Op Resource exposed column record after defaulting
196     *                 Revised Sub Op Resource unexposed column record after defaulting
197     *                 Return Status
198     *                 Message Token Table
199     * Purpose   : Attribute defaulting proc. defualts columns to
200     *             appropriate values. Defualting will happen for
201     *             exposed as well as unexposed columns.
202     *********************************************************************/
203     PROCEDURE Attribute_Defaulting
204     (  p_rev_sub_resource_rec    IN  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
205      , p_rev_sub_res_unexp_rec   IN  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
206      , p_control_Rec             IN  Bom_Rtg_Pub.Control_Rec_Type
207      , x_rev_sub_resource_rec    IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
208      , x_rev_sub_res_unexp_rec   IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
209      , x_mesg_token_tbl          IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
210      , x_return_status           IN OUT NOCOPY VARCHAR2
211     )
212 
213     IS
214 
215         l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
216         l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
217 
218         l_return_status VARCHAR2(1);
219         l_err_text  VARCHAR2(2000) ;
220         l_Mesg_Token_Tbl    Error_Handler.Mesg_Token_Tbl_Type;
221 
222 
223     BEGIN
224 
225        IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
226             ('Within the Sub Operation Resource Attr. Defaulting...') ;
227        END IF ;
228 
229        l_return_status := FND_API.G_RET_STS_SUCCESS ;
230        x_return_status := FND_API.G_RET_STS_SUCCESS ;
231 
232        --  Initialize operation exp and unexp record
233        l_rev_sub_resource_rec    := p_rev_sub_resource_rec ;
234        l_rev_sub_res_unexp_rec   := p_rev_sub_res_unexp_rec ;
235 
236 
237             /***********************************************************
238             --
239             -- Default Assigned_Units
240             -- Call Op Resource : BOM_Default_Op_Res.Get_Assigned_Units
241             --
242             ***********************************************************/
243             IF l_rev_sub_resource_rec.assigned_units IS NULL OR
244                l_rev_sub_resource_rec.assigned_units = FND_API.G_MISS_NUM
245             THEN
246                 l_rev_sub_resource_rec.assigned_units :=
247                 BOM_Default_Op_Res.Get_Assigned_Units ;
248             END IF ;
249 
250 
251 
252             /*********************************************************
253             --
254             -- Default Schedule_Flag
255             -- Call Op Resource : BOM_Default_Op_Res.Get_Schedule_Flag
256             --
257             ***********************************************************/
258 
259             IF l_rev_sub_resource_rec.schedule_flag IS NULL OR
260                l_rev_sub_resource_rec.schedule_flag =  FND_API.G_MISS_NUM
261             THEN
262                 l_rev_sub_resource_rec.schedule_flag :=
263                     BOM_Default_Op_Res.Get_Schedule_Flag ;
264             END IF;
265 
266             /************************************************************
267             --
268             -- Default Principle_Flag
269             --
270             ************************************************************/
271 
272             IF l_rev_sub_resource_rec.principle_flag IS NULL OR
273                l_rev_sub_resource_rec.principle_flag = FND_API.G_MISS_NUM
274             THEN
275                l_rev_sub_resource_rec.principle_flag :=
276                     Get_Principle_Flag ;
277             END IF;
278 
279 
280 
281             /************************************************************
282             --
283             -- Default Sub Operation Sequence's FlexFields
284             --
285             ************************************************************/
286 
287             IF  l_rev_sub_resource_rec.attribute_category = FND_API.G_MISS_CHAR
288             OR  l_rev_sub_resource_rec.attribute1  = FND_API.G_MISS_CHAR
289             OR  l_rev_sub_resource_rec.attribute2  = FND_API.G_MISS_CHAR
290             OR  l_rev_sub_resource_rec.attribute3  = FND_API.G_MISS_CHAR
291             OR  l_rev_sub_resource_rec.attribute4  = FND_API.G_MISS_CHAR
292             OR  l_rev_sub_resource_rec.attribute5  = FND_API.G_MISS_CHAR
293             OR  l_rev_sub_resource_rec.attribute6  = FND_API.G_MISS_CHAR
294             OR  l_rev_sub_resource_rec.attribute7  = FND_API.G_MISS_CHAR
295             OR  l_rev_sub_resource_rec.attribute8  = FND_API.G_MISS_CHAR
296             OR  l_rev_sub_resource_rec.attribute9  = FND_API.G_MISS_CHAR
297             OR  l_rev_sub_resource_rec.attribute10 = FND_API.G_MISS_CHAR
298             OR  l_rev_sub_resource_rec.attribute11 = FND_API.G_MISS_CHAR
299             OR  l_rev_sub_resource_rec.attribute12 = FND_API.G_MISS_CHAR
300             OR  l_rev_sub_resource_rec.attribute13 = FND_API.G_MISS_CHAR
301             OR  l_rev_sub_resource_rec.attribute14 = FND_API.G_MISS_CHAR
302             OR  l_rev_sub_resource_rec.attribute15 = FND_API.G_MISS_CHAR
303             THEN
304 
305                 Get_Flex_Sub_Op_Res(  p_rev_sub_resource_rec => l_rev_sub_resource_rec
306                                     , x_rev_sub_resource_rec => l_rev_sub_resource_rec ) ;
307 
308             END IF;
309 
310         x_rev_sub_resource_rec  := l_rev_sub_resource_rec ;
311         x_rev_sub_res_unexp_rec := l_rev_sub_res_unexp_rec ;
312 
313         IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN
314             Error_Handler.Write_Debug('Getting out of Operation Resource Attribute Defualting...');
315         END IF ;
316 
317 
318     EXCEPTION
319        WHEN OTHERS THEN
320           IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
321           ('Some unknown error in Attribute Defaulting . . .' || SQLERRM );
322           END IF ;
323 
324 
325           l_err_text := G_PKG_NAME || ' Default (Attr. Defaulting) '
326                                 || substrb(SQLERRM,1,200);
327           -- dbms_output.put_line('Unexpected Error: '||l_err_text);
328 
329           Error_Handler.Add_Error_Token
330           (  p_message_name   => NULL
331            , p_message_text   => l_err_text
332            , p_mesg_token_tbl => l_mesg_token_tbl
333            , x_mesg_token_tbl => l_mesg_token_tbl
334           ) ;
335 
336           -- Return the status and message table.
337           x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
338           x_mesg_token_tbl := l_mesg_token_tbl ;
339 
340 
341     END Attribute_Defaulting ;
342 
343 
344 
345     /******************************************************************
346     * Procedure : Populate_Null_Columns used by Rtg BO(Update or Delete)
347     * Parameters IN : Sub Operation Resource exposed column record
348     *                 Sub Operation Resource unexposed column record
349     *                 Old Sub Operation Resource exposed column record
350     *                 Old Sub Operation Resource unexposed column record
351     * Parameters out: Sub Op Resource exposed column record after
352     *                 populating null columns
353     *                 Sub Op Resource unexposed column record after
354     *                 populating null columns
355     * Purpose   : Convert Routing Sub Op Resource to ECO Sub Op Resource and
356     *             Call Populate_Null_Columns for ECO BO.
357     *             The procedure will populate the NULL columns from the
358     *             record that is queried from the database.
359     ********************************************************************/
360     PROCEDURE Populate_Null_Columns
361     (  p_sub_resource_rec          IN  Bom_Rtg_Pub.Sub_Resource_Rec_Type
362      , p_sub_res_unexp_rec         IN  Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
363      , p_old_sub_resource_rec      IN  Bom_Rtg_Pub.Sub_Resource_Rec_Type
364      , p_old_sub_res_unexp_rec     IN  Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
365      , x_sub_resource_rec          IN OUT NOCOPY Bom_Rtg_Pub.Sub_Resource_Rec_Type
366      , x_sub_res_unexp_rec         IN OUT NOCOPY Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
367     )
368 
369     IS
370         l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
371         l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
372         l_old_rev_sub_resource_rec  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
373         l_old_rev_sub_res_unexp_rec Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
374 
375 
376     BEGIN
377 
378         -- Convert Routing Sub Op Resource to Revised Sub Op Resource
379         Bom_Rtg_Pub.Convert_RtgSubRes_To_EcoSubRes
380         (  p_rtg_sub_resource_rec      => p_sub_resource_rec
381          , p_rtg_sub_res_unexp_rec     => p_sub_res_unexp_rec
382          , x_rev_sub_resource_rec      => l_rev_sub_resource_rec
383          , x_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
384         ) ;
385 
386         -- Also Convert Old Rtg Sub Op Resource to Old Revised Sub Op Resource
387         Bom_Rtg_Pub.Convert_RtgSubRes_To_EcoSubRes
388         (  p_rtg_sub_resource_rec      => p_old_sub_resource_rec
389          , p_rtg_sub_res_unexp_rec     => p_old_sub_res_unexp_rec
390          , x_rev_sub_resource_rec      => l_old_rev_sub_resource_rec
391          , x_rev_sub_res_unexp_rec     => l_old_rev_sub_res_unexp_rec
392         ) ;
393 
394         --
395         -- Once the record transfer is done call the common
396         -- operation populate null columns
397         --
398         Bom_Default_Sub_Op_Res.Populate_Null_Columns
399         (  p_rev_sub_resource_rec       => l_rev_sub_resource_rec
400          , p_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
401          , p_old_rev_sub_resource_rec   => l_old_rev_sub_resource_rec
402          , p_old_rev_sub_res_unexp_rec  => l_old_rev_sub_res_unexp_rec
403          , x_rev_sub_resource_rec       => l_rev_sub_resource_rec
404          , x_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
405         ) ;
406 
407         --
408         -- On return from the populate null columns, save the defaulted
409         -- record back in the RTG BO's records
410         --
411 
412         -- Convert the Common record to Routing Record
413         Bom_Rtg_Pub.Convert_EcoSubRes_To_RtgSubRes
414         (  p_rev_sub_resource_rec      => l_rev_sub_resource_rec
415          , p_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
416          , x_rtg_sub_resource_rec      => x_sub_resource_rec
417          , x_rtg_sub_res_unexp_rec     => x_sub_res_unexp_rec
418          ) ;
419 
420     END Populate_Null_Columns;
421 
422 
423     /******************************************************************
424     * Procedure : Populate_Null_Columns used
425     *            used by ECO BO(Update, Delete or Create with ACD_Type:2 Change)
426     * Parameters IN : Revised Sub Op Resource exposed column record
427     *                 Revised Sub Op Resource unexposed column record
428     *                 Old Revised Sub Op Resource exposed column record
429     *                 Old Revised Sub Op Resource unexposed column record
430     * Parameters out: Revised Sub Op Resource exposed column record
431     *                 after populating null columns
432     *                 Revised Sub Op Resource unexposed column record
433     *                 after populating null columns
434     * Purpose   : Complete record will compare the database record with
435     *             the user given record and will complete the user
436     *             record with values from the database record, for all
437     *             columns that the user has left NULL.
438     ********************************************************************/
439     PROCEDURE Populate_Null_Columns
440     (  p_rev_sub_resource_rec      IN  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
441      , p_rev_sub_res_unexp_rec     IN  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
442      , p_old_rev_sub_resource_rec  IN  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
443      , p_old_rev_sub_res_unexp_rec IN  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
444      , x_rev_sub_resource_rec      IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
445      , x_rev_sub_res_unexp_rec     IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
446     )
447     IS
448 
449        l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
450        l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
451 
452     BEGIN
453        IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
454             ('Within the Sub Operation Resource Populate null columns...') ;
455        END IF ;
456 
457        --  Initialize operation exp and unexp record
458        l_rev_sub_resource_rec  := p_rev_sub_resource_rec ;
459        l_rev_sub_res_unexp_rec := p_rev_sub_res_unexp_rec ;
460 
461        -- Exposed Column
462        IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
463             ('Populate null exposed columns......') ;
464        END IF ;
465 
466             IF l_rev_sub_resource_rec.ACD_Type IS NULL
467             THEN
468                l_rev_sub_resource_rec.ACD_Type
469                := p_old_rev_sub_resource_rec.ACD_Type ;
470             END IF ;
471 
472             IF l_rev_sub_resource_rec.Replacement_Group_Number IS NULL
473             THEN
474                l_rev_sub_resource_rec.Replacement_Group_Number
475                := p_old_rev_sub_resource_rec.Replacement_Group_Number ;
476             END IF ;
477 
478             IF l_rev_sub_resource_rec.schedule_sequence_number IS NULL
479             THEN
480                l_rev_sub_resource_rec.schedule_sequence_number
481                := p_old_rev_sub_resource_rec.schedule_sequence_number;
482             END IF;
483 
484             IF l_rev_sub_resource_rec.Standard_Rate_Flag IS NULL
485             THEN
486                l_rev_sub_resource_rec.Standard_Rate_Flag
487                := p_old_rev_sub_resource_rec.Standard_Rate_Flag ;
488             END IF ;
489 
490 
491             IF l_rev_sub_resource_rec.Assigned_Units IS NULL
492             THEN
493                l_rev_sub_resource_rec.Assigned_Units
494                := p_old_rev_sub_resource_rec.Assigned_Units ;
495             END IF;
496 
497 
498             --  Usage Rate and Inverse are not same as others because
499             --  of defaulting.
500             IF  l_rev_sub_resource_rec.Usage_Rate_Or_Amount IS NULL
501             AND l_rev_sub_resource_rec.Usage_Rate_Or_Amount_Inverse IS NULL
502             THEN
503                l_rev_sub_resource_rec.Usage_Rate_Or_Amount
504                := p_old_rev_sub_resource_rec.Usage_Rate_Or_Amount ;
505 
506                l_rev_sub_resource_rec.Usage_Rate_Or_Amount_Inverse
507                := p_old_rev_sub_resource_rec.Usage_Rate_Or_Amount_Inverse ;
508 
509             END IF ;
510 
511 
512             IF l_rev_sub_resource_rec.Basis_Type IS NULL
513             THEN
514                l_rev_sub_resource_rec.Basis_Type
515                := p_old_rev_sub_resource_rec.Basis_Type ;
516             END IF ;
517 
518             IF l_rev_sub_resource_rec.Schedule_Flag IS NULL
519             THEN
520                l_rev_sub_resource_rec.Schedule_Flag
521                := p_old_rev_sub_resource_rec.Schedule_Flag ;
522             END IF ;
523 
524             IF l_rev_sub_resource_rec.Resource_Offset_Percent IS NULL
525             THEN
526                l_rev_sub_resource_rec.Resource_Offset_Percent
527                := p_old_rev_sub_resource_rec.Resource_Offset_Percent ;
528             END IF ;
529 
530             IF l_rev_sub_resource_rec.Autocharge_Type IS NULL
531             THEN
532                l_rev_sub_resource_rec.Autocharge_Type
533                := p_old_rev_sub_resource_rec.Autocharge_Type ;
534             END IF ;
535 
536             IF l_rev_sub_resource_rec.Principle_Flag IS NULL
537             THEN
538                l_rev_sub_resource_rec.Principle_Flag
539                := p_old_rev_sub_resource_rec.Principle_Flag ;
540             END IF ;
541 
542             -- Populate Null Columns for FlexFields
543             IF l_rev_sub_resource_rec.attribute_category IS NULL THEN
544                 l_rev_sub_resource_rec.attribute_category :=
545                 p_old_rev_sub_resource_rec.attribute_category;
546             END IF;
547 
548             IF l_rev_sub_resource_rec.attribute1 IS NULL THEN
549                 l_rev_sub_resource_rec.attribute1 :=
550                 p_old_rev_sub_resource_rec.attribute1;
551             END IF;
552 
553             IF l_rev_sub_resource_rec.attribute2  IS NULL THEN
554                 l_rev_sub_resource_rec.attribute2 :=
555                 p_old_rev_sub_resource_rec.attribute2;
556             END IF;
557 
558             IF l_rev_sub_resource_rec.attribute3 IS NULL THEN
559                 l_rev_sub_resource_rec.attribute3 :=
560                 p_old_rev_sub_resource_rec.attribute3;
561             END IF;
562 
563             IF l_rev_sub_resource_rec.attribute4 IS NULL THEN
564                 l_rev_sub_resource_rec.attribute4 :=
565                 p_old_rev_sub_resource_rec.attribute4;
566             END IF;
567 
568             IF l_rev_sub_resource_rec.attribute5 IS NULL THEN
569                 l_rev_sub_resource_rec.attribute5 :=
570                 p_old_rev_sub_resource_rec.attribute5;
571             END IF;
572 
573             IF l_rev_sub_resource_rec.attribute6 IS NULL THEN
574                 l_rev_sub_resource_rec.attribute6 :=
575                 p_old_rev_sub_resource_rec.attribute6;
576             END IF;
577 
578             IF l_rev_sub_resource_rec.attribute7 IS NULL THEN
579                 l_rev_sub_resource_rec.attribute7 :=
580                 p_old_rev_sub_resource_rec.attribute7;
581             END IF;
582 
583             IF l_rev_sub_resource_rec.attribute8 IS NULL THEN
584                 l_rev_sub_resource_rec.attribute8 :=
585                 p_old_rev_sub_resource_rec.attribute8;
586             END IF;
587 
588             IF l_rev_sub_resource_rec.attribute9 IS NULL THEN
589                 l_rev_sub_resource_rec.attribute9 :=
590                 p_old_rev_sub_resource_rec.attribute9;
591             END IF;
592 
593             IF l_rev_sub_resource_rec.attribute10 IS NULL THEN
594                 l_rev_sub_resource_rec.attribute10 :=
595                 p_old_rev_sub_resource_rec.attribute10;
596             END IF;
597 
598             IF l_rev_sub_resource_rec.attribute11 IS NULL THEN
599                 l_rev_sub_resource_rec.attribute11 :=
600                 p_old_rev_sub_resource_rec.attribute11;
601             END IF;
602 
603             IF l_rev_sub_resource_rec.attribute12 IS NULL THEN
604                 l_rev_sub_resource_rec.attribute12 :=
605                 p_old_rev_sub_resource_rec.attribute12;
606             END IF;
607 
608             IF l_rev_sub_resource_rec.attribute13 IS NULL THEN
609                 l_rev_sub_resource_rec.attribute13 :=
610                 p_old_rev_sub_resource_rec.attribute13;
611             END IF;
612 
613             IF l_rev_sub_resource_rec.attribute14 IS NULL THEN
614                 l_rev_sub_resource_rec.attribute14 :=
615                 p_old_rev_sub_resource_rec.attribute14;
616             END IF;
617 
618             IF l_rev_sub_resource_rec.attribute15 IS NULL THEN
619                 l_rev_sub_resource_rec.attribute15 :=
620                 p_old_rev_sub_resource_rec.attribute15;
621             END IF;
622 
623 
624             --
625             -- Also copy the Unexposed Columns from Database to New record
626             --
627 
628 
629        IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
630             ('Populate Null Unexposed columns......') ;
631        END IF ;
632 
633 
634            IF l_rev_sub_resource_rec.transaction_type <> BOM_Rtg_GLOBALS.G_OPR_CREATE
635            THEN
636 
637               l_rev_sub_res_unexp_rec.Revised_Item_Sequence_Id
638               := p_old_rev_sub_res_unexp_rec.Revised_Item_Sequence_Id ;
639 
640               l_rev_sub_res_unexp_rec.Operation_Sequence_Id
641               := p_old_rev_sub_res_unexp_rec.Operation_Sequence_Id ;
642 
643            END IF;
644 
645 
646            IF l_rev_sub_resource_rec.Substitute_Group_Number IS NULL
647               OR l_rev_sub_resource_rec.Substitute_Group_Number  = FND_API.G_MISS_NUM
648            THEN
649               l_rev_sub_resource_rec.Substitute_Group_Number
650               := p_old_rev_sub_resource_rec.Substitute_Group_Number ;
651            END IF ;
652               l_rev_sub_res_unexp_rec.Substitute_Group_Number := l_rev_sub_resource_rec.Substitute_Group_Number;
653 
654            IF l_rev_sub_res_unexp_rec.Resource_Id IS NULL
655               OR l_rev_sub_res_unexp_rec.Resource_Id = FND_API.G_MISS_NUM
656            THEN
657               l_rev_sub_res_unexp_rec.Resource_Id
658               := p_old_rev_sub_res_unexp_rec.Resource_Id ;
659            END IF ;
660 
661            IF l_rev_sub_res_unexp_rec.Activity_Id IS NULL
662               OR l_rev_sub_res_unexp_rec.Activity_Id = FND_API.G_MISS_NUM
663            THEN
664               l_rev_sub_res_unexp_rec.Activity_Id
665               := p_old_rev_sub_res_unexp_rec.Activity_Id ;
666            END IF ;
667 
668            IF l_rev_sub_res_unexp_rec.Setup_Id IS NULL
669               OR l_rev_sub_res_unexp_rec.Setup_Id = FND_API.G_MISS_NUM
670            THEN
671               l_rev_sub_res_unexp_rec.Setup_Id
672               := p_old_rev_sub_res_unexp_rec.Setup_Id ;
673            END IF ;
674 
675 
676            --  Return operation exp and unexp record
677            x_rev_sub_resource_rec    := l_rev_sub_resource_rec ;
678            x_rev_sub_res_unexp_rec   := l_rev_sub_res_unexp_rec ;
679 
680 
681     END Populate_Null_Columns;
682 
683 
684     /*********************************************************************
685     * Procedure : Entity_Defaulting by RTG BO
686     * Parameters IN : Sub Operation Resource exposed column record
687     *                 Sub Operation Resource unexposed column record
688     * Parameters out: Sub Operation Resource exposed column record after defaulting
689     *                 Sub Operation Resource unexposed column record after defaulting
690     *                 Return Status
691     *                 Message Token Table
692     * Purpose   : Convert Routing Operation to Revised Sub Op Resource and
693     *             Call Entity_Defaulting for ECO BO
694     *             This procedure will entity default values in all the op resource.
695     *             fields that the user has left unfilled.
696     **********************************************************************/
697     PROCEDURE Entity_Defaulting
698     (  p_sub_resource_rec     IN  Bom_Rtg_Pub.Sub_Resource_Rec_Type
699      , p_sub_res_unexp_rec    IN  Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
700      , x_sub_resource_rec     IN OUT NOCOPY Bom_Rtg_Pub.Sub_Resource_Rec_Type
701      , x_sub_res_unexp_rec    IN OUT NOCOPY Bom_Rtg_Pub.Sub_Res_Unexposed_Rec_Type
702      , x_mesg_token_tbl       IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
703      , x_return_status        IN OUT NOCOPY VARCHAR2
704     )
705     IS
706         l_rev_sub_resource_rec      Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
707         l_rev_sub_res_unexp_rec     Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
708 
709         l_err_text  VARCHAR2(2000) ;
710 
711     BEGIN
712 
713         x_return_status := FND_API.G_RET_STS_SUCCESS;
714 
715         --
716         -- The record definition of Revised Sub Op Resource in ECO BO is
717         -- slightly different than the Sub Op Resource definition of RTG BO
718         -- So, we will copy the values of RTG BO Record into an ECO
719         -- BO compatible record before we make a call to the
720         -- Entity Defaulting procedure.
721         --
722 
723         -- Convert Routing Op Resource to ECO Op Resource
724         Bom_Rtg_Pub.Convert_RtgSubRes_To_EcoSubRes
725         (  p_rtg_sub_resource_rec      => p_sub_resource_rec
726          , p_rtg_sub_res_unexp_rec     => p_sub_res_unexp_rec
727          , x_rev_sub_resource_rec      => l_rev_sub_resource_rec
728          , x_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
729         ) ;
730 
731 
732         -- Once the record transfer is done call the revised
733         -- sub operation resource entity defaulting
734         --
735         BOM_Default_Sub_Op_Res.Entity_Defaulting
736         (  p_rev_sub_resource_rec     => l_rev_sub_resource_rec
737          , p_rev_sub_res_unexp_rec    => l_rev_sub_res_unexp_rec
738          , p_control_Rec              => Bom_Rtg_Pub.G_Default_Control_Rec
739          , x_rev_sub_resource_rec     => l_rev_sub_resource_rec
740          , x_rev_sub_res_unexp_rec    => l_rev_sub_res_unexp_rec
741          , x_return_status            => x_return_status
742          , x_mesg_token_tbl           => x_mesg_token_tbl
743         ) ;
744 
745         -- Convert the ECO record to Routing Record
746         Bom_Rtg_Pub.Convert_EcoSubRes_To_RtgSubRes
747         (  p_rev_sub_resource_rec      => l_rev_sub_resource_rec
748          , p_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
749          , x_rtg_sub_resource_rec      => x_sub_resource_rec
750          , x_rtg_sub_res_unexp_rec     => x_sub_res_unexp_rec
751          ) ;
752 
753     END Entity_Defaulting ;
754 
755 
756     /*********************************************************************
757     * Procedure : Entity_Defaulting by ECOBO
758     * Parameters IN : Revised Sub Op Resource exposed column record
759     *                 Revised Sub Op Resource unexposed column record
760     * Parameters out: Revised Sub Op Resource exposed column record after defaulting
761     *                 Revised Sub Op Resource unexposed column record after defaulting
762     *                 Return Status
763     *                 Message Token Table
764     * Purpose   : Entity defaulting proc. defualts columns to
765     *             appropriate values. Defualting will happen for
766     *             exposed as well as unexposed columns.
767     **********************************************************************/
768     PROCEDURE Entity_Defaulting
769     (  p_rev_sub_resource_rec    IN  Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
770      , p_rev_sub_res_unexp_rec   IN  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
771      , p_control_Rec             IN  Bom_Rtg_Pub.Control_Rec_Type
772      , x_rev_sub_resource_rec    IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type
773      , x_rev_sub_res_unexp_rec   IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type
774      , x_mesg_token_tbl          IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
775      , x_return_status           IN OUT NOCOPY VARCHAR2
776     )
777 
778     IS
779         l_rev_sub_resource_rec        Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type ;
780         l_rev_sub_res_unexp_rec       Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type ;
781 
782         l_return_status VARCHAR2(1);
783         l_err_text  VARCHAR2(2000) ;
784         l_Token_Tbl         Error_Handler.Token_Tbl_Type ;
785         l_Mesg_Token_Tbl    Error_Handler.Mesg_Token_Tbl_Type ;
786 
787 
788 
789 
790     BEGIN
791 
792        IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
793             ('Within the Sub Operation Resource Entity Defaulting...') ;
794        END IF ;
795 
796        x_return_status := FND_API.G_RET_STS_SUCCESS;
797        l_return_status := FND_API.G_RET_STS_SUCCESS;
798 
799        --  Initialize operation exp and unexp record
800        l_rev_sub_resource_rec    := p_rev_sub_resource_rec ;
801        l_rev_sub_res_unexp_rec   := p_rev_sub_res_unexp_rec ;
802 
803 
804             /************************************************************
805             --
806             -- Default Substitute_Group_Number
807             --         Copy from Schedule_Sequence_Number
808             ************************************************************/
809 
810               l_rev_sub_res_unexp_rec.substitute_group_number := l_rev_sub_resource_rec.substitute_group_number;
811             --l_rev_sub_res_unexp_rec.substitute_group_number
812             --           := l_rev_sub_resource_rec.schedule_sequence_number ;
813 
814             /************************************************************
815             --
816             -- Default Usage_Rate_Or_Amount and Usage_Rate_Or_Amount_Inverse
817             -- Call Op Resource : BOM_Default_Op_Res.Get_Usage_Rate_Or_Amount
818             --
819             ************************************************************/
820             BOM_Default_Op_Res.Get_Usage_Rate_Or_Amount
821              ( p_usage_rate_or_amount
822                => l_rev_sub_resource_rec.usage_rate_or_amount
823              , p_usage_rate_or_amount_inverse
824                => l_rev_sub_resource_rec.usage_rate_or_amount_inverse
825              , x_usage_rate_or_amount
826                => l_rev_sub_resource_rec.usage_rate_or_amount
827              , x_usage_rate_or_amount_inverse
828                => l_rev_sub_resource_rec.usage_rate_or_amount_inverse
829             ) ;
830 
831 
832             /************************************************************
833             --
834             -- Default Activity_Id,
835             --         Autocharge_Type,
836             --         Basis_Type,
837             --         Standard_Rate_Flag
838             -- Call Op Resource : BOM_Default_Op_Res.Get_Res_Attributes
839             --
840             ************************************************************/
841             IF l_rev_sub_resource_rec.transaction_type = BOM_Rtg_GLOBALS.G_OPR_CREATE
842                AND
843                ( l_rev_sub_res_unexp_rec.activity_id       IS NULL OR
844                  l_rev_sub_res_unexp_rec.activity_id       = FND_API.G_MISS_NUM OR
845                  l_rev_sub_resource_rec.autocharge_type    IS NULL OR
846                  l_rev_sub_resource_rec.autocharge_type    = FND_API.G_MISS_NUM OR
847                  l_rev_sub_resource_rec.basis_type         IS NULL OR
848                  l_rev_sub_resource_rec.basis_type         = FND_API.G_MISS_NUM OR
849                  l_rev_sub_resource_rec.standard_rate_flag IS NULL OR
850                  l_rev_sub_resource_rec.standard_rate_flag = FND_API.G_MISS_NUM
851                )
852             THEN
853                BOM_Default_Op_Res.Get_Res_Attributes
854                (  p_operation_sequence_id  => l_rev_sub_res_unexp_rec.operation_sequence_id
855                 , p_resource_id            => l_rev_sub_res_unexp_rec.resource_id
856                 , p_activity_id            => l_rev_sub_res_unexp_rec.activity_id
857                 , p_autocharge_type        => l_rev_sub_resource_rec.autocharge_type
858                 , p_basis_type             => l_rev_sub_resource_rec.basis_type
859                 , p_standard_rate_flag     => l_rev_sub_resource_rec.standard_rate_flag
860                 , p_org_id                 => l_rev_sub_res_unexp_rec.organization_id
861                 , x_activity_id            => l_rev_sub_res_unexp_rec.activity_id
862                 , x_autocharge_type        => l_rev_sub_resource_rec.autocharge_type
863                 , x_basis_type             => l_rev_sub_resource_rec.basis_type
864                 , x_standard_rate_flag     => l_rev_sub_resource_rec.standard_rate_flag ) ;
865 
866             END IF ;
867 
868 
869             /************************************************************
870             --
871             -- Default Assigned Units
872             --         Check if resource is availabel 24hours.
873             --          If so, Assigned Units must be 1.
874             -- Call Op Resource : BOM_Default_Op_Res.Get_Available_24hs_flag
875             --
876             ************************************************************/
877 	    /**** Commenting the following validation as per bug 2661684
878             IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
879             ('Default Assigned Units. . . . ' || l_return_status) ;
880             END IF ;
881 
882             IF   NVL(l_rev_sub_resource_rec.acd_type,l_ACD_ADD) = l_ACD_ADD
883                  AND l_rev_sub_resource_rec.assigned_units <> 1
884             THEN
885 
886 
887                IF BOM_Default_Op_Res.Get_Available_24hs_flag
888                  ( p_resource_id => l_rev_sub_res_unexp_rec.resource_id
889                  , p_op_seq_id   => l_rev_sub_res_unexp_rec.operation_sequence_id
890                  )  = 1  -- Yes
891                THEN
892 
893                   -- Set Assigned Units to 1
894                   l_rev_sub_resource_rec.assigned_units := 1 ;
895 
896 
897                   l_Token_Tbl(1).token_name  := 'SUB_RESOURCE_CODE';
898                   l_Token_Tbl(1).token_value :=
899                                    p_rev_sub_resource_rec.sub_resource_code ;
900                   l_Token_Tbl(2).token_name  := 'SCHEDULE_SEQ_NUMBER';
901                   l_Token_Tbl(2).token_value :=
902                         p_rev_sub_resource_rec.schedule_sequence_number ;
903 
904                   -- Set Warning Message
905                   Error_Handler.Add_Error_Token
906                   ( p_message_name   => 'BOM_SUB_RES_DEF_ASSGN_UNIT'
907                   , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
908                   , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
909                   , p_Token_Tbl      => l_Token_Tbl
910                   , p_message_type   => 'W'
911                   ) ;
912 
913                END IF ;
914             END IF ;
915 	    End of commenting for bug 2661684 ****/
916 
917             /************************************************************
918             --
919             -- Set missing column values to Null
920             --
921             ************************************************************/
922             IF l_rev_sub_resource_rec.activity  = FND_API.G_MISS_CHAR
923                OR l_rev_sub_res_unexp_rec.activity_id = FND_API.G_MISS_NUM
924             THEN
925                l_rev_sub_resource_rec.activity := NULL ;
926                l_rev_sub_res_unexp_rec.activity_id := NULL ;
927             END IF ;
928 
929             IF l_rev_sub_resource_rec.setup_type = FND_API.G_MISS_CHAR
930                OR l_rev_sub_res_unexp_rec.setup_id = FND_API.G_MISS_NUM
931             THEN
932                l_rev_sub_resource_rec.setup_type := NULL ;
933                l_rev_sub_res_unexp_rec.setup_id  := NULL ;
934             END IF ;
935 
936             IF l_rev_sub_resource_rec.resource_offset_percent  = FND_API.G_MISS_NUM
937             THEN
938                l_rev_sub_resource_rec.resource_offset_percent := NULL ;
939             END IF ;
940 
941             IF l_rev_sub_resource_rec.schedule_sequence_number = FND_API.G_MISS_NUM
942             THEN
943                l_rev_sub_resource_rec.schedule_sequence_number := NULL ;
944             END IF ;
945 
946             IF l_rev_sub_resource_rec.replacement_group_number = FND_API.G_MISS_NUM -- bug 3741570
947             THEN
948                l_rev_sub_resource_rec.replacement_group_number := NULL;
949             END IF;
950 
951             IF l_rev_sub_resource_rec.new_basis_type  = FND_API.G_MISS_NUM /* Added for bug 4689856 */
952             THEN
953                l_rev_sub_resource_rec.new_basis_type := NULL;
954             END IF;
955 
956             IF l_rev_sub_resource_rec.new_schedule_flag  = FND_API.G_MISS_NUM /* Added for bug 13005178 */
957             THEN
958                l_rev_sub_resource_rec.new_schedule_flag := NULL;
959             END IF;
960 
961             IF l_rev_sub_resource_rec.New_Sub_Resource_Code = FND_API.G_MISS_CHAR
962                OR l_rev_sub_res_unexp_rec.new_resource_id = FND_API.G_MISS_NUM
963             THEN
964                l_rev_sub_resource_rec.New_Sub_Resource_Code := NULL ;
965                l_rev_sub_res_unexp_rec.new_resource_id := NULL ;
966             END IF ;
967 
968             IF l_rev_sub_resource_rec.principle_flag  = FND_API.G_MISS_NUM
969             THEN
970                l_rev_sub_resource_rec.principle_flag := NULL ;
971             END IF ;
972 
973             -- FlexFields
974             IF l_rev_sub_resource_rec.attribute_category = FND_API.G_MISS_CHAR THEN
975                     l_rev_sub_resource_rec.attribute_category := NULL ;
976             END IF;
977 
978             IF l_rev_sub_resource_rec.attribute1 = FND_API.G_MISS_CHAR THEN
979                     l_rev_sub_resource_rec.attribute1 := NULL ;
980             END IF;
981 
982             IF l_rev_sub_resource_rec.attribute2  = FND_API.G_MISS_CHAR THEN
983                     l_rev_sub_resource_rec.attribute2 := NULL ;
984             END IF;
985 
986             IF l_rev_sub_resource_rec.attribute3 = FND_API.G_MISS_CHAR THEN
987                     l_rev_sub_resource_rec.attribute3 := NULL ;
988             END IF;
989 
990             IF l_rev_sub_resource_rec.attribute4 = FND_API.G_MISS_CHAR THEN
991                     l_rev_sub_resource_rec.attribute4 := NULL ;
992             END IF;
993 
994             IF l_rev_sub_resource_rec.attribute5 = FND_API.G_MISS_CHAR THEN
995                     l_rev_sub_resource_rec.attribute5 := NULL ;
996             END IF;
997 
998             IF l_rev_sub_resource_rec.attribute6 = FND_API.G_MISS_CHAR THEN
999                     l_rev_sub_resource_rec.attribute6 := NULL ;
1000             END IF;
1001 
1002             IF l_rev_sub_resource_rec.attribute7 = FND_API.G_MISS_CHAR THEN
1003                     l_rev_sub_resource_rec.attribute7 := NULL ;
1004             END IF;
1005 
1006             IF l_rev_sub_resource_rec.attribute8 = FND_API.G_MISS_CHAR THEN
1007                     l_rev_sub_resource_rec.attribute8 := NULL ;
1008             END IF;
1009 
1010             IF l_rev_sub_resource_rec.attribute9 = FND_API.G_MISS_CHAR THEN
1011                     l_rev_sub_resource_rec.attribute9 := NULL ;
1012             END IF;
1013 
1014             IF l_rev_sub_resource_rec.attribute10 = FND_API.G_MISS_CHAR THEN
1015                     l_rev_sub_resource_rec.attribute10 := NULL ;
1016             END IF;
1017 
1018             IF l_rev_sub_resource_rec.attribute11 = FND_API.G_MISS_CHAR THEN
1019                     l_rev_sub_resource_rec.attribute11 := NULL ;
1020             END IF;
1021 
1022             IF l_rev_sub_resource_rec.attribute12 = FND_API.G_MISS_CHAR THEN
1023                     l_rev_sub_resource_rec.attribute12 := NULL ;
1024             END IF;
1025 
1026             IF l_rev_sub_resource_rec.attribute13 = FND_API.G_MISS_CHAR THEN
1027                     l_rev_sub_resource_rec.attribute13 := NULL ;
1028             END IF;
1029 
1030             IF l_rev_sub_resource_rec.attribute14 = FND_API.G_MISS_CHAR THEN
1031                     l_rev_sub_resource_rec.attribute14 := NULL ;
1032             END IF;
1033 
1034             IF l_rev_sub_resource_rec.attribute15 = FND_API.G_MISS_CHAR THEN
1035                     l_rev_sub_resource_rec.attribute15 := NULL ;
1036             END IF;
1037 
1038 
1039            --  Return operation exp and unexp record
1040            x_rev_sub_resource_rec    := l_rev_sub_resource_rec ;
1041            x_rev_sub_res_unexp_rec   := l_rev_sub_res_unexp_rec ;
1042 
1043            -- Return the status and message table.
1044            x_return_status  := l_return_status ;
1045            x_mesg_token_tbl := l_mesg_token_tbl ;
1046 
1047 
1048     EXCEPTION
1049        WHEN OTHERS THEN
1050           IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1051           ('Some unknown error in Entity Defaulting . . .' || SQLERRM );
1052           END IF ;
1053 
1054 
1055           l_err_text := G_PKG_NAME || ' Defaulting (Entity Defaulting) '
1056                                 || substrb(SQLERRM,1,200);
1057           -- dbms_output.put_line('Unexpected Error: '||l_err_text);
1058 
1059           Error_Handler.Add_Error_Token
1060           (  p_message_name   => NULL
1061            , p_message_text   => l_err_text
1062            , p_mesg_token_tbl => l_mesg_token_tbl
1063            , x_mesg_token_tbl => l_mesg_token_tbl
1064           ) ;
1065 
1066           -- Return the status and message table.
1067           x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1068           x_mesg_token_tbl := l_mesg_token_tbl ;
1069 
1070     END Entity_Defaulting ;
1071 
1072 
1073 END BOM_Default_Sub_Op_Res ;