DBA Data[Home] [Help]

PACKAGE BODY: APPS.ENG_ECO_PVT

Source


1 PACKAGE BODY ENG_Eco_PVT AS
2 /* $Header: ENGVECOB.pls 120.11 2008/05/23 23:06:55 atjen ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME              CONSTANT VARCHAR2(30) := 'ENG_Eco_PVT';
7 G_EXC_QUIT_IMPORT       EXCEPTION;
8 
9 G_MISS_ECO_REC          ENG_Eco_PUB.ECO_Rec_Type;
10 G_MISS_ECO_REV_REC      ENG_Eco_PUB.ECO_Revision_Rec_Type;
11 G_MISS_REV_ITEM_REC     ENG_Eco_PUB.Revised_Item_Rec_Type;
12 G_MISS_REV_COMP_REC     BOM_BO_PUB.Rev_Component_Rec_Type;
13 G_MISS_REF_DESG_REC     BOM_BO_PUB.Ref_Designator_Rec_Type;
14 G_MISS_SUB_COMP_REC     BOM_BO_PUB.Sub_Component_Rec_Type;
15 
16 G_MISS_REV_OP_REC       Bom_Rtg_Pub.Rev_Operation_Tbl_Type;   --L1
17 G_MISS_REV_OP_RES_REC   Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type; --L1
18 G_MISS_REV_SUB_RES_REC  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;--L1
19 
20     -- Bug 2918350 // kamohan
21     -- Start Changes
22 
23     FUNCTION ret_co_status ( p_change_notice VARCHAR2, p_organization_id NUMBER)
24        RETURN NUMBER
25     IS
26 	CURSOR check_co_sch IS
27 	 SELECT status_type
28 	   FROM eng_engineering_changes
29 	 WHERE change_notice = p_change_notice
30 	      AND organization_id = p_organization_id
31 	      AND nvl(plm_or_erp_change, 'PLM') = 'PLM'; -- Added for bug 3692807
32 
33 	l_chk_co_sch eng_engineering_changes.status_type%TYPE;
34     BEGIN
35 	OPEN check_co_sch;
36 	FETCH check_co_sch INTO l_chk_co_sch;
37 	IF check_co_sch%FOUND THEN
38 		l_chk_co_sch := l_chk_co_sch;
39 	ELSE
40 		l_chk_co_sch := 10000;
41 	END IF;
42 	CLOSE check_co_sch;
43 
44 	RETURN l_chk_co_sch;
45 
46     END ret_co_status;
47 
48     -- End Changes
49 
50 
51 
52 --  L1:  The following part is for ECO enhancement
53 --  Rev_Sub_Operation_Resources
54 
55 PROCEDURE Rev_Sub_Operation_Resources
56 (   p_validation_level        IN  NUMBER
57 ,   p_change_notice           IN  VARCHAR2 := NULL
58 ,   p_organization_id         IN  NUMBER   := NULL
59 ,   p_revised_item_name       IN  VARCHAR2 := NULL
60 ,   p_effectivity_date        IN  DATE     := NULL
61 ,   p_item_revision           IN  VARCHAR2 := NULL
62 ,   p_routing_revision        IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
63 ,   p_from_end_item_number    IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
64 ,   p_operation_seq_num       IN  NUMBER   := NULL
65 ,   p_operation_type          IN  NUMBER   := NULL
66 ,   p_rev_sub_resource_tbl    IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
67 ,   x_rev_sub_resource_tbl    IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
68 ,   x_mesg_token_tbl          OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
69 ,   x_return_status           OUT NOCOPY VARCHAR2
70 )
71 
72 IS
73 
74 /* Exposed and Unexposed record */
75 l_eco_rec                ENG_Eco_PUB.Eco_Rec_Type;
76 l_eco_revision_tbl       ENG_Eco_PUB.ECO_Revision_Tbl_Type;
77 l_revised_item_tbl       ENG_Eco_PUB.Revised_Item_Tbl_Type;
78 l_rev_component_rec      BOM_BO_PUB.Rev_Component_Rec_Type;
79 l_rev_component_tbl      BOM_BO_PUB.Rev_Component_Tbl_Type;
80 l_rev_comp_unexp_rec     BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
81 --l_old_rev_component_rec  BOM_BO_PUB.Rev_Component_Rec_Type;
82 --l_old_rev_comp_unexp_rec BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
83 l_ref_designator_tbl     BOM_BO_PUB.Ref_Designator_Tbl_Type;
84 l_sub_component_tbl      BOM_BO_PUB.Sub_Component_Tbl_Type;
85 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type;
86 l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;
87 --l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;
88 l_rev_sub_resource_rec   Bom_Rtg_Pub.Rev_Sub_Resource_rec_Type;
89 l_rev_sub_res_unexp_rec  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type;
90 l_old_rev_sub_resource_rec   Bom_Rtg_Pub.Rev_Sub_Resource_rec_Type;
91 l_old_rev_sub_res_unexp_rec  Bom_Rtg_Pub.Rev_Sub_Res_Unexposed_Rec_Type;
92 
93 /* Error Handling Variables */
94 l_token_tbl             Error_Handler.Token_Tbl_Type ;
95 l_mesg_token_tbl        Error_Handler.Mesg_Token_Tbl_Type;
96 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
97 l_other_message         VARCHAR2(2000);
98 l_err_text              VARCHAR2(2000);
99 
100 
101 /* Others */
102 l_return_status         VARCHAR2(1);
103 l_bo_return_status      VARCHAR2(1);
104 l_op_parent_exists      BOOLEAN := FALSE;
105 l_rtg_parent_exists     BOOLEAN := FALSE;
106 l_process_children      BOOLEAN := TRUE;
107 l_valid                 BOOLEAN := TRUE;
108 
109 /* Error handler definations */
110 EXC_SEV_QUIT_RECORD     EXCEPTION ;
111 EXC_SEV_QUIT_BRANCH     EXCEPTION ;
112 EXC_UNEXP_SKIP_OBJECT   EXCEPTION ;
113 EXC_SEV_QUIT_SIBLINGS   EXCEPTION ;
114 EXC_SEV_SKIP_BRANCH     EXCEPTION ;
115 EXC_FAT_QUIT_SIBLINGS   EXCEPTION ;
116 EXC_FAT_QUIT_BRANCH     EXCEPTION ;
117 EXC_FAT_QUIT_OBJECT     EXCEPTION ;
118 
119 BEGIN
120 
121    --  Init local table variables.
122    l_return_status    := 'S';
123    l_bo_return_status := 'S';
124    --l_rev_sub_resource_tbl  := p_rev_sub_resource_tbl;
125    x_rev_sub_resource_tbl  := p_rev_sub_resource_tbl;
126    l_rev_sub_res_unexp_rec.organization_id := Eng_Globals.Get_Org_Id;
127 
128    FOR I IN 1..x_rev_sub_resource_tbl.COUNT LOOP
129    -- Processing records for which the return status is null
130    IF (x_rev_sub_resource_tbl(I).return_status IS NULL OR
131         x_rev_sub_resource_tbl(I).return_status  = FND_API.G_MISS_CHAR)
132    THEN
133    BEGIN
134 
135       --  Load local records
136       l_rev_sub_resource_rec := x_rev_sub_resource_tbl(I);
137 
138       l_rev_sub_resource_rec.transaction_type :=
139           UPPER(l_rev_sub_resource_rec.transaction_type);
140 
141 
142 
143       --
144       -- Initialize the Unexposed Record for every iteration of the Loop
145       -- so that sequence numbers get generated for every new row.
146       --
147       l_rev_sub_res_unexp_rec.Revised_Item_Sequence_Id := NULL ;
148       l_rev_sub_res_unexp_rec.Operation_Sequence_Id   := NULL ;
149       l_rev_sub_res_unexp_rec.Substitute_Group_Number := NULL ;
150       l_rev_sub_res_unexp_rec.Resource_Id             := NULL ;
151       l_rev_sub_res_unexp_rec.New_Resource_Id         := NULL ;
152       l_rev_sub_res_unexp_rec.Activity_Id             := NULL ;
153       l_rev_sub_res_unexp_rec.Setup_Id                := NULL ;
154 
155       IF p_operation_seq_num  IS NOT NULL AND
156          p_revised_item_name  IS NOT NULL AND
157          p_effectivity_date   IS NOT NULL AND
158          p_organization_id    IS NOT NULL
159       THEN
160          -- Revised Operation or Operation Sequence parent exists
161          l_op_parent_exists  := TRUE;
162 
163       ELSIF p_revised_item_name IS NOT NULL AND
164             p_organization_id    IS NOT NULL
165       THEN
166          -- Revised Item or Routing parent exists
167          l_rtg_parent_exists := TRUE;
168       END IF ;
169 
170       -- Process Flow Step 2: Check if record has not yet been processed and
171       -- that it is the child of the parent that called this procedure
172       --
173 
174       IF --(l_rev_sub_resource_rec.return_status IS NULL OR
175          -- l_rev_sub_resource_rec.return_status  = FND_API.G_MISS_CHAR)
176          --AND
177          (
178             -- Did Op_Seq call this procedure, that is,
179             -- if revised operation(operation sequence) exists, then is this record a child ?
180             (   l_op_parent_exists AND
181                 l_rev_sub_resource_rec.ECO_name = p_change_notice       AND
182                 l_rev_sub_res_unexp_rec.organization_id
183                                              =   p_organization_id      AND
184                 NVL(l_rev_sub_resource_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
185                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR )       AND
186                 l_rev_sub_resource_rec.revised_item_name
187                                              =   p_revised_item_name    AND
188                 l_rev_sub_resource_rec.operation_sequence_number
189                                              =   p_operation_seq_num    AND
190                 NVL(l_rev_sub_resource_rec.new_routing_revision,FND_API.G_MISS_CHAR )
191                                              =   NVL(p_routing_revision,FND_API.G_MISS_CHAR )     AND -- Added by MK on 11/02/00
192                 NVL(l_rev_sub_resource_rec.from_end_item_unit_number,FND_API.G_MISS_CHAR )
193                                              =   NVL(p_from_end_item_number,FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
194                 l_rev_sub_resource_rec.op_start_effective_date
195                                              = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) -- Bug 6657209
196               --  NVL(l_rev_sub_resource_rec.operation_type, 1)
197               --                               = NVL(p_operation_type, 1)
198 
199             )
200             OR
201             -- Did Rtg_Header call this procedure, that is,
202             -- if revised item or routing header exists, then is this record a child ?
203             (  l_rtg_parent_exists AND
204                l_rev_sub_resource_rec.ECO_name = p_change_notice       AND
205                l_rev_sub_res_unexp_rec.organization_id
206                                              =   p_organization_id     AND
207                NVL(l_rev_sub_resource_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
208                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR )       AND
209                l_rev_sub_resource_rec.revised_item_name
210                                              = p_revised_item_name     AND
211                NVL(l_rev_sub_resource_rec.new_routing_revision,FND_API.G_MISS_CHAR )
212                                              =   NVL(p_routing_revision,FND_API.G_MISS_CHAR )     AND -- Added by MK on 11/02/00
213                NVL(l_rev_sub_resource_rec.from_end_item_unit_number,FND_API.G_MISS_CHAR )
214                                              =   NVL(p_from_end_item_number,FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
215                l_rev_sub_resource_rec.op_start_effective_date
216                                              = p_effectivity_date
217              --   NVL(l_rev_sub_resource_rec.alternate_routing_code, 'P')
218              --                      = NVL(p_alternate_routing_code, 'P')
219 
220             )
221            OR
222            (NOT l_rtg_parent_exists AND NOT l_op_parent_exists)
223          )
224       THEN
225          l_return_status := FND_API.G_RET_STS_SUCCESS;
226          l_rev_sub_resource_rec.return_status := FND_API.G_RET_STS_SUCCESS;
227 
228          -- Bug 6657209
229          IF (l_op_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null) THEN
230            l_rev_sub_resource_rec.op_start_effective_date := p_effectivity_date;
231          END IF;
232          --
233          -- Process Flow step 3 : Check if transaction_type is valid
234          -- Transaction_Type must be CRATE, UPDATE, DELETE or CANCEL(in only ECO for Rrg)
235          -- Call the Bom_Rtg_Globals.Transaction_Type_Validity
236          --
237          Eng_Globals.Transaction_Type_Validity
238          (   p_transaction_type => l_rev_sub_resource_rec.transaction_type
239          ,   p_entity           => 'Sub_Res'
240          ,   p_entity_id        => l_rev_sub_resource_rec.Sub_Resource_Code
241          ,   x_valid            => l_valid
242          ,   x_mesg_token_tbl   => l_mesg_token_tbl
243          ) ;
244 
245          IF NOT l_valid
246          THEN
247             RAISE EXC_SEV_QUIT_RECORD ;
248          END IF ;
249 
250          --
251          -- Process Flow step 4(a): Convert user unique index to unique
252          -- index I
253          -- Call Rtg_Val_To_Id.Op_Resource_UUI_To_UI Shared Utility Package
254          --
255          BOM_Rtg_Val_To_Id.Rev_Sub_Resource_UUI_To_UI
256          ( p_rev_sub_resource_rec    => l_rev_sub_resource_rec
257          , p_rev_sub_res_unexp_rec   => l_rev_sub_res_unexp_rec
258          , x_rev_sub_res_unexp_rec   => l_rev_sub_res_unexp_rec
259          , x_mesg_token_tbl          => l_mesg_token_tbl
260          , x_return_status           => l_return_status
261          ) ;
262 
263          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
264          ('Convert to User Unique Index to Index1 completed with return_status: ' || l_return_status) ;
265          END IF;
266 
267          IF l_return_status = Error_Handler.G_STATUS_ERROR
268          THEN
269             l_other_message := 'BOM_SUB_RES_UUI_SEV_ERROR';
270             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
271             l_other_token_tbl(1).token_value :=
272                         l_rev_sub_resource_rec.sub_resource_code ;
273             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
274             l_other_token_tbl(2).token_value :=
275                         l_rev_sub_resource_rec.schedule_sequence_number ;
276             RAISE EXC_SEV_QUIT_BRANCH ;
277 
278          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
279          THEN
280             l_other_message := 'BOM_SUB_RES_UUI_UNEXP_SKIP';
281             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
282             l_other_token_tbl(1).token_value :=
283                         l_rev_sub_resource_rec.sub_resource_code ;
284             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
285             l_other_token_tbl(2).token_value :=
286                         l_rev_sub_resource_rec.schedule_sequence_number ;
287             RAISE EXC_UNEXP_SKIP_OBJECT;
288          END IF ;
289 
290          -- Added by MK on 12/03/00 to resolve ECO dependency
291          ENG_Val_To_Id.RtgAndRevitem_UUI_To_UI
292            ( p_revised_item_name        => l_rev_sub_resource_rec.revised_item_name
293            , p_revised_item_id          => l_rev_sub_res_unexp_rec.revised_item_id
294            , p_item_revision            => l_rev_sub_resource_rec.new_revised_item_revision
295            , p_effective_date           => l_rev_sub_resource_rec.op_start_effective_date
296            , p_change_notice            => l_rev_sub_resource_rec.eco_name
297            , p_organization_id          => l_rev_sub_res_unexp_rec.organization_id
298            , p_new_routing_revision     => l_rev_sub_resource_rec.new_routing_revision
299            , p_from_end_item_number     => l_rev_sub_resource_rec.from_end_item_unit_number
300            , p_entity_processed         => 'SR'
301            , p_operation_sequence_number => l_rev_sub_resource_rec.operation_sequence_number
302            , p_sub_resource_code         => l_rev_sub_resource_rec.sub_resource_code
303            , p_schedule_sequence_number  => l_rev_sub_resource_rec.schedule_sequence_number
304            , x_revised_item_sequence_id  => l_rev_sub_res_unexp_rec.revised_item_sequence_id
305            , x_routing_sequence_id       => l_rev_sub_res_unexp_rec.routing_sequence_id
306            , x_operation_sequence_id     => l_rev_sub_res_unexp_rec.operation_sequence_id
307            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
308            , x_other_message            => l_other_message
309            , x_other_token_tbl          => l_other_token_tbl
310            , x_Return_Status            => l_return_status
311           ) ;
312 
313          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
314          ('Convert to User Unique Index to Index1 for Rtg and Rev Item Seq completed with return_status: ' || l_return_status) ;
315          END IF;
316 
317          IF l_return_status = Error_Handler.G_STATUS_ERROR
318          THEN
319             l_other_message := 'BOM_SUB_RES_UUI_SEV_ERROR';
320             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
321             l_other_token_tbl(1).token_value :=
322                         l_rev_sub_resource_rec.sub_resource_code ;
323             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
324             l_other_token_tbl(2).token_value :=
325                         l_rev_sub_resource_rec.schedule_sequence_number ;
326             RAISE EXC_SEV_QUIT_BRANCH ;
327 
328          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
329          THEN
330             l_other_message := 'BOM_SUB_RES_UUI_UNEXP_SKIP';
331             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
332             l_other_token_tbl(1).token_value :=
333                         l_rev_sub_resource_rec.sub_resource_code ;
334             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
335             l_other_token_tbl(2).token_value :=
336                         l_rev_sub_resource_rec.schedule_sequence_number ;
337             RAISE EXC_UNEXP_SKIP_OBJECT;
338          END IF ;
339 
340 
341 
342 
343          --
344          -- Process Flow step 4(b): Convert user unique index to unique
345          -- index II
346          -- Call the Rtg_Val_To_Id.Rev_Sub_Resource_UUI_To_UI2
347          --
348         /*
349          Bom_Rtg_Val_To_Id.Rev_Sub_Resource_UUI_To_UI2
350          ( p_rev_sub_resource_rec   => l_rev_sub_resource_rec
351          , p_rev_sub_res_unexp_rec  => l_rev_sub_res_unexp_rec
352          , x_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
353          , x_mesg_token_tbl         => l_mesg_token_tbl
354          , x_other_message          => l_other_message
355          , x_other_token_tbl        => l_other_token_tbl
356          , x_return_status          => l_return_status
357          ) ;
358 
359          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
360          ('Convert to User Unique Index to Index2 completed with return_status: ' || l_return_status) ;
361          END IF;
362 
363          IF l_return_status = Error_Handler.G_STATUS_ERROR
364          THEN
365             RAISE EXC_SEV_QUIT_SIBLINGS ;
366          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
367          THEN
368             l_other_message := 'BOM_SUB_RES_UUI_UNEXP_SKIP';
369             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
370             l_other_token_tbl(1).token_value :=
371                         l_rev_sub_resource_rec.sub_resource_code;
372             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
373             l_other_token_tbl(2).token_value :=
374                         l_rev_sub_resource_rec.schedule_sequence_number ;
375             RAISE EXC_UNEXP_SKIP_OBJECT;
376          END IF ;
377 
378         */
379          --
380          -- Process Flow step 5: Verify Substitute Resource's existence
381          -- Call the Bom_Validate_Sub_Op_Res.Check_Existence.
382          --
383          --
384 
385          Bom_Validate_Sub_Op_Res.Check_Existence
386          (  p_rev_sub_resource_rec        => l_rev_sub_resource_rec
387          ,  p_rev_sub_res_unexp_rec       => l_rev_sub_res_unexp_rec
388          ,  x_old_rev_sub_resource_rec    => l_old_rev_sub_resource_rec
389          ,  x_old_rev_sub_res_unexp_rec   => l_old_rev_sub_res_unexp_rec
390          ,  x_mesg_token_tbl              => l_mesg_token_tbl
391          ,  x_return_status               => l_return_status
392          ) ;
393 
394 
395          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
396          ('Check Existence completed with return_status: ' || l_return_status) ;
397          END IF ;
398 
399          IF l_return_status = Error_Handler.G_STATUS_ERROR
400          THEN
401             l_other_message := 'BOM_SUB_RES_EXS_SEV_SKIP';
402             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
403             l_other_token_tbl(1).token_value :=
404                         l_rev_sub_resource_rec.sub_resource_code ;
405             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
406             l_other_token_tbl(2).token_value :=
407                         l_rev_sub_resource_rec.schedule_sequence_number ;
408             -- l_other_token_tbl(3).token_name := 'REVISED_ITEM_NAME';
409             -- l_other_token_tbl(3).token_value :=
410             --            l_rev_sub_resource_rec.revised_item_name ;
411             RAISE EXC_SEV_QUIT_BRANCH;
412          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
413          THEN
414             l_other_message := 'BOM_SUB_RES_EXS_UNEXP_SKIP';
415             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
416             l_other_token_tbl(1).token_value :=
417                         l_rev_sub_resource_rec.sub_resource_code ;
418             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
419             l_other_token_tbl(2).token_value :=
420                         l_rev_sub_resource_rec.schedule_sequence_number ;
421             -- l_other_token_tbl(3).token_name := 'REVISED_ITEM_NAME';
422             -- l_other_token_tbl(3).token_value :=
423             --          l_rev_sub_resource_rec.revised_item_name ;
424             RAISE EXC_UNEXP_SKIP_OBJECT;
425          END IF;
426 
427 
428          --
429          -- Process Flow step 6: Is Substitute Resource record an orphan ?
430          --
431 
432          IF NOT l_op_parent_exists
433          THEN
434 
435             --
436             -- Process Flow step 7: Check lineage
437             --
438             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');     END IF;
439             BOM_Validate_Op_Seq.Check_Lineage
440                 ( p_routing_sequence_id       =>
441                                l_rev_sub_res_unexp_rec.routing_sequence_id
442                 , p_operation_sequence_number =>
443                                l_rev_sub_resource_rec.operation_sequence_number
444                 , p_effectivity_date          =>
445                                l_rev_sub_resource_rec.op_start_effective_date
446                 , p_operation_type            =>
447                                l_rev_sub_resource_rec.operation_type
448                 , p_revised_item_sequence_id  =>
449                                l_rev_sub_res_unexp_rec.revised_item_sequence_id
450                 , x_mesg_token_tbl            => l_mesg_token_tbl
451                 , x_return_status             => l_return_status
452                 ) ;
453 
454             IF l_return_status = Error_Handler.G_STATUS_ERROR
455             THEN
456 
457                 l_Token_Tbl(1).token_name  := 'SUB_RESOURCE_CODE';
458                 l_Token_Tbl(1).token_value := l_rev_sub_resource_rec.sub_resource_code ;
459                 l_Token_Tbl(2).token_name  := 'SCHEDULE_SEQ_NUMBER';
460                 l_Token_Tbl(2).token_value := l_rev_sub_resource_rec.schedule_sequence_number ;
461                 l_Token_Tbl(3).token_name  := 'OP_SEQ_NUMBER' ;
462                 l_Token_Tbl(3).token_value := l_rev_sub_resource_rec.operation_sequence_number ;
463                 l_Token_Tbl(4).token_name  := 'REVISED_ITEM_NAME' ;
464                 l_Token_Tbl(4).token_value := l_rev_sub_resource_rec.revised_item_name;
465 
466                 Error_Handler.Add_Error_Token
467                 (  p_Message_Name  => 'BOM_SUB_RES_REV_ITEM_MISMATCH'
468                 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
469                 , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
470                 , p_Token_Tbl      => l_Token_Tbl
471                 ) ;
472 
473 
474                 l_other_message := 'BOM_SUB_RES_LIN_SEV_SKIP';
475                 l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
476                 l_other_token_tbl(1).token_value :=
477                             l_rev_sub_resource_rec.sub_resource_code ;
478                 l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
479                 l_other_token_tbl(2).token_value :=
480                             l_rev_sub_resource_rec.schedule_sequence_number ;
481 
482                 RAISE EXC_SEV_QUIT_BRANCH;
483 
484             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
485             THEN
486                 l_other_message := 'BOM_SUB_RES_LIN_UNEXP_SKIP';
487                 l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
488                 l_other_token_tbl(1).token_value :=
489                             l_rev_sub_resource_rec.sub_resource_code ;
490                 l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
491                 l_other_token_tbl(2).token_value :=
492                             l_rev_sub_resource_rec.schedule_sequence_number ;
493                 RAISE EXC_UNEXP_SKIP_OBJECT;
494             END IF;
495 
496             -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
497             --
498 
499             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check ECO access'); END IF;
500 
501             ENG_Validate_ECO.Check_Access
502             ( p_change_notice       => l_rev_sub_resource_rec.ECO_Name
503             , p_organization_id     => l_rev_sub_res_unexp_rec.organization_id
504             , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
505             , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
506             , x_Return_Status       => l_return_status
507             );
508 
509             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
510 
511             IF l_return_status = Error_Handler.G_STATUS_ERROR
512             THEN
513                         l_other_message := 'BOM_SUB_RES_ECOACC_FAT_FATAL';
514                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
515                         l_other_token_tbl(1).token_value :=
516                                     l_rev_sub_resource_rec.sub_resource_code ;
517                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
518                         l_other_token_tbl(2).token_value :=
519                                     l_rev_sub_resource_rec.schedule_sequence_number ;
520                         l_return_status := 'F';
521                         RAISE EXC_FAT_QUIT_OBJECT;
522             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
523             THEN
524                         l_other_message := 'BOM_SUB_RES_ECOACC_UNEXP_SKIP';
525                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
526                         l_other_token_tbl(1).token_value :=
527                                     l_rev_sub_resource_rec.sub_resource_code ;
528                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
529                         l_other_token_tbl(2).token_value :=
530                                     l_rev_sub_resource_rec.schedule_sequence_number ;
531                         RAISE EXC_UNEXP_SKIP_OBJECT;
532             END IF;
533 
534             -- Process Flow step 9(a and b): check that user has access to revised item
535             --
536 
537             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Revised item access'); END IF;
538             ENG_Validate_Revised_Item.Check_Access
539             (  p_change_notice   => l_rev_sub_resource_rec.ECO_Name
540             ,  p_organization_id => l_rev_sub_res_unexp_rec.organization_id
541             ,  p_revised_item_id => l_rev_sub_res_unexp_rec.revised_item_id
542             ,  p_new_item_revision  =>
543                                l_rev_sub_resource_rec.new_revised_item_revision
544             ,  p_effectivity_date   =>
545                                l_rev_sub_resource_rec.op_start_effective_date
546             ,  p_new_routing_revsion   => l_rev_sub_resource_rec.new_routing_revision  -- Added by MK on 11/02/00
547             ,  p_from_end_item_number  => l_rev_sub_resource_rec.from_end_item_unit_number -- Added by MK on 11/02/00
548             ,  p_revised_item_name     =>
549                                l_rev_sub_resource_rec.revised_item_name
550             ,  p_entity_processed   => 'SR'                                               -- Added by MK
551             ,  p_operation_seq_num  =>  l_rev_sub_resource_rec.operation_sequence_number  -- Added by MK
552             ,  p_routing_sequence_id => l_rev_sub_res_unexp_rec.routing_sequence_id       -- Added by MK
553             ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
554             ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
555             ,  x_return_status      => l_Return_Status
556             );
557 
558             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
559 
560             IF l_return_status = Error_Handler.G_STATUS_ERROR
561             THEN
562                         l_other_message := 'BOM_SUB_RES_RITACC_FAT_FATAL';
563                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
564                         l_other_token_tbl(1).token_value :=
565                                     l_rev_sub_resource_rec.sub_resource_code ;
566                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
567                         l_other_token_tbl(2).token_value :=
568                                     l_rev_sub_resource_rec.schedule_sequence_number ;
569                         l_return_status := 'F';
570                         RAISE EXC_FAT_QUIT_SIBLINGS;
571             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
572             THEN
573                         l_other_message := 'BOM_SUB_RES_RITACC_UNEXP_SKIP';
574                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
575                         l_other_token_tbl(1).token_value :=
576                                     l_rev_sub_resource_rec.sub_resource_code ;
577                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
578                         l_other_token_tbl(2).token_value :=
579                                     l_rev_sub_resource_rec.schedule_sequence_number ;
580                         RAISE EXC_UNEXP_SKIP_OBJECT;
581             END IF;
582 
583             --
584             -- Process Flow step 10(b) : Check that user has access to revised
585             -- operation
586             -- BOM_Validate_Op_Seq.Check_Access
587 
588             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Operation sequence item access'); END IF;
589             BOM_Validate_Op_Seq.Check_Access
590               (  p_change_notice      => l_rev_sub_resource_rec.ECO_Name
591               ,  p_organization_id    => l_rev_sub_res_unexp_rec.organization_id
592               ,  p_revised_item_id    => l_rev_sub_res_unexp_rec.revised_item_id
593               ,  p_revised_item_name  => l_rev_sub_resource_rec.revised_item_name
594               ,  p_new_item_revision  =>
595                              l_rev_sub_resource_rec.new_revised_item_revision
596               ,  p_effectivity_date   =>
597                              l_rev_sub_resource_rec.op_start_effective_date
598               ,  p_new_routing_revsion   => l_rev_sub_resource_rec.new_routing_revision  -- Added by MK on 11/02/00
599               ,  p_from_end_item_number  => l_rev_sub_resource_rec.from_end_item_unit_number -- Added by MK on 11/02/00
600               ,  p_operation_seq_num  =>
601                              l_rev_sub_resource_rec.operation_sequence_number
602               ,  p_routing_sequence_id=>
603                                    l_rev_sub_res_unexp_rec.routing_sequence_id
604               ,  p_operation_type     => l_rev_sub_resource_rec.operation_type
605               ,  p_entity_processed   => 'SR'
606               ,  p_sub_resource_code  =>
607                             l_rev_sub_resource_rec.sub_resource_code
608               ,  p_sub_group_num      =>
609                             l_rev_sub_resource_rec.schedule_sequence_number
610               ,  p_resource_seq_num   => NULL
611               ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
612               ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
613               ,  x_return_status      => l_Return_Status
614              );
615 
616             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
617 
618             IF l_return_status = Error_Handler.G_STATUS_ERROR
619             THEN
620                         l_other_message := 'BOM_SUB_RES_ACCESS_FAT_FATAL';
621                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
622                         l_other_token_tbl(1).token_value :=
623                                     l_rev_sub_resource_rec.sub_resource_code ;
624                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
625                         l_other_token_tbl(2).token_value :=
626                                     l_rev_sub_resource_rec.schedule_sequence_number ;
627                         l_return_status := 'F';
628                         RAISE EXC_FAT_QUIT_OBJECT;
629             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
630             THEN
631                         l_other_message := 'BOM_SUB_RES_ACCESS_UNEXP_SKIP';
632                         l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
633                         l_other_token_tbl(1).token_value :=
634                                     l_rev_sub_resource_rec.sub_resource_code ;
635                         l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
636                         l_other_token_tbl(2).token_value :=
637                                     l_rev_sub_resource_rec.schedule_sequence_number ;
638                         RAISE EXC_UNEXP_SKIP_OBJECT;
639             END IF;
640 
641          END IF; -- parent op does not exist
642 
643          --
644          -- Process Flow step 11 : Check if the parent operation is
645          -- non-referencing operation of type: Event
646          -- Call Bom_Validate_Op_Seq.Check_NonRefEvent
647          --
648          Bom_Validate_Op_Res.Check_NonRefEvent
649          (  p_operation_sequence_id =>
650                                   l_rev_sub_res_unexp_rec.operation_sequence_id
651             ,  p_operation_type       => l_rev_sub_resource_rec.operation_type
652             ,  p_entity_processed     => 'RES'
653             ,  x_mesg_token_tbl       => l_mesg_token_tbl
654             ,  x_return_status        => l_return_status
655          ) ;
656 
657          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
658             ('Check non-ref operation completed with return_status: '
659                       || l_return_status) ;
660          END IF;
661 
662          IF l_return_status = Error_Handler.G_STATUS_ERROR
663          THEN
664                IF l_rev_sub_resource_rec.operation_type IN (2, 3) -- Process or Line Op
665                THEN
666 
667                   l_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
668                   l_token_tbl(1).token_value :=
669                           l_rev_sub_resource_rec.sub_resource_code ;
670                   l_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
671                   l_token_tbl(2).token_value :=
672                           l_rev_sub_resource_rec.schedule_sequence_number ;
673                   l_token_tbl(3).token_name := 'OP_SEQ_NUMBER';
674                   l_token_tbl(3).token_value :=
675                           l_rev_sub_resource_rec.operation_sequence_number ;
676 
677                   Error_Handler.Add_Error_Token
678                         ( p_Message_Name   => 'BOM_SUB_RES_OPTYPE_NOT_EVENT'
679                         , p_mesg_token_tbl => l_mesg_token_tbl
680                         , x_mesg_token_tbl => l_mesg_token_tbl
681                         , p_Token_Tbl      => l_token_tbl
682                         ) ;
683                ELSE
684 
685                   l_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
686                   l_token_tbl(1).token_value :=
687                           l_rev_sub_resource_rec.sub_resource_code ;
688                   l_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
689                   l_token_tbl(2).token_value :=
690                           l_rev_sub_resource_rec.schedule_sequence_number ;
691                   l_token_tbl(3).token_name := 'OP_SEQ_NUMBER';
692                   l_token_tbl(3).token_value :=
693                           l_rev_sub_resource_rec.operation_sequence_number ;
694 
695                   Error_Handler.Add_Error_Token
696                         ( p_Message_Name   => 'BOM_SUB_RES_MUST_NONREF'
697                         , p_mesg_token_tbl => l_mesg_token_tbl
698                         , x_mesg_token_tbl => l_mesg_token_tbl
699                         , p_Token_Tbl      => l_token_tbl
700                         ) ;
701 
702                END IF ;
703 
704                l_return_status := 'F';
705                l_other_message := 'BOM_SUB_RES_ACCESS_FAT_FATAL';
706                l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
707                l_other_token_tbl(1).token_value :=
708                                     l_rev_sub_resource_rec.sub_resource_code ;
709                l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
710                l_other_token_tbl(2).token_value :=
711                                     l_rev_sub_resource_rec.schedule_sequence_number ;
712 
713                RAISE EXC_FAT_QUIT_SIBLINGS ;
714 
715          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
716          THEN
717                l_other_message := 'BOM_SUB_RES_ACCESS_UNEXP_SKIP';
718                l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
719                l_other_token_tbl(1).token_value :=
720                         l_rev_sub_resource_rec.sub_resource_code ;
721                l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
722                l_other_token_tbl(2).token_value :=
723                         l_rev_sub_resource_rec.schedule_sequence_number ;
724                RAISE EXC_UNEXP_SKIP_OBJECT;
725          END IF;
726 
727 
728          --
729          -- Process Flow step 12: Value to Id conversions
730          -- Call Rtg_Val_To_Id.Rev_Sub_Resource_VID
731          --
732 
733          Bom_Rtg_Val_To_Id.Rev_Sub_Resource_VID
734          (  p_rev_sub_resource_rec       => l_rev_sub_resource_rec
735          ,  p_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
736          ,  x_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
737          ,  x_mesg_token_tbl             => l_mesg_token_tbl
738          ,  x_return_status              => l_return_status
739          );
740 
741          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
742          ('Value-id conversions completed with return_status: ' || l_return_status) ;
743          END IF ;
744 
745          IF l_return_status = Error_Handler.G_STATUS_ERROR
746          THEN
747             IF l_rev_sub_resource_rec.transaction_type = 'CREATE'
748             THEN
749                l_other_message := 'BOM_SUB_RES_VID_CSEV_SKIP';
750                l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
751                l_other_token_tbl(1).token_value :=
752                         l_rev_sub_resource_rec.sub_resource_code ;
753                l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
754                l_other_token_tbl(2).token_value :=
755                         l_rev_sub_resource_rec.schedule_sequence_number ;
756                RAISE EXC_SEV_SKIP_BRANCH;
757             ELSE
758                RAISE EXC_SEV_QUIT_RECORD ;
759             END IF ;
760 
761          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
762          THEN
763             l_other_message := 'BOM_SUB_RES_VID_UNEXP_SKIP';
764             l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
765             l_other_token_tbl(1).token_value :=
766                      l_rev_sub_resource_rec.sub_resource_code ;
767             l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
768             l_other_token_tbl(2).token_value :=
769                      l_rev_sub_resource_rec.schedule_sequence_number ;
770             RAISE EXC_UNEXP_SKIP_OBJECT;
771 
772          ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
773          THEN
774            ECO_Error_Handler.Log_Error
775             (
776                p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
777             ,  p_mesg_token_tbl      => l_mesg_token_tbl
778             ,  p_error_status        => 'W'
779             ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
780             ,  p_entity_index        => I
781             ,  x_eco_rec             => l_ECO_rec
782             ,  x_eco_revision_tbl    => l_eco_revision_tbl
783             ,  x_revised_item_tbl    => l_revised_item_tbl
784             ,  x_rev_component_tbl   => l_rev_component_tbl
785             ,  x_ref_designator_tbl  => l_ref_designator_tbl
786             ,  x_sub_component_tbl   => l_sub_component_tbl
787             ,  x_rev_operation_tbl   => l_rev_operation_tbl
788             ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
789             ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
790             ) ;
791 
792 
793          END IF;
794 
795 
796          --
797          -- Process Flow step 13 : Check required fields exist
798          -- (also includes a part of conditionally required fields)
799          --
800          -- No process contents
801 
802          --
803          -- Process Flow step 14 : Attribute Validation for CREATE and UPDATE
804          -- Call Bom_Validate_Op_Res.Check_Attributes
805          --
806 
807          IF l_rev_sub_resource_rec.transaction_type IN
808             (Bom_Rtg_Globals.G_OPR_CREATE, Bom_Rtg_Globals.G_OPR_UPDATE)
809          THEN
810             Bom_Validate_Sub_Op_Res.Check_Attributes
811             ( p_rev_sub_resource_rec   => l_rev_sub_resource_rec
812             , p_rev_sub_res_unexp_rec  => l_rev_sub_res_unexp_rec
813             , x_return_status          => l_return_status
814             , x_mesg_token_tbl         => l_mesg_token_tbl
815             ) ;
816 
817             IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
818             ('Attribute validation completed with return_status: ' ||
819                   l_return_status) ;
820             END IF ;
821 
822             IF l_return_status = Error_Handler.G_STATUS_ERROR
823             THEN
824                IF l_rev_sub_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
825                THEN
826                   l_other_message := 'BOM_SUB_RES_ATTVAL_CSEV_SKIP';
827                   l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
828                   l_other_token_tbl(1).token_value :=
829                         l_rev_sub_resource_rec.sub_resource_code ;
830                   l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
831                   l_other_token_tbl(2).token_value :=
832                         l_rev_sub_resource_rec.schedule_sequence_number ;
833                   RAISE EXC_SEV_SKIP_BRANCH ;
834                   ELSE
835                      RAISE EXC_SEV_QUIT_RECORD ;
836                END IF;
837             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
838             THEN
839                l_other_message := 'BOM_SUB_RES_ATTVAL_UNEXP_SKIP';
840                l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
841                l_other_token_tbl(1).token_value :=
842                         l_rev_sub_resource_rec.sub_resource_code ;
843                l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
844                l_other_token_tbl(2).token_value :=
845                         l_rev_sub_resource_rec.schedule_sequence_number ;
846                RAISE EXC_UNEXP_SKIP_OBJECT ;
847             ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
848             THEN
849                ECO_Error_Handler.Log_Error
850                (
851                   p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
852                ,  p_mesg_token_tbl      => l_mesg_token_tbl
853                ,  p_error_status        => 'W'
854                ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
855                ,  p_entity_index        => I
856                ,  x_eco_rec             => l_ECO_rec
857                ,  x_eco_revision_tbl    => l_eco_revision_tbl
858                ,  x_revised_item_tbl    => l_revised_item_tbl
859                ,  x_rev_component_tbl   => l_rev_component_tbl
860                ,  x_ref_designator_tbl  => l_ref_designator_tbl
861                ,  x_sub_component_tbl   => l_sub_component_tbl
862                ,  x_rev_operation_tbl   => l_rev_operation_tbl
863                ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
864                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
865                ) ;
866            END IF;
867         END IF;
868 
869         IF l_rev_sub_resource_rec.transaction_type IN
870            (Bom_Rtg_Globals.G_OPR_UPDATE, Bom_Rtg_Globals.G_OPR_DELETE)
871         THEN
872 
873         --
874         -- Process flow step 16: Populate NULL columns for Update and Delete
875         -- Call Bom_Default_Op_Res.Populate_Null_Columns
876         --
877 
878            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populate NULL columns') ;
879            END IF ;
880 
881            Bom_Default_Sub_Op_Res.Populate_Null_Columns
882            (   p_rev_sub_resource_rec       => l_rev_sub_resource_rec
883            ,   p_old_rev_sub_resource_rec   => l_old_rev_sub_resource_rec
884            ,   p_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
885            ,   p_old_rev_sub_res_unexp_rec  => l_old_rev_sub_res_unexp_rec
886            ,   x_rev_sub_resource_rec       => l_rev_sub_resource_rec
887            ,   x_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
888            ) ;
889 
890 
891         ELSIF l_rev_sub_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
892         THEN
893         --
894         -- Process Flow step 18 : Default missing values for Sub Op Resource (CREATE)
895         -- Call Bom_Default_Op_Res.Attribute_Defaulting
896         --
897 
898            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting') ;
899            END IF ;
900 
901            Bom_Default_Sub_Op_Res.Attribute_Defaulting
902            (   p_rev_sub_resource_rec => l_rev_sub_resource_rec
903            ,   p_rev_sub_res_unexp_rec=> l_rev_sub_res_unexp_rec
904            ,   p_control_rec          => Bom_Rtg_Pub.G_Default_Control_Rec
905            ,   x_rev_sub_resource_rec => l_rev_sub_resource_rec
906            ,   x_rev_sub_res_unexp_rec=> l_rev_sub_res_unexp_rec
907            ,   x_mesg_token_tbl       => l_mesg_token_tbl
908            ,   x_return_status        => l_return_status
909            ) ;
910 
911 
912            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
913            ('Attribute Defaulting completed with return_status: ' || l_return_status) ;
914            END IF ;
915 
916            IF l_return_status = Error_Handler.G_STATUS_ERROR
917            THEN
918               l_other_message := 'BOM_SUB_RES_ATTDEF_CSEV_SKIP';
919               l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
920               l_other_token_tbl(1).token_value:=
921                         l_rev_sub_resource_rec.sub_resource_code ;
922               l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
923               l_other_token_tbl(2).token_value:=
924                         l_rev_sub_resource_rec.schedule_sequence_number ;
925               RAISE EXC_SEV_SKIP_BRANCH ;
926 
927            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
928            THEN
929               l_other_message := 'BOM_SUB_RES_ATTDEF_UNEXP_SKIP';
930               l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
931               l_other_token_tbl(1).token_value:=
932                         l_rev_sub_resource_rec.sub_resource_code ;
933               l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
934               l_other_token_tbl(2).token_value:=
935                         l_rev_sub_resource_rec.schedule_sequence_number;
936               RAISE EXC_UNEXP_SKIP_OBJECT ;
937            ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
938            THEN
939                ECO_Error_Handler.Log_Error
940                (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
941                ,  p_mesg_token_tbl      => l_mesg_token_tbl
942                ,  p_error_status        => 'W'
943                ,  p_error_level         => Error_Handler.G_SR_LEVEL
944                ,  p_entity_index        => I
945                ,  x_ECO_rec             => l_ECO_rec
946                ,  x_eco_revision_tbl    => l_eco_revision_tbl
947                ,  x_revised_item_tbl    => l_revised_item_tbl
948                ,  x_rev_component_tbl   => l_rev_component_tbl
949                ,  x_ref_designator_tbl  => l_ref_designator_tbl
950                ,  x_sub_component_tbl   => l_sub_component_tbl
951                ,  x_rev_operation_tbl   => l_rev_operation_tbl
952                ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
953                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
954                ) ;
955           END IF;
956        END IF;
957 
958        --
959        -- Process Flow step 17: Conditionally Required Attributes
960        -- No process contents
961        --
962 
963        --
964        -- Process Flow step 18: Entity defaulting for CREATE and UPDATE
965        --
966 
967 
968        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting') ;
969        END IF ;
970        IF l_rev_sub_resource_rec.transaction_type IN ( Bom_Rtg_Globals.G_OPR_CREATE
971                                                  , Bom_Rtg_Globals.G_OPR_UPDATE )
972        THEN
973           Bom_Default_Sub_OP_Res.Entity_Defaulting
974               (   p_rev_sub_resource_rec   => l_rev_sub_resource_rec
975               ,   p_rev_sub_res_unexp_rec  => l_rev_sub_res_unexp_rec
976               ,   p_control_rec            => Bom_Rtg_Pub.G_Default_Control_Rec
977               ,   x_rev_sub_resource_rec   => l_rev_sub_resource_rec
978               ,   x_rev_sub_res_unexp_rec  => l_rev_sub_res_unexp_rec
979               ,   x_mesg_token_tbl         => l_mesg_token_tbl
980               ,   x_return_status          => l_return_status
981               ) ;
982 
983           IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
984           ('Entity defaulting completed with return_status: ' || l_return_status) ;
985           END IF ;
986 
987           IF l_return_status = Error_Handler.G_STATUS_ERROR
988           THEN
989              IF l_rev_sub_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
990              THEN
991                 l_other_message := 'BOM_SUB_RES_ENTDEF_CSEV_SKIP';
992                 l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
993                 l_other_token_tbl(1).token_value :=
994                         l_rev_sub_resource_rec.sub_resource_code ;
995                 l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
996                 l_other_token_tbl(2).token_value :=
997                         l_rev_sub_resource_rec.schedule_sequence_number ;
998                 RAISE EXC_SEV_SKIP_BRANCH ;
999              ELSE
1000                 RAISE EXC_SEV_QUIT_RECORD ;
1001              END IF;
1002           ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1003           THEN
1004              l_other_message := 'BOM_SUB_RES_ENTDEF_UNEXP_SKIP';
1005              l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
1006              l_other_token_tbl(1).token_value :=
1007                         l_rev_sub_resource_rec.sub_resource_code ;
1008              l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
1009              l_other_token_tbl(2).token_value :=
1010                         l_rev_sub_resource_rec.schedule_sequence_number ;
1011              RAISE EXC_UNEXP_SKIP_OBJECT ;
1012           ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
1013           THEN
1014              ECO_Error_Handler.Log_Error
1015              (  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
1016              ,  p_mesg_token_tbl      => l_mesg_token_tbl
1017              ,  p_error_status        => 'W'
1018              ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1019              ,  p_entity_index        => I
1020              ,  x_ECO_rec               => l_ECO_rec
1021              ,  x_eco_revision_tbl      => l_eco_revision_tbl
1022              ,  x_revised_item_tbl      => l_revised_item_tbl
1023              ,  x_rev_component_tbl     => l_rev_component_tbl
1024              ,  x_ref_designator_tbl    => l_ref_designator_tbl
1025              ,  x_sub_component_tbl     => l_sub_component_tbl
1026              ,  x_rev_operation_tbl     => l_rev_operation_tbl
1027              ,  x_rev_op_resource_tbl   => l_rev_op_resource_tbl
1028              ,  x_rev_sub_resource_tbl  => x_rev_sub_resource_tbl
1029              ) ;
1030           END IF ;
1031        END IF ;
1032 
1033 
1034        --
1035        -- Process Flow step 19 - Entity Level Validation
1036        -- Call Bom_Validate_Op_Res.Check_Entity
1037        --
1038 
1039 IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN
1040    Error_Handler.Write_Debug('Starting Entity Validation for Sub Op Resources . . . ') ;
1041 END IF ;
1042 
1043           Bom_Validate_Sub_Op_Res.Check_Entity
1044           (  p_rev_sub_resource_rec       => l_rev_sub_resource_rec
1045           ,  p_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
1046           ,  p_old_rev_sub_resource_rec   => l_old_rev_sub_resource_rec
1047           ,  p_old_rev_sub_res_unexp_rec  => l_old_rev_sub_res_unexp_rec
1048           ,  p_control_rec                => Bom_Rtg_Pub.G_Default_Control_Rec
1049           ,  x_rev_sub_resource_rec       => l_rev_sub_resource_rec
1050           ,  x_rev_sub_res_unexp_rec      => l_rev_sub_res_unexp_rec
1051           ,  x_mesg_token_tbl             => l_mesg_token_tbl
1052           ,  x_return_status              => l_return_status
1053           ) ;
1054 
1055        IF l_return_status = Error_Handler.G_STATUS_ERROR
1056        THEN
1057           IF l_rev_sub_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
1058           THEN
1059              l_other_message := 'BOM_SUB_RES_ENTVAL_CSEV_SKIP';
1060              l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
1061              l_other_token_tbl(1).token_value :=
1062                         l_rev_sub_resource_rec.sub_resource_code ;
1063              l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
1064              l_other_token_tbl(2).token_value :=
1065                         l_rev_sub_resource_rec.schedule_sequence_number ;
1066              RAISE EXC_SEV_SKIP_BRANCH ;
1067           ELSE
1068              RAISE EXC_SEV_QUIT_RECORD ;
1069           END IF;
1070        ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1071        THEN
1072           l_other_message := 'BOM_SUB_RES_ENTVAL_UNEXP_SKIP';
1073           l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
1074           l_other_token_tbl(1).token_value :=
1075                         l_rev_sub_resource_rec.sub_resource_code ;
1076           l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
1077           l_other_token_tbl(2).token_value :=
1078                         l_rev_sub_resource_rec.schedule_sequence_number ;
1079           RAISE EXC_UNEXP_SKIP_OBJECT ;
1080        ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
1081        THEN
1082           ECO_Error_Handler.Log_Error
1083           (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1084           ,  p_mesg_token_tbl      => l_mesg_token_tbl
1085           ,  p_error_status        => 'W'
1086           ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1087           ,  p_entity_index        => I
1088           ,  x_ECO_rec             => l_ECO_rec
1089           ,  x_eco_revision_tbl    => l_eco_revision_tbl
1090           ,  x_revised_item_tbl    => l_revised_item_tbl
1091           ,  x_rev_component_tbl   => l_rev_component_tbl
1092           ,  x_ref_designator_tbl  => l_ref_designator_tbl
1093           ,  x_sub_component_tbl   => l_sub_component_tbl
1094           ,  x_rev_operation_tbl   => l_rev_operation_tbl
1095           ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1096           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1097           ) ;
1098        END IF;
1099 
1100        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation completed with '
1101              || l_return_Status || ' proceeding for database writes . . . ') ;
1102        END IF;
1103 
1104        --
1105        -- Process Flow step 20 : Database Writes
1106        --
1107           Bom_Sub_Op_Res_Util.Perform_Writes
1108           (   p_rev_sub_resource_rec => l_rev_sub_resource_rec
1109           ,   p_rev_sub_res_unexp_rec=> l_rev_sub_res_unexp_rec
1110           ,   p_control_rec          => Bom_Rtg_Pub.G_Default_Control_Rec
1111           ,   x_mesg_token_tbl       => l_mesg_token_tbl
1112           ,   x_return_status        => l_return_status
1113           ) ;
1114 
1115        IF l_return_status = ECo_Error_Handler.G_STATUS_UNEXPECTED
1116        THEN
1117           l_other_message := 'BOM_SUB_RES_WRITES_UNEXP_SKIP';
1118           l_other_token_tbl(1).token_name := 'SUB_RESOURCE_CODE';
1119           l_other_token_tbl(1).token_value :=
1120                         l_rev_sub_resource_rec.sub_resource_code ;
1121           l_other_token_tbl(2).token_name := 'SCHEDULE_SEQ_NUMBER';
1122           l_other_token_tbl(2).token_value :=
1123                         l_rev_sub_resource_rec.schedule_sequence_number ;
1124           RAISE EXC_UNEXP_SKIP_OBJECT ;
1125        ELSIF l_return_status ='S' AND
1126           l_mesg_token_tbl.COUNT <>0
1127        THEN
1128           ECO_Error_Handler.Log_Error
1129           (  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
1130           ,  p_mesg_token_tbl      => l_mesg_token_tbl
1131           ,  p_error_status        => 'W'
1132           ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1133           ,  p_entity_index        => I
1134           ,  x_ECO_rec             => l_ECO_rec
1135           ,  x_eco_revision_tbl    => l_eco_revision_tbl
1136           ,  x_revised_item_tbl    => l_revised_item_tbl
1137           ,  x_rev_component_tbl   => l_rev_component_tbl
1138           ,  x_ref_designator_tbl  => l_ref_designator_tbl
1139           ,  x_sub_component_tbl   => l_sub_component_tbl
1140           ,  x_rev_operation_tbl   => l_rev_operation_tbl
1141           ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1142           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1143           ) ;
1144        END IF;
1145 
1146        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Database writes completed with status  ' || l_return_status);
1147        END IF;
1148 
1149 
1150     END IF; -- END IF statement that checks RETURN STATUS
1151 
1152     --  Load tables.
1153     x_rev_sub_resource_tbl(I)          := l_rev_sub_resource_rec;
1154 
1155 
1156     --  For loop exception handler.
1157 
1158     EXCEPTION
1159        WHEN EXC_SEV_QUIT_RECORD THEN
1160           ECO_Error_Handler.Log_Error
1161           (  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
1162           ,  p_mesg_token_tbl      => l_mesg_token_tbl
1163           ,  p_error_status        => FND_API.G_RET_STS_ERROR
1164           ,  p_error_scope         => Error_Handler.G_SCOPE_RECORD
1165           ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1166           ,  p_entity_index        => I
1167           ,  x_ECO_rec             => l_ECO_rec
1168           ,  x_eco_revision_tbl    => l_eco_revision_tbl
1169           ,  x_revised_item_tbl    => l_revised_item_tbl
1170           ,  x_rev_component_tbl   => l_rev_component_tbl
1171           ,  x_ref_designator_tbl  => l_ref_designator_tbl
1172           ,  x_sub_component_tbl   => l_sub_component_tbl
1173           ,  x_rev_operation_tbl   => l_rev_operation_tbl
1174           ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1175           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1176           ) ;
1177 
1178 
1179          IF l_bo_return_status = 'S'
1180          THEN
1181             l_bo_return_status := l_return_status ;
1182          END IF;
1183 
1184          x_return_status       := l_bo_return_status;
1185          x_mesg_token_tbl      := l_mesg_token_tbl ;
1186          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1187 
1188 
1189       WHEN EXC_SEV_QUIT_BRANCH THEN
1190 
1191          ECO_Error_Handler.Log_Error
1192          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1193          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1194          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
1195          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
1196          ,  p_other_status        => ECo_Error_Handler.G_STATUS_ERROR
1197          ,  p_other_message       => l_other_message
1198          ,  p_other_token_tbl     => l_other_token_tbl
1199          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1200          ,  p_entity_index        => I
1201          ,  x_ECO_rec             => l_ECO_rec
1202          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1203          ,  x_revised_item_tbl    => l_revised_item_tbl
1204          ,  x_rev_component_tbl   => l_rev_component_tbl
1205          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1206          ,  x_sub_component_tbl   => l_sub_component_tbl
1207          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1208          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1209          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1210          ) ;
1211 
1212 
1213          IF l_bo_return_status = 'S'
1214          THEN
1215             l_bo_return_status := l_return_status;
1216          END IF;
1217 
1218          x_return_status       := l_bo_return_status;
1219          x_mesg_token_tbl      := l_mesg_token_tbl ;
1220          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1221 
1222       WHEN EXC_SEV_SKIP_BRANCH THEN
1223          ECO_Error_Handler.Log_Error
1224          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1225          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1226          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
1227          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
1228          ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
1229          ,  p_other_message       => l_other_message
1230          ,  p_other_token_tbl     => l_other_token_tbl
1231          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1232          ,  p_entity_index        => I
1233          ,  x_ECO_rec             => l_ECO_rec
1234          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1235          ,  x_revised_item_tbl    => l_revised_item_tbl
1236          ,  x_rev_component_tbl   => l_rev_component_tbl
1237          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1238          ,  x_sub_component_tbl   => l_sub_component_tbl
1239          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1240          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1241          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1242          ) ;
1243 
1244         IF l_bo_return_status = 'S'
1245         THEN
1246            l_bo_return_status  := l_return_status ;
1247         END IF;
1248         x_return_status        := l_bo_return_status;
1249         x_mesg_token_tbl       := l_mesg_token_tbl ;
1250         --x_rev_sub_resource_tbl := l_rev_sub_resource_tbl ;
1251 
1252       WHEN EXC_SEV_QUIT_SIBLINGS THEN
1253          ECO_Error_Handler.Log_Error
1254          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1255          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1256          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
1257          ,  p_error_scope         => Error_Handler.G_SCOPE_SIBLINGS
1258          ,  p_other_status        => Error_Handler.G_STATUS_ERROR
1259          ,  p_other_message       => l_other_message
1260          ,  p_other_token_tbl     => l_other_token_tbl
1261          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1262          ,  p_entity_index        => I
1263          ,  x_ECO_rec             => l_ECO_rec
1264          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1265          ,  x_revised_item_tbl    => l_revised_item_tbl
1266          ,  x_rev_component_tbl   => l_rev_component_tbl
1267          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1268          ,  x_sub_component_tbl   => l_sub_component_tbl
1269          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1270          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1271          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1272          ) ;
1273 
1274          IF l_bo_return_status = 'S'
1275          THEN
1276            l_bo_return_status  := l_return_status ;
1277          END IF;
1278          x_return_status       := l_bo_return_status;
1279          x_mesg_token_tbl      := l_mesg_token_tbl ;
1280          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1281 
1282 
1283       WHEN EXC_FAT_QUIT_BRANCH THEN
1284          ECO_Error_Handler.Log_Error
1285          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1286          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1287          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
1288          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
1289          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
1290          ,  p_other_message       => l_other_message
1291          ,  p_other_token_tbl     => l_other_token_tbl
1292          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1293          ,  p_entity_index        => I
1294          ,  x_ECO_rec             => l_ECO_rec
1295          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1296          ,  x_revised_item_tbl    => l_revised_item_tbl
1297          ,  x_rev_component_tbl   => l_rev_component_tbl
1298          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1299          ,  x_sub_component_tbl   => l_sub_component_tbl
1300          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1301          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1302          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1303          ) ;
1304 
1305          x_return_status         := Error_Handler.G_STATUS_FATAL;
1306          x_mesg_token_tbl        := l_mesg_token_tbl ;
1307          --x_rev_sub_resource_tbl  := l_rev_sub_resource_tbl ;
1308 
1309 
1310       WHEN EXC_FAT_QUIT_SIBLINGS THEN
1311          ECO_Error_Handler.Log_Error
1312          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1313          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1314          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
1315          ,  p_error_scope         => Error_Handler.G_SCOPE_SIBLINGS
1316          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
1317          ,  p_other_message       => l_other_message
1318          ,  p_other_token_tbl     => l_other_token_tbl
1319          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1320          ,  p_entity_index        => I
1321          ,  x_ECO_rec             => l_ECO_rec
1322          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1323          ,  x_revised_item_tbl    => l_revised_item_tbl
1324          ,  x_rev_component_tbl   => l_rev_component_tbl
1325          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1326          ,  x_sub_component_tbl   => l_sub_component_tbl
1327          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1328          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1329          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1330          ) ;
1331 
1332         x_return_status       := Error_Handler.G_STATUS_FATAL;
1333         x_mesg_token_tbl      := l_mesg_token_tbl ;
1334         --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1335 
1336     WHEN EXC_FAT_QUIT_OBJECT THEN
1337          ECO_Error_Handler.Log_Error
1338          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1339          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1340          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
1341          ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
1342          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
1343          ,  p_other_message       => l_other_message
1344          ,  p_other_token_tbl     => l_other_token_tbl
1345          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1346          ,  p_entity_index        => I
1347          ,  x_ECO_rec             => l_ECO_rec
1348          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1349          ,  x_revised_item_tbl    => l_revised_item_tbl
1350          ,  x_rev_component_tbl   => l_rev_component_tbl
1351          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1352          ,  x_sub_component_tbl   => l_sub_component_tbl
1353          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1354          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1355          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1356          ) ;
1357 
1358          l_return_status       := 'Q';
1359          x_mesg_token_tbl      := l_mesg_token_tbl ;
1360          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1361 
1362       WHEN EXC_UNEXP_SKIP_OBJECT THEN
1363          ECO_Error_Handler.Log_Error
1364          (  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1365          ,  p_mesg_token_tbl      => l_mesg_token_tbl
1366          ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
1367          ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
1368          ,  p_other_message       => l_other_message
1369          ,  p_other_token_tbl     => l_other_token_tbl
1370          ,  p_error_level         => ECO_Error_Handler.G_SR_LEVEL
1371          ,  x_ECO_rec             => l_ECO_rec
1372          ,  x_eco_revision_tbl    => l_eco_revision_tbl
1373          ,  x_revised_item_tbl    => l_revised_item_tbl
1374          ,  x_rev_component_tbl   => l_rev_component_tbl
1375          ,  x_ref_designator_tbl  => l_ref_designator_tbl
1376          ,  x_sub_component_tbl   => l_sub_component_tbl
1377          ,  x_rev_operation_tbl   => l_rev_operation_tbl
1378          ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1379          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
1380          ) ;
1381 
1382          l_return_status       := 'U';
1383          x_mesg_token_tbl      := l_mesg_token_tbl ;
1384          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1385 
1386    END ; -- END block
1387 
1388 
1389    IF l_return_status in ('Q', 'U')
1390    THEN
1391       x_return_status := l_return_status;
1392       RETURN ;
1393    END IF;
1394 
1395    END IF; -- End of processing records for which the return status is null
1396    END LOOP; -- END Substitute Operation Resources processing loop
1397 
1398    --  Load OUT parameters
1399    IF NVL(l_return_status, 'S') <> 'S'
1400    THEN
1401       x_return_status     := l_return_status;
1402    END IF;
1403 
1404    x_mesg_token_tbl      := l_mesg_token_tbl ;
1405    --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
1406    x_mesg_token_tbl      := l_mesg_token_tbl ;
1407 
1408 END Rev_Sub_Operation_Resources ;
1409 
1410 --  Rev_Operation_Resources
1411 
1412 /****************************************************************************
1413 * Procedure : Rev_Operation_Resources
1414 * Parameters IN   : Revised Operation Resources Table and all the other sibiling entities
1415 * Parameters OUT  : Revised Operatin Resources and all the other sibiling entities
1416 * Purpose   : This procedure will process all the Revised Operation Resources records.
1417 *
1418 *****************************************************************************/
1419 
1420 PROCEDURE Rev_Operation_Resources
1421 (   p_validation_level              IN  NUMBER
1422 ,   p_change_notice                 IN  VARCHAR2 := NULL
1423 ,   p_organization_id               IN  NUMBER   := NULL
1424 ,   p_revised_item_name             IN  VARCHAR2 := NULL
1425 ,   p_effectivity_date              IN  DATE     := NULL
1426 ,   p_item_revision                 IN  VARCHAR2 := NULL
1427 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
1428 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
1429 ,   p_operation_seq_num             IN  NUMBER   := NULL
1430 ,   p_operation_type                IN  NUMBER   := NULL
1431 ,   p_rev_op_resource_tbl           IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type
1432 ,   p_rev_sub_resource_tbl          IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
1433 ,   x_rev_op_resource_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type
1434 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
1435 ,   x_mesg_token_tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
1436 ,   x_return_status                 OUT NOCOPY VARCHAR2
1437 )
1438 IS
1439 
1440 /* Exposed and Unexposed record */
1441 l_rev_op_resource_rec         Bom_Rtg_Pub.Rev_Op_Resource_Rec_Type ;
1442 l_rev_op_res_unexp_rec        Bom_Rtg_Pub.Rev_Op_Res_Unexposed_Rec_Type ;
1443 --l_rev_op_resource_tbl         Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type ;
1444 l_old_rev_op_resource_rec     Bom_Rtg_Pub.Rev_Op_Resource_Rec_Type ;
1445 l_old_rev_op_res_unexp_rec    Bom_Rtg_Pub.Rev_Op_Res_Unexposed_Rec_Type ;
1446 
1447 
1448 
1449 /* Other Entities */
1450 l_eco_rec                ENG_Eco_PUB.Eco_Rec_Type;
1451 l_eco_revision_tbl       ENG_Eco_PUB.ECO_Revision_Tbl_Type;
1452 l_revised_item_tbl       ENG_Eco_PUB.Revised_Item_Tbl_Type;
1453 l_rev_component_rec      BOM_BO_PUB.Rev_Component_Rec_Type;
1454 l_rev_component_tbl      BOM_BO_PUB.Rev_Component_Tbl_Type;
1455 l_rev_comp_unexp_rec     BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
1456 l_old_rev_component_rec  BOM_BO_PUB.Rev_Component_Rec_Type;
1457 l_old_rev_comp_unexp_rec BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
1458 l_ref_designator_tbl     BOM_BO_PUB.Ref_Designator_Tbl_Type;
1459 l_sub_component_tbl      BOM_BO_PUB.Sub_Component_Tbl_Type;
1460 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type ;
1461 --l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type ;
1462 --                                   := p_rev_sub_resource_tbl ;
1463 
1464 
1465 /* Error Handling Variables */
1466 l_token_tbl             Error_Handler.Token_Tbl_Type ;
1467 l_mesg_token_tbl        Error_Handler.Mesg_Token_Tbl_Type ;
1468 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
1469 l_other_message         VARCHAR2(2000);
1470 l_err_text              VARCHAR2(2000);
1471 
1472 
1473 /* Others */
1474 l_return_status         VARCHAR2(1);
1475 l_bo_return_status      VARCHAR2(1);
1476 l_op_parent_exists      BOOLEAN := FALSE;
1477 l_item_parent_exists    BOOLEAN := FALSE;
1478 l_process_children      BOOLEAN := TRUE;
1479 l_valid                 BOOLEAN := TRUE;
1480 
1481 /* Error handler definations */
1482 EXC_SEV_QUIT_RECORD     EXCEPTION ;
1483 EXC_SEV_QUIT_BRANCH     EXCEPTION ;
1484 EXC_UNEXP_SKIP_OBJECT   EXCEPTION ;
1485 EXC_SEV_QUIT_SIBLINGS   EXCEPTION ;
1486 EXC_SEV_SKIP_BRANCH     EXCEPTION ;
1487 EXC_FAT_QUIT_SIBLINGS   EXCEPTION ;
1488 EXC_FAT_QUIT_BRANCH     EXCEPTION ;
1489 EXC_FAT_QUIT_OBJECT     EXCEPTION ;
1490 
1491 BEGIN
1492 
1493    --  Init local table variables.
1494    l_return_status    := 'S';
1495    l_bo_return_status := 'S';
1496    --l_rev_op_resource_tbl  := p_rev_op_resource_tbl;
1497    x_rev_op_resource_tbl  := p_rev_op_resource_tbl;
1498    x_rev_sub_resource_tbl  := p_rev_sub_resource_tbl;
1499 
1500    l_rev_op_res_unexp_rec.organization_id := Eng_Globals.Get_Org_Id;
1501 
1502    FOR I IN 1..x_rev_op_resource_tbl.COUNT LOOP
1503    -- Processing records for which the return status is null
1504    IF (x_rev_op_resource_tbl(I).return_status IS NULL OR
1505         x_rev_op_resource_tbl(I).return_status  = FND_API.G_MISS_CHAR) THEN
1506    BEGIN
1507 
1508       --  Load local records
1509       l_rev_op_resource_rec := x_rev_op_resource_tbl(I) ;
1510 
1511       l_rev_op_resource_rec.transaction_type :=
1512          UPPER(l_rev_op_resource_rec.transaction_type) ;
1513 
1514       --
1515       -- Initialize the Unexposed Record for every iteration of the Loop
1516       -- so that sequence numbers get generated for every new row.
1517       --
1518       l_rev_op_res_unexp_rec.Revised_Item_Sequence_Id:= NULL ;
1519       l_rev_op_res_unexp_rec.Operation_Sequence_Id   := NULL ;
1520       l_rev_op_res_unexp_rec.Substitute_Group_Number := NULL ;
1521       l_rev_op_res_unexp_rec.Resource_Id             := NULL ;
1522       l_rev_op_res_unexp_rec.Activity_Id             := NULL ;
1523       l_rev_op_res_unexp_rec.Setup_Id                := NULL ;
1524 
1525 
1526       IF p_operation_seq_num  IS NOT NULL AND
1527          p_revised_item_name  IS NOT NULL AND
1528          p_effectivity_date   IS NOT NULL AND
1529          p_organization_id    IS NOT NULL AND
1530          p_change_notice IS NOT NULL
1531       THEN
1532          -- Revised Operation parent exists
1533          l_op_parent_exists  := TRUE ;
1534 
1535       ELSIF p_revised_item_name IS NOT NULL AND
1536             p_effectivity_date IS NOT NULL  AND
1537             /* p_item_revision IS NOT NULL     AND Commented for Bug 6485168 */
1538             p_change_notice IS NOT NULL     AND
1539             p_organization_id IS NOT NULL
1540       THEN
1541 
1542          -- Revised Item parent exists
1543          l_item_parent_exists := TRUE ;
1544       END IF ;
1545 
1546       -- Process Flow Step 2: Check if record has not yet been processed and
1547       -- that it is the child of the parent that called this procedure
1548       --
1549 
1550       IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1551                         ('ECO Name: ' || p_change_notice ||
1552                          ' Org: ' || p_organization_id ||
1553                          ' Eff. Dt: ' || to_char(p_effectivity_date) ||
1554                          ' Revision: ' || p_item_revision ||
1555                          ' Rev Item: ' || p_revised_item_name ||
1556                          ' Op. Seq: ' || p_operation_seq_num); END IF;
1557 
1558 
1559       IF --(l_rev_op_resource_rec.return_status IS NULL OR
1560          --l_rev_op_resource_rec.return_status  = FND_API.G_MISS_CHAR)
1561          --AND
1562          (
1563             -- Did Op_Seq call this procedure, that is,
1564             -- if revised operation(operation sequence) exists, then is this record a child ?
1565             (l_op_parent_exists AND
1566                (l_rev_op_resource_rec.ECO_Name
1567                                              = p_change_notice    AND
1568                 l_rev_op_res_unexp_rec.organization_id
1569                                              = p_organization_id  AND
1570                 l_rev_op_resource_rec.op_start_effective_date
1571                                              = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND -- Bug 6657209
1572                 NVL(l_rev_op_resource_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
1573                                              = NVL(p_item_revision, FND_API.G_MISS_CHAR )   AND
1574                 l_rev_op_resource_rec.revised_item_name
1575                                             = p_revised_item_name AND
1576                 NVL(l_rev_op_resource_rec.new_routing_revision, FND_API.G_MISS_CHAR )
1577                                              = NVL(p_routing_revision, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
1578                 NVL(l_rev_op_resource_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
1579                                              = NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
1580                 l_rev_op_resource_rec.operation_sequence_number
1581                                             = p_operation_seq_num AND
1582                 NVL(l_rev_op_resource_rec.operation_type, 1)
1583                                            = NVL(p_operation_type, 1)
1584                 )
1585              )
1586              OR
1587              -- Did Rev_Items call this procedure, that is,
1588              -- if revised item exists, then is this record a child ?
1589 
1590              (l_item_parent_exists AND
1591                (l_rev_op_resource_rec.ECO_Name
1592                                                 = p_change_notice AND
1593                 l_rev_op_res_unexp_rec.organization_id
1594                                               = p_organization_id AND
1595                 l_rev_op_resource_rec.revised_item_name
1596                                             = p_revised_item_name AND
1597                 l_rev_op_resource_rec.op_start_effective_date
1598                                              = p_effectivity_date AND
1599                 NVL(l_rev_op_resource_rec.new_routing_revision, FND_API.G_MISS_CHAR )
1600                                              = NVL(p_routing_revision, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
1601                 NVL(l_rev_op_resource_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
1602                                              = NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
1603                 NVL(l_rev_op_resource_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
1604                                                   = NVL(p_item_revision, FND_API.G_MISS_CHAR ) )
1605              )
1606 
1607              OR
1608 
1609              (NOT l_item_parent_exists AND
1610               NOT l_op_parent_exists)
1611          )
1612 
1613       THEN
1614          l_return_status := FND_API.G_RET_STS_SUCCESS;
1615          l_rev_op_resource_rec.return_status := FND_API.G_RET_STS_SUCCESS;
1616 
1617          -- Bug 6657209
1618            IF (l_op_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null) THEN
1619               l_rev_op_resource_rec.op_start_effective_date := p_effectivity_date;
1620            END IF;
1621 
1622          --
1623          -- Process Flow step 3 :Check if transaction_type is valid
1624          -- Transaction_Type must be CRATE, UPDATE, DELETE or CANCEL(in only ECO for Rrg)
1625          -- Call the Bom_Rtg_Globals.Transaction_Type_Validity
1626          --
1627 
1628          Eng_Globals.Transaction_Type_Validity
1629          (   p_transaction_type => l_rev_op_resource_rec.transaction_type
1630          ,   p_entity           => 'Op_Res'
1631          ,   p_entity_id        => l_rev_op_resource_rec.resource_sequence_number
1632          ,   x_valid            => l_valid
1633          ,   x_mesg_token_tbl   => l_mesg_token_tbl
1634          ) ;
1635 
1636          IF NOT l_valid
1637          THEN
1638             RAISE EXC_SEV_QUIT_RECORD ;
1639          END IF ;
1640 
1641          --
1642          -- Process Flow step 4(a): Convert user unique index to unique
1643          -- index I
1644          -- Call Rtg_Val_To_Id.Op_Resource_UUI_To_UI Shared Utility Package
1645          --
1646 
1647          Bom_Rtg_Val_To_Id.Rev_Op_Resource_UUI_To_UI
1648          ( p_rev_op_resource_rec    => l_rev_op_resource_rec
1649          , p_rev_op_res_unexp_rec   => l_rev_op_res_unexp_rec
1650          , x_rev_op_res_unexp_rec   => l_rev_op_res_unexp_rec
1651          , x_mesg_token_tbl         => l_mesg_token_tbl
1652          , x_return_status          => l_return_status
1653          ) ;
1654 
1655          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1656          ('Convert to User Unique Index to Index1 completed with return_status: ' || l_return_status) ;
1657          END IF;
1658 
1659          IF l_return_status = Error_Handler.G_STATUS_ERROR
1660          THEN
1661             l_other_message := 'BOM_RES_UUI_SEV_ERROR';
1662             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1663             l_other_token_tbl(1).token_value :=
1664                         l_rev_op_resource_rec.resource_sequence_number ;
1665             RAISE EXC_SEV_QUIT_BRANCH ;
1666 
1667          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1668          THEN
1669             l_other_message := 'BOM_RES_UUI_UNEXP_SKIP';
1670             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1671             l_other_token_tbl(1).token_value :=
1672                         l_rev_op_resource_rec.resource_sequence_number ;
1673             RAISE EXC_UNEXP_SKIP_OBJECT;
1674          END IF ;
1675 
1676 
1677          -- Added by MK on 12/03/00 to resolve ECO dependency
1678          ENG_Val_To_Id.RtgAndRevitem_UUI_To_UI
1679            ( p_revised_item_name        => l_rev_op_resource_rec.revised_item_name
1680            , p_revised_item_id          => l_rev_op_res_unexp_rec.revised_item_id
1681            , p_item_revision            => l_rev_op_resource_rec.new_revised_item_revision
1682            , p_effective_date           => l_rev_op_resource_rec.op_start_effective_date
1683            , p_change_notice            => l_rev_op_resource_rec.eco_name
1684            , p_organization_id          => l_rev_op_res_unexp_rec.organization_id
1685            , p_new_routing_revision     => l_rev_op_resource_rec.new_routing_revision
1686            , p_from_end_item_number     => l_rev_op_resource_rec.from_end_item_unit_number
1687            , p_entity_processed         => 'RES'
1688            , p_operation_sequence_number => l_rev_op_resource_rec.operation_sequence_number
1689            , p_resource_sequence_number  => l_rev_op_resource_rec.resource_sequence_number
1690            , x_revised_item_sequence_id  => l_rev_op_res_unexp_rec.revised_item_sequence_id
1691            , x_routing_sequence_id       => l_rev_op_res_unexp_rec.routing_sequence_id
1692            , x_operation_sequence_id     => l_rev_op_res_unexp_rec.operation_sequence_id
1693            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
1694            , x_other_message            => l_other_message
1695            , x_other_token_tbl          => l_other_token_tbl
1696            , x_Return_Status            => l_return_status
1697           ) ;
1698 
1699          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1700          ('Convert to User Unique Index to Index1 for Rtg and Rev Item Seq completed with return_status: ' || l_return_status) ;
1701          END IF;
1702 
1703          IF l_return_status = Error_Handler.G_STATUS_ERROR
1704          THEN
1705             l_other_message := 'BOM_RES_UUI_SEV_ERROR';
1706             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1707             l_other_token_tbl(1).token_value :=
1708                         l_rev_op_resource_rec.resource_sequence_number ;
1709             RAISE EXC_SEV_QUIT_BRANCH ;
1710 
1711          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1712          THEN
1713             l_other_message := 'BOM_RES_UUI_UNEXP_SKIP';
1714             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1715             l_other_token_tbl(1).token_value :=
1716                         l_rev_op_resource_rec.resource_sequence_number ;
1717             RAISE EXC_UNEXP_SKIP_OBJECT;
1718          END IF ;
1719 
1720 
1721          --
1722          -- Process Flow step 4(b): Convert user unique index to unique
1723          -- index II
1724          -- Call the Rtg_Val_To_Id.Operation_UUI_To_UI2
1725          --
1726          /*
1727          Bom_Rtg_Val_To_Id.Rev_Op_Resource_UUI_To_UI2
1728          ( p_rev_op_resource_rec    => l_rev_op_resource_rec
1729          , p_rev_op_res_unexp_rec   => l_rev_op_res_unexp_rec
1730          , x_rev_op_res_unexp_rec   => l_rev_op_res_unexp_rec
1731          , x_mesg_token_tbl         => l_mesg_token_tbl
1732          , x_other_message          => l_other_message
1733          , x_other_token_tbl        => l_other_token_tbl
1734          , x_return_status          => l_return_status
1735          ) ;
1736 
1737          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1738          ('Convert to User Unique Index to Index2 completed with return_status: ' || l_return_status) ;
1739          END IF;
1740 
1741          IF l_return_status = Error_Handler.G_STATUS_ERROR
1742          THEN
1743             RAISE EXC_SEV_QUIT_SIBLINGS ;
1744          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1745          THEN
1746             l_other_message := 'BOM_RES_UUI_UNEXP_SKIP';
1747             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1748             l_other_token_tbl(1).token_value :=
1749                    l_rev_op_resource_rec.resource_sequence_number ;
1750             RAISE EXC_UNEXP_SKIP_OBJECT;
1751          END IF ;
1752          */
1753          --
1754          -- Process Flow step 5: Verify Operation Resource's existence
1755          -- Call the Bom_Validate_Op_Seq.Check_Existence
1756          --
1757          --
1758 
1759          Bom_Validate_Op_Res.Check_Existence
1760          (  p_rev_op_resource_rec        => l_rev_op_resource_rec
1761          ,  p_rev_op_res_unexp_rec       => l_rev_op_res_unexp_rec
1762          ,  x_old_rev_op_resource_rec    => l_old_rev_op_resource_rec
1763          ,  x_old_rev_op_res_unexp_rec   => l_old_rev_op_res_unexp_rec
1764          ,  x_mesg_token_tbl             => l_mesg_token_tbl
1765          ,  x_return_status              => l_return_status
1766          ) ;
1767 
1768          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
1769          ('Check Existence completed with return_status: ' || l_return_status) ;
1770          END IF ;
1771 
1772          IF l_return_status = Error_Handler.G_STATUS_ERROR
1773          THEN
1774             l_other_message := 'BOM_RES_EXS_SEV_SKIP';
1775             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1776             l_other_token_tbl(1).token_value :=
1777                           l_rev_op_resource_rec.resource_sequence_number ;
1778             l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
1779             l_other_token_tbl(2).token_value :=
1780                           l_rev_op_resource_rec.revised_item_name ;
1781             RAISE EXC_SEV_QUIT_BRANCH;
1782          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1783          THEN
1784             l_other_message := 'BOM_RES_EXS_UNEXP_SKIP';
1785             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1786             l_other_token_tbl(1).token_value :=
1787                           l_rev_op_resource_rec.resource_sequence_number ;
1788             l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
1789             l_other_token_tbl(2).token_value :=
1790                           l_rev_op_resource_rec.revised_item_name ;
1791             RAISE EXC_UNEXP_SKIP_OBJECT;
1792          END IF;
1793 
1794          --
1795          -- Process Flow step 6: Is Operation Resource record an orphan ?
1796          --
1797 
1798          IF NOT l_op_parent_exists
1799          THEN
1800 
1801             --
1802             -- Process Flow step 7: Check lineage
1803             --
1804             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');     END IF;
1805 
1806             BOM_Validate_Op_Seq.Check_Lineage
1807             ( p_routing_sequence_id       =>
1808                              l_rev_op_res_unexp_rec.routing_sequence_id
1809             , p_operation_sequence_number =>
1810                              l_rev_op_resource_rec.operation_sequence_number
1811             , p_effectivity_date          =>
1812                              l_rev_op_resource_rec.op_start_effective_date
1813             , p_operation_type            =>
1814                              l_rev_op_resource_rec.operation_type
1815             , p_revised_item_sequence_id  =>
1816                              l_rev_op_res_unexp_rec.revised_item_sequence_id
1817             , x_mesg_token_tbl            => l_mesg_token_tbl
1818             , x_return_status             => l_return_status
1819             ) ;
1820 
1821             IF l_return_status = Error_Handler.G_STATUS_ERROR
1822             THEN
1823                 l_Token_Tbl(1).token_name  := 'RES_SEQ_NUMBER' ;
1824                 l_Token_Tbl(1).token_value := l_rev_op_resource_rec.resource_sequence_number ;
1825                 l_Token_Tbl(2).token_name  := 'OP_SEQ_NUMBER' ;
1826                 l_Token_Tbl(2).token_value := l_rev_op_resource_rec.operation_sequence_number ;
1827                 l_Token_Tbl(3).token_name  := 'REVISED_ITEM_NAME' ;
1828                 l_Token_Tbl(3).token_value := l_rev_op_resource_rec.revised_item_name;
1829 
1830                 Error_Handler.Add_Error_Token
1831                 ( p_Message_Name  => 'BOM_RES_REV_ITEM_MISMATCH'
1832                 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1833                 , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1834                 , p_Token_Tbl      => l_Token_Tbl
1835                 ) ;
1836 
1837 
1838                 l_other_message := 'BOM_RES_LIN_SEV_SKIP';
1839                 l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1840                 l_other_token_tbl(1).token_value :=
1841                                l_rev_op_resource_rec.resource_sequence_number ;
1842                 RAISE EXC_SEV_QUIT_BRANCH;
1843 
1844             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1845             THEN
1846                 l_other_message := 'BOM_RES_LIN_UNEXP_SKIP';
1847                 l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1848                 l_other_token_tbl(1).token_value :=
1849                            l_rev_op_resource_rec.resource_sequence_number ;
1850                 RAISE EXC_UNEXP_SKIP_OBJECT;
1851             END IF;
1852 
1853             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
1854 
1855 
1856                 -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
1857                 --
1858 
1859                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check ECO access'); END IF;
1860 
1861                 ENG_Validate_ECO.Check_Access
1862                 ( p_change_notice       => l_rev_op_resource_rec.ECO_Name
1863                 , p_organization_id     =>
1864                                         l_rev_op_res_unexp_rec.organization_id
1865                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
1866                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
1867                 , x_Return_Status       => l_return_status
1868                 );
1869 
1870                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
1871 
1872                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1873                 THEN
1874                         l_other_message := 'BOM_RES_ECOACC_FAT_FATAL' ;
1875                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1876                         l_other_token_tbl(1).token_value :=
1877                                l_rev_op_resource_rec.operation_sequence_number;
1878                         l_return_status := 'F';
1879                         RAISE EXC_FAT_QUIT_OBJECT;
1880                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1881                 THEN
1882                         l_other_message := 'BOM_RES_ECOACC_UNEXP_SKIP' ;
1883                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1884                         l_other_token_tbl(1).token_value :=
1885                                l_rev_op_resource_rec.resource_sequence_number;
1886                         RAISE EXC_UNEXP_SKIP_OBJECT;
1887                 END IF;
1888 
1889                 --
1890                 -- Process Flow step 9(a and b): check that user has access to revised item
1891                 --
1892 
1893                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Revised item access'); END IF;
1894                 ENG_Validate_Revised_Item.Check_Access
1895                 (  p_change_notice   => l_rev_op_resource_rec.ECO_Name
1896                 ,  p_organization_id => l_rev_op_res_unexp_rec.organization_id
1897                 ,  p_revised_item_id => l_rev_op_res_unexp_rec.revised_item_id
1898                 ,  p_new_item_revision  =>
1899                                l_rev_op_resource_rec.new_revised_item_revision
1900                 ,  p_effectivity_date   =>
1901                                l_rev_op_resource_rec.op_start_effective_date
1902                 ,  p_new_routing_revsion   => l_rev_op_resource_rec.new_routing_revision  -- Added by MK on 11/02/00
1903                 ,  p_from_end_item_number  => l_rev_op_resource_rec.from_end_item_unit_number -- Added by MK on 11/02/00
1904                 ,  p_revised_item_name  =>
1905                                l_rev_op_resource_rec.revised_item_name
1906                 ,  p_entity_processed   => 'RES'                                             -- Added by MK
1907                 ,  p_operation_seq_num  =>  l_rev_op_resource_rec.operation_sequence_number  -- Added by MK
1908                 ,  p_routing_sequence_id => l_rev_op_res_unexp_rec.routing_sequence_id       -- Added by MK
1909 
1910                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
1911                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
1912                 ,  x_return_status      => l_Return_Status
1913                 );
1914 
1915                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
1916 
1917                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1918                 THEN
1919                         l_other_message := 'BOM_RES_RITACC_FAT_FATAL';
1920                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1921                         l_other_token_tbl(1).token_value :=
1922                                l_rev_op_resource_rec.resource_sequence_number;
1923                         l_return_status := 'F';
1924                         RAISE EXC_FAT_QUIT_SIBLINGS;
1925                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1926                 THEN
1927                         l_other_message := 'BOM_RES_RITACC_UNEXP_SKIP';
1928                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1929                         l_other_token_tbl(1).token_value :=
1930                                l_rev_op_resource_rec.resource_sequence_number;
1931                         RAISE EXC_UNEXP_SKIP_OBJECT;
1932                 END IF;
1933 
1934 
1935             --
1936             -- Process Flow step 10(b) : Check that user has access to revised
1937             -- operation
1938             -- BOM_Validate_Op_Seq.Check_Access
1939 
1940             IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Operation sequence item access'); END IF;
1941                 BOM_Validate_Op_Seq.Check_Access
1942                 (  p_change_notice     => l_rev_op_resource_rec.ECO_Name
1943                 ,  p_organization_id   => l_rev_op_res_unexp_rec.organization_id
1944                 ,  p_revised_item_id   => l_rev_op_res_unexp_rec.revised_item_id
1945                 ,  p_revised_item_name => l_rev_op_resource_rec.revised_item_name
1946                 ,  p_new_item_revision =>
1947                                 l_rev_op_resource_rec.new_revised_item_revision
1948                 ,  p_effectivity_date  =>
1949                                 l_rev_op_resource_rec.op_start_effective_date
1950                 ,  p_new_routing_revsion   => l_rev_op_resource_rec.new_routing_revision  -- Added by MK on 11/02/00
1951                 ,  p_from_end_item_number  => l_rev_op_resource_rec.from_end_item_unit_number -- Added by MK on 11/02/00
1952                 ,  p_operation_seq_num =>
1953                                 l_rev_op_resource_rec.operation_sequence_number
1954                 ,  p_routing_sequence_id=>
1955                                 l_rev_op_res_unexp_rec.routing_sequence_id
1956                 ,  p_operation_type    =>
1957                                 l_rev_op_resource_rec.operation_type
1958                 ,  p_entity_processed  => 'RES'
1959                 ,  p_resource_seq_num  =>
1960                                 l_rev_op_resource_rec.resource_sequence_number
1961                 ,  p_sub_resource_code => NULL
1962                 ,  p_sub_group_num     => NULL
1963                 ,  p_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
1964                 ,  x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
1965                 ,  x_return_status     => l_Return_Status
1966                 );
1967 
1968                IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
1969 
1970                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1971                 THEN
1972                         l_other_message := 'BOM_RES_ACCESS_FAT_FATAL';
1973                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1974                         l_other_token_tbl(1).token_value :=
1975                                 l_rev_op_resource_rec.resource_sequence_number;
1976                         l_return_status := 'F';
1977                         RAISE EXC_FAT_QUIT_OBJECT;
1978                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1979                 THEN
1980                         l_other_message := 'BOM_RES_ACCESS_UNEXP_SKIP';
1981                         l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
1982                         l_other_token_tbl(1).token_value :=
1983                                l_rev_op_resource_rec.resource_sequence_number;
1984                         RAISE EXC_UNEXP_SKIP_OBJECT;
1985                 END IF;
1986 
1987          END IF; -- parent op does not exist
1988 
1989          --
1990          -- Process Flow step 11 : Check if the parent operation is
1991          -- non-referencing operation of type: Event
1992          --
1993          Bom_Validate_Op_Res.Check_NonRefEvent
1994             (  p_operation_sequence_id     => l_rev_op_res_unexp_rec.operation_sequence_id
1995             ,  p_operation_type            => l_rev_op_resource_rec.operation_type
1996             ,  p_entity_processed          => 'RES'
1997             ,  x_mesg_token_tbl            => l_mesg_token_tbl
1998             ,  x_return_status             => l_return_status
1999             ) ;
2000 
2001          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2002             ('Check non-ref operation completed with return_status: ' || l_return_status) ;
2003          END IF ;
2004 
2005          IF l_return_status = Error_Handler.G_STATUS_ERROR
2006          THEN
2007                IF  l_rev_op_resource_rec.operation_type IN (2,3) -- Process or Line Op
2008                THEN
2009 
2010                   l_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2011                   l_token_tbl(1).token_value :=
2012                           l_rev_op_resource_rec.resource_sequence_number ;
2013                   l_token_tbl(2).token_name := 'OP_SEQ_NUMBER';
2014                   l_token_tbl(2).token_value :=
2015                           l_rev_op_resource_rec.operation_sequence_number ;
2016 
2017                   Error_Handler.Add_Error_Token
2018                         ( p_Message_Name   => 'BOM_RES_OPTYPE_NOT_EVENT'
2019                         , p_mesg_token_tbl => l_mesg_token_tbl
2020                         , x_mesg_token_tbl => l_mesg_token_tbl
2021                         , p_Token_Tbl      => l_token_tbl
2022                         ) ;
2023 
2024                ELSE
2025                   l_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2026                   l_token_tbl(1).token_value :=
2027                           l_rev_op_resource_rec.resource_sequence_number ;
2028                   l_token_tbl(2).token_name := 'OP_SEQ_NUMBER';
2029                   l_token_tbl(2).token_value :=
2030                           l_rev_op_resource_rec.operation_sequence_number ;
2031 
2032                   Error_Handler.Add_Error_Token
2033                         ( p_Message_Name   => 'BOM_RES_MUST_NONREF'
2034                         , p_mesg_token_tbl => l_mesg_token_tbl
2035                         , x_mesg_token_tbl => l_mesg_token_tbl
2036                         , p_Token_Tbl      => l_token_tbl
2037                         ) ;
2038 
2039 
2040                END IF ;
2041 
2042                l_return_status := 'F';
2043                l_other_message := 'BOM_RES_ACCESS_FAT_FATAL';
2044                l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2045                l_other_token_tbl(1).token_value :=
2046                                 l_rev_op_resource_rec.resource_sequence_number;
2047                RAISE EXC_FAT_QUIT_SIBLINGS ;
2048 
2049          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2050          THEN
2051                l_other_message := 'BOM_RES_ACCESS_UNEXP_SKIP';
2052                l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2053                l_other_token_tbl(1).token_value :=
2054                           l_rev_op_resource_rec.resource_sequence_number ;
2055                RAISE EXC_UNEXP_SKIP_OBJECT;
2056          END IF;
2057 
2058 
2059          --
2060          -- Process Flow step 11: Value to Id conversions
2061          -- Call Rtg_Val_To_Id.Rev_Op_Resource_VID
2062          --
2063          Bom_Rtg_Val_To_Id.Rev_Op_Resource_VID
2064          (  p_rev_op_resource_rec        => l_rev_op_resource_rec
2065          ,  p_rev_op_res_unexp_rec       => l_rev_op_res_unexp_rec
2066          ,  x_rev_op_res_unexp_rec       => l_rev_op_res_unexp_rec
2067          ,  x_mesg_token_tbl             => l_mesg_token_tbl
2068          ,  x_return_status              => l_return_status
2069          );
2070 
2071          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2072          ('Value-id conversions completed with return_status: ' || l_return_status) ;
2073          END IF ;
2074 
2075          IF l_return_status = Error_Handler.G_STATUS_ERROR
2076          THEN
2077             IF l_rev_op_resource_rec.transaction_type = 'CREATE'
2078             THEN
2079                l_other_message := 'BOM_RES_VID_CSEV_SKIP';
2080                l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2081                l_other_token_tbl(1).token_value :=
2082                           l_rev_op_resource_rec.resource_sequence_number ;
2083                RAISE EXC_SEV_SKIP_BRANCH;
2084             ELSE
2085                RAISE EXC_SEV_QUIT_RECORD ;
2086             END IF ;
2087 
2088          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2089          THEN
2090             l_other_message := 'BOM_RES_VID_UNEXP_SKIP';
2091             l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2092             l_other_token_tbl(1).token_value :=
2093                           l_rev_op_resource_rec.resource_sequence_number ;
2094             RAISE EXC_UNEXP_SKIP_OBJECT;
2095 
2096          ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <>0
2097          THEN
2098             ECO_Error_Handler.Log_Error
2099             (  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
2100             ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
2101             ,  p_mesg_token_tbl      => l_mesg_token_tbl
2102             ,  p_error_status        => 'W'
2103             ,  p_error_level         => Error_Handler.G_RES_LEVEL
2104             ,  p_entity_index        => I
2105             ,  x_ECO_rec             => l_ECO_rec
2106             ,  x_eco_revision_tbl    => l_eco_revision_tbl
2107             ,  x_revised_item_tbl    => l_revised_item_tbl
2108             ,  x_rev_component_tbl   => l_rev_component_tbl
2109             ,  x_ref_designator_tbl  => l_ref_designator_tbl
2110             ,  x_sub_component_tbl   => l_sub_component_tbl
2111             ,  x_rev_operation_tbl   => l_rev_operation_tbl
2112             ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2113             ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2114             ) ;
2115          END IF;
2116 
2117 
2118          --
2119          -- Process Flow step 13 : Check required fields exist
2120          -- (also includes a part of conditionally required fields)
2121          --
2122 
2123          -- No required fields checking
2124 
2125 
2126          --
2127          -- Process Flow step 14 : Attribute Validation for CREATE and UPDATE
2128          -- Call Bom_Validate_Op_Res.Check_Attributes
2129          --
2130          IF l_rev_op_resource_rec.transaction_type IN
2131             (Bom_Rtg_Globals.G_OPR_CREATE, Bom_Rtg_Globals.G_OPR_UPDATE)
2132          THEN
2133             Bom_Validate_Op_Res.Check_Attributes
2134             ( p_rev_op_resource_rec   => l_rev_op_resource_rec
2135             , p_rev_op_res_unexp_rec  => l_rev_op_res_unexp_rec
2136             , x_return_status     => l_return_status
2137             , x_mesg_token_tbl    => l_mesg_token_tbl
2138             ) ;
2139 
2140             IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2141             ('Attribute validation completed with return_status: ' || l_return_status) ;
2142             END IF ;
2143 
2144 
2145             IF l_return_status = Error_Handler.G_STATUS_ERROR
2146             THEN
2147                IF l_rev_op_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
2148                THEN
2149                   l_other_message := 'BOM_RES_ATTVAL_CSEV_SKIP';
2150                   l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2151                   l_other_token_tbl(1).token_value :=
2152                            l_rev_op_resource_rec.resource_sequence_number ;
2153                   RAISE EXC_SEV_SKIP_BRANCH ;
2154                   ELSE
2155                      RAISE EXC_SEV_QUIT_RECORD ;
2156                END IF;
2157             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2158             THEN
2159                l_other_message := 'BOM_RES_ATTVAL_UNEXP_SKIP';
2160                l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2161                l_other_token_tbl(1).token_value :=
2162                            l_rev_op_resource_rec.resource_sequence_number ;
2163                RAISE EXC_UNEXP_SKIP_OBJECT ;
2164             ELSIF l_return_status ='S' AND l_mesg_token_tbl.COUNT <> 0
2165             THEN
2166                ECO_Error_Handler.Log_Error
2167                (  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
2168                ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
2169                ,  p_mesg_token_tbl      => l_mesg_token_tbl
2170                ,  p_error_status        => 'W'
2171                ,  p_error_level         => Error_Handler.G_RES_LEVEL
2172                ,  p_entity_index        => I
2173                ,  x_ECO_rec             => l_ECO_rec
2174                ,  x_eco_revision_tbl    => l_eco_revision_tbl
2175                ,  x_revised_item_tbl    => l_revised_item_tbl
2176                ,  x_rev_component_tbl   => l_rev_component_tbl
2177                ,  x_ref_designator_tbl  => l_ref_designator_tbl
2178                ,  x_sub_component_tbl   => l_sub_component_tbl
2179                ,  x_rev_operation_tbl   => l_rev_operation_tbl
2180                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2181                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2182                ) ;
2183            END IF;
2184         END IF;
2185 
2186         --
2187         -- Process flow step: Query the operation resource  record using by Res Seq Num
2188         -- Call Bom_Res_Seq_Util.Query_Row
2189         --
2190 
2191         IF (l_rev_op_resource_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
2192             AND l_rev_op_resource_rec.acd_type IN ( 2, 3 )) -- ACD Type: Change or Disable
2193         THEN
2194 
2195             Bom_Op_Res_Util.Query_Row
2196             ( p_resource_sequence_number  =>  l_rev_op_resource_rec.resource_sequence_number
2197             , p_operation_sequence_id     =>  l_rev_op_res_unexp_rec.operation_sequence_id
2198             , p_acd_type                  =>  FND_API.G_MISS_NUM
2199             , p_mesg_token_tbl            =>  l_mesg_token_tbl
2200             , x_rev_op_resource_rec       =>  l_old_rev_op_resource_rec
2201             , x_rev_op_res_unexp_rec      =>  l_old_rev_op_res_unexp_rec
2202             , x_mesg_token_tbl            =>  l_mesg_token_tbl
2203             , x_return_status             =>  l_return_status
2204             ) ;
2205 
2206             IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2207             ('Query the original op res for rev op res with acd type : change or delete completed with return_status: ' || l_return_status) ;
2208             END IF ;
2209 
2210             IF l_return_status <> Eng_Globals.G_RECORD_FOUND
2211             THEN
2212                   l_return_status := Error_Handler.G_STATUS_ERROR ;
2213                   l_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2214                   l_token_tbl(1).token_value :=
2215                            l_rev_op_resource_rec.resource_sequence_number ;
2216                   l_token_tbl(2).token_name  := 'OP_SEQ_NUMBER';
2217                   l_token_tbl(2).token_value :=
2218                            l_rev_op_resource_rec.operation_sequence_number ;
2219 
2220                   Error_Handler.Add_Error_Token
2221                   ( p_message_name       => 'BOM_RES_CREATE_REC_NOT_FOUND'
2222                   , p_mesg_token_tbl     => l_Mesg_Token_Tbl
2223                   , p_token_tbl          => l_Token_Tbl
2224                   , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
2225                   );
2226 
2227                   l_other_message := 'BOM_RES_QRY_CSEV_SKIP';
2228                   l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2229                   l_other_token_tbl(1).token_value :=
2230                            l_rev_op_resource_rec.resource_sequence_number ;
2231                   RAISE EXC_SEV_SKIP_BRANCH;
2232            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2233            THEN
2234                   l_other_message := 'BOM_RES_QRY_UNEXP_SKIP';
2235                   l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2236                   l_other_token_tbl(1).token_value :=
2237                            l_rev_op_resource_rec.resource_sequence_number ;
2238                   RAISE EXC_UNEXP_SKIP_OBJECT;
2239           END IF;
2240 
2241         END IF;
2242 
2243 
2244         IF (l_rev_op_resource_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
2245            AND l_rev_op_resource_rec.acd_type IN ( 2, 3 ) ) -- ACD Type : Change or Disable
2246         OR
2247            l_rev_op_resource_rec.transaction_type IN (ENG_GLOBALS.G_OPR_UPDATE ,
2248                                                       ENG_GLOBALS.G_OPR_DELETE)
2249         THEN
2250 
2251         --
2252         -- Process flow step 12: Populate NULL columns for Update and Delete
2253         -- Call Bom_Default_Op_Res.Populate_Null_Columns
2254         --
2255 
2256            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populate NULL columns') ;
2257            END IF ;
2258 
2259            Bom_Default_Op_Res.Populate_Null_Columns
2260            (   p_rev_op_resource_rec     => l_rev_op_resource_rec
2261            ,   p_old_rev_op_resource_rec => l_old_rev_op_resource_rec
2262            ,   p_rev_op_res_unexp_rec    => l_rev_op_res_unexp_rec
2263            ,   p_old_rev_op_res_unexp_rec=> l_old_rev_op_res_unexp_rec
2264            ,   x_rev_op_resource_rec     => l_rev_op_resource_rec
2265            ,   x_rev_op_res_unexp_rec    => l_rev_op_res_unexp_rec
2266            ) ;
2267 
2268 
2269         ELSIF l_rev_op_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
2270         THEN
2271         --
2272         -- Process Flow step 13 : Default missing values for Op Resource (CREATE)
2273         -- Call Bom_Default_Op_Res.Attribute_Defaulting
2274         --
2275 
2276            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting') ;
2277            END IF ;
2278 
2279            Bom_Default_Op_res.Attribute_Defaulting
2280            (   p_rev_op_resource_rec     => l_rev_op_resource_rec
2281            ,   p_rev_op_res_unexp_rec    => l_rev_op_res_unexp_rec
2282            ,   p_control_rec             => Bom_Rtg_Pub.G_Default_Control_Rec
2283            ,   x_rev_op_resource_rec     => l_rev_op_resource_rec
2284            ,   x_rev_op_res_unexp_rec    => l_rev_op_res_unexp_rec
2285            ,   x_mesg_token_tbl          => l_mesg_token_tbl
2286            ,   x_return_status           => l_return_status
2287            ) ;
2288 
2289 
2290            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2291            ('Attribute Defaulting completed with return_status: ' || l_return_status) ;
2292            END IF ;
2293 
2294            IF l_return_status = Error_Handler.G_STATUS_ERROR
2295            THEN
2296               l_other_message := 'BOM_RES_ATTDEF_CSEV_SKIP';
2297               l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2298               l_other_token_tbl(1).token_value :=
2299                           l_rev_op_resource_rec.resource_sequence_number ;
2300               RAISE EXC_SEV_SKIP_BRANCH ;
2301 
2302            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2303            THEN
2304               l_other_message := 'BOM_RES_ATTDEF_UNEXP_SKIP';
2305               l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2306               l_other_token_tbl(1).token_value :=
2307                            l_rev_op_resource_rec.resource_sequence_number ;
2308               RAISE EXC_UNEXP_SKIP_OBJECT ;
2309            ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
2310            THEN
2311                ECO_Error_Handler.Log_Error
2312                (  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
2313                ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
2314                ,  p_mesg_token_tbl      => l_mesg_token_tbl
2315                ,  p_error_status        => 'W'
2316                ,  p_error_level         => Error_Handler.G_RES_LEVEL
2317                ,  p_entity_index        => I
2318                ,  x_ECO_rec             => l_ECO_rec
2319                ,  x_eco_revision_tbl    => l_eco_revision_tbl
2320                ,  x_revised_item_tbl    => l_revised_item_tbl
2321                ,  x_rev_component_tbl   => l_rev_component_tbl
2322                ,  x_ref_designator_tbl  => l_ref_designator_tbl
2323                ,  x_sub_component_tbl   => l_sub_component_tbl
2324                ,  x_rev_operation_tbl   => l_rev_operation_tbl
2325                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2326                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2327                ) ;
2328           END IF;
2329        END IF;
2330 
2331        --
2332        -- Process Flow step 17: Conditionally Required Attributes
2333        --
2334        --
2335        -- No Conditionally Required Attributes
2336 
2337 
2338        --
2339        -- Process Flow step 18: Entity defaulting for CREATE and UPDATE
2340        --
2341        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting') ;
2342        END IF ;
2343        IF l_rev_op_resource_rec.transaction_type IN ( Bom_Rtg_Globals.G_OPR_CREATE
2344                                                 , Bom_Rtg_Globals.G_OPR_UPDATE )
2345        THEN
2346           Bom_Default_Op_res.Entity_Defaulting
2347               (   p_rev_op_resource_rec   => l_rev_op_resource_rec
2348               ,   p_rev_op_res_unexp_rec  => l_rev_op_res_unexp_rec
2349               ,   p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
2350               ,   x_rev_op_resource_rec   => l_rev_op_resource_rec
2351               ,   x_rev_op_res_unexp_rec  => l_rev_op_res_unexp_rec
2352               ,   x_mesg_token_tbl        => l_mesg_token_tbl
2353               ,   x_return_status         => l_return_status
2354               ) ;
2355 
2356           IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2357           ('Entity defaulting completed with return_status: ' || l_return_status) ;
2358           END IF ;
2359 
2360           IF l_return_status = Error_Handler.G_STATUS_ERROR
2361           THEN
2362              IF l_rev_op_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
2363              THEN
2364                 l_other_message := 'BOM_RES_ENTDEF_CSEV_SKIP';
2365                 l_other_token_tbl(1).token_name  := 'RES_SEQ_NUMBER';
2366                 l_other_token_tbl(1).token_value :=
2367                           l_rev_op_resource_rec.operation_sequence_number ;
2368                 RAISE EXC_SEV_SKIP_BRANCH ;
2369              ELSE
2370                 RAISE EXC_SEV_QUIT_RECORD ;
2371              END IF;
2372           ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2373           THEN
2374              l_other_message := 'BOM_RES_ENTDEF_UNEXP_SKIP';
2375              l_other_token_tbl(1).token_name  := 'RES_SEQ_NUMBER';
2376              l_other_token_tbl(1).token_value :=
2377                           l_rev_op_resource_rec.resource_sequence_number ;
2378              RAISE EXC_UNEXP_SKIP_OBJECT ;
2379           ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
2380           THEN
2381              ECO_Error_Handler.Log_Error
2382              (  p_rev_op_resource_tbl         => x_rev_op_resource_tbl
2383              ,  p_rev_sub_resource_tbl        => x_rev_sub_resource_tbl
2384              ,  p_mesg_token_tbl          => l_mesg_token_tbl
2385              ,  p_error_status            => 'W'
2386              ,  p_error_level             => Error_Handler.G_RES_LEVEL
2387              ,  p_entity_index            => I
2388              ,  x_ECO_rec                 => l_ECO_rec
2389              ,  x_eco_revision_tbl        => l_eco_revision_tbl
2390              ,  x_revised_item_tbl        => l_revised_item_tbl
2391              ,  x_rev_component_tbl       => l_rev_component_tbl
2392              ,  x_ref_designator_tbl      => l_ref_designator_tbl
2393              ,  x_sub_component_tbl       => l_sub_component_tbl
2394              ,  x_rev_operation_tbl       => l_rev_operation_tbl
2395              ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
2396              ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
2397              ) ;
2398           END IF ;
2399        END IF ;
2400 
2401        --
2402        -- Process Flow step 16 - Entity Level Validation
2403        -- Call Bom_Validate_Op_Res.Check_Entity
2404        --
2405        IF Bom_Rtg_Globals.Get_Debug = 'Y'
2406        THEN Error_Handler.Write_Debug('Starting with Op Resources entity validation . . . ') ;
2407        END IF ;
2408 
2409           Bom_Validate_Op_Res.Check_Entity
2410           (  p_rev_op_resource_rec       => l_rev_op_resource_rec
2411           ,  p_rev_op_res_unexp_rec      => l_rev_op_res_unexp_rec
2412           ,  p_old_rev_op_resource_rec   => l_old_rev_op_resource_rec
2413           ,  p_old_rev_op_res_unexp_rec  => l_old_rev_op_res_unexp_rec
2414           ,  p_control_rec               => Bom_Rtg_Pub.G_Default_Control_Rec
2415           ,  x_rev_op_resource_rec       => l_rev_op_resource_rec
2416           ,  x_rev_op_res_unexp_rec      => l_rev_op_res_unexp_rec
2417           ,  x_mesg_token_tbl            => l_mesg_token_tbl
2418           ,  x_return_status             => l_return_status
2419           ) ;
2420 
2421 
2422        IF l_return_status = Error_Handler.G_STATUS_ERROR
2423        THEN
2424           IF l_rev_op_resource_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
2425           THEN
2426              l_other_message := 'BOM_RES_ENTVAL_CSEV_SKIP';
2427              l_other_token_tbl(1).token_name  := 'RES_SEQ_NUMBER';
2428              l_other_token_tbl(1).token_value :=
2429                            l_rev_op_resource_rec.resource_sequence_number ;
2430              RAISE EXC_SEV_SKIP_BRANCH ;
2431           ELSE
2432              RAISE EXC_SEV_QUIT_RECORD ;
2433           END IF;
2434        ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2435        THEN
2436           l_other_message := 'BOM_RES_ENTVAL_UNEXP_SKIP';
2437           l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2438           l_other_token_tbl(1).token_value :=
2439                         l_rev_op_resource_rec.resource_sequence_number ;
2440           RAISE EXC_UNEXP_SKIP_OBJECT ;
2441        ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
2442        THEN
2443           ECO_Error_Handler.Log_Error
2444           (  p_rev_op_resource_tbl  => x_rev_op_resource_tbl
2445           ,  p_rev_sub_resource_tbl => x_rev_sub_resource_tbl
2446           ,  p_mesg_token_tbl       => l_mesg_token_tbl
2447           ,  p_error_status         => 'W'
2448           ,  p_error_level          => Error_Handler.G_RES_LEVEL
2449           ,  p_entity_index         => I
2450           ,  x_ECO_rec              => l_ECO_rec
2451           ,  x_eco_revision_tbl     => l_eco_revision_tbl
2452           ,  x_revised_item_tbl     => l_revised_item_tbl
2453           ,  x_rev_component_tbl    => l_rev_component_tbl
2454           ,  x_ref_designator_tbl   => l_ref_designator_tbl
2455           ,  x_sub_component_tbl    => l_sub_component_tbl
2456           ,  x_rev_operation_tbl    => l_rev_operation_tbl
2457           ,  x_rev_op_resource_tbl  => x_rev_op_resource_tbl
2458           ,  x_rev_sub_resource_tbl => x_rev_sub_resource_tbl
2459           ) ;
2460        END IF;
2461 
2462        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation completed with '
2463              || l_return_Status || ' proceeding for database writes . . . ') ;
2464        END IF;
2465 
2466        --
2467        -- Process Flow step 16 : Database Writes
2468        --
2469        Bom_Op_Res_Util.Perform_Writes
2470           (   p_rev_op_resource_rec     => l_rev_op_resource_rec
2471           ,   p_rev_op_res_unexp_rec    => l_rev_op_res_unexp_rec
2472           ,   p_control_rec             => Bom_Rtg_Pub.G_Default_Control_Rec
2473           ,   x_mesg_token_tbl          => l_mesg_token_tbl
2474           ,   x_return_status           => l_return_status
2475           ) ;
2476 
2477        IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2478        THEN
2479           l_other_message := 'BOM_RES_WRITES_UNEXP_SKIP';
2480           l_other_token_tbl(1).token_name := 'RES_SEQ_NUMBER';
2481           l_other_token_tbl(1).token_value :=
2482                           l_rev_op_resource_rec.resource_sequence_number ;
2483           RAISE EXC_UNEXP_SKIP_OBJECT ;
2484        ELSIF l_return_status ='S' AND
2485           l_mesg_token_tbl .COUNT <>0
2486        THEN
2487           ECO_Error_Handler.Log_Error
2488           (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2489           ,  p_mesg_token_tbl      => l_mesg_token_tbl
2490           ,  p_error_status        => 'W'
2491           ,  p_error_level         => Error_Handler.G_RES_LEVEL
2492           ,  p_entity_index        => I
2493           ,  x_ECO_rec             => l_ECO_rec
2494           ,  x_eco_revision_tbl    => l_eco_revision_tbl
2495           ,  x_revised_item_tbl    => l_revised_item_tbl
2496           ,  x_rev_component_tbl   => l_rev_component_tbl
2497           ,  x_ref_designator_tbl  => l_ref_designator_tbl
2498           ,  x_sub_component_tbl   => l_sub_component_tbl
2499           ,  x_rev_operation_tbl   => l_rev_operation_tbl
2500           ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2501           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2502           ) ;
2503        END IF;
2504 
2505        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Database writes completed with status:  ' || l_return_status);
2506        END IF;
2507 
2508     END IF; -- END IF statement that checks RETURN STATUS
2509 
2510     --  Load tables.
2511     x_rev_op_resource_tbl(I)  := l_rev_op_resource_rec;
2512 
2513 
2514     --  For loop exception handler.
2515 
2516     EXCEPTION
2517        WHEN EXC_SEV_QUIT_RECORD THEN
2518           ECO_Error_Handler.Log_Error
2519           (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2520           ,  p_mesg_token_tbl      => l_mesg_token_tbl
2521           ,  p_error_status        => FND_API.G_RET_STS_ERROR
2522           ,  p_error_scope         => Error_Handler.G_SCOPE_RECORD
2523           ,  p_error_level         => Error_Handler.G_RES_LEVEL
2524           ,  p_entity_index        => I
2525           ,  x_ECO_rec             => l_ECO_rec
2526           ,  x_eco_revision_tbl    => l_eco_revision_tbl
2527           ,  x_revised_item_tbl    => l_revised_item_tbl
2528           ,  x_rev_component_tbl   => l_rev_component_tbl
2529           ,  x_ref_designator_tbl  => l_ref_designator_tbl
2530           ,  x_sub_component_tbl   => l_sub_component_tbl
2531           ,  x_rev_operation_tbl   => l_rev_operation_tbl
2532           ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2533           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2534           ) ;
2535 
2536 
2537          IF l_bo_return_status = 'S'
2538          THEN
2539             l_bo_return_status := l_return_status ;
2540          END IF;
2541 
2542          x_return_status           := l_bo_return_status;
2543          x_mesg_token_tbl          := l_mesg_token_tbl ;
2544          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2545       --   x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2546 
2547 
2548       WHEN EXC_SEV_QUIT_BRANCH THEN
2549 
2550          ECO_Error_Handler.Log_Error
2551          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2552          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2553          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
2554          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
2555          ,  p_other_status        => Error_Handler.G_STATUS_ERROR
2556          ,  p_other_message       => l_other_message
2557          ,  p_other_token_tbl     => l_other_token_tbl
2558          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2559          ,  p_entity_index        => I
2560          ,  x_ECO_rec             => l_ECO_rec
2561          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2562          ,  x_revised_item_tbl    => l_revised_item_tbl
2563          ,  x_rev_component_tbl   => l_rev_component_tbl
2564          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2565          ,  x_sub_component_tbl   => l_sub_component_tbl
2566          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2567          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2568          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2569          ) ;
2570 
2571 
2572          IF l_bo_return_status = 'S'
2573          THEN
2574             l_bo_return_status  := l_return_status;
2575          END IF;
2576 
2577          x_return_status        := l_bo_return_status;
2578          x_mesg_token_tbl       := l_mesg_token_tbl ;
2579          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2580          --x_rev_sub_resource_tbl := l_rev_sub_resource_tbl ;
2581 
2582       WHEN EXC_SEV_SKIP_BRANCH THEN
2583          ECO_Error_Handler.Log_Error
2584          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2585          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2586          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
2587          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
2588          ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
2589          ,  p_other_message       => l_other_message
2590          ,  p_other_token_tbl     => l_other_token_tbl
2591          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2592          ,  p_entity_index        => I
2593          ,  x_ECO_rec             => l_ECO_rec
2594          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2595          ,  x_revised_item_tbl    => l_revised_item_tbl
2596          ,  x_rev_component_tbl   => l_rev_component_tbl
2597          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2598          ,  x_sub_component_tbl   => l_sub_component_tbl
2599          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2600          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2601          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2602          ) ;
2603 
2604         IF l_bo_return_status = 'S'
2605         THEN
2606            l_bo_return_status     := l_return_status ;
2607         END IF;
2608         x_return_status           := l_bo_return_status;
2609         x_mesg_token_tbl          := l_mesg_token_tbl ;
2610         --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2611         --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2612 
2613      WHEN EXC_SEV_QUIT_SIBLINGS THEN
2614          ECO_Error_Handler.Log_Error
2615          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2616          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2617          ,  p_error_status        => Error_Handler.G_STATUS_ERROR
2618          ,  p_error_scope         => Error_Handler.G_SCOPE_SIBLINGS
2619          ,  p_other_status        => Error_Handler.G_STATUS_ERROR
2620          ,  p_other_message       => l_other_message
2621          ,  p_other_token_tbl     => l_other_token_tbl
2622          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2623          ,  p_entity_index        => I
2624          ,  x_ECO_rec             => l_ECO_rec
2625          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2626          ,  x_revised_item_tbl    => l_revised_item_tbl
2627          ,  x_rev_component_tbl   => l_rev_component_tbl
2628          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2629          ,  x_sub_component_tbl   => l_sub_component_tbl
2630          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2631          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2632          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2633          ) ;
2634 
2635          IF l_bo_return_status = 'S'
2636          THEN
2637            l_bo_return_status  := l_return_status ;
2638          END IF;
2639          x_return_status       := l_bo_return_status;
2640          x_mesg_token_tbl      := l_mesg_token_tbl ;
2641          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2642          --x_rev_sub_resource_tbl := l_rev_sub_resource_tbl ;
2643 
2644 
2645       WHEN EXC_FAT_QUIT_BRANCH THEN
2646          ECO_Error_Handler.Log_Error
2647          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2648          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2649          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
2650          ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
2651          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
2652          ,  p_other_message       => l_other_message
2653          ,  p_other_token_tbl     => l_other_token_tbl
2654          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2655          ,  p_entity_index        => I
2656          ,  x_ECO_rec             => l_ECO_rec
2657          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2658          ,  x_revised_item_tbl    => l_revised_item_tbl
2659          ,  x_rev_component_tbl   => l_rev_component_tbl
2660          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2661          ,  x_sub_component_tbl   => l_sub_component_tbl
2662          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2663          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2664          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2665          ) ;
2666 
2667          x_return_status       := Error_Handler.G_STATUS_FATAL;
2668          x_mesg_token_tbl      := l_mesg_token_tbl ;
2669          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2670          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2671 
2672 
2673       WHEN EXC_FAT_QUIT_SIBLINGS THEN
2674          ECO_Error_Handler.Log_Error
2675          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2676          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2677          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
2678          ,  p_error_scope         => Error_Handler.G_SCOPE_SIBLINGS
2679          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
2680          ,  p_other_message       => l_other_message
2681          ,  p_other_token_tbl     => l_other_token_tbl
2682          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2683          ,  p_entity_index        => I
2684          ,  x_ECO_rec             => l_ECO_rec
2685          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2686          ,  x_revised_item_tbl    => l_revised_item_tbl
2687          ,  x_rev_component_tbl   => l_rev_component_tbl
2688          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2689          ,  x_sub_component_tbl   => l_sub_component_tbl
2690          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2691          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2692          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2693          ) ;
2694 
2695         x_return_status       := Error_Handler.G_STATUS_FATAL;
2696         x_mesg_token_tbl      := l_mesg_token_tbl ;
2697         --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2698         --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2699 
2700     WHEN EXC_FAT_QUIT_OBJECT THEN
2701          ECO_Error_Handler.Log_Error
2702          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2703          ,  p_rev_sub_resource_tbl => x_rev_sub_resource_tbl
2704          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2705          ,  p_error_status        => Error_Handler.G_STATUS_FATAL
2706          ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
2707          ,  p_other_status        => Error_Handler.G_STATUS_FATAL
2708          ,  p_other_message       => l_other_message
2709          ,  p_other_token_tbl     => l_other_token_tbl
2710          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2711          ,  p_entity_index        => I
2712          ,  x_ECO_rec             => l_ECO_rec
2713          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2714          ,  x_revised_item_tbl    => l_revised_item_tbl
2715          ,  x_rev_component_tbl   => l_rev_component_tbl
2716          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2717          ,  x_sub_component_tbl   => l_sub_component_tbl
2718          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2719          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2720          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2721          ) ;
2722 
2723          l_return_status       := 'Q';
2724          x_mesg_token_tbl      := l_mesg_token_tbl ;
2725          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2726          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2727 
2728       WHEN EXC_UNEXP_SKIP_OBJECT THEN
2729          ECO_Error_Handler.Log_Error
2730          (  p_rev_op_resource_tbl => x_rev_op_resource_tbl
2731          ,  p_mesg_token_tbl      => l_mesg_token_tbl
2732          ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
2733          ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
2734          ,  p_other_message       => l_other_message
2735          ,  p_other_token_tbl     => l_other_token_tbl
2736          ,  p_error_level         => Error_Handler.G_RES_LEVEL
2737          ,  x_ECO_rec             => l_ECO_rec
2738          ,  x_eco_revision_tbl    => l_eco_revision_tbl
2739          ,  x_revised_item_tbl    => l_revised_item_tbl
2740          ,  x_rev_component_tbl   => l_rev_component_tbl
2741          ,  x_ref_designator_tbl  => l_ref_designator_tbl
2742          ,  x_sub_component_tbl   => l_sub_component_tbl
2743          ,  x_rev_operation_tbl   => l_rev_operation_tbl
2744          ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
2745          ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
2746          ) ;
2747 
2748          l_return_status       := 'U';
2749          x_mesg_token_tbl      := l_mesg_token_tbl ;
2750          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2751          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2752 
2753    END ; -- END block
2754 
2755    IF l_return_status in ('Q', 'U')
2756    THEN
2757       x_return_status := l_return_status;
2758       RETURN ;
2759    END IF;
2760 
2761    END IF; -- End of processing records for which the return status is null
2762    END LOOP; -- END Operation Resources processing loop
2763 
2764    --  Load OUT parameters
2765    IF NVL(l_return_status, 'S') <> 'S'
2766    THEN
2767       x_return_status    := l_return_status;
2768    END IF;
2769 
2770    x_mesg_token_tbl          := l_mesg_token_tbl ;
2771    --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
2772    --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
2773    x_mesg_token_tbl          := l_mesg_token_tbl ;
2774 
2775 END Rev_Operation_Resources ;
2776 
2777 
2778 PROCEDURE Rev_Operation_Sequences
2779 (   p_validation_level              IN  NUMBER
2780 ,   p_change_notice                 IN  VARCHAR2 := NULL
2781 ,   p_organization_id               IN  NUMBER   := NULL
2782 ,   p_revised_item_name             IN  VARCHAR2 := NULL
2783 ,   p_effectivity_date              IN  DATE     := NULL
2784 ,   p_item_revision                 IN  VARCHAR2 := NULL
2785 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
2786 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
2787 ,   p_rev_operation_tbl             IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type
2788 ,   p_rev_op_resource_tbl           IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type
2789 ,   p_rev_sub_resource_tbl          IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
2790 ,   x_rev_operation_tbl             IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type
2791 ,   x_rev_op_resource_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type
2792 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
2793 ,   x_mesg_token_tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
2794 ,   x_return_status                 OUT NOCOPY VARCHAR2
2795 )
2796 
2797 IS
2798 
2799 /* Exposed and Unexposed record */
2800 l_rev_operation_rec         Bom_Rtg_Pub.Rev_Operation_Rec_Type ;
2801 --l_rev_operation_tbl         Bom_Rtg_Pub.Rev_Operation_Tbl_Type ;
2802 l_rev_op_unexp_rec          Bom_Rtg_Pub.Rev_Op_Unexposed_Rec_Type ;
2803 l_old_rev_operation_rec     Bom_Rtg_Pub.Rev_Operation_Rec_Type ;
2804 l_old_rev_op_unexp_rec      Bom_Rtg_Pub.Rev_Op_Unexposed_Rec_Type ;
2805 
2806 /* Other Entities */
2807 l_eco_rec                ENG_Eco_PUB.Eco_Rec_Type;
2808 l_eco_revision_tbl       ENG_Eco_PUB.ECO_Revision_Tbl_Type;
2809 l_revised_item_tbl       ENG_Eco_PUB.Revised_Item_Tbl_Type;
2810 l_rev_component_rec      BOM_BO_PUB.Rev_Component_Rec_Type;
2811 l_rev_component_tbl      BOM_BO_PUB.Rev_Component_Tbl_Type;
2812 l_rev_comp_unexp_rec     BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
2813 l_old_rev_component_rec  BOM_BO_PUB.Rev_Component_Rec_Type;
2814 l_old_rev_comp_unexp_rec BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
2815 l_ref_designator_tbl     BOM_BO_PUB.Ref_Designator_Tbl_Type;
2816 l_sub_component_tbl      BOM_BO_PUB.Sub_Component_Tbl_Type;
2817 --l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type   := p_rev_op_resource_tbl ;
2818 --l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type  := p_rev_sub_resource_tbl ;
2819 
2820 /* Others */
2821 l_return_status         VARCHAR2(1) ;
2822 l_bo_return_status      VARCHAR2(1) ;
2823 l_process_children      BOOLEAN := TRUE ;
2824 l_item_parent_exists    BOOLEAN := FALSE ;
2825 l_valid                 BOOLEAN := TRUE ;
2826 l_dummy                 NUMBER ;
2827 
2828 /* Error Handling Variables */
2829 l_token_tbl             Error_Handler.Token_Tbl_Type ;
2830 l_mesg_token_tbl        Error_Handler.Mesg_Token_Tbl_Type;
2831 l_other_token_tbl       Error_Handler.Token_Tbl_Type ;
2832 l_other_message         VARCHAR2(2000);
2833 l_err_text              VARCHAR2(2000);
2834 
2835 EXC_SEV_QUIT_RECORD     EXCEPTION ;
2836 EXC_SEV_QUIT_BRANCH     EXCEPTION ;
2837 EXC_UNEXP_SKIP_OBJECT   EXCEPTION ;
2838 EXC_SEV_QUIT_SIBLINGS   EXCEPTION ;
2839 EXC_SEV_SKIP_BRANCH     EXCEPTION ;
2840 EXC_FAT_QUIT_SIBLINGS   EXCEPTION ;
2841 EXC_FAT_QUIT_BRANCH     EXCEPTION ;
2842 EXC_FAT_QUIT_OBJECT     EXCEPTION ;
2843 
2844 BEGIN
2845 
2846    --  Init local table variables.
2847    l_return_status        := FND_API.G_RET_STS_SUCCESS ;
2848    l_bo_return_status     := FND_API.G_RET_STS_SUCCESS ;
2849    x_rev_operation_tbl    := p_rev_operation_tbl ;
2850    x_rev_op_resource_tbl  := p_rev_op_resource_tbl ;
2851    x_rev_sub_resource_tbl := p_rev_sub_resource_tbl ;
2852 
2853    l_rev_op_unexp_rec.organization_id := Eng_Globals.Get_Org_Id;
2854 
2855 
2856    FOR I IN 1..x_rev_operation_tbl.COUNT LOOP
2857 
2858    IF (x_rev_operation_tbl(I).return_status IS NULL OR
2859         x_rev_operation_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
2860 
2861    BEGIN
2862 
2863        --  Load local records.
2864        l_rev_operation_rec := x_rev_operation_tbl(I);
2865 
2866        l_rev_operation_rec.transaction_type :=
2867        UPPER(l_rev_operation_rec.transaction_type);
2868 
2869        /* make sure to set process_children to false at the start of
2870           every iteration */
2871 
2872        l_process_children := FALSE;    /* Bug 6485168 */
2873 
2874         --
2875         -- Initialize the Unexposed Record for every iteration of the Loop
2876         -- so that sequence numbers get generated for every new row.
2877         --
2878         l_rev_op_unexp_rec.Revised_Item_Sequence_Id    := NULL ;
2879         l_rev_op_unexp_rec.Operation_Sequence_Id       := NULL ;
2880         l_rev_op_unexp_rec.Old_Operation_Sequence_Id   := NULL ;
2881         l_rev_op_unexp_rec.Routing_Sequence_Id         := NULL ;
2882         l_rev_op_unexp_rec.Revised_Item_Id             := NULL ;
2883         l_rev_op_unexp_rec.Department_Id               := NULL ;
2884         l_rev_op_unexp_rec.Standard_Operation_Id       := NULL ;
2885 
2886         IF p_revised_item_name IS NOT NULL AND
2887            p_effectivity_date  IS NOT NULL AND
2888            p_change_notice     IS NOT NULL AND
2889            p_organization_id   IS NOT NULL
2890         THEN
2891                 -- revised item parent exists
2892                 l_item_parent_exists := TRUE;
2893         END IF;
2894 
2895 
2896         -- Process Flow Step 2: Check if record has not yet been processed and
2897         -- that it is the child of the parent that called this procedure
2898         --
2899 
2900           IF --(l_rev_operation_rec.return_status IS NULL OR
2901             --l_rev_operation_rec.return_status = FND_API.G_MISS_CHAR)
2902            --AND
2903 
2904             -- Did Rev_Items call this procedure, that is,
2905             -- if revised item exists, then is this record a child ?
2906 
2907             (NOT l_item_parent_exists
2908              OR
2909              (l_item_parent_exists AND
2910               (l_rev_operation_rec.ECO_Name = p_change_notice AND
2911                l_rev_op_unexp_rec.organization_id = p_organization_id AND
2912                l_rev_operation_rec.revised_item_name = p_revised_item_name AND
2913                l_rev_operation_rec.start_effective_date = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND -- Bug 6657209
2914                NVL(l_rev_operation_rec.new_routing_revision, FND_API.G_MISS_CHAR )
2915                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR )     AND -- Added by MK on 11/02/00
2916                NVL(l_rev_operation_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
2917                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
2918                NVL(l_rev_operation_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
2919                                              = NVL(p_item_revision, FND_API.G_MISS_CHAR) ))
2920             )
2921         THEN
2922 
2923          l_return_status := FND_API.G_RET_STS_SUCCESS;
2924          l_rev_operation_rec.return_status := FND_API.G_RET_STS_SUCCESS;
2925 
2926          -- Bug 6657209
2927            IF (l_item_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null) THEN
2928               l_rev_operation_rec.start_effective_date := p_effectivity_date;
2929            END IF;
2930 
2931          --
2932          -- Process Flow step 3 :Check if transaction_type is valid
2933          -- Transaction_Type must be CRATE, UPDATE, DELETE or CANCEL
2934          -- Call the Bom_Rtg_Globals.Transaction_Type_Validity
2935          --
2936 
2937          ENG_GLOBALS.Transaction_Type_Validity
2938          (   p_transaction_type => l_rev_operation_rec.transaction_type
2939          ,   p_entity           => 'Op_Seq'
2940          ,   p_entity_id        => l_rev_operation_rec.operation_sequence_number
2941          ,   x_valid            => l_valid
2942          ,   x_mesg_token_tbl   => l_mesg_token_tbl
2943          ) ;
2944 
2945          IF NOT l_valid
2946          THEN
2947             RAISE EXC_SEV_QUIT_RECORD ;
2948          END IF ;
2949 
2950          --
2951          -- Process Flow step 4(a): Convert user unique index to unique
2952          -- index I
2953          -- Call Rtg_Val_To_Id.Operation_UUI_To_UI Shared Utility Package
2954          --
2955          Bom_Rtg_Val_To_Id.Rev_Operation_UUI_To_UI
2956          ( p_rev_operation_rec  => l_rev_operation_rec
2957          , p_rev_op_unexp_rec   => l_rev_op_unexp_rec
2958          , x_rev_op_unexp_rec   => l_rev_op_unexp_rec
2959          , x_mesg_token_tbl     => l_mesg_token_tbl
2960          , x_return_status      => l_return_status
2961          ) ;
2962 
2963          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
2964          ('Convert to User Unique Index to Index1 completed with return_status: ' || l_return_status) ;
2965          END IF;
2966 
2967          IF l_return_status = Error_Handler.G_STATUS_ERROR
2968          THEN
2969             l_other_message := 'BOM_OP_UUI_SEV_ERROR';
2970             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
2971             l_other_token_tbl(1).token_value :=
2972                         l_rev_operation_rec.operation_sequence_number ;
2973             RAISE EXC_SEV_QUIT_BRANCH ;
2974 
2975          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2976          THEN
2977             l_other_message := 'BOM_OP_UUI_UNEXP_SKIP';
2978             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
2979             l_other_token_tbl(1).token_value :=
2980                         l_rev_operation_rec.operation_sequence_number ;
2981             RAISE EXC_UNEXP_SKIP_OBJECT;
2982          END IF ;
2983 
2984 
2985          -- Added by MK on 12/03/00 to resolve ECO dependency
2986          ENG_Val_To_Id.RtgAndRevitem_UUI_To_UI
2987            ( p_revised_item_name        => l_rev_operation_rec.revised_item_name
2988            , p_revised_item_id          => l_rev_op_unexp_rec.revised_item_id
2989            , p_item_revision            => l_rev_operation_rec.new_revised_item_revision
2990            , p_effective_date           => l_rev_operation_rec.start_effective_date
2991            , p_change_notice            => l_rev_operation_rec.eco_name
2992            , p_organization_id          => l_rev_op_unexp_rec.organization_id
2993            , p_new_routing_revision     => l_rev_operation_rec.new_routing_revision
2994            , p_from_end_item_number     => l_rev_operation_rec.from_end_item_unit_number
2995            , p_entity_processed         => 'ROP'
2996            , p_operation_sequence_number => l_rev_operation_rec.operation_sequence_number
2997            , x_revised_item_sequence_id  => l_rev_op_unexp_rec.revised_item_sequence_id
2998            , x_routing_sequence_id       => l_rev_op_unexp_rec.routing_sequence_id
2999            , x_operation_sequence_id    => l_dummy
3000            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
3001            , x_other_message            => l_other_message
3002            , x_other_token_tbl          => l_other_token_tbl
3003            , x_Return_Status            => l_return_status
3004           ) ;
3005 
3006          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3007          ('Convert to User Unique Index to Index1 for Rtg and Rev Item Seq completed with return_status: ' || l_return_status) ;
3008          END IF;
3009 
3010          IF l_return_status = Error_Handler.G_STATUS_ERROR
3011          THEN
3012             l_other_message := 'BOM_OP_UUI_SEV_ERROR';
3013             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3014             l_other_token_tbl(1).token_value :=
3015                         l_rev_operation_rec.operation_sequence_number ;
3016             RAISE EXC_SEV_QUIT_BRANCH ;
3017 
3018          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3019          THEN
3020             l_other_message := 'BOM_OP_UUI_UNEXP_SKIP';
3021             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3022             l_other_token_tbl(1).token_value :=
3023                         l_rev_operation_rec.operation_sequence_number ;
3024             RAISE EXC_UNEXP_SKIP_OBJECT;
3025          END IF ;
3026 
3027 
3028          --
3029          -- Process Flow step 4(b): Convert user unique index to unique
3030          -- index II
3031          -- Call the Rtg_Val_To_Id.Operation_UUI_To_UI2
3032          --
3033          /*
3034          Bom_Rtg_Val_To_Id.Rev_Operation_UUI_To_UI2
3035          ( p_rev_operation_rec  => l_rev_operation_rec
3036          , p_rev_op_unexp_rec   => l_rev_op_unexp_rec
3037          , x_rev_op_unexp_rec   => l_rev_op_unexp_rec
3038          , x_mesg_token_tbl     => l_mesg_token_tbl
3039          , x_other_message      => l_other_message
3040          , x_other_token_tbl    => l_other_token_tbl
3041          , x_return_status      => l_return_status
3042          ) ;
3043 
3044          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3045          ('Convert to User Unique Index to Index2 completed with return_status: ' || l_return_status) ;
3046          END IF;
3047 
3048          IF l_return_status = Error_Handler.G_STATUS_ERROR
3049          THEN
3050             RAISE EXC_SEV_QUIT_SIBLINGS ;
3051          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3052          THEN
3053             l_other_message := 'BOM_OP_UUI_UNEXP_SKIP';
3054             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3055             l_other_token_tbl(1).token_value :=
3056                    l_rev_operation_rec.operation_sequence_number ;
3057             RAISE EXC_UNEXP_SKIP_OBJECT;
3058          END IF ;
3059          */
3060 
3061          -- Set Unit Controlled Item
3062          Bom_Rtg_Globals.Set_Unit_Controlled_Item
3063            ( p_inventory_item_id => l_rev_comp_unexp_rec.revised_item_id
3064            , p_organization_id   => l_rev_comp_unexp_rec.organization_id
3065            );
3066 
3067          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3068          ('Set unit controlled item flag . . .' ) ;
3069          END IF ;
3070 
3071          --
3072          -- Process Flow step 5 : Check the parent revised item is controlled
3073          -- by model unit effectivity
3074          --
3075          --
3076          IF Bom_Rtg_Globals.Get_Unit_Controlled_Item THEN
3077              l_return_status := FND_API.G_RET_STS_ERROR;
3078              l_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3079              l_token_tbl(1).token_value := l_rev_operation_rec.operation_sequence_number ;
3080              l_token_tbl(2).token_name  := 'REVISED_ITEM_NAME';
3081              l_token_tbl(2).token_value := l_rev_operation_rec.revised_item_name ;
3082 
3083              Error_Handler.Add_Error_Token
3084              ( p_Message_Name   => 'BOM_OP_ECO_MDLUNITEFFECT'
3085              , p_mesg_token_tbl => l_mesg_token_tbl
3086              , x_mesg_token_tbl => l_mesg_token_tbl
3087              , p_Token_Tbl      => l_token_tbl
3088              ) ;
3089 
3090              l_return_status := 'F';
3091              RAISE EXC_FAT_QUIT_SIBLINGS ; -- RAISE EXC_FAT_QUIT_BRANCH
3092          END IF;
3093 
3094          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3095          ('Check if the parent item is unit controlled item with return_status: ' || l_return_status) ;
3096          END IF ;
3097 
3098          --
3099          -- Process Flow step 6: Verify Operation Sequence's existence
3100          -- Call the Bom_Validate_Op_Seq.Check_Existence
3101          --
3102          --
3103          Bom_Validate_Op_Seq.Check_Existence
3104          (  p_rev_operation_rec          => l_rev_operation_rec
3105          ,  p_rev_op_unexp_rec           => l_rev_op_unexp_rec
3106          ,  x_old_rev_operation_rec      => l_old_rev_operation_rec
3107          ,  x_old_rev_op_unexp_rec       => l_old_rev_op_unexp_rec
3108          ,  x_mesg_token_tbl             => l_mesg_token_tbl
3109          ,  x_return_status              => l_return_status
3110          ) ;
3111 
3112 
3113          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3114          ('Check Existence completed with return_status: ' || l_return_status) ;
3115          END IF ;
3116 
3117          IF l_return_status = Error_Handler.G_STATUS_ERROR
3118          THEN
3119             l_other_message := 'BOM_OP_EXS_SEV_SKIP';
3120             l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3121             l_other_token_tbl(1).token_value :=
3122                           l_rev_operation_rec.operation_sequence_number ;
3123             l_other_token_tbl(2).token_name  := 'REVISED_ITEM_NAME';
3124             l_other_token_tbl(2).token_value :=
3125                           l_rev_operation_rec.revised_item_name ;
3126             RAISE EXC_SEV_QUIT_BRANCH;
3127          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3128          THEN
3129             l_other_message := 'BOM_OP_EXS_UNEXP_SKIP';
3130             l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3131             l_other_token_tbl(1).token_value :=
3132                           l_rev_operation_rec.operation_sequence_number ;
3133             l_other_token_tbl(2).token_name  := 'REVISED_ITEM_NAME';
3134             l_other_token_tbl(2).token_value :=
3135                           l_rev_operation_rec.revised_item_name ;
3136             RAISE EXC_UNEXP_SKIP_OBJECT;
3137          END IF;
3138 
3139          --
3140          -- Process Flow step 7: Check lineage
3141          --
3142          IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage'); END IF;
3143          IF l_rev_operation_rec.transaction_type IN
3144             (Bom_Rtg_Globals.G_OPR_UPDATE, Bom_Rtg_Globals.G_OPR_DELETE,
3145             Bom_Rtg_Globals.G_OPR_CANCEL)
3146          THEN
3147 
3148              BOM_Validate_Op_Seq.Check_Lineage
3149              ( p_routing_sequence_id       =>
3150                                    l_rev_op_unexp_rec.routing_sequence_id
3151              , p_operation_sequence_number =>
3152                                    l_rev_operation_rec.operation_sequence_number
3153              , p_effectivity_date          =>
3154                                    l_rev_operation_rec.start_effective_date
3155              , p_operation_type            =>
3156                                    l_rev_operation_rec.operation_type
3157              , p_revised_item_sequence_id  =>
3158                                    l_rev_op_unexp_rec.revised_item_sequence_id
3159              , x_mesg_token_tbl            => l_mesg_token_tbl
3160              , x_return_status             => l_return_status
3161              ) ;
3162 
3163              IF l_return_status = Error_Handler.G_STATUS_ERROR
3164              THEN
3165 
3166                   l_Token_Tbl(1).token_name  := 'OP_SEQ_NUMBER';
3167                   l_Token_Tbl(1).token_value :=
3168                                l_rev_operation_rec.operation_sequence_number ;
3169                   l_Token_Tbl(2).token_name  := 'REVISED_ITEM_NAME';
3170                   l_Token_Tbl(2).token_value :=
3171                                l_rev_operation_rec.revised_item_name ;
3172                   l_token_tbl(3).token_name  := 'ECO_NAME' ;
3173                   l_token_tbl(3).token_value := l_rev_operation_rec.eco_name ;
3174 
3175                   Error_Handler.Add_Error_Token
3176                   ( p_Message_Name   => 'BOM_OP_REV_ITEM_MISMATCH'
3177                   , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
3178                   , x_mesg_token_tbl => l_Mesg_Token_Tbl
3179                   , p_Token_Tbl      => l_Token_Tbl
3180                   ) ;
3181 
3182                   l_other_message := 'BOM_OP_LIN_SEV_SKIP';
3183                   l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3184                   l_other_token_tbl(1).token_value :=
3185                               l_rev_operation_rec.operation_sequence_number ;
3186                   RAISE EXC_SEV_QUIT_BRANCH;
3187 
3188              ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3189              THEN
3190                   l_other_message := 'BOM_OP_LIN_UNEXP_SKIP';
3191                   l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3192                   l_other_token_tbl(1).token_value :=
3193                               l_rev_operation_rec.operation_sequence_number ;
3194                   RAISE EXC_UNEXP_SKIP_OBJECT;
3195              END IF;
3196          END IF ;
3197 
3198          --
3199          -- Process Flow step 8: Is Operation Sequence record an orphan ?
3200          --
3201 
3202          IF NOT l_item_parent_exists
3203          THEN
3204 
3205 
3206                 --
3207                 -- Process Flow step 9(a and b): Is ECO impl/cancl, or in wkflw process ?
3208                 --
3209               IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('ECO Check access'); END IF;
3210                 ENG_Validate_ECO.Check_Access
3211                 ( p_change_notice       => l_rev_operation_rec.ECO_Name
3212                 , p_organization_id     => l_rev_op_unexp_rec.organization_id
3213                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
3214                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
3215                 , x_Return_Status       => l_return_status
3216                 );
3217 
3218                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
3219 
3220                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3221                 THEN
3222                         l_other_message := 'BOM_OP_ECOACC_FAT_FATAL';
3223                         l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3224                         l_other_token_tbl(1).token_value :=
3225                                         l_rev_operation_rec.operation_sequence_number ;
3226                         l_return_status := 'F';
3227                         RAISE EXC_FAT_QUIT_OBJECT;
3228                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3229                 THEN
3230                         l_other_message := 'BOM_OP_ECOACC_UNEXP_SKIP';
3231                         l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3232                         l_other_token_tbl(1).token_value :=
3233                                         l_rev_operation_rec.operation_sequence_number ;
3234                         RAISE EXC_UNEXP_SKIP_OBJECT;
3235                 END IF;
3236 
3237 
3238                 -- Process Flow step 10(a and b): check that user has access to revised item
3239                 --
3240 
3241                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Revised Item Check access'); END IF;
3242                 ENG_Validate_Revised_Item.Check_Access
3243                 (  p_change_notice      => l_rev_operation_rec.ECO_Name
3244                 ,  p_organization_id    => l_rev_op_unexp_rec.organization_id
3245                 ,  p_revised_item_id    => l_rev_op_unexp_rec.revised_item_id
3246                 ,  p_new_item_revision  => l_rev_operation_rec.new_revised_item_revision
3247                 ,  p_effectivity_date   => l_rev_operation_rec.start_effective_date
3248                 ,  p_new_routing_revsion   => l_rev_operation_rec.new_routing_revision  -- Added by MK on 11/02/00
3249                 ,  p_from_end_item_number  => l_rev_operation_rec.from_end_item_unit_number -- Added by MK on 11/02/00
3250                 ,  p_revised_item_name  => l_rev_operation_rec.revised_item_name
3251                 ,  p_entity_processed   => 'ROP'  -- Added by MK on 12/03 to resolve Eco dependency
3252                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
3253                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
3254                 ,  x_return_status      => l_Return_Status
3255                 );
3256 
3257                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
3258 
3259                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3260                 THEN
3261                         l_other_message := 'BOM_OP_RITACC_FAT_FATAL';
3262                         l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3263                         l_other_token_tbl(1).token_value :=
3264                                         l_rev_operation_rec.operation_sequence_number;
3265                         l_return_status := 'F';
3266                         RAISE EXC_FAT_QUIT_SIBLINGS;
3267                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3268                 THEN
3269                         l_other_message := 'BOM_OP_RITACC_UNEXP_SKIP';
3270                         l_other_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3271                         l_other_token_tbl(1).token_value :=
3272                                         l_rev_operation_rec.operation_sequence_number ;
3273                         RAISE EXC_UNEXP_SKIP_OBJECT;
3274                 END IF;
3275 
3276                 --
3277                 -- Process Flow step  : Check Assembly Item Operability for Operation
3278                 -- BOM_Validate_Op_Seq.Check_Access
3279                 --
3280                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Operation Check access'); END IF;
3281                 BOM_Validate_Op_Seq.Check_Access
3282                 (  p_change_notice     => l_rev_operation_rec.ECO_Name
3283                 ,  p_organization_id   => l_rev_op_unexp_rec.organization_id
3284                 ,  p_revised_item_id   => l_rev_op_unexp_rec.revised_item_id
3285                 ,  p_revised_item_name => l_rev_operation_rec.revised_item_name
3286                 ,  p_new_item_revision =>
3287                                   l_rev_operation_rec.new_revised_item_revision
3288                 ,  p_effectivity_date  =>
3289                                   l_rev_operation_rec.start_effective_date
3290                 ,  p_new_routing_revsion   => l_rev_operation_rec.new_routing_revision  -- Added by MK on 11/02/00
3291                 ,  p_from_end_item_number  => l_rev_operation_rec.from_end_item_unit_number -- Added by MK on 11/02/00
3292 
3293                 ,  p_operation_seq_num  =>
3294                                   l_rev_operation_rec.operation_sequence_number
3295                 ,  p_routing_sequence_id =>
3296                                   l_rev_op_unexp_rec.routing_sequence_id
3297                 ,  p_operation_type   =>
3298                                   l_rev_operation_rec.operation_type
3299                 ,  p_entity_processed => 'OP'
3300                 ,  p_resource_seq_num  => NULL
3301                 ,  p_sub_resource_code => NULL
3302                 ,  p_sub_group_num     => NULL
3303                 ,  p_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
3304                 ,  x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
3305                 ,  x_return_status     => l_Return_Status
3306                 );
3307 
3308                IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('In check access of operations, return_status: ' || l_return_status); END IF;
3309 
3310                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3311                 THEN
3312                    l_other_message := 'BOM_OP_ACCESS_FAT_FATAL';
3313                    l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3314                    l_other_token_tbl(1).token_value :=
3315                          l_rev_operation_rec.operation_sequence_number ;
3316                    l_return_status := 'F' ;
3317                    RAISE EXC_FAT_QUIT_SIBLINGS ; -- Check EXC_FAT_QUIT_OBJECT
3318                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3319                         THEN
3320                         l_other_message := 'BOM_OP_ACCESS_UNEXP_SKIP';
3321                         l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3322                         l_other_token_tbl(1).token_value :=
3323                               l_rev_operation_rec.operation_sequence_number ;
3324                         RAISE EXC_UNEXP_SKIP_OBJECT;
3325                 END IF;
3326 
3327 
3328                 --
3329                 -- Process Flow step 11 : Check the routing does not have a common
3330                 --
3331 
3332                 Bom_Validate_Op_Seq.Check_CommonRtg
3333                 (  p_routing_sequence_id  =>
3334                                         l_rev_op_unexp_rec.routing_sequence_id
3335                 ,  x_mesg_token_tbl       => l_mesg_token_tbl
3336                 ,  x_return_status        => l_return_status
3337                 ) ;
3338 
3339                 IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3340                 ('Check the routing non-referenced common completed with return_status: ' || l_return_status) ;
3341                 END IF ;
3342 
3343                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3344                 THEN
3345                         l_token_tbl(1).token_name  := 'OP_SEQ_NUMBER';
3346                         l_token_tbl(1).token_value :=
3347                                 l_rev_operation_rec.operation_sequence_number ;
3348                         l_token_tbl(2).token_name  := 'REVISED_ITEM_NAME';
3349                         l_token_tbl(2).token_value :=
3350                                 l_rev_operation_rec.revised_item_name ;
3351                         Error_Handler.Add_Error_Token
3352                         ( p_Message_Name   => 'BOM_OP_RTG_HAVECOMMON'
3353                         , p_mesg_token_tbl => l_mesg_token_tbl
3354                         , x_mesg_token_tbl => l_mesg_token_tbl
3355                         , p_Token_Tbl      => l_token_tbl
3356                         ) ;
3357 
3358                         l_return_status := 'F';
3359                         RAISE EXC_FAT_QUIT_SIBLINGS ; -- RAISE EXC_FAT_QUIT_BRANCH ;
3360 
3361                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3362                 THEN
3363                         l_other_message := 'BOM_OP_ACCESS_UNEXP_SKIP';
3364                         l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3365                         l_other_token_tbl(1).token_value :=
3366                            l_rev_operation_rec.operation_sequence_number ;
3367                         RAISE EXC_UNEXP_SKIP_OBJECT;
3368                 END IF;
3369 
3370          END IF ;  -- End of process for an orphan
3371 
3372 
3373          /* In future release If ECO for Flow Routing is supported,
3374             this step should be implemented.
3375 
3376          -- Process Flow Step  : Check parent CFM Routing Flag
3377          -- Validate Non-Operated Columns using CFM Routing Flag
3378          -- Standard Routing, Flow Routing, Lot Based Routing.
3379          -- If a non-operated column is not null, the procedure set it to null
3380          -- and occur Warning.
3381          --
3382          BOM_Validate_Op_Seq.Check_NonOperated_Attribute
3383          ( p_rev_operation_rec    => l_rev_operation_rec
3384          , p_rev_op_unexp_rec     => l_rev_op_unexp_rec
3385          , x_rev_operation_rec    => l_rev_operation_rec
3386          , x_rev_op_unexp_rec     => l_rev_op_unexp_rec
3387          , x_mesg_token_tbl       => l_mesg_token_tbl
3388          , x_return_status        => l_return_status
3389          ) ;
3390 
3391          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3392          ('Check non-operating columns completed with return_status: ' || l_return_status) ;
3393          END IF ;
3394 
3395          IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3396          THEN
3397             l_other_message := 'BOM_OP_NOPATTR_UNEXP_SKIP';
3398             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3399             l_other_token_tbl(1).token_value :=
3400                           l_rev_operation_rec.operation_sequence_number ;
3401             RAISE EXC_UNEXP_SKIP_OBJECT;
3402 
3403          ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <>0
3404          THEN
3405             ECO_Error_Handler.Log_Error
3406             (  p_rev_operation_tbl   => l_rev_operation_tbl
3407             ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl
3408             ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl
3409             ,  p_mesg_token_tbl      => l_mesg_token_tbl
3410             ,  p_error_status        => 'W'
3411             ,  p_error_level         => Error_Handler.G_OP_LEVEL
3412             ,  p_entity_index        => I
3413             ,  x_ECO_rec             => l_ECO_rec
3414             ,  x_eco_revision_tbl    => l_eco_revision_tbl
3415             ,  x_revised_item_tbl    => l_revised_item_tbl
3416             ,  x_rev_component_tbl   => l_rev_component_tbl
3417             ,  x_ref_designator_tbl  => l_ref_designator_tbl
3418             ,  x_sub_component_tbl   => l_sub_component_tbl
3419             ,  x_rev_operation_tbl   => l_rev_operation_tbl
3420             ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
3421             ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl
3422             ) ;
3423          END IF;
3424          */
3425 
3426 
3427          --
3428          -- Process Flow step 12: Value to Id conversions
3429          -- Call Rtg_Val_To_Id.Operation_VID
3430          --
3431          Bom_Rtg_Val_To_Id.Rev_Operation_VID
3432          (  p_rev_operation_rec          => l_rev_operation_rec
3433          ,  p_rev_op_unexp_rec           => l_rev_op_unexp_rec
3434          ,  x_rev_op_unexp_rec           => l_rev_op_unexp_rec
3435          ,  x_mesg_token_tbl             => l_mesg_token_tbl
3436          ,  x_return_status              => l_return_status
3437          );
3438 
3439          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3440          ('Value-id conversions completed with return_status: ' ||
3441                                                l_return_status) ;
3442          END IF ;
3443 
3444          IF l_return_status = Error_Handler.G_STATUS_ERROR
3445          THEN
3446             IF l_rev_operation_rec.transaction_type = 'CREATE'
3447             THEN
3448                l_other_message := 'BOM_OP_VID_CSEV_SKIP';
3449                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3450                l_other_token_tbl(1).token_value :=
3451                           l_rev_operation_rec.operation_sequence_number ;
3452                RAISE EXC_SEV_SKIP_BRANCH;
3453             ELSE
3454                RAISE EXC_SEV_QUIT_RECORD ;
3455             END IF ;
3456 
3457          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3458          THEN
3459             l_other_message := 'BOM_OP_VID_UNEXP_SKIP';
3460             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3461             l_other_token_tbl(1).token_value :=
3462                           l_rev_operation_rec.operation_sequence_number ;
3463             RAISE EXC_UNEXP_SKIP_OBJECT;
3464 
3465          ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <>0
3466          THEN
3467             ECO_Error_Handler.Log_Error
3468             (  p_rev_operation_tbl       => x_rev_operation_tbl
3469             ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
3470             ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
3471             ,  p_mesg_token_tbl      => l_mesg_token_tbl
3472             ,  p_error_status        => 'W'
3473             ,  p_error_level         => Error_Handler.G_OP_LEVEL
3474             ,  p_entity_index        => I
3475             ,  x_ECO_rec             => l_ECO_rec
3476             ,  x_eco_revision_tbl    => l_eco_revision_tbl
3477             ,  x_revised_item_tbl    => l_revised_item_tbl
3478             ,  x_rev_component_tbl   => l_rev_component_tbl
3479             ,  x_ref_designator_tbl  => l_ref_designator_tbl
3480             ,  x_sub_component_tbl   => l_sub_component_tbl
3481             ,  x_rev_operation_tbl   => x_rev_operation_tbl
3482             ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3483             ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3484             ) ;
3485          END IF;
3486 
3487          --
3488          -- Process Flow step 13 : Check required fields exist
3489          -- (also includes a part of conditionally required fields)
3490          --
3491 
3492          Bom_Validate_Op_Seq.Check_Required
3493          ( p_rev_operation_rec          => l_rev_operation_rec
3494          , x_return_status              => l_return_status
3495          , x_mesg_token_tbl             => l_mesg_token_tbl
3496          ) ;
3497 
3498 
3499          IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3500          ('Check required completed with return_status: ' || l_return_status) ;
3501          END IF ;
3502 
3503 
3504          IF l_return_status = Error_Handler.G_STATUS_ERROR
3505          THEN
3506             IF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3507             THEN
3508                l_other_message := 'BOM_OP_REQ_CSEV_SKIP';
3509                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3510                l_other_token_tbl(1).token_value :=
3511                           l_rev_operation_rec.operation_sequence_number ;
3512                RAISE EXC_SEV_SKIP_BRANCH ;
3513             ELSE
3514                RAISE EXC_SEV_QUIT_RECORD ;
3515             END IF;
3516          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3517          THEN
3518             l_other_message := 'BOM_OP_REQ_UNEXP_SKIP';
3519             l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3520             l_other_token_tbl(1).token_value :=
3521                           l_rev_operation_rec.operation_sequence_number ;
3522             RAISE EXC_UNEXP_SKIP_OBJECT ;
3523          END IF;
3524 
3525 
3526          --
3527          -- Process Flow step 14 : Attribute Validation for CREATE and UPDATE
3528          --
3529          --
3530          IF l_rev_operation_rec.transaction_type IN
3531             (Bom_Rtg_Globals.G_OPR_CREATE, Bom_Rtg_Globals.G_OPR_UPDATE)
3532          THEN
3533             Bom_Validate_Op_Seq.Check_Attributes
3534             ( p_rev_operation_rec => l_rev_operation_rec
3535             , p_rev_op_unexp_rec  => l_rev_op_unexp_rec
3536             , x_return_status     => l_return_status
3537             , x_mesg_token_tbl    => l_mesg_token_tbl
3538             ) ;
3539 
3540             IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3541             ('Attribute validation completed with return_status: ' || l_return_status) ;
3542             END IF ;
3543 
3544             IF l_return_status = Error_Handler.G_STATUS_ERROR
3545             THEN
3546                IF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3547                THEN
3548                   l_other_message := 'BOM_OP_ATTVAL_CSEV_SKIP';
3549                   l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3550                   l_other_token_tbl(1).token_value :=
3551                            l_rev_operation_rec.operation_sequence_number ;
3552                   RAISE EXC_SEV_SKIP_BRANCH ;
3553                   ELSE
3554                      RAISE EXC_SEV_QUIT_RECORD ;
3555                END IF;
3556             ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3557             THEN
3558                l_other_message := 'BOM_OP_ATTVAL_UNEXP_SKIP';
3559                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3560                l_other_token_tbl(1).token_value :=
3561                            l_rev_operation_rec.operation_sequence_number ;
3562                RAISE EXC_UNEXP_SKIP_OBJECT ;
3563             ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
3564             THEN
3565                ECO_Error_Handler.Log_Error
3566                (  p_rev_operation_tbl   => x_rev_operation_tbl
3567                ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3568                ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3569                ,  p_mesg_token_tbl      => l_mesg_token_tbl
3570                ,  p_error_status        => 'W'
3571                ,  p_error_level         => Error_Handler.G_OP_LEVEL
3572                ,  p_entity_index        => I
3573                ,  x_ECO_rec             => l_ECO_rec
3574                ,  x_eco_revision_tbl    => l_eco_revision_tbl
3575                ,  x_revised_item_tbl    => l_revised_item_tbl
3576                ,  x_rev_component_tbl   => l_rev_component_tbl
3577                ,  x_ref_designator_tbl  => l_ref_designator_tbl
3578                ,  x_sub_component_tbl   => l_sub_component_tbl
3579                ,  x_rev_operation_tbl   => x_rev_operation_tbl
3580                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3581                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3582                ) ;
3583            END IF;
3584         END IF;
3585 
3586         --
3587         -- Process flow step: Query the operation record using by Old Op Seq Num
3588         -- and Old Effectivity Date Call Bom_Op_Seq_Util.Query_Row
3589         --
3590 
3591         IF (l_rev_operation_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
3592             AND l_rev_operation_rec.acd_type IN (2 ,3)    ) -- ACD Type: Change or Disable
3593         THEN
3594 
3595             IF l_rev_operation_rec.old_operation_sequence_number IS NULL OR
3596                l_rev_operation_rec.old_operation_sequence_number = FND_API.G_MISS_NUM
3597             THEN
3598                l_rev_operation_rec.old_operation_sequence_number
3599                    := l_rev_operation_rec.operation_sequence_number ;
3600             END IF ;
3601 
3602             Bom_Op_Seq_Util.Query_Row
3603             ( p_operation_sequence_number =>
3604                               l_rev_operation_rec.old_operation_sequence_number
3605             , p_effectivity_date          =>
3606                               l_rev_operation_rec.old_start_effective_date
3607             , p_routing_sequence_id       =>
3608                               l_rev_op_unexp_rec.routing_sequence_id
3609             , p_operation_type            => l_rev_operation_rec.operation_type
3610             , p_mesg_token_tbl            => l_mesg_token_tbl
3611             , x_rev_operation_rec         => l_old_rev_operation_rec
3612             , x_rev_op_unexp_rec          => l_old_rev_op_unexp_rec
3613             , x_mesg_token_tbl            => l_mesg_token_tbl
3614             , x_return_status             => l_return_status
3615             ) ;
3616 
3617             IF l_return_status <> Eng_Globals.G_RECORD_FOUND
3618             THEN
3619                   l_return_status := Error_Handler.G_STATUS_ERROR ;
3620                   l_Token_Tbl(1).token_name := 'OP_SEQ_NUMBER';
3621                   l_Token_Tbl(1).token_value :=
3622                            l_rev_operation_rec.operation_sequence_number ;
3623 
3624                   Error_Handler.Add_Error_Token
3625                   ( p_message_name       => 'BOM_OP_CREATE_REC_NOT_FOUND'
3626                   , p_mesg_token_tbl     => l_Mesg_Token_Tbl
3627                   , p_token_tbl          => l_Token_Tbl
3628                   , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
3629                   );
3630 
3631                   l_other_message := 'BOM_OP_QRY_CSEV_SKIP';
3632                   l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3633                   l_other_token_tbl(1).token_value :=
3634                            l_rev_operation_rec.operation_sequence_number ;
3635                   RAISE EXC_SEV_SKIP_BRANCH;
3636            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3637            THEN
3638                     l_other_message := 'BOM_OP_QRY_UNEXP_SKIP';
3639                     l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3640                     l_other_token_tbl(1).token_value :=
3641                            l_rev_operation_rec.operation_sequence_number ;
3642                    RAISE EXC_UNEXP_SKIP_OBJECT;
3643           END IF;
3644         END IF;
3645 
3646 
3647         IF (l_rev_operation_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
3648            AND l_rev_operation_rec.acd_type IN ( 2,3 ) ) -- ACD Type : Change or Disable
3649         OR
3650            l_rev_operation_rec.transaction_type IN (ENG_GLOBALS.G_OPR_UPDATE ,
3651                                                     ENG_GLOBALS.G_OPR_DELETE ,
3652                                                     ENG_GLOBALS.G_OPR_CANCEL)
3653         THEN
3654 
3655         --
3656         -- Process flow step 15: Populate NULL columns for Update and Delete
3657         -- and Creates with ACD_Type 'Add'.
3658         -- Call Bom_Default_Op_Seq.Populate_Null_Columns
3659         --
3660 
3661            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populate NULL columns') ;
3662            END IF ;
3663 
3664 
3665            Bom_Default_Op_Seq.Populate_Null_Columns
3666            (   p_rev_operation_rec     => l_rev_operation_rec
3667            ,   p_old_rev_operation_Rec => l_old_rev_operation_rec
3668            ,   p_rev_op_unexp_rec      => l_rev_op_unexp_rec
3669            ,   p_old_rev_op_unexp_rec  => l_old_rev_op_unexp_rec
3670            ,   x_rev_operation_rec     => l_rev_operation_rec
3671            ,   x_rev_op_unexp_rec      => l_rev_op_unexp_rec
3672            ) ;
3673 
3674 
3675         ELSIF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3676               AND l_rev_operation_rec.acd_type <> 2  -- ACD Type : Not Change
3677         THEN
3678         --
3679         -- Process Flow step 16 : Default missing values for Operation (CREATE)
3680         -- (also includes Entity Defaulting)
3681         -- Call Bom_Default_Op_Seq.Attribute_Defaulting
3682         --
3683 
3684            Bom_Default_Op_Seq.Attribute_Defaulting
3685            (   p_rev_operation_rec   => l_rev_operation_rec
3686            ,   p_rev_op_unexp_rec    => l_rev_op_unexp_rec
3687            ,   p_control_rec         => Bom_Rtg_Pub.G_Default_Control_Rec
3688            ,   x_rev_operation_rec   => l_rev_operation_rec
3689            ,   x_rev_op_unexp_rec    => l_rev_op_unexp_rec
3690            ,   x_mesg_token_tbl      => l_mesg_token_tbl
3691            ,   x_return_status       => l_return_status
3692            ) ;
3693 
3694            IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3695            ('Attribute Defaulting completed with return_status: ' || l_return_status) ;
3696            END IF ;
3697 
3698 
3699            IF l_return_status = Error_Handler.G_STATUS_ERROR
3700            THEN
3701               l_other_message := 'BOM_OP_ATTDEF_CSEV_SKIP';
3702               l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3703               l_other_token_tbl(1).token_value :=
3704                           l_rev_operation_rec.operation_sequence_number ;
3705               RAISE EXC_SEV_SKIP_BRANCH ;
3706 
3707            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3708            THEN
3709               l_other_message := 'BOM_OP_ATTDEF_UNEXP_SKIP';
3710               l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3711               l_other_token_tbl(1).token_value :=
3712                            l_rev_operation_rec.operation_sequence_number ;
3713               RAISE EXC_UNEXP_SKIP_OBJECT ;
3714            ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
3715            THEN
3716                ECO_Error_Handler.Log_Error
3717                (  p_rev_operation_tbl   => x_rev_operation_tbl
3718                ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3719                ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3720                ,  p_mesg_token_tbl      => l_mesg_token_tbl
3721                ,  p_error_status        => 'W'
3722                ,  p_error_level         => Error_Handler.G_OP_LEVEL
3723                ,  p_entity_index        => I
3724                ,  x_ECO_rec             => l_ECO_rec
3725                ,  x_eco_revision_tbl    => l_eco_revision_tbl
3726                ,  x_revised_item_tbl    => l_revised_item_tbl
3727                ,  x_rev_component_tbl   => l_rev_component_tbl
3728                ,  x_ref_designator_tbl  => l_ref_designator_tbl
3729                ,  x_sub_component_tbl   => l_sub_component_tbl
3730                ,  x_rev_operation_tbl   => x_rev_operation_tbl
3731                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3732                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3733               ) ;
3734           END IF;
3735        END IF;
3736 
3737 
3738        --
3739        -- Process Flow step 17: Conditionally Required Attributes
3740        --
3741        --
3742        IF l_rev_operation_rec.transaction_type IN ( Bom_Rtg_Globals.G_OPR_CREATE
3743                                                   , Bom_Rtg_Globals.G_OPR_UPDATE )
3744        THEN
3745           Bom_Validate_Op_Seq.Check_Conditionally_Required
3746           ( p_rev_operation_rec          => l_rev_operation_rec
3747           , p_rev_op_unexp_rec           => l_rev_op_unexp_rec
3748           , x_return_status              => l_return_status
3749           , x_mesg_token_tbl             => l_mesg_token_tbl
3750           ) ;
3751 
3752           IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3753           ('Check Conditionally Required Attr. completed with return_status: ' || l_return_status) ;
3754           END IF ;
3755 
3756           IF l_return_status = Error_Handler.G_STATUS_ERROR
3757           THEN
3758              IF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3759              THEN
3760                 l_other_message := 'BOM_OP_CONREQ_CSEV_SKIP';
3761                 l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3762                 l_other_token_tbl(1).token_value :=
3763                           l_rev_operation_rec.operation_sequence_number ;
3764                 RAISE EXC_SEV_SKIP_BRANCH ;
3765              ELSE
3766                 RAISE EXC_SEV_QUIT_RECORD ;
3767              END IF;
3768           ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3769           THEN
3770              l_other_message := 'BOM_OP_CONREQ_UNEXP_SKIP';
3771              l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3772              l_other_token_tbl(1).token_value :=
3773                           l_rev_operation_rec.operation_sequence_number ;
3774              RAISE EXC_UNEXP_SKIP_OBJECT ;
3775           ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
3776           THEN
3777              ECO_Error_Handler.Log_Error
3778              (  p_rev_operation_tbl   => x_rev_operation_tbl
3779              ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3780              ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3781              ,  p_mesg_token_tbl      => l_mesg_token_tbl
3782              ,  p_error_status        => 'W'
3783              ,  p_error_level         => Error_Handler.G_OP_LEVEL
3784              ,  p_entity_index        => I
3785              ,  x_ECO_rec             => l_ECO_rec
3786              ,  x_eco_revision_tbl    => l_eco_revision_tbl
3787              ,  x_revised_item_tbl    => l_revised_item_tbl
3788              ,  x_rev_component_tbl   => l_rev_component_tbl
3789              ,  x_ref_designator_tbl  => l_ref_designator_tbl
3790              ,  x_sub_component_tbl   => l_sub_component_tbl
3791              ,  x_rev_operation_tbl   => x_rev_operation_tbl
3792              ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3793              ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3794              ) ;
3795           END IF;
3796        END IF;
3797 
3798 
3799        --
3800        -- Process Flow step 18: Entity defaulting for CREATE and UPDATE
3801        -- Merged into Process Flow step 13 : Default missing values
3802        --
3803 
3804        IF l_rev_operation_rec.transaction_type IN ( Bom_Rtg_Globals.G_OPR_CREATE
3805                                                   , Bom_Rtg_Globals.G_OPR_UPDATE )
3806        THEN
3807           Bom_Default_Op_Seq.Entity_Defaulting
3808               (   p_rev_operation_rec   => l_rev_operation_rec
3809               ,   p_rev_op_unexp_rec    => l_rev_op_unexp_rec
3810               ,   p_control_rec         => Bom_Rtg_Pub.G_Default_Control_Rec
3811               ,   x_rev_operation_rec   => l_rev_operation_rec
3812               ,   x_rev_op_unexp_rec    => l_rev_op_unexp_rec
3813               ,   x_mesg_token_tbl  => l_mesg_token_tbl
3814               ,   x_return_status   => l_return_status
3815               ) ;
3816 
3817           IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3818           ('Entity defaulting completed with return_status: ' || l_return_status) ;
3819           END IF ;
3820 
3821           IF l_return_status = Error_Handler.G_STATUS_ERROR
3822           THEN
3823              IF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3824              THEN
3825                 l_other_message := 'BOM_OP_ENTDEF_CSEV_SKIP';
3826                 l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3827                 l_other_token_tbl(1).token_value :=
3828                           l_rev_operation_rec.operation_sequence_number ;
3829                 RAISE EXC_SEV_SKIP_BRANCH ;
3830              ELSE
3831                 RAISE EXC_SEV_QUIT_RECORD ;
3832              END IF;
3833           ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3834           THEN
3835              l_other_message := 'BOM_OP_ENTDEF_UNEXP_SKIP';
3836              l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3837              l_other_token_tbl(1).token_value :=
3838                           l_rev_operation_rec.operation_sequence_number ;
3839              RAISE EXC_UNEXP_SKIP_OBJECT ;
3840           ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
3841           THEN
3842              ECO_Error_Handler.Log_Error
3843              (  p_rev_operation_tbl   => x_rev_operation_tbl
3844              ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3845              ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3846              ,  p_mesg_token_tbl      => l_mesg_token_tbl
3847              ,  p_error_status        => 'W'
3848              ,  p_error_level         => Error_Handler.G_OP_LEVEL
3849              ,  p_entity_index        => I
3850              ,  x_ECO_rec             => l_ECO_rec
3851              ,  x_eco_revision_tbl    => l_eco_revision_tbl
3852              ,  x_revised_item_tbl    => l_revised_item_tbl
3853              ,  x_rev_component_tbl   => l_rev_component_tbl
3854              ,  x_ref_designator_tbl  => l_ref_designator_tbl
3855              ,  x_sub_component_tbl   => l_sub_component_tbl
3856              ,  x_rev_operation_tbl   => x_rev_operation_tbl
3857              ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3858              ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3859              ) ;
3860           END IF ;
3861        END IF ;
3862 
3863 
3864        --
3865        -- Process Flow step 19 - Entity Level Validation
3866        -- Call Bom_Validate_Op_Seq.Check_Entity
3867        --
3868 
3869        IF Bom_Rtg_Globals.Get_Debug = 'Y'
3870        THEN Error_Handler.Write_Debug('Starting with Revised Operatin Entity Validation . . . ') ;
3871        END IF ;
3872 
3873           Bom_Validate_Op_Seq.Check_Entity
3874           (  p_rev_operation_rec     => l_rev_operation_rec
3875           ,  p_rev_op_unexp_rec      => l_rev_op_unexp_rec
3876           ,  p_old_rev_operation_rec => l_old_rev_operation_rec
3877           ,  p_old_rev_op_unexp_rec  => l_old_rev_op_unexp_rec
3878           ,  p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
3879           ,  x_rev_operation_rec     => l_rev_operation_rec
3880           ,  x_rev_op_unexp_rec      => l_rev_op_unexp_rec
3881           ,  x_mesg_token_tbl        => l_mesg_token_tbl
3882           ,  x_return_status         => l_return_status
3883           ) ;
3884 
3885 
3886        IF l_return_status = Error_Handler.G_STATUS_ERROR
3887        THEN
3888           IF l_rev_operation_rec.transaction_type = Bom_Rtg_Globals.G_OPR_CREATE
3889           THEN
3890              l_other_message := 'BOM_OP_ENTVAL_CSEV_SKIP';
3891              l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3892              l_other_token_tbl(1).token_value :=
3893                            l_rev_operation_rec.operation_sequence_number ;
3894              RAISE EXC_SEV_SKIP_BRANCH ;
3895           ELSE
3896              RAISE EXC_SEV_QUIT_RECORD ;
3897           END IF;
3898        ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3899        THEN
3900           l_other_message := 'BOM_OP_ENTVAL_UNEXP_SKIP';
3901           l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3902           l_other_token_tbl(1).token_value :=
3903                         l_rev_operation_rec.operation_sequence_number ;
3904           RAISE EXC_UNEXP_SKIP_OBJECT ;
3905        ELSIF l_return_status ='S' AND l_mesg_token_tbl .COUNT <> 0
3906        THEN
3907           ECO_Error_Handler.Log_Error
3908           (  p_rev_operation_tbl   => x_rev_operation_tbl
3909           ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3910           ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3911           ,  p_mesg_token_tbl      => l_mesg_token_tbl
3912           ,  p_error_status        => 'W'
3913           ,  p_error_level         => Error_Handler.G_OP_LEVEL
3914           ,  p_entity_index        => I
3915           ,  x_ECO_rec             => l_ECO_rec
3916           ,  x_eco_revision_tbl    => l_eco_revision_tbl
3917           ,  x_revised_item_tbl    => l_revised_item_tbl
3918           ,  x_rev_component_tbl   => l_rev_component_tbl
3919           ,  x_ref_designator_tbl  => l_ref_designator_tbl
3920           ,  x_sub_component_tbl   => l_sub_component_tbl
3921           ,  x_rev_operation_tbl   => x_rev_operation_tbl
3922           ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3923           ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3924           ) ;
3925        END IF;
3926 
3927        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation completed with '
3928              || l_return_Status || ' proceeding for database writes . . . ') ;
3929        END IF;
3930 
3931        --
3932        -- Process Flow step 20 : Database Writes
3933        --
3934        IF l_rev_operation_rec.transaction_type = BOM_Rtg_Globals.G_OPR_CANCEL
3935        THEN
3936 
3937 IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3938 ('Operatin Sequence: Perform Cancel Operation . . .') ;
3939 END IF ;
3940 
3941            ENG_Globals.Cancel_Operation
3942            ( p_operation_sequence_id  => l_rev_op_unexp_rec.operation_sequence_id
3943            , p_cancel_comments        => l_rev_operation_rec.cancel_comments
3944            , p_op_seq_num             => l_rev_operation_rec.operation_sequence_number
3945            , p_user_id                => BOM_Rtg_Globals.Get_User_Id
3946            , p_login_id               => BOM_Rtg_Globals.Get_Login_Id
3947            , p_prog_id                => BOM_Rtg_Globals.Get_Prog_Id
3948            , p_prog_appid             => BOM_Rtg_Globals.Get_Prog_AppId
3949            , x_return_status          => l_return_status
3950            , x_mesg_token_tbl         => l_mesg_token_tbl
3951            ) ;
3952 
3953 IF BOM_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
3954 ('Cancel Operation is completed with return status ' || l_return_status ) ;
3955 END IF ;
3956 
3957        ELSE
3958            ENG_Globals.Perform_Writes_For_Primary_Rtg
3959               (   p_rev_operation_rec       => l_rev_operation_rec
3960               ,   p_rev_op_unexp_rec        => l_rev_op_unexp_rec
3961               ,   x_mesg_token_tbl          => l_mesg_token_tbl
3962               ,   x_return_status           => l_return_status
3963               ) ;
3964 
3965            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3966            THEN
3967                l_other_message := 'BOM_OP_WRITES_UNEXP_SKIP';
3968                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
3969                l_other_token_tbl(1).token_value :=
3970                           l_rev_operation_rec.operation_sequence_number ;
3971                RAISE EXC_UNEXP_SKIP_OBJECT ;
3972            ELSIF l_return_status ='S' AND
3973                l_mesg_token_tbl .COUNT <>0
3974            THEN
3975                ECO_Error_Handler.Log_Error
3976                (  p_rev_operation_tbl   => x_rev_operation_tbl
3977                ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
3978                ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3979                ,  p_mesg_token_tbl      => l_mesg_token_tbl
3980                ,  p_error_status        => 'W'
3981                ,  p_error_level         => Error_Handler.G_OP_LEVEL
3982                ,  p_entity_index        => I
3983                ,  x_ECO_rec             => l_ECO_rec
3984                ,  x_eco_revision_tbl    => l_eco_revision_tbl
3985                ,  x_revised_item_tbl    => l_revised_item_tbl
3986                ,  x_rev_component_tbl   => l_rev_component_tbl
3987                ,  x_ref_designator_tbl  => l_ref_designator_tbl
3988                ,  x_sub_component_tbl   => l_sub_component_tbl
3989                ,  x_rev_operation_tbl   => x_rev_operation_tbl
3990                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
3991                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
3992                ) ;
3993            END IF;
3994 
3995            Bom_Op_Seq_Util.Perform_Writes
3996               (   p_rev_operation_rec       => l_rev_operation_rec
3997               ,   p_rev_op_unexp_rec        => l_rev_op_unexp_rec
3998               ,   p_control_rec             => Bom_Rtg_Pub.G_Default_Control_Rec
3999               ,   x_mesg_token_tbl          => l_mesg_token_tbl
4000               ,   x_return_status           => l_return_status
4001               ) ;
4002 
4003            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4004            THEN
4005                l_other_message := 'BOM_OP_WRITES_UNEXP_SKIP';
4006                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
4007                l_other_token_tbl(1).token_value :=
4008                           l_rev_operation_rec.operation_sequence_number ;
4009                RAISE EXC_UNEXP_SKIP_OBJECT ;
4010            ELSIF l_return_status ='S' AND
4011                l_mesg_token_tbl .COUNT <>0
4012            THEN
4013                ECO_Error_Handler.Log_Error
4014                (  p_rev_operation_tbl   => x_rev_operation_tbl
4015                ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl
4016                ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
4017                ,  p_mesg_token_tbl      => l_mesg_token_tbl
4018                ,  p_error_status        => 'W'
4019                ,  p_error_level         => Error_Handler.G_OP_LEVEL
4020                ,  p_entity_index        => I
4021                ,  x_ECO_rec             => l_ECO_rec
4022                ,  x_eco_revision_tbl    => l_eco_revision_tbl
4023                ,  x_revised_item_tbl    => l_revised_item_tbl
4024                ,  x_rev_component_tbl   => l_rev_component_tbl
4025                ,  x_ref_designator_tbl  => l_ref_designator_tbl
4026                ,  x_sub_component_tbl   => l_sub_component_tbl
4027                ,  x_rev_operation_tbl   => x_rev_operation_tbl
4028                ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl
4029                ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl
4030                ) ;
4031            END IF;
4032 
4033        END IF ;
4034 
4035 
4036        IF Bom_Rtg_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Database writes completed with status  ' || l_return_status);
4037        END IF;
4038 
4039      /*Bug 6485168. l_process_children should be set inside the if clause. In the else set it to false
4040      END IF; -- END IF statement that checks RETURN STATUS
4041      */
4042     --  Load tables.
4043     x_rev_operation_tbl(I)          := l_rev_operation_rec;
4044 
4045     -- Indicate that children need to be processed
4046     l_process_children := TRUE;
4047 
4048      ELSE
4049 
4050      l_process_children := FALSE;
4051 
4052     END IF; -- END IF statement that checks RETURN STATUS
4053 
4054     --  For loop exception handler.
4055 
4056     EXCEPTION
4057        WHEN EXC_SEV_QUIT_RECORD THEN
4058           ECO_Error_Handler.Log_Error
4059           (  p_rev_operation_tbl       => x_rev_operation_tbl
4060           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4061           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4062           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4063           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4064           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4065           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4066           ,  p_entity_index            => I
4067           ,  x_eco_rec                 => l_eco_rec
4068           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4069           ,  x_revised_item_tbl        => l_revised_item_tbl
4070           ,  x_rev_component_tbl       => l_rev_component_tbl
4071           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4072           ,  x_sub_component_tbl       => l_sub_component_tbl
4073           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4074           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4075           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4076           ) ;
4077 
4078          l_process_children := TRUE;
4079 
4080          IF l_bo_return_status = 'S'
4081          THEN
4082             l_bo_return_status := l_return_status;
4083          END IF;
4084 
4085          x_return_status           := l_bo_return_status;
4086          x_mesg_token_tbl          := l_mesg_token_tbl ;
4087 
4088          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4089          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4090          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4091 
4092 
4093       WHEN EXC_SEV_QUIT_BRANCH THEN
4094 
4095           ECO_Error_Handler.Log_Error
4096           (  p_rev_operation_tbl       => x_rev_operation_tbl
4097           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4098           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4099           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4100           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4101           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4102           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4103           ,  p_entity_index            => I
4104           ,  x_eco_rec                 => l_eco_rec
4105           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4106           ,  x_revised_item_tbl        => l_revised_item_tbl
4107           ,  x_rev_component_tbl       => l_rev_component_tbl
4108           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4109           ,  x_sub_component_tbl       => l_sub_component_tbl
4110           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4111           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4112           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4113           );
4114 
4115          l_process_children := FALSE;
4116 
4117          IF l_bo_return_status = 'S'
4118          THEN
4119             l_bo_return_status  := l_return_status;
4120          END IF;
4121 
4122          x_return_status           := l_bo_return_status;
4123          x_mesg_token_tbl          := l_mesg_token_tbl ;
4124 
4125          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4126          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4127          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4128 
4129 
4130       WHEN EXC_SEV_SKIP_BRANCH THEN
4131           ECO_Error_Handler.Log_Error
4132           (  p_rev_operation_tbl       => x_rev_operation_tbl
4133           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4134           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4135           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4136           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4137           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4138           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4139           ,  p_entity_index            => I
4140           ,  x_eco_rec                 => l_eco_rec
4141           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4142           ,  x_revised_item_tbl        => l_revised_item_tbl
4143           ,  x_rev_component_tbl       => l_rev_component_tbl
4144           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4145           ,  x_sub_component_tbl       => l_sub_component_tbl
4146           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4147           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4148           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4149           ) ;
4150 
4151         l_process_children    := FALSE ;
4152         IF l_bo_return_status = 'S'
4153         THEN
4154            l_bo_return_status := l_return_status ;
4155         END IF;
4156 
4157          x_return_status           := l_bo_return_status;
4158          x_mesg_token_tbl          := l_mesg_token_tbl ;
4159 
4160          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4161          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4162          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4163 
4164 
4165       WHEN EXC_SEV_QUIT_SIBLINGS THEN
4166           ECO_Error_Handler.Log_Error
4167           (  p_rev_operation_tbl       => x_rev_operation_tbl
4168           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4169           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4170           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4171           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4172           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4173           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4174           ,  p_entity_index            => I
4175           ,  x_eco_rec                 => l_eco_rec
4176           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4177           ,  x_revised_item_tbl        => l_revised_item_tbl
4178           ,  x_rev_component_tbl       => l_rev_component_tbl
4179           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4180           ,  x_sub_component_tbl       => l_sub_component_tbl
4181           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4182           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4183           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4184           ) ;
4185 
4186 
4187          l_process_children    := FALSE ;
4188          IF l_bo_return_status = 'S'
4189          THEN
4190            l_bo_return_status  := l_return_status ;
4191          END IF;
4192 
4193          x_return_status           := l_bo_return_status;
4194          x_mesg_token_tbl          := l_mesg_token_tbl ;
4195 
4196          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4197          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4198          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4199 
4200 
4201 
4202       WHEN EXC_FAT_QUIT_BRANCH THEN
4203           ECO_Error_Handler.Log_Error
4204           (  p_rev_operation_tbl       => x_rev_operation_tbl
4205           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4206           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4207           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4208           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4209           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4210           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4211           ,  p_entity_index            => I
4212           ,  x_eco_rec                 => l_eco_rec
4213           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4214           ,  x_revised_item_tbl        => l_revised_item_tbl
4215           ,  x_rev_component_tbl       => l_rev_component_tbl
4216           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4217           ,  x_sub_component_tbl       => l_sub_component_tbl
4218           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4219           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4220           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4221           ) ;
4222 
4223          l_process_children    := FALSE ;
4224          x_return_status       := Error_Handler.G_STATUS_FATAL;
4225          x_mesg_token_tbl      := l_mesg_token_tbl ;
4226 
4227          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4228          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4229          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4230 
4231 
4232 
4233       WHEN EXC_FAT_QUIT_SIBLINGS THEN
4234           ECO_Error_Handler.Log_Error
4235           (  p_rev_operation_tbl       => x_rev_operation_tbl
4236           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4237           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4238           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4239           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4240           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4241           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4242           ,  p_entity_index            => I
4243           ,  x_eco_rec                 => l_eco_rec
4244           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4245           ,  x_revised_item_tbl        => l_revised_item_tbl
4246           ,  x_rev_component_tbl       => l_rev_component_tbl
4247           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4248           ,  x_sub_component_tbl       => l_sub_component_tbl
4249           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4250           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4251           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4252           ) ;
4253 
4254 
4255         l_process_children    := FALSE ;
4256         x_return_status       := Error_Handler.G_STATUS_FATAL;
4257         x_mesg_token_tbl      := l_mesg_token_tbl ;
4258 
4259         --x_rev_operation_tbl       := l_rev_operation_tbl ;
4260         --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4261         --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4262 
4263 
4264     WHEN EXC_FAT_QUIT_OBJECT THEN
4265           ECO_Error_Handler.Log_Error
4266           (  p_rev_operation_tbl       => x_rev_operation_tbl
4267           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4268           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4269           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4270           ,  p_error_status            => FND_API.G_RET_STS_ERROR
4271           ,  p_error_scope             => Error_Handler.G_SCOPE_RECORD
4272           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4273           ,  p_entity_index            => I
4274           ,  x_eco_rec                 => l_eco_rec
4275           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4276           ,  x_revised_item_tbl        => l_revised_item_tbl
4277           ,  x_rev_component_tbl       => l_rev_component_tbl
4278           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4279           ,  x_sub_component_tbl       => l_sub_component_tbl
4280           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4281           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4282           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4283           ) ;
4284 
4285          l_return_status       := 'Q';
4286          x_mesg_token_tbl      := l_mesg_token_tbl ;
4287 
4288          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4289          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4290          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4291 
4292 
4293       WHEN EXC_UNEXP_SKIP_OBJECT THEN
4294           ECO_Error_Handler.Log_Error
4295           (  p_rev_operation_tbl       => x_rev_operation_tbl
4296           ,  p_rev_op_resource_tbl     => x_rev_op_resource_tbl
4297           ,  p_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4298           ,  p_mesg_token_tbl          => l_mesg_token_tbl
4299           ,  p_error_status            => Error_Handler.G_STATUS_UNEXPECTED
4300           ,  p_error_level             => Error_Handler.G_OP_LEVEL
4301           ,  p_entity_index            => I
4302           ,  p_other_status            => Error_Handler.G_STATUS_NOT_PICKED
4303           ,  p_other_message           => l_other_message
4304           ,  p_other_token_tbl         => l_other_token_tbl
4305           ,  x_eco_rec                 => l_eco_rec
4306           ,  x_eco_revision_tbl        => l_eco_revision_tbl
4307           ,  x_revised_item_tbl        => l_revised_item_tbl
4308           ,  x_rev_component_tbl       => l_rev_component_tbl
4309           ,  x_ref_designator_tbl      => l_ref_designator_tbl
4310           ,  x_sub_component_tbl       => l_sub_component_tbl
4311           ,  x_rev_operation_tbl       => x_rev_operation_tbl
4312           ,  x_rev_op_resource_tbl     => x_rev_op_resource_tbl
4313           ,  x_rev_sub_resource_tbl    => x_rev_sub_resource_tbl
4314           ) ;
4315          l_return_status       := 'U';
4316          x_mesg_token_tbl      := l_mesg_token_tbl ;
4317 
4318          --x_rev_operation_tbl       := l_rev_operation_tbl ;
4319          --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4320          --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4321 
4322    END ; -- END block
4323 
4324 
4325    IF l_return_status in ('Q', 'U')
4326    THEN
4327       x_return_status := l_return_status;
4328       RETURN ;
4329    END IF;
4330 
4331    IF l_process_children
4332    THEN
4333       -- Process Operation Resources that are direct children of this
4334       -- Operation
4335       Rev_Operation_Resources
4336       (   p_validation_level         => p_validation_level
4337       ,   p_change_notice            => l_rev_operation_rec.eco_name
4338       ,   p_organization_id          =>
4339                        l_rev_op_unexp_rec.organization_id
4340       ,   p_revised_item_name        =>
4341                        l_rev_operation_rec.revised_item_name
4342     --  ,   p_alternate_routing_code   =>
4343     --                   l_rev_operation_rec.alternate_routing_code
4344       ,   p_operation_seq_num        =>
4345                        l_rev_operation_rec.operation_sequence_number
4346       ,   p_item_revision            =>
4347                        l_rev_operation_rec.new_revised_item_revision
4348       ,   p_effectivity_date         =>
4349                        l_rev_operation_rec.start_effective_date
4350       ,   p_routing_revision         =>
4351                        l_rev_operation_rec.new_routing_revision   -- Added by MK on 11/02/00
4352       ,   p_from_end_item_number     =>
4353                        l_rev_operation_rec.from_end_item_unit_number -- Added by MK on 11/02/0
4354       ,   p_operation_type           =>
4355                        l_rev_operation_rec.operation_type
4356       ,   p_rev_op_resource_tbl      => x_rev_op_resource_tbl
4357       ,   p_rev_sub_resource_tbl     => x_rev_sub_resource_tbl
4358       ,   x_rev_op_resource_tbl      => x_rev_op_resource_tbl
4359       ,   x_rev_sub_resource_tbl     => x_rev_sub_resource_tbl
4360       ,   x_mesg_token_tbl           => l_mesg_token_tbl
4361       ,   x_return_status            => l_return_status
4362       ) ;
4363 
4364       -- Process Substitute Operation Resources that are direct children of this
4365       -- operation
4366 
4367      Rev_Sub_Operation_Resources
4368       (   p_validation_level         => p_validation_level
4369       ,   p_change_notice            => l_rev_operation_rec.eco_name
4370       ,   p_organization_id          =>
4371                        l_rev_op_unexp_rec.organization_id
4372       ,   p_revised_item_name        =>
4373                        l_rev_operation_rec.revised_item_name
4374      -- ,   p_alternate_routing_code   =>
4375      --                  l_rev_operation_rec.alternate_routing_code
4376       ,   p_operation_seq_num        =>
4377                        l_rev_operation_rec.operation_sequence_number
4378       ,   p_item_revision            =>
4379                        l_rev_operation_rec.new_revised_item_revision
4380       ,   p_effectivity_date         =>
4381                        l_rev_operation_rec.start_effective_date
4382       ,   p_routing_revision         =>
4383                        l_rev_operation_rec.new_routing_revision   -- Added by MK on 11/02/00
4384       ,   p_from_end_item_number     =>
4385                        l_rev_operation_rec.from_end_item_unit_number -- Added by MK on 11/02/00
4386       ,   p_operation_type           => l_rev_operation_rec.operation_type
4387       ,   p_rev_sub_resource_tbl         => x_rev_sub_resource_tbl
4388       ,   x_rev_sub_resource_tbl         => x_rev_sub_resource_tbl
4389       ,   x_mesg_token_tbl           => l_mesg_token_tbl
4390       ,   x_return_status            => l_return_status
4391       ) ;
4392 
4393 
4394     END IF;   -- Process children
4395    END IF;
4396    END LOOP; -- END Operation Sequences processing loop
4397 
4398    --  Load OUT parameters
4399    IF NVL(l_return_status, 'S') <> 'S'
4400    THEN
4401       x_return_status     := l_return_status;
4402    END IF;
4403 
4404    x_mesg_token_tbl          := l_mesg_token_tbl ;
4405    --x_rev_operation_tbl       := l_rev_operation_tbl ;
4406    --x_rev_op_resource_tbl     := l_rev_op_resource_tbl ;
4407    --x_rev_sub_resource_tbl    := l_rev_sub_resource_tbl ;
4408 
4409 END Rev_Operation_Sequences ;
4410 
4411 
4412 --  L1:  The above part is for ECO enhancement
4413 
4414 
4415 --  Sub_Comps
4416 
4417 PROCEDURE Sub_Comps
4418 (   p_validation_level              IN  NUMBER
4419 ,   p_change_notice                 IN  VARCHAR2 := NULL
4420 ,   p_organization_id               IN  NUMBER := NULL
4421 ,   p_revised_item_name             IN  VARCHAR2 := NULL
4422 ,   p_alternate_bom_code            IN  VARCHAR2 := NULL  -- Bug 3991176
4423 ,   p_effectivity_date              IN  DATE := NULL
4424 ,   p_item_revision                 IN  VARCHAR2 := NULL
4425 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
4426 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
4427 ,   p_component_item_name           IN  VARCHAR2 := NULL
4428 ,   p_operation_seq_num             IN  NUMBER := NULL
4429 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
4430 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
4431 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
4432 ,   x_return_status                 OUT NOCOPY VARCHAR2
4433 )
4434 IS
4435 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
4436 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
4437 l_other_message         VARCHAR2(2000);
4438 l_err_text              VARCHAR2(2000);
4439 l_valid                 BOOLEAN := TRUE;
4440 l_item_parent_exists    BOOLEAN := FALSE;
4441 l_comp_parent_exists    BOOLEAN := FALSE;
4442 l_Return_Status         VARCHAR2(1);
4443 l_bo_return_status      VARCHAR2(1);
4444 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
4445 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
4446 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
4447 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
4448 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type;
4449 l_sub_component_rec     BOM_BO_PUB.Sub_Component_Rec_Type;
4450 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
4451 l_old_sub_component_rec BOM_BO_PUB.Sub_Component_Rec_Type;
4452 l_sub_comp_unexp_rec    BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type;
4453 l_old_sub_comp_unexp_rec BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type;
4454 l_return_value          NUMBER;
4455 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
4456 
4457 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type;
4458 l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;
4459 l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;
4460 
4461 
4462 EXC_SEV_QUIT_RECORD     EXCEPTION;
4463 EXC_SEV_QUIT_BRANCH     EXCEPTION;
4464 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
4465 EXC_FAT_QUIT_OBJECT     EXCEPTION;
4466 EXC_FAT_QUIT_SIBLINGS   EXCEPTION;
4467 EXC_FAT_QUIT_BRANCH     EXCEPTION;
4468 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
4469 
4470 BEGIN
4471 
4472     l_return_status := 'S';
4473     l_bo_return_status := 'S';
4474 
4475     l_comp_parent_exists := FALSE;
4476     l_item_parent_exists := FALSE;
4477 
4478     --  Init local table variables.
4479 
4480     x_sub_component_tbl            := p_sub_component_tbl;
4481 
4482     l_sub_comp_unexp_rec.organization_id := ENG_GLOBALS.Get_org_id;
4483 
4484     FOR I IN 1..x_sub_component_tbl.COUNT LOOP
4485 
4486     IF (x_sub_component_tbl(I).return_status IS NULL OR
4487             x_sub_component_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
4488 
4489     BEGIN
4490 
4491         --  Load local records.
4492 
4493         l_sub_component_rec := x_sub_component_tbl(I);
4494 
4495         l_sub_component_rec.transaction_type :=
4496                 UPPER(l_sub_component_rec.transaction_type);
4497 
4498         IF p_component_item_name IS NOT NULL AND
4499            p_operation_seq_num IS NOT NULL AND
4500            p_revised_item_name IS NOT NULL AND
4501            p_effectivity_date IS NOT NULL AND
4502            p_change_notice IS NOT NULL AND
4503            p_organization_id IS NOT NULL
4504         THEN
4505                 -- revised comp parent exists
4506 
4507                 l_comp_parent_exists := TRUE;
4508         ELSIF p_revised_item_name IS NOT NULL AND
4509            p_effectivity_date IS NOT NULL AND
4510            --p_item_revision IS NOT NULL    AND   (Commented for bug 3766816 - Forward porting for bug 3747487)
4511            p_change_notice IS NOT NULL AND
4512            p_organization_id IS NOT NULL
4513         THEN
4514                 -- revised item parent exists
4515 
4516                 l_item_parent_exists := TRUE;
4517         END IF;
4518 
4519         -- Process Flow Step 2: Check if record has not yet been processed and
4520         -- that it is the child of the parent that called this procedure
4521         --
4522 
4523         IF --(l_sub_component_rec.return_status IS NULL OR
4524             --l_sub_component_rec.return_status = FND_API.G_MISS_CHAR)
4525            --AND
4526 
4527            -- Did Rev_Comps call this procedure, that is,
4528            -- if revised comp exists, then is this record a child ?
4529 
4530            ((l_comp_parent_exists AND
4531                (l_sub_component_rec.ECO_Name = p_change_notice AND
4532                 l_sub_comp_unexp_rec.organization_id = p_organization_id AND
4533                 l_sub_component_rec.start_effective_date = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND  -- Bug 6657209
4534                 NVL(l_sub_component_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
4535                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR ) AND
4536                 l_sub_component_rec.revised_item_name = p_revised_item_name AND
4537                 NVL(l_sub_component_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND -- Bug 3991176
4538                 NVL(l_sub_component_rec.new_routing_revision, FND_API.G_MISS_CHAR )
4539                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR )     AND -- Added by MK on 11/02/00
4540                 NVL(l_sub_component_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
4541                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
4542                 l_sub_component_rec.component_item_name = p_component_item_name AND
4543                 l_sub_component_rec.operation_sequence_number = p_operation_seq_num))
4544 
4545             OR
4546 
4547             -- Did Rev_Items call this procedure, that is,
4548             -- if revised item exists, then is this record a child ?
4549 
4550             (l_item_parent_exists AND
4551                (l_sub_component_rec.ECO_Name = p_change_notice AND
4552                 l_sub_comp_unexp_rec.organization_id = p_organization_id AND
4553                 l_sub_component_rec.revised_item_name = p_revised_item_name AND
4554                 NVL(l_sub_component_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND -- Bug 3991176
4555                 l_sub_component_rec.start_effective_date = p_effectivity_date AND
4556                 NVL(l_sub_component_rec.new_routing_revision, FND_API.G_MISS_CHAR )
4557                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR )     AND -- Added by MK on 11/02/00
4558                 NVL(l_sub_component_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
4559                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/0
4560                 NVL(l_sub_component_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
4561                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR ) ))
4562 
4563              OR
4564 
4565              (NOT l_comp_parent_exists AND
4566               NOT l_item_parent_exists))
4567         THEN
4568 
4569            l_return_status := FND_API.G_RET_STS_SUCCESS;
4570 
4571            l_sub_component_rec.return_status := FND_API.G_RET_STS_SUCCESS;
4572 
4573            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing substitite component: ' || l_sub_component_rec.substitute_component_name); END IF;
4574 
4575            -- Bug 6657209
4576            IF (l_comp_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null) THEN
4577               l_sub_component_rec.start_effective_date := p_effectivity_date;
4578            END IF;
4579 
4580            -- Check if transaction_type is valid
4581            --
4582 
4583            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
4584            ENG_GLOBALS.Transaction_Type_Validity
4585            (   p_transaction_type       => l_sub_component_rec.transaction_type
4586            ,   p_entity                 => 'Sub_Comps'
4587            ,   p_entity_id              => l_sub_component_rec.revised_item_name
4588            ,   x_valid                  => l_valid
4589            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
4590            );
4591 
4592            IF NOT l_valid
4593            THEN
4594                 l_return_status := Error_Handler.G_STATUS_ERROR;
4595                 RAISE EXC_SEV_QUIT_RECORD;
4596            END IF;
4597 
4598            -- Process Flow step 4(a): Convert user unique index to unique index I
4599            --
4600 
4601            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index I'); END IF;
4602            Bom_Val_To_Id.Sub_Component_UUI_To_UI
4603                 ( p_sub_component_rec  => l_sub_component_rec
4604                 , p_sub_comp_unexp_rec => l_sub_comp_unexp_rec
4605                 , x_sub_comp_unexp_rec => l_sub_comp_unexp_rec
4606                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4607                 , x_Return_Status      => l_return_status
4608                 );
4609 
4610            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4611 
4612            IF l_return_status = Error_Handler.G_STATUS_ERROR
4613            THEN
4614                 RAISE EXC_SEV_QUIT_RECORD;
4615            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4616            THEN
4617                 l_other_message := 'BOM_SBC_UUI_UNEXP_SKIP';
4618                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4619                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4620                 RAISE EXC_UNEXP_SKIP_OBJECT;
4621            END IF;
4622 
4623            -- Process Flow step 4(b): Convert user unique index to unique index II
4624            --
4625 
4626 
4627            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index II'); END IF;
4628            Bom_Val_To_Id.Sub_Component_UUI_To_UI2
4629                 ( p_sub_component_rec  => l_sub_component_rec
4630                 , p_sub_comp_unexp_rec => l_sub_comp_unexp_rec
4631                 , x_sub_comp_unexp_rec => l_sub_comp_unexp_rec
4632                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4633                 , x_other_message      => l_other_message
4634                 , x_other_token_tbl    => l_other_token_tbl
4635                 , x_Return_Status      => l_return_status
4636                 );
4637 
4638            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4639 
4640            IF l_return_status = Error_Handler.G_STATUS_ERROR
4641            THEN
4642                 RAISE EXC_SEV_QUIT_SIBLINGS;
4643            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4644            THEN
4645                 l_other_message := 'BOM_SBC_UUI_UNEXP_SKIP';
4646                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4647                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4648                 RAISE EXC_UNEXP_SKIP_OBJECT;
4649            END IF;
4650 
4651            IF Bom_Globals.Get_Debug = 'Y' THEN
4652                Error_Handler.Write_Debug('Converting user unique index to unique index II for Bill and Rev Item Seq Id');
4653            END IF;
4654            -- Added by MK on 12/03/00 to resolve ECO dependency
4655            ENG_Val_To_Id.BillAndRevitem_UUI_To_UI
4656            ( p_revised_item_name        => l_sub_component_rec.revised_item_name
4657            , p_alternate_bom_code       => l_sub_component_rec.alternate_bom_code -- Bug 3991176
4658            , p_revised_item_id          => l_sub_comp_unexp_rec.revised_item_id
4659            , p_item_revision            => l_sub_component_rec.new_revised_item_revision
4660            , p_effective_date           => l_sub_component_rec.start_effective_date
4661            , p_change_notice            => l_sub_component_rec.eco_name
4662            , p_organization_id          => l_sub_comp_unexp_rec.organization_id
4663            , p_new_routing_revision     => l_sub_component_rec.new_routing_revision
4664            , p_from_end_item_number     => l_sub_component_rec.from_end_item_unit_number
4665            , p_entity_processed         => 'SBC'
4666            , p_component_item_name      => l_sub_component_rec.component_item_name
4667            , p_component_item_id        => l_sub_comp_unexp_rec.component_item_id
4668            , p_operation_sequence_number => l_sub_component_rec.operation_sequence_number
4669            , p_rfd_sbc_name             => l_sub_component_rec.substitute_component_name
4670            , p_transaction_type         => l_sub_component_rec.transaction_type
4671            , x_revised_item_sequence_id => l_sub_comp_unexp_rec.revised_item_sequence_id
4672            , x_bill_sequence_id         => l_sub_comp_unexp_rec.bill_sequence_id
4673            , x_component_sequence_id    => l_sub_comp_unexp_rec.component_sequence_id
4674            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
4675            , x_other_message            => l_other_message
4676            , x_other_token_tbl          => l_other_token_tbl
4677            , x_Return_Status            => l_return_status
4678           ) ;
4679 
4680            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4681 
4682            IF l_return_status = Error_Handler.G_STATUS_ERROR
4683            THEN
4684                 RAISE EXC_SEV_QUIT_SIBLINGS;
4685            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4686            THEN
4687                 l_other_message := 'BOM_SBC_UUI_UNEXP_SKIP';
4688                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4689                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4690                 RAISE EXC_UNEXP_SKIP_OBJECT;
4691            END IF;
4692 
4693 
4694 
4695 
4696            -- Process Flow step 5: Verify Substitute Component's existence
4697            --
4698 
4699            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
4700            Bom_Validate_Sub_Component.Check_Existence
4701                 (  p_sub_component_rec          => l_sub_component_rec
4702                 ,  p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
4703                 ,  x_old_sub_component_rec      => l_old_sub_component_rec
4704                 ,  x_old_sub_comp_unexp_rec     => l_old_sub_comp_unexp_rec
4705                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
4706                 ,  x_return_status              => l_Return_Status
4707                 );
4708 
4709            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4710 
4711            IF l_return_status = Error_Handler.G_STATUS_ERROR
4712            THEN
4713                 RAISE EXC_SEV_QUIT_RECORD;
4714            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4715            THEN
4716                 l_other_message := 'BOM_SBC_EXS_UNEXP_SKIP';
4717                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4718                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4719                 l_other_token_tbl(2).token_name := 'REVISED_COMPONENT_NAME';
4720                 l_other_token_tbl(2).token_value := l_sub_component_rec.component_item_name;
4721                 RAISE EXC_UNEXP_SKIP_OBJECT;
4722            END IF;
4723 
4724            -- Process Flow step 7: Is Subsitute Component record an orphan ?
4725 
4726            IF NOT l_comp_parent_exists
4727            THEN
4728 
4729                 -- Process Flow step 6: Check lineage
4730                 --
4731 
4732                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');     END IF;
4733                 Bom_Validate_Sub_Component.Check_Lineage
4734                 (  p_sub_component_rec          => l_sub_component_rec
4735                 ,  p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
4736                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
4737                 ,  x_return_status              => l_Return_Status
4738                 );
4739 
4740                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4741 
4742                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4743                 THEN
4744                         RAISE EXC_SEV_QUIT_BRANCH;
4745                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4746                 THEN
4747                         l_other_message := 'BOM_SBC_LIN_UNEXP_SKIP';
4748                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4749                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4750                         RAISE EXC_UNEXP_SKIP_OBJECT;
4751                 END IF;
4752 
4753                 -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
4754                 --
4755 
4756                 ENG_Validate_ECO.Check_Access
4757                 (  p_change_notice      => l_sub_component_rec.ECO_Name
4758                 ,  p_organization_id    => l_sub_comp_unexp_rec.organization_id
4759                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
4760                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
4761                 , x_Return_Status       => l_return_status
4762                 );
4763 
4764                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4765 
4766                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4767                 THEN
4768                         l_other_message := 'BOM_SBC_ECOACC_FAT_FATAL';
4769                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4770                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4771                         l_return_status := 'F';
4772                         RAISE EXC_FAT_QUIT_OBJECT;
4773                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4774                 THEN
4775                         l_other_message := 'BOM_SBC_ECOACC_UNEXP_SKIP';
4776                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4777                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4778                         RAISE EXC_UNEXP_SKIP_OBJECT;
4779                 END IF;
4780 
4781                 -- Process Flow step 9(a and b): check that user has access to revised item
4782                 --
4783 
4784                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
4785                 ENG_Validate_Revised_Item.Check_Access
4786                 (  p_change_notice      => l_sub_component_rec.ECO_Name
4787                 ,  p_organization_id    => l_sub_comp_unexp_rec.organization_id
4788                 ,  p_revised_item_id    => l_sub_comp_unexp_rec.revised_item_id
4789                 ,  p_new_item_revision  => l_sub_component_rec.new_revised_item_revision
4790                 ,  p_effectivity_date   => l_sub_component_rec.start_effective_date
4791                 ,  p_new_routing_revsion   => l_sub_component_rec.new_routing_revision  -- Added by MK on 11/02/00
4792                 ,  p_from_end_item_number  => l_sub_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
4793                 ,  p_revised_item_name  => l_sub_component_rec.revised_item_name
4794                 ,  p_entity_processed   => 'SBC' -- Bug 4210718
4795                 ,  p_alternate_bom_code => l_sub_component_rec.alternate_bom_code -- Bug 4210718
4796                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4797                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4798                 ,  x_return_status      => l_Return_Status
4799                 );
4800 
4801                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4802 
4803                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4804                 THEN
4805                         l_other_message := 'BOM_SBC_RITACC_FAT_FATAL';
4806                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4807                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4808                         l_return_status := 'F';
4809                         RAISE EXC_FAT_QUIT_SIBLINGS;
4810                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4811                 THEN
4812                         l_other_message := 'BOM_SBC_RITACC_UNEXP_SKIP';
4813                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4814                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4815                         RAISE EXC_UNEXP_SKIP_OBJECT;
4816                 END IF;
4817 
4818                 -- Process Flow step 10: check that user has access to revised component
4819                 --
4820 
4821                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
4822                 Bom_Validate_Bom_Component.Check_Access
4823                 (  p_change_notice      => l_sub_component_rec.ECO_Name
4824                 ,  p_organization_id    => l_sub_comp_unexp_rec.organization_id
4825                 ,  p_revised_item_id    => l_sub_comp_unexp_rec.revised_item_id
4826                 ,  p_new_item_revision  => l_sub_component_rec.new_revised_item_revision
4827                 ,  p_effectivity_date   => l_sub_component_rec.start_effective_date
4828                 ,  p_new_routing_revsion  => l_sub_component_rec.new_routing_revision -- Added by MK on 11/02/00
4829                 ,  p_from_end_item_number => l_sub_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
4830                 ,  p_revised_item_name  => l_sub_component_rec.revised_item_name
4831                 ,  p_component_item_id  => l_sub_comp_unexp_rec.component_item_id
4832                 ,  p_operation_seq_num  => l_sub_component_rec.operation_sequence_number
4833                 ,  p_bill_sequence_id   => l_sub_comp_unexp_rec.bill_sequence_id
4834                 ,  p_component_name     => l_sub_component_rec.component_item_name
4835                 ,  p_entity_processed   => 'SBC'
4836                 ,  p_rfd_sbc_name       => l_sub_component_rec.substitute_component_name
4837                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4838                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4839                 ,  x_return_status      => l_Return_Status
4840                 );
4841 
4842                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4843 
4844                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4845                 THEN
4846                         l_other_message := 'BOM_SBC_CMPACC_FAT_FATAL';
4847                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4848                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4849                         l_other_token_tbl(2).token_name := 'REVISED_COMPONENT_NAME';
4850                         l_other_token_tbl(2).token_value := l_sub_component_rec.component_item_name;
4851                         l_return_status := 'F';
4852                         RAISE EXC_FAT_QUIT_SIBLINGS;
4853                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4854                 THEN
4855                         l_other_message := 'BOM_SBC_CMPACC_UNEXP_SKIP';
4856                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4857                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4858                         l_other_token_tbl(2).token_name := 'REVISED_COMPONENT_NAME';
4859                         l_other_token_tbl(2).token_value := l_sub_component_rec.component_item_name;
4860                         RAISE EXC_UNEXP_SKIP_OBJECT;
4861                 END IF;
4862 
4863                 -- Process Flow step 11: does user have access to substitute component ?
4864                 --
4865 
4866                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
4867                 Bom_Validate_Sub_Component.Check_Access
4868                 (  p_sub_component_rec => l_sub_component_rec
4869                 ,  p_sub_comp_unexp_rec => l_sub_comp_unexp_rec
4870                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
4871                 ,  x_return_status      => l_Return_Status
4872                 );
4873 
4874                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4875 
4876                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4877                 THEN
4878                         l_other_message := 'BOM_SBC_ACCESS_FAT_FATAL';
4879                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4880                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4881                         l_return_status := 'F';
4882                         RAISE EXC_FAT_QUIT_BRANCH;
4883                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4884                 THEN
4885                         l_other_message := 'BOM_SBC_ACCESS_UNEXP_SKIP';
4886                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4887                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4888                         RAISE EXC_UNEXP_SKIP_OBJECT;
4889                 END IF;
4890 
4891            END IF;
4892 
4893            -- Process Flow step 12: Attribute Validation for CREATE and UPDATE
4894            --
4895 
4896            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
4897            IF l_sub_component_rec.Transaction_Type IN
4898                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
4899            THEN
4900                 Bom_Validate_Sub_Component.Check_Attributes
4901                 ( x_return_status              => l_return_status
4902                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
4903                 , p_sub_component_rec          => l_sub_component_rec
4904                 , p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
4905                 );
4906 
4907                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4908 
4909                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4910                 THEN
4911                    RAISE EXC_SEV_QUIT_RECORD;
4912                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4913                 THEN
4914                    l_other_message := 'BOM_SBC_ATTVAL_UNEXP_SKIP';
4915                    l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4916                    l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4917                    RAISE EXC_UNEXP_SKIP_OBJECT;
4918                 ELSIF l_return_status = 'S' AND
4919                       x_Mesg_Token_Tbl.COUNT <>0
4920                 THEN
4921                    Eco_Error_Handler.Log_Error
4922                         (  p_sub_component_tbl  => x_sub_component_tbl
4923                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
4924                         ,  p_error_status       => 'W'
4925                         ,  p_error_level        => 6
4926                         ,  p_entity_index       => I
4927                         ,  x_eco_rec            => l_eco_rec
4928                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
4929                         ,  x_revised_item_tbl   => l_revised_item_tbl
4930                         ,  x_rev_component_tbl  => l_rev_component_tbl
4931                         ,  x_ref_designator_tbl => l_ref_designator_tbl
4932                         ,  x_sub_component_tbl  => x_sub_component_tbl
4933                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
4934                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
4935                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
4936                         );
4937                 END IF;
4938            END IF;
4939 
4940            IF l_sub_component_rec.Transaction_Type IN
4941                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
4942            THEN
4943 
4944                 -- Process flow step 13 - Populate NULL columns for Update and
4945                 -- Delete.
4946 
4947                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
4948                 Bom_Default_Sub_Component.Populate_NULL_Columns
4949                 (   p_sub_component_rec         => l_sub_component_rec
4950                 ,   p_old_sub_component_rec     => l_old_sub_component_rec
4951                 ,   p_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
4952                 ,   p_old_sub_comp_unexp_rec    => l_old_sub_comp_unexp_rec
4953                 ,   x_sub_component_rec         => l_sub_component_rec
4954                 ,   x_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
4955                 );
4956 
4957            ELSIF l_sub_component_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
4958 
4959                 -- Process Flow step 14: Default missing values for Operation CREATE
4960                 --
4961 
4962                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
4963                 Bom_Default_Sub_Component.Attribute_Defaulting
4964                 (   p_sub_component_rec         => l_sub_component_rec
4965                 ,   p_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
4966                 ,   x_sub_component_rec         => l_sub_component_rec
4967                 ,   x_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
4968                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4969                 ,   x_return_status             => l_return_status
4970                 );
4971 
4972                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
4973 
4974                 IF l_return_status = Error_Handler.G_STATUS_ERROR
4975                 THEN
4976                         RAISE EXC_SEV_QUIT_RECORD;
4977                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
4978                 THEN
4979                         l_other_message := 'BOM_SBC_ATTDEF_UNEXP_SKIP';
4980                         l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
4981                         l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
4982                         RAISE EXC_UNEXP_SKIP_OBJECT;
4983                 ELSIF l_return_status ='S' AND
4984                         l_Mesg_Token_Tbl.COUNT <>0
4985                 THEN
4986                         Eco_Error_Handler.Log_Error
4987                         (  p_sub_component_tbl   => x_sub_component_tbl
4988                         ,  p_mesg_token_tbl      => l_mesg_token_tbl
4989                         ,  p_error_status        => 'W'
4990                         ,  p_error_level         => 6
4991                         ,  p_entity_index        => I
4992                         ,  x_eco_rec             => l_eco_rec
4993                         ,  x_eco_revision_tbl    => l_eco_revision_tbl
4994                         ,  x_revised_item_tbl    => l_revised_item_tbl
4995                         ,  x_rev_component_tbl   => l_rev_component_tbl
4996                         ,  x_ref_designator_tbl  => l_ref_designator_tbl
4997                         ,  x_sub_component_tbl   => x_sub_component_tbl
4998                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
4999                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5000                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5001                         );
5002                 END IF;
5003            END IF;
5004 
5005            -- Process Flow step 15 - Entity Level Validation
5006            --
5007 
5008            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
5009            Bom_Validate_Sub_Component.Check_Entity
5010                 (  p_sub_component_rec          => l_sub_component_rec
5011                 ,  p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
5012                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
5013                 ,  x_return_status              => l_Return_Status
5014                 );
5015 
5016            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5017 
5018            IF l_return_status = Error_Handler.G_STATUS_ERROR
5019            THEN
5020                 RAISE EXC_SEV_QUIT_RECORD;
5021            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5022            THEN
5023                 l_other_message := 'BOM_SBC_ENTVAL_UNEXP_SKIP';
5024                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
5025                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
5026                 RAISE EXC_UNEXP_SKIP_OBJECT;
5027            ELSIF l_return_status ='S' AND
5028                 l_Mesg_Token_Tbl.COUNT <>0
5029            THEN
5030                 Eco_Error_Handler.Log_Error
5031                 (  p_sub_component_tbl   => x_sub_component_tbl
5032                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
5033                 ,  p_error_status        => 'W'
5034                 ,  p_error_level         => 6
5035                 ,  p_entity_index        => I
5036                 ,  x_eco_rec             => l_eco_rec
5037                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
5038                 ,  x_revised_item_tbl    => l_revised_item_tbl
5039                 ,  x_rev_component_tbl   => l_rev_component_tbl
5040                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
5041                 ,  x_sub_component_tbl   => x_sub_component_tbl
5042                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5043                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5044                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5045                 );
5046            END IF;
5047 
5048            -- Process Flow step 16 : Database Writes
5049            --
5050 
5051            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
5052            Bom_Sub_Component_Util.Perform_Writes
5053                 (   p_sub_component_rec         => l_sub_component_rec
5054                 ,   p_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
5055                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
5056                 ,   x_return_status             => l_return_status
5057                 );
5058 
5059            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5060 
5061            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5062            THEN
5063                 l_other_message := 'BOM_SBC_WRITES_UNEXP_SKIP';
5064                 l_other_token_tbl(1).token_name := 'SUBSTITUTE_ITEM_NAME';
5065                 l_other_token_tbl(1).token_value := l_sub_component_rec.substitute_component_name;
5066                 RAISE EXC_UNEXP_SKIP_OBJECT;
5067            ELSIF l_return_status ='S' AND
5068               l_Mesg_Token_Tbl.COUNT <>0
5069            THEN
5070                 Eco_Error_Handler.Log_Error
5071                 (  p_sub_component_tbl   => x_sub_component_tbl
5072                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
5073                 ,  p_error_status        => 'W'
5074                 ,  p_error_level         => 6
5075                 ,  p_entity_index        => I
5076                 ,  x_eco_rec             => l_eco_rec
5077                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
5078                 ,  x_revised_item_tbl    => l_revised_item_tbl
5079                 ,  x_rev_component_tbl   => l_rev_component_tbl
5080                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
5081                 ,  x_sub_component_tbl   => x_sub_component_tbl
5082                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5083                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5084                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5085                 );
5086            END IF;
5087 
5088         END IF; -- END IF statement that checks RETURN STATUS
5089 
5090         --  Load tables.
5091 
5092         x_sub_component_tbl(I)          := l_sub_component_rec;
5093 
5094     --  For loop exception handler.
5095 
5096 
5097     EXCEPTION
5098 
5099        WHEN EXC_SEV_QUIT_RECORD THEN
5100 
5101         Eco_Error_Handler.Log_Error
5102                 (  p_sub_component_tbl   => x_sub_component_tbl
5103                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
5104                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
5105                 ,  p_error_scope         => Error_Handler.G_SCOPE_RECORD
5106                 ,  p_error_level         => 6
5107                 ,  p_entity_index        => I
5108                 ,  x_eco_rec             => l_eco_rec
5109                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
5110                 ,  x_revised_item_tbl    => l_revised_item_tbl
5111                 ,  x_rev_component_tbl   => l_rev_component_tbl
5112                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
5113                 ,  x_sub_component_tbl   => x_sub_component_tbl
5114                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
5115                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
5116                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
5117                 );
5118 
5119         IF l_bo_return_status = 'S'
5120         THEN
5121                 l_bo_return_status     := l_return_status;
5122         END IF;
5123         x_return_status                := l_bo_return_status;
5124         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5125         --x_sub_component_tbl            := l_sub_component_tbl;
5126 
5127        WHEN EXC_SEV_QUIT_BRANCH THEN
5128 
5129         Eco_Error_Handler.Log_Error
5130                 (  p_sub_component_tbl  => x_sub_component_tbl
5131                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5132                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
5133                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
5134                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
5135                 ,  p_other_message      => l_other_message
5136                 ,  p_other_token_tbl    => l_other_token_tbl
5137                 ,  p_error_level        => 6
5138                 ,  p_entity_index       => I
5139                 ,  x_eco_rec            => l_eco_rec
5140                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5141                 ,  x_revised_item_tbl   => l_revised_item_tbl
5142                 ,  x_rev_component_tbl  => l_rev_component_tbl
5143                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5144                 ,  x_sub_component_tbl  => x_sub_component_tbl
5145                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5146                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5147                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5148                 );
5149 
5150         IF l_bo_return_status = 'S'
5151         THEN
5152                 l_bo_return_status     := l_return_status;
5153         END IF;
5154         x_return_status                := l_bo_return_status;
5155         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5156         --x_sub_component_tbl            := l_sub_component_tbl;
5157 
5158        WHEN EXC_SEV_QUIT_SIBLINGS THEN
5159 
5160         Eco_Error_Handler.Log_Error
5161                 (  p_sub_component_tbl  => x_sub_component_tbl
5162                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5163                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
5164                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
5165                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
5166                 ,  p_other_message      => l_other_message
5167                 ,  p_other_token_tbl    => l_other_token_tbl
5168                 ,  p_error_level        => 6
5169                 ,  p_entity_index       => I
5170                 ,  x_eco_rec            => l_eco_rec
5171                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5172                 ,  x_revised_item_tbl   => l_revised_item_tbl
5173                 ,  x_rev_component_tbl  => l_rev_component_tbl
5174                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5175                 ,  x_sub_component_tbl  => x_sub_component_tbl
5176                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5177                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5178                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5179                 );
5180 
5181         IF l_bo_return_status = 'S'
5182         THEN
5183                 l_bo_return_status     := l_return_status;
5184         END IF;
5185         x_return_status                := l_bo_return_status;
5186         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5187         --x_sub_component_tbl            := l_sub_component_tbl;
5188 
5189         RETURN;
5190 
5191        WHEN EXC_FAT_QUIT_SIBLINGS THEN
5192 
5193         Eco_Error_Handler.Log_Error
5194                 (  p_sub_component_tbl  => x_sub_component_tbl
5195                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5196                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
5197                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
5198                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
5199                 ,  p_other_message      => l_other_message
5200                 ,  p_other_token_tbl    => l_other_token_tbl
5201                 ,  p_error_level        => 6
5202                 ,  p_entity_index       => I
5203                 ,  x_eco_rec            => l_eco_rec
5204                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5205                 ,  x_revised_item_tbl   => l_revised_item_tbl
5206                 ,  x_rev_component_tbl  => l_rev_component_tbl
5207                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5208                 ,  x_sub_component_tbl  => x_sub_component_tbl
5209                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5210                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5211                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5212                 );
5213 
5214         x_return_status                := Error_Handler.G_STATUS_FATAL;
5215         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5216         --x_sub_component_tbl            := l_sub_component_tbl;
5217 
5218         RETURN;
5219 
5220        WHEN EXC_FAT_QUIT_BRANCH THEN
5221 
5222         Eco_Error_Handler.Log_Error
5223                 (  p_sub_component_tbl  => x_sub_component_tbl
5224                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5225                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
5226                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
5227                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
5228                 ,  p_other_message      => l_other_message
5229                 ,  p_other_token_tbl    => l_other_token_tbl
5230                 ,  p_error_level        => 6
5231                 ,  p_entity_index       => I
5232                 ,  x_eco_rec            => l_eco_rec
5233                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5234                 ,  x_revised_item_tbl   => l_revised_item_tbl
5235                 ,  x_rev_component_tbl  => l_rev_component_tbl
5236                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5237                 ,  x_sub_component_tbl  => x_sub_component_tbl
5238                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5239                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5240                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5241                 );
5242 
5243         x_return_status                := Error_Handler.G_STATUS_FATAL;
5244         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5245         --x_sub_component_tbl            := l_sub_component_tbl;
5246 
5247        WHEN EXC_FAT_QUIT_OBJECT THEN
5248 
5249         Eco_Error_Handler.Log_Error
5250                 (  p_sub_component_tbl  => x_sub_component_tbl
5251                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5252                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
5253                 ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
5254                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
5255                 ,  p_other_message      => l_other_message
5256                 ,  p_other_token_tbl    => l_other_token_tbl
5257                 ,  p_error_level        => 6
5258                 ,  p_entity_index       => I
5259                 ,  x_eco_rec            => l_eco_rec
5260                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5261                 ,  x_revised_item_tbl   => l_revised_item_tbl
5262                 ,  x_rev_component_tbl  => l_rev_component_tbl
5263                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5264                 ,  x_sub_component_tbl  => x_sub_component_tbl
5265                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5266                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5267                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5268                 );
5269 
5270         x_return_status                := Error_Handler.G_STATUS_FATAL;
5271         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5272         --x_sub_component_tbl            := l_sub_component_tbl;
5273 
5274         l_return_status := 'Q';
5275 
5276        WHEN EXC_UNEXP_SKIP_OBJECT THEN
5277 
5278         Eco_Error_Handler.Log_Error
5279                 (  p_sub_component_tbl  => x_sub_component_tbl
5280                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5281                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
5282                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
5283                 ,  p_other_message      => l_other_message
5284                 ,  p_other_token_tbl    => l_other_token_tbl
5285                 ,  p_error_level        => 6
5286                 ,  x_ECO_rec            => l_ECO_rec
5287                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5288                 ,  x_revised_item_tbl   => l_revised_item_tbl
5289                 ,  x_rev_component_tbl  => l_rev_component_tbl
5290                 ,  x_ref_designator_tbl => l_ref_designator_tbl
5291                 ,  x_sub_component_tbl  => x_sub_component_tbl
5292                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5293                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5294                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5295                 );
5296 
5297         x_return_status                := l_bo_return_status;
5298         --x_sub_component_tbl            := l_sub_component_tbl;
5299         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5300 
5301         l_return_status := 'U';
5302 
5303         END; -- END block
5304      END IF;
5305      END LOOP; -- END Substitute Components processing loop
5306 
5307     IF l_return_status in ('Q', 'U')
5308     THEN
5309         x_return_status := l_return_status;
5310         RETURN;
5311     END IF;
5312 
5313     --  Load OUT parameters
5314 
5315      x_return_status            := l_bo_return_status;
5316      --x_sub_component_tbl        := l_sub_component_tbl;
5317      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
5318 
5319 END Sub_Comps;
5320 
5321 
5322 --  Ref_Desgs
5323 
5324 PROCEDURE Ref_Desgs
5325 (   p_validation_level              IN  NUMBER
5326 ,   p_change_notice                 IN  VARCHAR2 := NULL
5327 ,   p_organization_id               IN  NUMBER := NULL
5328 ,   p_revised_item_name             IN  VARCHAR2 := NULL
5329 ,   p_alternate_bom_code            IN  VARCHAR2 := NULL  -- Bug 3991176
5330 ,   p_effectivity_date              IN  DATE := NULL
5331 ,   p_item_revision                 IN  VARCHAR2 := NULL
5332 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
5333 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
5334 ,   p_component_item_name           IN  VARCHAR2 := NULL
5335 ,   p_operation_seq_num             IN  NUMBER := NULL
5336 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
5337 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
5338 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
5339 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
5340 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
5341 ,   x_return_status                 OUT NOCOPY VARCHAR2
5342 )
5343 IS
5344 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
5345 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
5346 l_other_message         VARCHAR2(2000);
5347 l_err_text              VARCHAR2(2000);
5348 l_valid                 BOOLEAN := TRUE;
5349 l_item_parent_exists    BOOLEAN := FALSE;
5350 l_comp_parent_exists    BOOLEAN := FALSE;
5351 l_Return_Status         VARCHAR2(1);
5352 l_bo_return_status      VARCHAR2(1);
5353 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
5354 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
5355 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
5356 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
5357 l_ref_designator_rec    BOM_BO_PUB.Ref_Designator_Rec_Type;
5358 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
5359 l_old_ref_designator_rec BOM_BO_PUB.Ref_Designator_Rec_Type;
5360 l_ref_desg_unexp_rec    BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type;
5361 l_old_ref_desg_unexp_rec BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type;
5362 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
5363 l_return_value          NUMBER;
5364 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
5365 
5366 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type;
5367 l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;
5368 l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;
5369 
5370 EXC_SEV_QUIT_RECORD     EXCEPTION;
5371 EXC_SEV_QUIT_BRANCH     EXCEPTION;
5372 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
5373 EXC_FAT_QUIT_OBJECT     EXCEPTION;
5374 EXC_FAT_QUIT_SIBLINGS   EXCEPTION;
5375 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
5376 
5377 BEGIN
5378 
5379     --  Init local table variables.
5380 
5381     l_return_status := 'S';
5382     l_bo_return_status := 'S';
5383 
5384     x_ref_designator_tbl           := p_ref_designator_tbl;
5385     x_sub_component_tbl            := p_sub_component_tbl;
5386 
5387     l_ref_desg_unexp_rec.organization_id := ENG_GLOBALS.Get_org_id;
5388 
5389 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Within processing Ref Designators . . . '); END IF;
5390 
5391 
5392     FOR I IN 1..x_ref_designator_tbl.COUNT LOOP
5393     IF (x_ref_designator_tbl(I).return_status IS NULL OR
5394          x_ref_designator_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
5395 
5396     BEGIN
5397 
5398         --  Load local records.
5399 
5400         l_ref_designator_rec := x_ref_designator_tbl(I);
5401 
5402         l_ref_designator_rec.transaction_type :=
5403                 UPPER(l_ref_designator_rec.transaction_type);
5404 
5405 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Ref Designator . . . ' || l_ref_designator_rec.reference_designator_name || 'at count ' || to_char(i)); END IF;
5406 
5407         IF p_component_item_name IS NOT NULL AND
5408            p_operation_seq_num IS NOT NULL AND
5409            p_revised_item_name IS NOT NULL AND
5410            p_effectivity_date IS NOT NULL AND
5411            p_change_notice IS NOT NULL AND
5412            p_organization_id IS NOT NULL
5413         THEN
5414                 -- revised comp parent exists
5415 
5416                 l_comp_parent_exists := TRUE;
5417 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Called by Rev_Comps . . .'); END IF;
5418 
5419         ELSIF p_revised_item_name IS NOT NULL AND
5420            p_effectivity_date IS NOT NULL AND
5421            --p_item_revision IS NOT NULL AND	(Commented for bug 3766816 - Forward porting for bug 3747487)
5422            p_change_notice IS NOT NULL AND
5423            p_organization_id IS NOT NULL
5424         THEN
5425                 -- revised item parent exists
5426 
5427                 l_item_parent_exists := TRUE;
5428 
5429 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Called by Rev_Items . . .'); END IF;
5430 
5431         END IF;
5432 
5433         -- Process Flow Step 2: Check if record has not yet been processed and
5434         -- that it is the child of the parent that called this procedure
5435         --
5436 
5437 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
5438                         ('ECO Name: ' || p_change_notice ||
5439                          ' Org     : ' || p_organization_id ||
5440                          ' Eff. Dt : ' || to_char(p_effectivity_date) ||
5441                          ' Revision: ' || p_item_revision ||
5442                          ' Rev Item: ' || p_revised_item_name ||
5443                          ' Rev Comp: ' || p_component_item_name ||
5444                          ' Op. Seq : ' || p_operation_seq_num); END IF;
5445 
5446         IF --(l_ref_designator_rec.return_status IS NULL OR
5447             --l_ref_designator_rec.return_status = FND_API.G_MISS_CHAR)
5448            --AND
5449 
5450            -- Did Rev_Comps call this procedure, that is,
5451            -- if revised comp exists, then is this record a child ?
5452 
5453            ((l_comp_parent_exists AND
5454                (l_ref_designator_rec.ECO_Name = p_change_notice AND
5455                 l_ref_desg_unexp_rec.organization_id = p_organization_id AND
5456                 l_ref_designator_rec.start_effective_date = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND -- bug 6657209
5457                 NVL(l_ref_designator_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
5458                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR )     AND
5459                 NVL(l_ref_designator_rec.new_routing_revision, FND_API.G_MISS_CHAR )
5460                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR )  AND -- Added by MK on 11/02/00
5461                 NVL(l_ref_designator_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
5462                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR )  AND -- Added by MK on 11/02/00
5463                 l_ref_designator_rec.revised_item_name = p_revised_item_name AND
5464                 NVL(l_ref_designator_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND -- Bug 3991176
5465                 l_ref_designator_rec.component_item_name = p_component_item_name AND
5466                 l_ref_designator_rec.operation_sequence_number = p_operation_seq_num))
5467 
5468              OR
5469 
5470              -- Did Rev_Items call this procedure, that is,
5471              -- if revised item exists, then is this record a child ?
5472 
5473              (l_item_parent_exists AND
5474                (l_ref_designator_rec.ECO_Name = p_change_notice AND
5475                 l_ref_desg_unexp_rec.organization_id = p_organization_id AND
5476                 l_ref_designator_rec.revised_item_name = p_revised_item_name AND
5477                 NVL(l_ref_designator_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND -- Bug 3991176
5478                 l_ref_designator_rec.start_effective_date = p_effectivity_date AND
5479                 NVL(l_ref_designator_rec.new_routing_revision, FND_API.G_MISS_CHAR )
5480                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR )  AND -- Added by MK on 11/02/00
5481                 NVL(l_ref_designator_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
5482                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR )  AND -- Added by MK on 11/02/00
5483                 NVL(l_ref_designator_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
5484                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR ) ))
5485 
5486              OR
5487 
5488              (NOT l_item_parent_exists AND
5489               NOT l_comp_parent_exists))
5490         THEN
5491 
5492            l_return_status := FND_API.G_RET_STS_SUCCESS;
5493 
5494            l_ref_designator_rec.return_status := FND_API.G_RET_STS_SUCCESS;
5495 
5496            -- Bug 6657209
5497            IF (l_comp_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null) THEN
5498               l_ref_designator_rec.start_effective_date := p_effectivity_date;
5499            END IF;
5500 
5501            -- Check if transaction_type is valid
5502            --
5503 
5504           IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
5505 
5506 
5507 	   ENG_GLOBALS.Transaction_Type_Validity
5508            (   p_transaction_type       => l_ref_designator_rec.transaction_type
5509            ,   p_entity                 => 'Ref_Desgs'
5510            ,   p_entity_id              => l_ref_designator_rec.revised_item_name
5511            ,   x_valid                  => l_valid
5512            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
5513            );
5514 
5515            IF NOT l_valid
5516            THEN
5517                 l_return_status := Error_Handler.G_STATUS_ERROR;
5518                 RAISE EXC_SEV_QUIT_RECORD;
5519            END IF;
5520 
5521            -- Process Flow step 4(a): Convert user unique index to unique index I
5522            --
5523 
5524            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index I'); END IF;
5525            Bom_Val_To_Id.Ref_Designator_UUI_To_UI
5526                 ( p_ref_designator_rec => l_ref_designator_rec
5527                 , p_ref_desg_unexp_rec => l_ref_desg_unexp_rec
5528                 , x_ref_desg_unexp_rec => l_ref_desg_unexp_rec
5529                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5530                 , x_Return_Status      => l_return_status
5531                 );
5532 
5533            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5534 
5535            IF l_return_status = Error_Handler.G_STATUS_ERROR
5536            THEN
5537                 RAISE EXC_SEV_QUIT_RECORD;
5538            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5539            THEN
5540                 l_other_message := 'BOM_RFD_UUI_UNEXP_SKIP';
5541                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5542                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5543                 RAISE EXC_UNEXP_SKIP_OBJECT;
5544            END IF;
5545 
5546            -- Process Flow step 4(b): Convert user unique index to unique index II
5547            --
5548 
5549            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index II'); END IF;
5550            Bom_Val_To_Id.Ref_Designator_UUI_To_UI2
5551                 ( p_ref_designator_rec => l_ref_designator_rec
5552                 , p_ref_desg_unexp_rec => l_ref_desg_unexp_rec
5553                 , x_ref_desg_unexp_rec => l_ref_desg_unexp_rec
5554                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5555                 , x_other_message      => l_other_message
5556                 , x_other_token_tbl    => l_other_token_tbl
5557                 , x_Return_Status      => l_return_status
5558                 );
5559 
5560            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5561 
5562            IF l_return_status = Error_Handler.G_STATUS_ERROR
5563            THEN
5564                 RAISE EXC_SEV_QUIT_SIBLINGS;
5565            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5566            THEN
5567                 l_other_message := 'BOM_RFD_UUI_UNEXP_SKIP';
5568                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5569                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5570                 RAISE EXC_UNEXP_SKIP_OBJECT;
5571            END IF;
5572 
5573 
5574            IF Bom_Globals.Get_Debug = 'Y' THEN
5575            Error_Handler.Write_Debug('Converting user unique index to unique index II for Bill and Rev Item Seq Id');
5576            END IF;
5577 
5578            -- Added by MK on 12/03/00 to resolve ECO dependency
5579            ENG_Val_To_Id.BillAndRevitem_UUI_To_UI
5580            ( p_revised_item_name        => l_ref_designator_rec.revised_item_name
5581            , p_alternate_bom_code       => l_ref_designator_rec.alternate_bom_code -- Bug 3991176
5582            , p_revised_item_id          => l_ref_desg_unexp_rec.revised_item_id
5583            , p_item_revision            => l_ref_designator_rec.new_revised_item_revision
5584            , p_effective_date           => l_ref_designator_rec.start_effective_date
5585            , p_change_notice            => l_ref_designator_rec.eco_name
5586            , p_organization_id          => l_ref_desg_unexp_rec.organization_id
5587            , p_new_routing_revision     => l_ref_designator_rec.new_routing_revision
5588            , p_from_end_item_number     => l_ref_designator_rec.from_end_item_unit_number
5589            , p_entity_processed         => 'RFD'
5590            , p_component_item_name      => l_ref_designator_rec.component_item_name
5591            , p_component_item_id        => l_ref_desg_unexp_rec.component_item_id
5592            , p_operation_sequence_number => l_ref_designator_rec.operation_sequence_number
5593            , p_rfd_sbc_name             => l_ref_designator_rec.reference_designator_name
5594            , p_transaction_type         => l_ref_designator_rec.transaction_type
5595            , x_revised_item_sequence_id => l_ref_desg_unexp_rec.revised_item_sequence_id
5596            , x_bill_sequence_id         => l_ref_desg_unexp_rec.bill_sequence_id
5597            , x_component_sequence_id    => l_ref_desg_unexp_rec.component_sequence_id
5598            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
5599            , x_other_message            => l_other_message
5600            , x_other_token_tbl          => l_other_token_tbl
5601            , x_Return_Status            => l_return_status
5602           ) ;
5603 
5604 
5605            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5606 
5607            IF l_return_status = Error_Handler.G_STATUS_ERROR
5608            THEN
5609                 RAISE EXC_SEV_QUIT_SIBLINGS;
5610            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5611            THEN
5612                 l_other_message := 'BOM_RFD_UUI_UNEXP_SKIP';
5613                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5614                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5615                 RAISE EXC_UNEXP_SKIP_OBJECT;
5616            END IF;
5617 
5618 
5619            -- Process Flow step 5: Verify Reference Designator's existence
5620            --
5621 
5622            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
5623            Bom_Validate_Ref_Designator.Check_Existence
5624                 (  p_ref_designator_rec         => l_ref_designator_rec
5625                 ,  p_ref_desg_unexp_rec         => l_ref_desg_unexp_rec
5626                 ,  x_old_ref_designator_rec     => l_old_ref_designator_rec
5627                 ,  x_old_ref_desg_unexp_rec     => l_old_ref_desg_unexp_rec
5628                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
5629                 ,  x_return_status              => l_Return_Status
5630                 );
5631 
5632            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5633 
5634            IF l_return_status = Error_Handler.G_STATUS_ERROR
5635            THEN
5636                 RAISE EXC_SEV_QUIT_RECORD;
5637            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5638            THEN
5639                 l_other_message := 'BOM_RFD_EXS_UNEXP_SKIP';
5640                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5641                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5642                 l_other_token_tbl(2).token_name := 'REVISED_COMPONENT_NAME';
5643                 l_other_token_tbl(2).token_value := l_ref_designator_rec.component_item_name;
5644                 RAISE EXC_UNEXP_SKIP_OBJECT;
5645            END IF;
5646 
5647            -- Process Flow step 6: Is Revised Component record an orphan ?
5648 
5649            IF NOT l_comp_parent_exists
5650            THEN
5651 
5652                 -- Process Flow step 7: Check lineage
5653                 --
5654 
5655                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');     END IF;
5656                 Bom_Validate_Ref_Designator.Check_Lineage
5657                 (  p_ref_designator_rec         => l_ref_designator_rec
5658                 ,  p_ref_desg_unexp_rec         => l_ref_desg_unexp_rec
5659                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
5660                 ,  x_return_status              => l_Return_Status
5661                 );
5662 
5663                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5664 
5665                 IF l_return_status = Error_Handler.G_STATUS_ERROR
5666                 THEN
5667                         RAISE EXC_SEV_QUIT_BRANCH;
5668                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5669                 THEN
5670                         l_other_message := 'BOM_RFD_LIN_UNEXP_SKIP';
5671                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5672                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5673                         RAISE EXC_UNEXP_SKIP_OBJECT;
5674                 END IF;
5675 
5676                 -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
5677                 --
5678 
5679                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' Check ECO access'); END IF;
5680 
5681                 ENG_Validate_ECO.Check_Access
5682                 ( p_change_notice       => l_ref_designator_rec.ECO_Name
5683                 , p_organization_id     => l_ref_desg_unexp_rec.organization_id
5684                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
5685                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
5686                 , x_Return_Status       => l_return_status
5687                 );
5688 
5689                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5690 
5691                 IF l_return_status = Error_Handler.G_STATUS_ERROR
5692                 THEN
5693                         l_other_message := 'BOM_RFD_ECOACC_FAT_FATAL';
5694                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5695                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5696                         l_return_status := 'F';
5697                         RAISE EXC_FAT_QUIT_OBJECT;
5698                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5699                 THEN
5700                         l_other_message := 'BOM_RFD_ECOACC_UNEXP_SKIP';
5701                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5702                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5703                         RAISE EXC_UNEXP_SKIP_OBJECT;
5704                 END IF;
5705 
5706                 -- Process Flow step 9(a and b): check that user has access to revised item
5707                 --
5708 
5709                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
5710                 ENG_Validate_Revised_Item.Check_Access
5711                 (  p_change_notice      => l_ref_designator_rec.ECO_Name
5712                 ,  p_organization_id    => l_ref_desg_unexp_rec.organization_id
5713                 ,  p_revised_item_id    => l_ref_desg_unexp_rec.revised_item_id
5714                 ,  p_new_item_revision  => l_ref_designator_rec.new_revised_item_revision
5715                 ,  p_effectivity_date   => l_ref_designator_rec.start_effective_date
5716                 ,  p_new_routing_revsion  => l_ref_designator_rec.new_routing_revision -- Added by MK on 11/02/00
5717                 ,  p_from_end_item_number => l_ref_designator_rec.from_end_item_unit_number -- Added by MK on 11/02/00
5718                 ,  p_revised_item_name  => l_ref_designator_rec.revised_item_name
5719                 ,  p_entity_processed   => 'RFD' -- Bug 4210718
5720                 ,  p_alternate_bom_code => l_ref_designator_rec.alternate_bom_code -- Bug 4210718
5721                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5722                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5723                 ,  x_return_status      => l_Return_Status
5724                 );
5725 
5726                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5727 
5728                 IF l_return_status = Error_Handler.G_STATUS_ERROR
5729                 THEN
5730                         l_other_message := 'BOM_RFD_RITACC_FAT_FATAL';
5731                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5732                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5733                         l_return_status := 'F';
5734                         RAISE EXC_FAT_QUIT_SIBLINGS;
5735                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5736                 THEN
5737                         l_other_message := 'BOM_RFD_RITACC_UNEXP_SKIP';
5738                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5739                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5740                         RAISE EXC_UNEXP_SKIP_OBJECT;
5741                 END IF;
5742 
5743                 -- Process Flow step 10: check that user has access to revised component
5744                 --
5745 
5746                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
5747                 Bom_Validate_Bom_Component.Check_Access
5748                 (  p_change_notice      => l_ref_designator_rec.ECO_Name
5749                 ,  p_organization_id    => l_ref_desg_unexp_rec.organization_id
5750                 ,  p_revised_item_id    => l_ref_desg_unexp_rec.revised_item_id
5751                 ,  p_new_item_revision  => l_ref_designator_rec.new_revised_item_revision
5752                 ,  p_effectivity_date   => l_ref_designator_rec.start_effective_date
5753                 ,  p_new_routing_revsion  => l_ref_designator_rec.new_routing_revision -- Added by MK on 11/02/00
5754                 ,  p_from_end_item_number => l_ref_designator_rec.from_end_item_unit_number -- Added by MK on 11/02/00
5755                 ,  p_revised_item_name  => l_ref_designator_rec.revised_item_name
5756                 ,  p_component_item_id  => l_ref_desg_unexp_rec.component_item_id
5757                 ,  p_operation_seq_num  => l_ref_designator_rec.operation_sequence_number
5758                 ,  p_bill_sequence_id   => l_ref_desg_unexp_rec.bill_sequence_id
5759                 ,  p_component_name     => l_ref_designator_rec.component_item_name
5760                 ,  p_entity_processed   => 'RFD'
5761                 ,  p_rfd_sbc_name       => l_ref_designator_rec.reference_designator_name
5762                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5763                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5764                 ,  x_return_status      => l_Return_Status
5765                 );
5766 
5767                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5768 
5769                 IF l_return_status = Error_Handler.G_STATUS_ERROR
5770                 THEN
5771                         l_other_message := 'BOM_RFD_CMPACC_FAT_FATAL';
5772                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5773                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5774                         l_return_status := 'F';
5775                         RAISE EXC_FAT_QUIT_SIBLINGS;
5776                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5777                 THEN
5778                         l_other_message := 'BOM_RFD_CMPACC_UNEXP_SKIP';
5779                         l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5780                         l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5781                         RAISE EXC_UNEXP_SKIP_OBJECT;
5782                 END IF;
5783 
5784                 -- Process Flow step 8(b): check that user has access to ECO
5785                 --
5786 
5787                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
5788                 Bom_Validate_Ref_Designator.Check_Access
5789                 (  p_ref_designator_rec => l_ref_designator_rec
5790                 ,  p_ref_desg_unexp_rec => l_ref_desg_unexp_rec
5791                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
5792                 ,  x_return_status      => l_Return_Status
5793                 );
5794 
5795                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5796 
5797                 IF l_return_status = Error_Handler.G_STATUS_ERROR
5798                 THEN
5799                         l_return_status := 'F';
5800                         RAISE EXC_FAT_QUIT_SIBLINGS;
5801                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5802                 THEN
5803                         RAISE EXC_UNEXP_SKIP_OBJECT;
5804                 END IF;
5805 
5806            END IF;
5807 
5808            IF l_ref_designator_rec.transaction_type IN
5809                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
5810            THEN
5811 
5812                 -- Process flow step 11 - Populate NULL columns for Update and
5813                 -- Delete.
5814 
5815                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
5816                 Bom_Default_Ref_Designator.Populate_NULL_Columns
5817                 (   p_ref_designator_rec        => l_ref_designator_rec
5818                 ,   p_old_ref_designator_rec    => l_old_ref_designator_rec
5819                 ,   p_ref_desg_unexp_rec        => l_ref_desg_unexp_rec
5820                 ,   p_old_ref_desg_unexp_rec    => l_old_ref_desg_unexp_rec
5821                 ,   x_ref_designator_rec        => l_ref_designator_rec
5822                 ,   x_ref_desg_unexp_rec        => l_ref_desg_unexp_rec
5823                 );
5824 
5825            END IF;
5826 
5827            -- Process Flow step 12 - Entity Level Validation
5828            -- Added Check_Entity_Delete by MK on 11/14/00
5829            --
5830            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
5831 
5832            IF l_ref_designator_rec.transaction_type = 'DELETE'
5833            THEN
5834 
5835            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Calling Entity Delete validation'); END IF;
5836 
5837                 Bom_Validate_Ref_Designator.Check_Entity_Delete
5838                 (  p_ref_designator_rec         => l_ref_designator_rec
5839                 ,  p_ref_desg_unexp_rec         => l_ref_desg_unexp_rec
5840                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
5841                 ,  x_return_status              => l_Return_Status
5842                 );
5843            ELSE
5844                 Bom_Validate_Ref_Designator.Check_Entity
5845                 (  p_ref_designator_rec         => l_ref_designator_rec
5846                 ,  p_ref_desg_unexp_rec         => l_ref_desg_unexp_rec
5847                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
5848                 ,  x_return_status              => l_Return_Status
5849                 );
5850            END IF ;
5851 
5852            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5853 
5854            IF l_return_status = Error_Handler.G_STATUS_ERROR
5855            THEN
5856                 RAISE EXC_SEV_QUIT_RECORD;
5857            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5858            THEN
5859                 l_other_message := 'BOM_RFD_ENTVAL_UNEXP_SKIP';
5860                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5861                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5862                 RAISE EXC_UNEXP_SKIP_OBJECT;
5863            ELSIF l_return_status ='S' AND
5864                 l_Mesg_Token_Tbl.COUNT <>0
5865            THEN
5866                 Eco_Error_Handler.Log_Error
5867                 (  p_ref_designator_tbl => x_ref_designator_tbl
5868                 ,  p_sub_component_tbl  => x_sub_component_tbl
5869                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5870                 ,  p_error_status       => 'W'
5871                 ,  p_error_level        => 5
5872                 ,  p_entity_index       => I
5873                 ,  x_eco_rec            => l_eco_rec
5874                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5875                 ,  x_revised_item_tbl   => l_revised_item_tbl
5876                 ,  x_rev_component_tbl  => l_rev_component_tbl
5877                 ,  x_ref_designator_tbl => x_ref_designator_tbl
5878                 ,  x_sub_component_tbl  => x_sub_component_tbl
5879                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5880                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5881                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5882                 );
5883            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Log Error For Warning '); END IF;
5884            END IF;
5885 
5886            -- Process Flow step 14 : Database Writes
5887            --
5888 
5889            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
5890            Bom_Ref_Designator_Util.Perform_Writes
5891                 (   p_ref_designator_rec        => l_ref_designator_rec
5892                 ,   p_ref_desg_unexp_rec        => l_ref_desg_unexp_rec
5893                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
5894                 ,   x_return_status             => l_return_status
5895                 );
5896 
5897            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
5898 
5899            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
5900            THEN
5901                 l_other_message := 'BOM_RFD_WRITES_UNEXP_SKIP';
5902                 l_other_token_tbl(1).token_name := 'REFERENCE_DESIGNATOR_NAME';
5903                 l_other_token_tbl(1).token_value := l_ref_designator_rec.reference_designator_name;
5904                 RAISE EXC_UNEXP_SKIP_OBJECT;
5905            ELSIF l_return_status ='S' AND
5906               l_Mesg_Token_Tbl.COUNT <>0
5907            THEN
5908                 Eco_Error_Handler.Log_Error
5909                 (  p_ref_designator_tbl => x_ref_designator_tbl
5910                 ,  p_sub_component_tbl  => x_sub_component_tbl
5911                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5912                 ,  p_error_status       => 'W'
5913                 ,  p_error_level        => 5
5914                 ,  p_entity_index       => I
5915                 ,  x_eco_rec            => l_eco_rec
5916                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5917                 ,  x_revised_item_tbl   => l_revised_item_tbl
5918                 ,  x_rev_component_tbl  => l_rev_component_tbl
5919                 ,  x_ref_designator_tbl => x_ref_designator_tbl
5920                 ,  x_sub_component_tbl  => x_sub_component_tbl
5921                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5922                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5923                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5924                 );
5925            END IF;
5926 
5927         END IF; -- END IF statement that checks RETURN STATUS
5928 
5929         --  Load tables.
5930 
5931         x_ref_designator_tbl(I)          := l_ref_designator_rec;
5932 
5933     --  For loop exception handler.
5934 
5935 
5936     EXCEPTION
5937 
5938        WHEN EXC_SEV_QUIT_RECORD THEN
5939 
5940         Eco_Error_Handler.Log_Error
5941                 (  p_ref_designator_tbl => x_ref_designator_tbl
5942                 ,  p_sub_component_tbl  => x_sub_component_tbl
5943                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5944                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
5945                 ,  p_error_scope        => Error_Handler.G_SCOPE_RECORD
5946                 ,  p_error_level        => 5
5947                 ,  p_entity_index       => I
5948                 ,  x_eco_rec            => l_eco_rec
5949                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5950                 ,  x_revised_item_tbl   => l_revised_item_tbl
5951                 ,  x_rev_component_tbl  => l_rev_component_tbl
5952                 ,  x_ref_designator_tbl => x_ref_designator_tbl
5953                 ,  x_sub_component_tbl  => x_sub_component_tbl
5954                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5955                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5956                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5957                 );
5958 
5959         IF l_bo_return_status = 'S'
5960         THEN
5961                 l_bo_return_status     := l_return_status;
5962         END IF;
5963         x_return_status                := l_bo_return_status;
5964         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5965         --x_ref_designator_tbl           := l_ref_designator_tbl;
5966         --x_sub_component_tbl            := l_sub_component_tbl;
5967 
5968        WHEN EXC_SEV_QUIT_BRANCH THEN
5969 
5970         Eco_Error_Handler.Log_Error
5971                 (  p_ref_designator_tbl => x_ref_designator_tbl
5972                 ,  p_sub_component_tbl  => x_sub_component_tbl
5973                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
5974                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
5975                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
5976                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
5977                 ,  p_other_message      => l_other_message
5978                 ,  p_other_token_tbl    => l_other_token_tbl
5979                 ,  p_error_level        => 5
5980                 ,  p_entity_index       => I
5981                 ,  x_eco_rec            => l_eco_rec
5982                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
5983                 ,  x_revised_item_tbl   => l_revised_item_tbl
5984                 ,  x_rev_component_tbl  => l_rev_component_tbl
5985                 ,  x_ref_designator_tbl => x_ref_designator_tbl
5986                 ,  x_sub_component_tbl  => x_sub_component_tbl
5987                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
5988                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
5989                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
5990                 );
5991 
5992         IF l_bo_return_status = 'S'
5993         THEN
5994                 l_bo_return_status     := l_return_status;
5995         END IF;
5996         x_return_status                := l_bo_return_status;
5997         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
5998         --x_ref_designator_tbl           := l_ref_designator_tbl;
5999         --x_sub_component_tbl            := l_sub_component_tbl;
6000 
6001        WHEN EXC_SEV_QUIT_SIBLINGS THEN
6002 
6003         Eco_Error_Handler.Log_Error
6004                 (  p_ref_designator_tbl => x_ref_designator_tbl
6005                 ,  p_sub_component_tbl  => x_sub_component_tbl
6006                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6007                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
6008                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
6009                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
6010                 ,  p_other_message      => l_other_message
6011                 ,  p_other_token_tbl    => l_other_token_tbl
6012                 ,  p_error_level        => 5
6013                 ,  p_entity_index       => I
6014                 ,  x_eco_rec            => l_eco_rec
6015                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6016                 ,  x_revised_item_tbl   => l_revised_item_tbl
6017                 ,  x_rev_component_tbl  => l_rev_component_tbl
6018                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6019                 ,  x_sub_component_tbl  => x_sub_component_tbl
6020                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6021                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6022                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6023                 );
6024 
6025         IF l_bo_return_status = 'S'
6026         THEN
6027                 l_bo_return_status     := l_return_status;
6028         END IF;
6029         x_return_status                := l_bo_return_status;
6030         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
6031         --x_ref_designator_tbl           := l_ref_designator_tbl;
6032         --x_sub_component_tbl            := l_sub_component_tbl;
6033 
6034         RETURN;
6035 
6036        WHEN EXC_FAT_QUIT_SIBLINGS THEN
6037 
6038         Eco_Error_Handler.Log_Error
6039                 (  p_ref_designator_tbl => x_ref_designator_tbl
6040                 ,  p_sub_component_tbl  => x_sub_component_tbl
6041                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6042                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
6043                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
6044                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
6045                 ,  p_other_message      => l_other_message
6046                 ,  p_other_token_tbl    => l_other_token_tbl
6047                 ,  p_error_level        => 5
6048                 ,  p_entity_index       => I
6049                 ,  x_eco_rec            => l_eco_rec
6050                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6051                 ,  x_revised_item_tbl   => l_revised_item_tbl
6052                 ,  x_rev_component_tbl  => l_rev_component_tbl
6053                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6054                 ,  x_sub_component_tbl  => x_sub_component_tbl
6055                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6056                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6057                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6058                 );
6059 
6060         x_return_status                := Error_Handler.G_STATUS_FATAL;
6061         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
6062         --x_ref_designator_tbl           := l_ref_designator_tbl;
6063         --x_sub_component_tbl            := l_sub_component_tbl;
6064 
6065         RETURN;
6066 
6067        WHEN EXC_FAT_QUIT_OBJECT THEN
6068 
6069         Eco_Error_Handler.Log_Error
6070                 (  p_ref_designator_tbl => x_ref_designator_tbl
6071                 ,  p_sub_component_tbl  => x_sub_component_tbl
6072                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6073                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
6074                 ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
6075                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
6076                 ,  p_other_message      => l_other_message
6077                 ,  p_other_token_tbl    => l_other_token_tbl
6078                 ,  p_error_level        => 5
6079                 ,  p_entity_index       => I
6080                 ,  x_eco_rec            => l_eco_rec
6081                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6082                 ,  x_revised_item_tbl   => l_revised_item_tbl
6083                 ,  x_rev_component_tbl  => l_rev_component_tbl
6084                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6085                 ,  x_sub_component_tbl  => x_sub_component_tbl
6086                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6087                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6088                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6089                 );
6090 
6091         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
6092         --x_ref_designator_tbl           := l_ref_designator_tbl;
6093         --x_sub_component_tbl            := l_sub_component_tbl;
6094 
6095         l_return_status := 'Q';
6096 
6097        WHEN EXC_UNEXP_SKIP_OBJECT THEN
6098 
6099         Eco_Error_Handler.Log_Error
6100                 (  p_ref_designator_tbl => x_ref_designator_tbl
6101                 ,  p_sub_component_tbl  => x_sub_component_tbl
6102                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6103                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
6104                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
6105                 ,  p_other_message      => l_other_message
6106                 ,  p_other_token_tbl    => l_other_token_tbl
6107                 ,  p_error_level        => 5
6108                 ,  x_ECO_rec            => l_ECO_rec
6109                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6110                 ,  x_revised_item_tbl   => l_revised_item_tbl
6111                 ,  x_rev_component_tbl  => l_rev_component_tbl
6112                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6113                 ,  x_sub_component_tbl  => x_sub_component_tbl
6114                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6115                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6116                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6117                 );
6118 
6119         --x_ref_designator_tbl           := l_ref_designator_tbl;
6120         --x_sub_component_tbl            := l_sub_component_tbl;
6121         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
6122 
6123         l_return_status := 'U';
6124 
6125         END; -- END block
6126 
6127         IF l_return_status in ('Q', 'U')
6128         THEN
6129                 x_return_status := l_return_status;
6130                 RETURN;
6131         END IF;
6132      END IF; -- End of processing records for which the return status is null
6133      END LOOP; -- END Reference Designator processing loop
6134 
6135     --  Load OUT parameters
6136 
6137      x_return_status            := l_bo_return_status;
6138      --x_ref_designator_tbl       := l_ref_designator_tbl;
6139      --x_sub_component_tbl        := l_sub_component_tbl;
6140      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
6141 
6142 
6143 END Ref_Desgs;
6144 
6145 PROCEDURE Process_Rev_Comp
6146 (   p_validation_level              IN  NUMBER
6147 ,   p_change_notice                 IN  VARCHAR2 := NULL
6148 ,   p_organization_id               IN  NUMBER := NULL
6149 ,   p_revised_item_name             IN  VARCHAR2 := NULL
6150 ,   p_alternate_bom_code            IN  VARCHAR2 := NULL -- Bug 2429272 Change4(cont..of..ENGSVIDB.pls)
6151 ,   p_effectivity_date              IN  DATE := NULL
6152 ,   p_item_revision                 IN  VARCHAR2 := NULL
6153 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
6154 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
6155 ,   I                               IN  NUMBER
6156 ,   p_rev_component_rec             IN  BOM_BO_PUB.Rev_Component_Rec_Type
6157 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
6158 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
6159 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
6160 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
6161 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
6162 ,   x_rev_comp_unexp_rec            OUT NOCOPY BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type
6163 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
6164 ,   x_return_status                 OUT NOCOPY VARCHAR2
6165 -- Bug 2941096 // kamohan
6166 ,   x_bill_sequence_id           IN NUMBER := NULL
6167 )
6168 IS
6169 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
6170 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
6171 l_other_message         VARCHAR2(2000);
6172 l_err_text              VARCHAR2(2000);
6173 l_valid                 BOOLEAN := TRUE;
6174 l_item_parent_exists    BOOLEAN := FALSE;
6175 l_Return_Status         VARCHAR2(1);
6176 l_bo_return_status      VARCHAR2(1);
6177 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
6178 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
6179 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
6180 l_rev_component_rec     BOM_BO_PUB.Rev_Component_Rec_Type;
6181 --l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
6182 l_rev_comp_unexp_rec    BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
6183 l_old_rev_component_rec BOM_BO_PUB.Rev_Component_Rec_Type;
6184 l_old_rev_comp_unexp_rec BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
6185 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
6186 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
6187 l_return_value          NUMBER;
6188 l_process_children      BOOLEAN := TRUE;
6189 l_dummy                 NUMBER ;
6190 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
6191 l_structure_type_id     NUMBER ;
6192 l_strc_cp_not_allowed   NUMBER ;
6193 
6194 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type;
6195 l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;
6196 l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;
6197 
6198 EXC_SEV_QUIT_RECORD     EXCEPTION;
6199 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
6200 EXC_SEV_QUIT_BRANCH     EXCEPTION;
6201 EXC_SEV_SKIP_BRANCH     EXCEPTION;
6202 EXC_FAT_QUIT_OBJECT     EXCEPTION;
6203 EXC_FAT_QUIT_SIBLINGS   EXCEPTION;
6204 EXC_FAT_QUIT_BRANCH     EXCEPTION;
6205 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
6206 
6207 BEGIN
6208 
6209     l_return_status := FND_API.G_RET_STS_SUCCESS;
6210     l_bo_return_status := FND_API.G_RET_STS_SUCCESS;
6211     x_return_status := FND_API.G_RET_STS_SUCCESS;
6212     x_ref_designator_tbl := p_ref_designator_tbl;
6213     x_sub_component_tbl := p_sub_component_tbl;
6214     l_rev_comp_unexp_rec.organization_id := ENG_GLOBALS.Get_org_id;
6215 
6216     BEGIN
6217 
6218         --
6219         --  Load local records.
6220         --
6221         l_rev_component_rec := x_rev_component_tbl(I);
6222 
6223         l_rev_component_rec.transaction_type :=
6224                 UPPER(l_rev_component_rec.transaction_type);
6225 
6226 
6227         --
6228         -- make sure to set process_children to false at the start of
6229         -- every iteration
6230         --
6231         l_process_children := FALSE;
6232 
6233         --
6234         -- Initialize the Unexposed Record for every iteration of the Loop
6235         -- so that sequence numbers get generated for every new row.
6236         --
6237         l_rev_comp_unexp_rec.Component_Item_Id          := NULL;
6238         l_rev_comp_unexp_rec.Old_Component_Sequence_Id  := NULL;
6239         l_rev_comp_unexp_rec.Component_Sequence_Id      := NULL;
6240         l_rev_comp_unexp_rec.Pick_Components            := NULL;
6241         l_rev_comp_unexp_rec.Supply_Locator_Id          := NULL;
6242         l_rev_comp_unexp_rec.Revised_Item_Sequence_Id   := NULL;
6243         l_rev_comp_unexp_rec.Bom_Item_Type              := NULL;
6244         l_rev_comp_unexp_rec.Revised_Item_Id            := NULL;
6245         l_rev_comp_unexp_rec.Include_On_Bill_Docs       := NULL;
6246 
6247 	-- Bug 2941096 // kamohan
6248 	-- Start changes
6249 
6250 	IF x_bill_sequence_id IS NOT NULL THEN
6251 		l_rev_comp_unexp_rec.Bill_Sequence_Id           := x_bill_sequence_id;
6252 	ELSE
6253 		l_rev_comp_unexp_rec.Bill_Sequence_Id           := NULL;
6254 	END IF;
6255 
6256 	-- End Changes
6257 
6258         IF p_revised_item_name IS NOT NULL AND
6259            p_effectivity_date IS NOT NULL AND
6260            p_change_notice IS NOT NULL AND
6261            p_organization_id IS NOT NULL
6262         THEN
6263                 -- revised item parent exists
6264 
6265                 l_item_parent_exists := TRUE;
6266         END IF;
6267 
6268         -- Process Flow Step 2: Check if record has not yet been processed and
6269         -- that it is the child of the parent that called this procedure
6270         --
6271 
6272         IF --(l_rev_component_rec.return_status IS NULL OR
6273             --l_rev_component_rec.return_status = FND_API.G_MISS_CHAR)
6274            --AND
6275 
6276             -- Did Rev_Items call this procedure, that is,
6277             -- if revised item exists, then is this record a child ?
6278 
6279             (NOT l_item_parent_exists
6280              OR
6281              (l_item_parent_exists AND
6282               (l_rev_component_rec.ECO_Name = p_change_notice AND
6283                l_rev_comp_unexp_rec.organization_id = p_organization_id AND
6284                l_rev_component_rec.revised_item_name = p_revised_item_name AND
6285                NVL(l_rev_component_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND
6286                                                                           -- Bug 2429272 Change 4
6287                l_rev_component_rec.start_effective_date = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND -- Bug 6657209
6288                NVL(l_rev_component_rec.new_routing_revision, FND_API.G_MISS_CHAR )
6289                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
6290                NVL(l_rev_component_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
6291                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
6292                NVL(l_rev_component_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
6293                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR) )))
6294 
6295         THEN
6296 
6297            l_return_status := FND_API.G_RET_STS_SUCCESS;
6298 
6299            l_rev_component_rec.return_status := FND_API.G_RET_STS_SUCCESS;
6300 
6301            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing component: ' || l_rev_component_rec.component_item_name); END IF;
6302            -- Check if transaction_type is valid
6303            --
6304            -- Bug 6657209
6305            IF (l_item_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null ) THEN
6306               l_rev_component_rec.start_effective_date := p_effectivity_date;
6307            END IF;
6308 
6309            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
6310            ENG_GLOBALS.Transaction_Type_Validity
6311            (   p_transaction_type       => l_rev_component_rec.transaction_type
6312            ,   p_entity                 => 'Rev_Comps'
6313            ,   p_entity_id              => l_rev_component_rec.revised_item_name
6314            ,   x_valid                  => l_valid
6315            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
6316            );
6317 
6318            IF NOT l_valid
6319            THEN
6320                 RAISE EXC_SEV_QUIT_RECORD;
6321            END IF;
6322 
6323            -- Process Flow step 4(a): Convert user unique index to unique index I
6324            --
6325 
6326            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index I'); END IF;
6327            Bom_Val_To_Id.Rev_Component_UUI_To_UI
6328                 ( p_rev_component_rec  => l_rev_component_rec
6329                 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
6330                 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
6331                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6332                 , x_Return_Status      => l_return_status
6333                 );
6334 
6335            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6336 
6337            IF l_return_status = Error_Handler.G_STATUS_ERROR
6338            THEN
6339                 l_other_message := 'BOM_CMP_UUI_SEV_ERROR';
6340                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6341                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6342                 RAISE EXC_SEV_QUIT_BRANCH;
6343            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6344            THEN
6345                 l_other_message := 'BOM_CMP_UUI_UNEXP_SKIP';
6346                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6347                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6348                 RAISE EXC_UNEXP_SKIP_OBJECT;
6349            END IF;
6350 
6351            -- Process Flow step 4(b): Convert user unique index to unique index II
6352            --
6353 
6354            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index II'); END IF;
6355            Bom_Val_To_Id.Rev_Component_UUI_To_UI2
6356                 ( p_rev_component_rec  => l_rev_component_rec
6357                 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
6358                 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
6359                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6360                 , x_other_message      => l_other_message
6361                 , x_other_token_tbl    => l_other_token_tbl
6362                 , x_Return_Status      => l_return_status
6363                 );
6364 
6365            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6366 
6367            IF l_return_status = Error_Handler.G_STATUS_ERROR
6368            THEN
6369                 RAISE EXC_SEV_QUIT_SIBLINGS;
6370            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6371            THEN
6372                 l_other_message := 'ENG_CMP_UUI_UNEXP_SKIP';
6373                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6374                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6375                 RAISE EXC_UNEXP_SKIP_OBJECT;
6376            END IF;
6377 
6378            IF Bom_Globals.Get_Debug = 'Y' THEN
6379            Error_Handler.Write_Debug('Converting user unique index to unique index II for Bill And Rev Seq Id');
6380            END IF;
6381 
6382            ENG_Val_To_Id.BillAndRevitem_UUI_To_UI
6383            ( p_revised_item_name        => l_rev_component_rec.revised_item_name
6384            , p_revised_item_id          => l_rev_comp_unexp_rec.revised_item_id
6385            , p_alternate_bom_code       => l_rev_component_rec.alternate_bom_code -- Bug 2429272 Change 4
6386            , p_item_revision            => l_rev_component_rec.new_revised_item_revision
6387            , p_effective_date           => l_rev_component_rec.start_effective_date
6388            , p_change_notice            => l_rev_component_rec.eco_name
6389            , p_organization_id          => l_rev_comp_unexp_rec.organization_id
6390            , p_new_routing_revision     => l_rev_component_rec.new_routing_revision
6391            , p_from_end_item_number     => l_rev_component_rec.from_end_item_unit_number
6392            , p_entity_processed         => 'RC'
6393            , p_component_item_name      => l_rev_component_rec.component_item_name
6394            , p_transaction_type         => l_rev_component_rec.transaction_type
6395            , x_revised_item_sequence_id => l_rev_comp_unexp_rec.revised_item_sequence_id
6396            , x_bill_sequence_id         => l_rev_comp_unexp_rec.bill_sequence_id
6397            , x_component_sequence_id    => l_dummy
6398            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
6399            , x_other_message            => l_other_message
6400            , x_other_token_tbl          => l_other_token_tbl
6401            , x_Return_Status            => l_return_status
6402           ) ;
6403 
6404            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status) ;
6405            END IF;
6406 
6407            IF l_return_status = Error_Handler.G_STATUS_ERROR
6408            THEN
6409                 RAISE EXC_SEV_QUIT_SIBLINGS;
6410            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6411            THEN
6412                 l_other_message := 'ENG_CMP_UUI_UNEXP_SKIP';
6413                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6414                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6415                 RAISE EXC_UNEXP_SKIP_OBJECT;
6416            END IF;
6417 
6418 
6419            BOM_Globals.Set_Unit_Controlled_Item
6420            ( p_inventory_item_id => l_rev_comp_unexp_rec.revised_item_id
6421            , p_organization_id  => l_rev_comp_unexp_rec.organization_id
6422            );
6423 
6424            BOM_Globals.Set_Unit_Controlled_Component
6425            ( p_inventory_item_id => l_rev_comp_unexp_rec.component_item_id
6426            , p_organization_id  => l_rev_comp_unexp_rec.organization_id
6427            );
6428 
6429            -- Process Flow step 5: Verify Revised Component's existence
6430            --
6431 
6432            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
6433            Bom_Validate_Bom_Component.Check_Existence
6434                 (  p_rev_component_rec          => l_rev_component_rec
6435                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
6436                 ,  x_old_rev_component_rec      => l_old_rev_component_rec
6437                 ,  x_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
6438                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
6439                 ,  x_return_status              => l_Return_Status
6440                 );
6441 
6442            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6443 
6444            IF l_return_status = Error_Handler.G_STATUS_ERROR
6445            THEN
6446                 l_other_message := 'BOM_CMP_EXS_SEV_ERROR';
6447                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6448                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6449                 l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
6450                 l_other_token_tbl(2).token_value := l_rev_component_rec.revised_item_name;
6451                 RAISE EXC_SEV_QUIT_BRANCH;
6452            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6453            THEN
6454                 l_other_message := 'BOM_CMP_EXS_UNEXP_SKIP';
6455                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6456                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6457                 l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
6458                 l_other_token_tbl(2).token_value := l_rev_component_rec.revised_item_name
6459 ;
6460                 RAISE EXC_UNEXP_SKIP_OBJECT;
6461            END IF;
6462 
6463            -- Process Flow step 6: Check lineage
6464            --
6465 
6466            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');          END IF;
6467            Bom_Validate_Bom_Component.Check_Lineage
6468                 (  p_rev_component_rec          => l_rev_component_rec
6469                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
6470                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
6471                 ,  x_return_status              => l_Return_Status
6472                 );
6473 
6474            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6475 
6476            IF l_return_status = Error_Handler.G_STATUS_ERROR
6477            THEN
6478                    l_other_message := 'BOM_CMP_LIN_SEV_SKIP';
6479                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6480                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6481                    RAISE EXC_SEV_QUIT_BRANCH;
6482            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6483            THEN
6484                    l_other_message := 'ENG_CMP_LIN_UNEXP_SKIP';
6485                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6486                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6487                    RAISE EXC_UNEXP_SKIP_OBJECT;
6488            END IF;
6489 
6490            -- Process Flow step 7: Is Revised Component record an orphan ?
6491 
6492            IF NOT l_item_parent_exists
6493            THEN
6494 
6495                 -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
6496                 --
6497 
6498                 ENG_Validate_ECO.Check_Access
6499                 (  p_change_notice      => l_rev_component_rec.ECO_Name
6500                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
6501                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
6502                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
6503                 , x_Return_Status       => l_return_status
6504                 );
6505 
6506                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6507 
6508                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6509                 THEN
6510                         l_other_message := 'BOM_CMP_ECOACC_FAT_FATAL';
6511                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6512                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6513                         l_return_status := 'F';
6514                         RAISE EXC_FAT_QUIT_OBJECT;
6515                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6516                 THEN
6517                         l_other_message := 'BOM_CMP_ECOACC_UNEXP_SKIP';
6518                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6519                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6520                         RAISE EXC_UNEXP_SKIP_OBJECT;
6521                 END IF;
6522 
6523                 -- Process Flow step 9(a and b): check that user has access to revised item
6524                 --
6525 
6526                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
6527                 ENG_Validate_Revised_Item.Check_Access
6528                 (  p_change_notice      => l_rev_component_rec.ECO_Name
6529                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
6530                 ,  p_revised_item_id    => l_rev_comp_unexp_rec.revised_item_id
6531                 ,  p_new_item_revision  => l_rev_component_rec.new_revised_item_revision
6532                 ,  p_effectivity_date   => l_rev_component_rec.start_effective_date
6533                 ,  p_new_routing_revsion   => l_rev_component_rec.new_routing_revision  -- Added by MK on 11/02/00
6534                 ,  p_from_end_item_number  => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
6535                 ,  p_revised_item_name  => l_rev_component_rec.revised_item_name
6536                 ,  p_entity_processed   => 'RC'
6537                 ,  p_alternate_bom_code => l_rev_component_rec.alternate_bom_code -- Bug 4210718
6538                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6539                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6540                 ,  x_return_status      => l_Return_Status
6541                 );
6542 
6543                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6544                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6545                 THEN
6546                         l_other_message := 'BOM_CMP_RITACC_FAT_FATAL';
6547                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6548                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6549                         l_return_status := 'F';
6550                         RAISE EXC_FAT_QUIT_SIBLINGS;
6551                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6552                 THEN
6553                         l_other_message := 'BOM_CMP_RITACC_UNEXP_SKIP';
6554                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6555                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6556                         RAISE EXC_UNEXP_SKIP_OBJECT;
6557                 END IF;
6558 
6559                 -- Process Flow step 10: check that user has access to revised component
6560                 --
6561 
6562                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
6563                 Bom_Validate_Bom_Component.Check_Access
6564                 (  p_change_notice      => l_rev_component_rec.ECO_Name
6565                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
6566                 ,  p_revised_item_id    => l_rev_comp_unexp_rec.revised_item_id
6567                 ,  p_new_item_revision  => l_rev_component_rec.new_revised_item_revision
6568                 ,  p_effectivity_date   => l_rev_component_rec.start_effective_date
6569                 ,  p_new_routing_revsion  => l_rev_component_rec.new_routing_revision -- Added by MK on 11/02/00
6570                 ,  p_from_end_item_number => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
6571                 ,  p_revised_item_name  => l_rev_component_rec.revised_item_name
6572                 ,  p_component_item_id  => l_rev_comp_unexp_rec.component_item_id
6573                 ,  p_operation_seq_num  => l_rev_component_rec.operation_sequence_number
6574                 ,  p_bill_sequence_id   => l_rev_comp_unexp_rec.bill_sequence_id
6575                 ,  p_component_name     => l_rev_component_rec.component_item_name
6576                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6577                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6578                 ,  x_return_status      => l_Return_Status
6579                 );
6580 
6581                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6582 
6583                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6584                 THEN
6585                         l_other_message := 'BOM_CMP_ACCESS_FAT_FATAL';
6586                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6587                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6588                         l_return_status := 'F';
6589                         RAISE EXC_FAT_QUIT_BRANCH;
6590                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6591                 THEN
6592                         l_other_message := 'BOM_CMP_ACCESS_UNEXP_SKIP';
6593                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6594                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6595                         RAISE EXC_UNEXP_SKIP_OBJECT;
6596                 END IF;
6597 
6598            ELSE
6599            -- Bug No: 5246049
6600            -- Structure policy check should happen even if parent exists
6601                 l_structure_type_id := NULL;
6602                 l_strc_cp_not_allowed := 2;
6603 
6604                 ENG_Validate_Revised_Item.Check_Structure_Type_Policy
6605                     ( p_inventory_item_id   => l_rev_comp_unexp_rec.revised_item_id
6606                     , p_organization_id     => l_rev_comp_unexp_rec.organization_id
6607                     , p_alternate_bom_code  => l_rev_component_rec.alternate_bom_code
6608                     , x_structure_type_id   => l_structure_type_id
6609                     , x_strc_cp_not_allowed => l_strc_cp_not_allowed
6610                     );
6611                 IF l_strc_cp_not_allowed = 1
6612                 THEN
6613                         l_return_status := Error_Handler.G_STATUS_ERROR ;
6614                         l_Token_Tbl.DELETE;
6615                         l_Token_Tbl(1).token_name := 'STRUCTURE_NAME';
6616                         l_Token_Tbl(1).token_value := l_rev_component_rec.alternate_bom_code;
6617 
6618                         Error_Handler.Add_Error_Token
6619                         ( p_message_name       => 'ENG_BILL_CHANGES_NOT_ALLOWED'
6620                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
6621                         , p_token_tbl          => l_Token_Tbl
6622                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6623                         );
6624 
6625                         l_other_message := 'BOM_CMP_QRY_CSEV_SKIP';
6626                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6627                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6628                         RAISE EXC_SEV_SKIP_BRANCH;
6629                 END IF;
6630 
6631 
6632            END IF;
6633 
6634            -- Process Flow step 11: Value to Id conversions
6635            --
6636 
6637            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-id conversions'); END IF;
6638            Bom_Val_To_Id.Rev_Component_VID
6639                 ( x_Return_Status       => l_return_status
6640                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
6641                 , p_rev_comp_unexp_Rec  => l_rev_comp_unexp_rec
6642                 , x_rev_comp_unexp_Rec  => l_rev_comp_unexp_rec
6643                 , p_rev_component_Rec   => l_rev_component_rec
6644                 );
6645 
6646            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6647 
6648            IF l_return_status = Error_Handler.G_STATUS_ERROR
6649            THEN
6650                 IF l_rev_component_rec.transaction_type = 'CREATE'
6651                 THEN
6652                         l_other_message := 'BOM_CMP_VID_CSEV_SKIP';
6653                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6654                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6655                         RAISE EXC_SEV_SKIP_BRANCH;
6656                 ELSE
6657                         RAISE EXC_SEV_QUIT_RECORD;
6658                 END IF;
6659            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6660            THEN
6661                 l_other_message := 'BOM_CMP_VID_UNEXP_SKIP';
6662                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6663                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6664                 RAISE EXC_UNEXP_SKIP_OBJECT;
6665            ELSIF l_return_status ='S' AND
6666                 l_Mesg_Token_Tbl.COUNT <>0
6667            THEN
6668                 Eco_Error_Handler.Log_Error
6669                 (  p_rev_component_tbl  => x_rev_component_tbl
6670                 ,  p_ref_designator_tbl => x_ref_designator_tbl
6671                 ,  p_sub_component_tbl  => x_sub_component_tbl
6672                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6673                 ,  p_error_status       => 'W'
6674                 ,  p_error_level        => 4
6675                 ,  p_entity_index       => I
6676                 ,  x_eco_rec            => l_eco_rec
6677                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6678                 ,  x_revised_item_tbl   => l_revised_item_tbl
6679                 ,  x_rev_component_tbl  => x_rev_component_tbl
6680                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6681                 ,  x_sub_component_tbl  => x_sub_component_tbl
6682                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6683                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6684                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6685                 );
6686            END IF;
6687 
6688            -- Process Flow step 12: Check required fields exist
6689            -- (also includes conditionally required fields)
6690            --
6691 
6692            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check required fields'); END IF;
6693            Bom_Validate_Bom_Component.Check_Required
6694                 ( x_return_status              => l_return_status
6695                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
6696                 , p_rev_component_rec          => l_rev_component_rec
6697                 );
6698 
6699            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6700 
6701            IF l_return_status = Error_Handler.G_STATUS_ERROR
6702            THEN
6703                 IF l_rev_component_rec.transaction_type = 'CREATE'
6704                 THEN
6705                         l_other_message := 'BOM_CMP_REQ_CSEV_SKIP';
6706                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6707                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6708                         RAISE EXC_SEV_SKIP_BRANCH;
6709                 ELSE
6710                         RAISE EXC_SEV_QUIT_RECORD;
6711                 END IF;
6712            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6713            THEN
6714                 l_other_message := 'BOM_CMP_REQ_UNEXP_SKIP';
6715                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6716                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6717                 RAISE EXC_UNEXP_SKIP_OBJECT;
6718            ELSIF l_return_status ='S' AND
6719                 l_Mesg_Token_Tbl.COUNT <>0
6720            THEN
6721                 Eco_Error_Handler.Log_Error
6722                 (  p_rev_component_tbl  => x_rev_component_tbl
6723                 ,  p_ref_designator_tbl => x_ref_designator_tbl
6724                 ,  p_sub_component_tbl  => x_sub_component_tbl
6725                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
6726                 ,  p_error_status       => 'W'
6727                 ,  p_error_level        => 4
6728                 ,  p_entity_index       => I
6729                 ,  x_eco_rec            => l_eco_rec
6730                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
6731                 ,  x_revised_item_tbl   => l_revised_item_tbl
6732                 ,  x_rev_component_tbl  => x_rev_component_tbl
6733                 ,  x_ref_designator_tbl => x_ref_designator_tbl
6734                 ,  x_sub_component_tbl  => x_sub_component_tbl
6735                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6736                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6737                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6738                 );
6739            END IF;
6740 
6741            -- Process Flow step 13: Attribute Validation for CREATE and UPDATE
6742            --
6743 
6744            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
6745            IF l_rev_component_rec.Transaction_Type IN
6746                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
6747            THEN
6748                 Bom_Validate_Bom_Component.Check_Attributes
6749                 ( x_return_status              => l_return_status
6750                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
6751                 , p_rev_component_rec          => l_rev_component_rec
6752                 , p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
6753                 );
6754 
6755                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6756 
6757                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6758                 THEN
6759                    IF l_rev_component_rec.transaction_type = 'CREATE'
6760                    THEN
6761                         l_other_message := 'BOM_CMP_ATTVAL_CSEV_SKIP';
6762                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6763                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6764                         RAISE EXC_SEV_QUIT_BRANCH;
6765                    ELSE
6766                         RAISE EXC_SEV_QUIT_RECORD;
6767                    END IF;
6768                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6769                 THEN
6770                    l_other_message := 'BOM_CMP_ATTVAL_UNEXP_SKIP';
6771                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6772                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6773                    RAISE EXC_UNEXP_SKIP_OBJECT;
6774                 ELSIF l_return_status ='S' AND
6775                       l_Mesg_Token_Tbl.COUNT <>0
6776                 THEN
6777                    Eco_Error_Handler.Log_Error
6778                         (  p_rev_component_tbl  => x_rev_component_tbl
6779                         ,  p_ref_designator_tbl => x_ref_designator_tbl
6780                         ,  p_sub_component_tbl  => x_sub_component_tbl
6781                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
6782                         ,  p_error_status       => 'W'
6783                         ,  p_error_level        => 4
6784                         ,  p_entity_index       => I
6785                         ,  x_eco_rec            => l_eco_rec
6786                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
6787                         ,  x_revised_item_tbl   => l_revised_item_tbl
6788                         ,  x_rev_component_tbl  => x_rev_component_tbl
6789                         ,  x_ref_designator_tbl => x_ref_designator_tbl
6790                         ,  x_sub_component_tbl  => x_sub_component_tbl
6791                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6792                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6793                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6794                         );
6795                 END IF;
6796            END IF;
6797 
6798            IF (l_rev_component_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
6799                AND l_rev_component_rec.acd_type IN ( 2, 3 ))
6800            THEN
6801 
6802                 Bom_Bom_Component_Util.Query_Row
6803                    ( p_component_item_id
6804                                 => l_rev_comp_unexp_rec.component_item_id
6805                    , p_operation_sequence_number
6806                                 => l_rev_component_rec.old_operation_sequence_number
6807                    , p_effectivity_date
6808                                 => l_rev_component_rec.old_effectivity_date
6809                    , p_from_end_item_number
6810                                => l_rev_component_rec.old_from_end_item_unit_number
6811                    , p_bill_sequence_id
6812                                 => l_rev_comp_unexp_rec.bill_sequence_id
6813                    , x_Rev_Component_Rec
6814                                 => l_old_rev_component_rec
6815                    , x_Rev_Comp_Unexp_Rec
6816                                 => l_old_rev_comp_unexp_rec
6817                    , x_return_status
6818                                 => l_return_status
6819                    , p_mesg_token_tbl   =>
6820                         l_mesg_token_tbl
6821                    , x_mesg_token_tbl   => l_mesg_token_tbl
6822                    );
6823 
6824                 IF l_return_status <> Eng_Globals.G_RECORD_FOUND
6825                 THEN
6826                         l_return_status := Error_Handler.G_STATUS_ERROR ;
6827                         l_Token_Tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6828                         l_Token_Tbl(1).token_value := l_rev_component_rec.component_item_name;
6829 
6830                         Error_Handler.Add_Error_Token
6831                         ( p_message_name       => 'ENG_CMP_CREATE_REC_NOT_FOUND' --'BOM_CMP_CREATE_REC_NOT_FOUND' -- Bug 3612008 :Modified incorrect message_name
6832                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
6833                         , p_token_tbl          => l_Token_Tbl
6834                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
6835                         );
6836 
6837                         l_other_message := 'BOM_CMP_QRY_CSEV_SKIP';
6838                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6839                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6840                         RAISE EXC_SEV_SKIP_BRANCH;
6841                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6842                 THEN
6843                         l_other_message := 'BOM_CMP_QRY_UNEXP_SKIP';
6844                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6845                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6846                    RAISE EXC_UNEXP_SKIP_OBJECT;
6847                 END IF;
6848             END IF;
6849 
6850             -- Process flow step 15 - Populate NULL columns for Update and
6851             -- Delete, and Creates with ACD_Type 'Add'.
6852 
6853             IF (l_rev_component_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
6854                 AND l_rev_component_rec.acd_type = 2)
6855                OR
6856                l_rev_component_rec.transaction_type IN (ENG_GLOBALS.G_OPR_UPDATE,
6857                                                         ENG_GLOBALS.G_OPR_DELETE)
6858             THEN
6859                     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populate NULL columns'); END IF;
6860                     Bom_Default_Bom_Component.Populate_Null_Columns
6861                     (   p_rev_component_rec     => l_rev_Component_Rec
6862                     ,   p_old_rev_Component_Rec => l_old_rev_Component_Rec
6863                     ,   p_rev_comp_unexp_rec    => l_rev_comp_unexp_rec
6864                     ,   p_old_rev_comp_unexp_rec=> l_old_rev_comp_unexp_rec
6865                     ,   x_rev_Component_Rec     => l_rev_Component_Rec
6866                     ,   x_rev_comp_unexp_rec    => l_rev_comp_unexp_rec
6867                     );
6868 
6869            ELSIF l_rev_component_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
6870 
6871                 -- Process Flow step 16: Default missing values for Operation CREATE
6872                 --
6873 
6874                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
6875                 Bom_Default_Bom_Component.Attribute_Defaulting
6876                 (   p_rev_component_rec         => l_rev_component_rec
6877                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
6878                 ,   x_rev_component_rec         => l_rev_component_rec
6879                 ,   x_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
6880                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
6881                 ,   x_return_status             => l_return_status
6882                 );
6883 
6884                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6885 
6886                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6887                 THEN
6888                         l_other_message := 'BOM_CMP_ATTDEF_CSEV_SKIP';
6889                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6890                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6891                         RAISE EXC_SEV_SKIP_BRANCH;
6892                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6893                 THEN
6894                         l_other_message := 'BOM_CMP_ATTDEF_UNEXP_SKIP';
6895                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6896                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6897                         RAISE EXC_UNEXP_SKIP_OBJECT;
6898                 ELSIF l_return_status ='S' AND
6899                         l_Mesg_Token_Tbl.COUNT <>0
6900                 THEN
6901                         Eco_Error_Handler.Log_Error
6902                         (  p_rev_component_tbl  => x_rev_component_tbl
6903                         ,  p_ref_designator_tbl => x_ref_designator_tbl
6904                         ,  p_sub_component_tbl  => x_sub_component_tbl
6905                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
6906                         ,  p_error_status       => 'W'
6907                         ,  p_error_level        => 4
6908                         ,  p_entity_index       => I
6909                         ,  x_eco_rec            => l_eco_rec
6910                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
6911                         ,  x_revised_item_tbl   => l_revised_item_tbl
6912                         ,  x_rev_component_tbl  => x_rev_component_tbl
6913                         ,  x_ref_designator_tbl => x_ref_designator_tbl
6914                         ,  x_sub_component_tbl  => x_sub_component_tbl
6915                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6916                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6917                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6918                         );
6919                 END IF;
6920            END IF;
6921 
6922            -- Process Flow step 17: Entity defaulting for CREATE and UPDATE
6923            --
6924 
6925            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting'); END IF;
6926            IF l_rev_component_rec.Transaction_Type IN
6927                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
6928            THEN
6929                 Bom_Default_Bom_Component.Entity_Defaulting
6930                 (   p_rev_component_rec         => l_rev_component_rec
6931                 ,   p_old_rev_component_rec     => l_old_rev_component_rec
6932                 ,   x_rev_component_rec         => l_rev_component_rec
6933                 );
6934 
6935                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6936 
6937                 IF l_return_status = Error_Handler.G_STATUS_ERROR
6938                 THEN
6939                    IF l_rev_component_rec.transaction_type = 'CREATE'
6940                    THEN
6941                         l_other_message := 'BOM_CMP_ENTDEF_CSEV_SKIP';
6942                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6943                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6944                         RAISE EXC_SEV_SKIP_BRANCH;
6945                    ELSE
6946                         RAISE EXC_SEV_QUIT_RECORD;
6947                    END IF;
6948                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
6949                 THEN
6950                         l_other_message := 'BOM_CMP_ENTDEF_UNEXP_SKIP';
6951                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6952                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
6953                         RAISE EXC_UNEXP_SKIP_OBJECT;
6954                 ELSIF l_return_status ='S' AND
6955                         l_Mesg_Token_Tbl.COUNT <>0
6956                 THEN
6957                         Eco_Error_Handler.Log_Error
6958                         (  p_rev_component_tbl  => x_rev_component_tbl
6959                         ,  p_ref_designator_tbl => x_ref_designator_tbl
6960                         ,  p_sub_component_tbl  => x_sub_component_tbl
6961                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
6962                         ,  p_error_status       => 'W'
6963                         ,  p_error_level        => 4
6964                         ,  p_entity_index       => I
6965                         ,  x_eco_rec            => l_eco_rec
6966                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
6967                         ,  x_revised_item_tbl   => l_revised_item_tbl
6968                         ,  x_rev_component_tbl  => x_rev_component_tbl
6969                         ,  x_ref_designator_tbl => x_ref_designator_tbl
6970                         ,  x_sub_component_tbl  => x_sub_component_tbl
6971                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
6972                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
6973                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
6974                         );
6975                 END IF;
6976            END IF;
6977 
6978            -- Process Flow step 18 - Entity Level Validation
6979            --
6980 
6981            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
6982            Bom_Validate_Bom_Component.Check_Entity
6983                 (  p_rev_component_rec          => l_rev_component_rec
6984                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
6985                 ,  p_old_rev_component_rec      => l_old_rev_component_rec
6986                 ,  p_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
6987                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
6988                 ,  x_return_status              => l_Return_Status
6989                 );
6990 
6991            --IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
6992 
6993            IF l_return_status = Error_Handler.G_STATUS_ERROR
6994            THEN
6995                 IF l_rev_component_rec.transaction_type = 'CREATE'
6996                 THEN
6997                         l_other_message := 'BOM_CMP_ENTVAL_CSEV_SKIP';
6998                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
6999                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7000                         RAISE EXC_SEV_QUIT_BRANCH;
7001                 ELSE
7002                         RAISE EXC_SEV_QUIT_RECORD;
7003                 END IF;
7004            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7005            THEN
7006                 l_other_message := 'BOM_CMP_ENTVAL_UNEXP_SKIP';
7007                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7008                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7009                 RAISE EXC_UNEXP_SKIP_OBJECT;
7010            ELSIF l_return_status ='S' AND
7011                 l_Mesg_Token_Tbl.COUNT <>0
7012            THEN
7013                 Eco_Error_Handler.Log_Error
7014                 (  p_rev_component_tbl  => x_rev_component_tbl
7015                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7016                 ,  p_sub_component_tbl  => x_sub_component_tbl
7017                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7018                 ,  p_error_status       => 'W'
7019                 ,  p_error_level        => 4
7020                 ,  p_entity_index       => I
7021                 ,  x_eco_rec            => l_eco_rec
7022                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7023                 ,  x_revised_item_tbl   => l_revised_item_tbl
7024                 ,  x_rev_component_tbl  => x_rev_component_tbl
7025                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7026                 ,  x_sub_component_tbl  => x_sub_component_tbl
7027                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7028                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7029                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7030                 );
7031            END IF;
7032 
7033            -- Process Flow step 16 : Database Writes
7034            --
7035 
7036            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
7037            Bom_Bom_Component_Util.Perform_Writes
7038                 (   p_rev_component_rec         => l_rev_component_rec
7039                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
7040                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
7041                 ,   x_return_status             => l_return_status
7042                 );
7043 
7044            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7045 
7046            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7047            THEN
7048                 l_other_message := 'BOM_CMP_WRITES_UNEXP_SKIP';
7049                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7050                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7051                 RAISE EXC_UNEXP_SKIP_OBJECT;
7052            ELSIF l_return_status ='S' AND
7053               l_Mesg_Token_Tbl.COUNT <>0
7054            THEN
7055                 Eco_Error_Handler.Log_Error
7056                 (  p_rev_component_tbl  => x_rev_component_tbl
7057                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7058                 ,  p_sub_component_tbl  => x_sub_component_tbl
7059                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7060                 ,  p_error_status       => 'W'
7061                 ,  p_error_level        => 4
7062                 ,  p_entity_index       => I
7063                 ,  x_eco_rec            => l_eco_rec
7064                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7065                 ,  x_revised_item_tbl   => l_revised_item_tbl
7066                 ,  x_rev_component_tbl  => x_rev_component_tbl
7067                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7068                 ,  x_sub_component_tbl  => x_sub_component_tbl
7069                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7070                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7071                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7072                 );
7073            END IF;
7074 
7075 
7076                 -- END IF; -- END IF statement that checks RETURN STATUS
7077 
7078                 --  Load tables.
7079 
7080                 x_rev_component_tbl(I)          := l_rev_component_rec;
7081 
7082                 -- Indicate that children need to be processed
7083 
7084                 l_process_children := TRUE;
7085                 -- END IF;
7086 
7087 
7088         ELSE
7089 
7090 
7091 IF Bom_Globals.Get_Debug = 'Y' THEN
7092     Error_Handler.Write_Debug('This record does not patch with the parent that called it . . .  ') ;
7093     Error_Handler.Write_Debug('so may be this is an comp in another branch . . . '
7094                                || l_rev_component_rec.component_item_name ) ;
7095 END IF ;
7096 
7097                 l_process_children := FALSE;
7098 
7099         END IF; -- END IF statement that checks RETURN STATUS
7100 
7101 
7102     --  For loop exception handler.
7103 
7104 
7105     EXCEPTION
7106 
7107        WHEN EXC_SEV_QUIT_RECORD THEN
7108 
7109         Eco_Error_Handler.Log_Error
7110                 (  p_rev_component_tbl  => x_rev_component_tbl
7111                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7112                 ,  p_sub_component_tbl  => x_sub_component_tbl
7113                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7114                 ,  p_error_status       => FND_API.G_RET_STS_ERROR
7115                 ,  p_error_scope        => Error_Handler.G_SCOPE_RECORD
7116                 ,  p_error_level        => 4
7117                 ,  p_entity_index       => I
7118                 ,  x_eco_rec            => l_eco_rec
7119                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7120                 ,  x_revised_item_tbl   => l_revised_item_tbl
7121                 ,  x_rev_component_tbl  => x_rev_component_tbl
7122                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7123                 ,  x_sub_component_tbl  => x_sub_component_tbl
7124                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7125                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7126                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7127                 );
7128 
7129         l_process_children := TRUE;
7130 
7131         IF l_bo_return_status = 'S'
7132         THEN
7133                 l_bo_return_status     := l_return_status;
7134         END IF;
7135         x_return_status                := l_bo_return_status;
7136         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7137         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7138         --x_rev_component_tbl            := l_rev_component_tbl;
7139         --x_ref_designator_tbl           := l_ref_designator_tbl;
7140         --x_sub_component_tbl            := l_sub_component_tbl;
7141 
7142        WHEN EXC_SEV_QUIT_BRANCH THEN
7143 
7144         Eco_Error_Handler.Log_Error
7145                 (  p_rev_component_tbl  => x_rev_component_tbl
7146                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7147                 ,  p_sub_component_tbl  => x_sub_component_tbl
7148                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7149                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
7150                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
7151                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
7152                 ,  p_other_message      => l_other_message
7153                 ,  p_other_token_tbl    => l_other_token_tbl
7154                 ,  p_error_level        => 4
7155                 ,  p_entity_index       => I
7156                 ,  x_eco_rec            => l_eco_rec
7157                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7158                 ,  x_revised_item_tbl   => l_revised_item_tbl
7159                 ,  x_rev_component_tbl  => x_rev_component_tbl
7160                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7161                 ,  x_sub_component_tbl  => x_sub_component_tbl
7162                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7163                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7164                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7165                 );
7166 
7167         l_process_children := FALSE;
7168 
7169         IF l_bo_return_status = 'S'
7170         THEN
7171                 l_bo_return_status     := l_return_status;
7172         END IF;
7173         x_return_status                := l_bo_return_status;
7174         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7175         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7176         --x_rev_component_tbl            := l_rev_component_tbl;
7177         --x_ref_designator_tbl           := l_ref_designator_tbl;
7178         --x_sub_component_tbl            := l_sub_component_tbl;
7179 
7180        WHEN EXC_SEV_SKIP_BRANCH THEN
7181 
7182         Eco_Error_Handler.Log_Error
7183                 (  p_rev_component_tbl  => x_rev_component_tbl
7184                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7185                 ,  p_sub_component_tbl  => x_sub_component_tbl
7186                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7187                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
7188                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
7189                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
7190                 ,  p_other_message      => l_other_message
7191                 ,  p_other_token_tbl    => l_other_token_tbl
7192                 ,  p_error_level        => 4
7193                 ,  p_entity_index       => I
7194                 ,  x_eco_rec            => l_eco_rec
7195                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7196                 ,  x_revised_item_tbl   => l_revised_item_tbl
7197                 ,  x_rev_component_tbl  => x_rev_component_tbl
7198                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7199                 ,  x_sub_component_tbl  => x_sub_component_tbl
7200                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7201                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7202                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7203                 );
7204 
7205         l_process_children := FALSE;
7206 
7207         IF l_bo_return_status = 'S'
7208         THEN
7209                 l_bo_return_status     := l_return_status;
7210         END IF;
7211         x_return_status                := l_bo_return_status;
7212         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7213         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7214         --x_rev_component_tbl            := l_rev_component_tbl;
7215         --x_ref_designator_tbl           := l_ref_designator_tbl;
7216         --x_sub_component_tbl            := l_sub_component_tbl;
7217 
7218        WHEN EXC_SEV_QUIT_SIBLINGS THEN
7219 
7220         Eco_Error_Handler.Log_Error
7221                 (  p_rev_component_tbl  => x_rev_component_tbl
7222                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7223                 ,  p_sub_component_tbl  => x_sub_component_tbl
7224                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7225                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
7226                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
7227                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
7228                 ,  p_other_message      => l_other_message
7229                 ,  p_other_token_tbl    => l_other_token_tbl
7230                 ,  p_error_level        => 4
7231                 ,  p_entity_index       => I
7232                 ,  x_eco_rec            => l_eco_rec
7233                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7234                 ,  x_revised_item_tbl   => l_revised_item_tbl
7235                 ,  x_rev_component_tbl  => x_rev_component_tbl
7236                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7237                 ,  x_sub_component_tbl  => x_sub_component_tbl
7238                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7239                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7240                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7241                 );
7242 
7243         l_process_children := FALSE;
7244 
7245         IF l_bo_return_status = 'S'
7246         THEN
7247                 l_bo_return_status     := l_return_status;
7248         END IF;
7249         x_return_status                := l_bo_return_status;
7250         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7251         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7252         --x_rev_component_tbl            := l_rev_component_tbl;
7253         --x_ref_designator_tbl           := l_ref_designator_tbl;
7254         --x_sub_component_tbl            := l_sub_component_tbl;
7255 
7256        WHEN EXC_FAT_QUIT_BRANCH THEN
7257 
7258         Eco_Error_Handler.Log_Error
7259                 (  p_rev_component_tbl  => x_rev_component_tbl
7260                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7261                 ,  p_sub_component_tbl  => x_sub_component_tbl
7262                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7263                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
7264                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
7265                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
7266                 ,  p_other_message      => l_other_message
7267                 ,  p_other_token_tbl    => l_other_token_tbl
7268                 ,  p_error_level        => 4
7269                 ,  p_entity_index       => I
7270                 ,  x_eco_rec            => l_eco_rec
7271                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7272                 ,  x_revised_item_tbl   => l_revised_item_tbl
7273                 ,  x_rev_component_tbl  => x_rev_component_tbl
7274                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7275                 ,  x_sub_component_tbl  => x_sub_component_tbl
7276                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7277                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7278                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7279                 );
7280 
7281         l_process_children := FALSE;
7282 
7283         x_return_status                := Error_Handler.G_STATUS_FATAL;
7284         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7285         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7286         --x_rev_component_tbl            := l_rev_component_tbl;
7287         --x_ref_designator_tbl           := l_ref_designator_tbl;
7288         --x_sub_component_tbl            := l_sub_component_tbl;
7289 
7290        WHEN EXC_FAT_QUIT_SIBLINGS THEN
7291 
7292         Eco_Error_Handler.Log_Error
7293                 (  p_rev_component_tbl  => x_rev_component_tbl
7294                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7295                 ,  p_sub_component_tbl  => x_sub_component_tbl
7296                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7297                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
7298                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
7299                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
7300                 ,  p_other_message      => l_other_message
7301                 ,  p_other_token_tbl    => l_other_token_tbl
7302                 ,  p_error_level        => 4
7303                 ,  p_entity_index       => I
7304                 ,  x_eco_rec            => l_eco_rec
7305                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7306                 ,  x_revised_item_tbl   => l_revised_item_tbl
7307                 ,  x_rev_component_tbl  => x_rev_component_tbl
7308                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7309                 ,  x_sub_component_tbl  => x_sub_component_tbl
7310                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7311                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7312                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7313                 );
7314 
7315         l_process_children := FALSE;
7316 
7317         IF l_bo_return_status = 'S'
7318         THEN
7319                 l_bo_return_status     := l_return_status;
7320         END IF;
7321         x_return_status                := Error_Handler.G_STATUS_FATAL;
7322         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7323         x_rev_comp_unexp_rec           := l_rev_comp_unexp_rec;
7324         --x_rev_component_tbl            := l_rev_component_tbl;
7325         --x_ref_designator_tbl           := l_ref_designator_tbl;
7326         --x_sub_component_tbl            := l_sub_component_tbl;
7327        WHEN EXC_FAT_QUIT_OBJECT THEN
7328 
7329         Eco_Error_Handler.Log_Error
7330                 (  p_rev_component_tbl  => x_rev_component_tbl
7331                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7332                 ,  p_sub_component_tbl  => x_sub_component_tbl
7333                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7334                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
7335                 ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
7336                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
7337                 ,  p_other_message      => l_other_message
7338                 ,  p_other_token_tbl    => l_other_token_tbl
7339                 ,  p_error_level        => 4
7340                 ,  p_entity_index       => I
7341                 ,  x_eco_rec            => l_eco_rec
7342                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7343                 ,  x_revised_item_tbl   => l_revised_item_tbl
7344                 ,  x_rev_component_tbl  => x_rev_component_tbl
7345                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7346                 ,  x_sub_component_tbl  => x_sub_component_tbl
7347                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7348                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7349                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7350                 );
7351 
7352         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7353         --x_rev_component_tbl            := l_rev_component_tbl;
7354         --x_ref_designator_tbl           := l_ref_designator_tbl;
7355         --x_sub_component_tbl            := l_sub_component_tbl;
7356 
7357         l_return_status := 'Q';
7358 
7359        WHEN EXC_UNEXP_SKIP_OBJECT THEN
7360 
7361 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Unexpected error caught in Rev Comps . . . '); END IF;
7362 
7363         Eco_Error_Handler.Log_Error
7364                 (  p_rev_component_tbl  => x_rev_component_tbl
7365                 ,  p_ref_designator_tbl => x_ref_designator_tbl
7366                 ,  p_sub_component_tbl  => x_sub_component_tbl
7367                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
7368                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
7369                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
7370                 ,  p_other_message      => l_other_message
7371                 ,  p_other_token_tbl    => l_other_token_tbl
7372                 ,  p_error_level        => 4
7373                 ,  p_entity_index       => I
7374                 ,  x_ECO_rec            => l_ECO_rec
7375                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
7376                 ,  x_revised_item_tbl   => l_revised_item_tbl
7377                 ,  x_rev_component_tbl  => x_rev_component_tbl
7378                 ,  x_ref_designator_tbl => x_ref_designator_tbl
7379                 ,  x_sub_component_tbl  => x_sub_component_tbl
7380                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
7381                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
7382                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
7383                 );
7384 
7385         --x_rev_component_tbl            := l_rev_component_tbl;
7386         --x_ref_designator_tbl           := l_ref_designator_tbl;
7387         --x_sub_component_tbl            := l_sub_component_tbl;
7388         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
7389 
7390         l_return_status := 'U';
7391 
7392 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Unexpected error in Rev Comps . . .'); END IF;
7393 
7394         END; -- END block
7395 
7396         IF l_return_status in ('Q', 'U')
7397         THEN
7398                 x_return_status := l_return_status;
7399 
7400 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Rev Comps returning with status ' || l_return_status ); END IF;
7401 
7402                 RETURN;
7403         END IF;
7404 
7405    IF l_process_children
7406    THEN
7407         -- Process Reference Designators that are direct children of this
7408         -- component
7409 
7410 IF Bom_Globals.Get_Debug = 'Y' THEN
7411     Error_Handler.Write_Debug('***********************************************************') ;
7412     Error_Handler.Write_Debug('Now processing direct children for the Rev Comp '
7413                               || l_rev_component_rec.component_item_name || '. . .'  );
7414     Error_Handler.Write_Debug('Now processing Ref Desig as direct children for the Rev Comp ') ;
7415 END IF;
7416 
7417 
7418         Ref_Desgs
7419         (   p_validation_level          => p_validation_level
7420         ,   p_change_notice             => l_rev_component_rec.ECO_Name
7421         ,   p_organization_id           => l_rev_comp_unexp_rec.organization_id
7422         ,   p_revised_item_name         => l_rev_component_rec.revised_item_name
7423         ,   p_alternate_bom_code        => l_rev_component_rec.alternate_bom_code  -- Bug 3991176
7424         ,   p_effectivity_date          => l_rev_component_rec.start_effective_date
7425         ,   p_item_revision             => l_rev_component_rec.new_revised_item_revision
7426         ,   p_routing_revision          => l_rev_component_rec.new_routing_revision      -- Added by MK on 11/02/00
7427         ,   p_from_end_item_number      => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
7428         ,   p_component_item_name       => l_rev_component_rec.component_item_name
7429         ,   p_operation_seq_num         => l_rev_component_rec.operation_sequence_number
7430         ,   p_ref_designator_tbl        => x_ref_designator_tbl
7431         ,   p_sub_component_tbl         => x_sub_component_tbl
7432         ,   x_ref_designator_tbl        => x_ref_designator_tbl
7433         ,   x_sub_component_tbl         => x_sub_component_tbl
7434         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
7435         ,   x_return_status             => l_return_status
7436         );
7437 
7438         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
7439         THEN
7440                 l_bo_return_status := l_return_status;
7441         END IF;
7442 
7443         -- Process Substitute Components that are direct children of this
7444         -- component
7445 
7446 IF Bom_Globals.Get_Debug = 'Y' THEN
7447     Error_Handler.Write_Debug('***********************************************************') ;
7448     Error_Handler.Write_Debug('Now processing Ref Desig as direct children for the Rev Comp ') ;
7449 END IF ;
7450 
7451         Sub_Comps
7452         (   p_validation_level          => p_validation_level
7453         ,   p_change_notice             => l_rev_component_rec.ECO_Name
7454         ,   p_organization_id           => l_rev_comp_unexp_rec.organization_id
7455         ,   p_revised_item_name         => l_rev_component_rec.revised_item_name
7456         ,   p_alternate_bom_code        => l_rev_component_rec.alternate_bom_code  -- Bug 3991176
7457         ,   p_effectivity_date          => l_rev_component_rec.start_effective_date
7458         ,   p_item_revision             => l_rev_component_rec.new_revised_item_revision
7459         ,   p_routing_revision          => l_rev_component_rec.new_routing_revision      -- Added by MK on 11/02/00
7460         ,   p_from_end_item_number      => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
7461         ,   p_component_item_name       => l_rev_component_rec.component_item_name
7462         ,   p_operation_seq_num         => l_rev_component_rec.operation_sequence_number
7463         ,   p_sub_component_tbl         => x_sub_component_tbl
7464         ,   x_sub_component_tbl         => x_sub_component_tbl
7465         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
7466         ,   x_return_status             => l_return_status
7467         );
7468 
7469         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
7470         THEN
7471                 l_bo_return_status := l_return_status;
7472         END IF;
7473 
7474         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Finished processing children for ' || l_rev_component_rec.component_item_name || ' . . . ' || l_return_status ); END IF;
7475 
7476     END IF;  -- Process children
7477     x_return_status            := l_bo_return_status;
7478     x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
7479     x_rev_comp_unexp_rec       := l_rev_comp_unexp_rec;
7480 
7481 
7482 END Process_Rev_Comp;
7483 
7484 --  Rev_Comps
7485 
7486 PROCEDURE Rev_Comps
7487 (   p_validation_level              IN  NUMBER
7488 ,   p_change_notice                 IN  VARCHAR2 := NULL
7489 ,   p_organization_id               IN  NUMBER := NULL
7490 ,   p_revised_item_name             IN  VARCHAR2 := NULL
7491 ,   p_alternate_bom_code            IN  VARCHAR2 := NULL -- Bug 2429272 Change4(cont..of..ENGSVIDB.pls)
7492 ,   p_effectivity_date              IN  DATE := NULL
7493 ,   p_item_revision                 IN  VARCHAR2 := NULL
7494 ,   p_routing_revision              IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
7495 ,   p_from_end_item_number          IN  VARCHAR2 := NULL -- Added by MK on 11/02/00
7496 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
7497 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
7498 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
7499 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
7500 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
7501 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
7502 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
7503 ,   x_return_status                 OUT NOCOPY VARCHAR2
7504 -- Bug 2941096 // kamohan
7505 ,   x_bill_sequence_id           IN NUMBER := NULL
7506 )
7507 IS
7508 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
7509 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
7510 l_other_message         VARCHAR2(2000);
7511 l_err_text              VARCHAR2(2000);
7512 l_valid                 BOOLEAN := TRUE;
7513 l_item_parent_exists    BOOLEAN := FALSE;
7514 l_Return_Status         VARCHAR2(1);
7515 l_bo_return_status      VARCHAR2(1);
7516 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
7517 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
7518 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
7519 l_rev_component_rec     BOM_BO_PUB.Rev_Component_Rec_Type;
7520 --l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
7521 l_rev_comp_unexp_rec    BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
7522 l_old_rev_component_rec BOM_BO_PUB.Rev_Component_Rec_Type;
7523 l_old_rev_comp_unexp_rec BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type;
7524 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
7525 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
7526 l_return_value          NUMBER;
7527 l_process_children      BOOLEAN := TRUE;
7528 l_dummy                 NUMBER ;
7529 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
7530 l_structure_type_id     NUMBER ;
7531 l_strc_cp_not_allowed   NUMBER ;
7532 
7533 l_rev_operation_tbl      Bom_Rtg_Pub.Rev_Operation_Tbl_Type;
7534 l_rev_op_resource_tbl    Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;
7535 l_rev_sub_resource_tbl   Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;
7536 
7537 EXC_SEV_QUIT_RECORD     EXCEPTION;
7538 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
7539 EXC_SEV_QUIT_BRANCH     EXCEPTION;
7540 EXC_SEV_SKIP_BRANCH     EXCEPTION;
7541 EXC_FAT_QUIT_OBJECT     EXCEPTION;
7542 EXC_FAT_QUIT_SIBLINGS   EXCEPTION;
7543 EXC_FAT_QUIT_BRANCH     EXCEPTION;
7544 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
7545 
7546 BEGIN
7547 
7548     --  Init local table variables.
7549 
7550     l_return_status := FND_API.G_RET_STS_SUCCESS;
7551     l_bo_return_status := FND_API.G_RET_STS_SUCCESS;
7552 
7553     x_return_status := FND_API.G_RET_STS_SUCCESS;
7554 
7555     --l_rev_component_tbl            := p_rev_component_tbl;
7556     x_rev_component_tbl            := p_rev_component_tbl;
7557     x_ref_designator_tbl           := p_ref_designator_tbl;
7558     x_sub_component_tbl            := p_sub_component_tbl;
7559 
7560     l_rev_comp_unexp_rec.organization_id := ENG_GLOBALS.Get_org_id;
7561 
7562     FOR I IN 1..x_rev_component_tbl.COUNT LOOP
7563     IF (x_rev_component_tbl(I).return_status IS NULL OR
7564          x_rev_component_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
7565 
7566     BEGIN
7567 
7568         --
7569         --  Load local records.
7570         --
7571         l_rev_component_rec := x_rev_component_tbl(I);
7572 
7573         l_rev_component_rec.transaction_type :=
7574                 UPPER(l_rev_component_rec.transaction_type);
7575 
7576 
7577         --
7578         -- make sure to set process_children to false at the start of
7579         -- every iteration
7580         --
7581         l_process_children := FALSE;
7582 
7583         --
7584         -- Initialize the Unexposed Record for every iteration of the Loop
7585         -- so that sequence numbers get generated for every new row.
7586         --
7587         l_rev_comp_unexp_rec.Component_Item_Id          := NULL;
7588         l_rev_comp_unexp_rec.Old_Component_Sequence_Id  := NULL;
7589         l_rev_comp_unexp_rec.Component_Sequence_Id      := NULL;
7590         l_rev_comp_unexp_rec.Pick_Components            := NULL;
7591         l_rev_comp_unexp_rec.Supply_Locator_Id          := NULL;
7592         l_rev_comp_unexp_rec.Revised_Item_Sequence_Id   := NULL;
7593         l_rev_comp_unexp_rec.Bom_Item_Type              := NULL;
7594         l_rev_comp_unexp_rec.Revised_Item_Id            := NULL;
7595         l_rev_comp_unexp_rec.Include_On_Bill_Docs       := NULL;
7596 
7597 	-- Bug 2941096 // kamohan
7598 	-- Start changes
7599 
7600 	IF x_bill_sequence_id IS NOT NULL THEN
7601 		l_rev_comp_unexp_rec.Bill_Sequence_Id           := x_bill_sequence_id;
7602 	ELSE
7603 		l_rev_comp_unexp_rec.Bill_Sequence_Id           := NULL;
7604 	END IF;
7605 
7606 	-- End Changes
7607 
7608         IF p_revised_item_name IS NOT NULL AND
7609            p_effectivity_date IS NOT NULL AND
7610            p_change_notice IS NOT NULL AND
7611            p_organization_id IS NOT NULL
7612         THEN
7613                 -- revised item parent exists
7614 
7615                 l_item_parent_exists := TRUE;
7616         END IF;
7617 
7618         -- Process Flow Step 2: Check if record has not yet been processed and
7619         -- that it is the child of the parent that called this procedure
7620         --
7621 
7622         IF --(l_rev_component_rec.return_status IS NULL OR
7623             --l_rev_component_rec.return_status = FND_API.G_MISS_CHAR)
7624            --AND
7625 
7626             -- Did Rev_Items call this procedure, that is,
7627             -- if revised item exists, then is this record a child ?
7628 
7629             (NOT l_item_parent_exists
7630              OR
7631              (l_item_parent_exists AND
7632               (l_rev_component_rec.ECO_Name = p_change_notice AND
7633                l_rev_comp_unexp_rec.organization_id = p_organization_id AND
7634                l_rev_component_rec.revised_item_name = p_revised_item_name AND
7635                NVL(l_rev_component_rec.alternate_bom_code,'NULL') = NVL(p_alternate_bom_code,'NULL') AND
7636                                                                           -- Bug 2429272 Change 4
7637                l_rev_component_rec.start_effective_date = nvl(ENG_Default_Revised_Item.G_OLD_SCHED_DATE,p_effectivity_date) AND -- Bug 6657209
7638                NVL(l_rev_component_rec.new_routing_revision, FND_API.G_MISS_CHAR )
7639                                              =   NVL(p_routing_revision, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
7640                NVL(l_rev_component_rec.from_end_item_unit_number, FND_API.G_MISS_CHAR )
7641                                              =   NVL(p_from_end_item_number, FND_API.G_MISS_CHAR ) AND -- Added by MK on 11/02/00
7642                NVL(l_rev_component_rec.new_revised_item_revision, FND_API.G_MISS_CHAR )
7643                                              =   NVL(p_item_revision, FND_API.G_MISS_CHAR) )))
7644 
7645         THEN
7646 
7647            l_return_status := FND_API.G_RET_STS_SUCCESS;
7648 
7649            l_rev_component_rec.return_status := FND_API.G_RET_STS_SUCCESS;
7650 
7651            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing component: ' || l_rev_component_rec.component_item_name); END IF;
7652            -- Check if transaction_type is valid
7653            --
7654            -- Bug 6657209
7655            IF (l_item_parent_exists and ENG_Default_Revised_Item.G_OLD_SCHED_DATE is not null ) THEN
7656               l_rev_component_rec.start_effective_date := p_effectivity_date;
7657            END IF;
7658 
7659            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
7660            ENG_GLOBALS.Transaction_Type_Validity
7661            (   p_transaction_type       => l_rev_component_rec.transaction_type
7662            ,   p_entity                 => 'Rev_Comps'
7663            ,   p_entity_id              => l_rev_component_rec.revised_item_name
7664            ,   x_valid                  => l_valid
7665            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
7666            );
7667 
7668            IF NOT l_valid
7669            THEN
7670                 RAISE EXC_SEV_QUIT_RECORD;
7671            END IF;
7672 
7673            -- Process Flow step 4(a): Convert user unique index to unique index I
7674            --
7675 
7676            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index I'); END IF;
7677            Bom_Val_To_Id.Rev_Component_UUI_To_UI
7678                 ( p_rev_component_rec  => l_rev_component_rec
7679                 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
7680                 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
7681                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7682                 , x_Return_Status      => l_return_status
7683                 );
7684 
7685            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7686 
7687            IF l_return_status = Error_Handler.G_STATUS_ERROR
7688            THEN
7689                 l_other_message := 'BOM_CMP_UUI_SEV_ERROR';
7690                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7691                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7692                 RAISE EXC_SEV_QUIT_BRANCH;
7693            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7694            THEN
7695                 l_other_message := 'BOM_CMP_UUI_UNEXP_SKIP';
7696                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7697                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7698                 RAISE EXC_UNEXP_SKIP_OBJECT;
7699            END IF;
7700 
7701            -- Process Flow step 4(b): Convert user unique index to unique index II
7702            --
7703 
7704            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index II'); END IF;
7705            Bom_Val_To_Id.Rev_Component_UUI_To_UI2
7706                 ( p_rev_component_rec  => l_rev_component_rec
7707                 , p_rev_comp_unexp_rec => l_rev_comp_unexp_rec
7708                 , x_rev_comp_unexp_rec => l_rev_comp_unexp_rec
7709                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7710                 , x_other_message      => l_other_message
7711                 , x_other_token_tbl    => l_other_token_tbl
7712                 , x_Return_Status      => l_return_status
7713                 );
7714 
7715            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7716 
7717            IF l_return_status = Error_Handler.G_STATUS_ERROR
7718            THEN
7719                 RAISE EXC_SEV_QUIT_SIBLINGS;
7720            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7721            THEN
7722                 l_other_message := 'ENG_CMP_UUI_UNEXP_SKIP';
7723                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7724                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7725                 RAISE EXC_UNEXP_SKIP_OBJECT;
7726            END IF;
7727 
7728            IF Bom_Globals.Get_Debug = 'Y' THEN
7729            Error_Handler.Write_Debug('Converting user unique index to unique index II for Bill And Rev Seq Id');
7730            END IF;
7731 
7732            ENG_Val_To_Id.BillAndRevitem_UUI_To_UI
7733            ( p_revised_item_name        => l_rev_component_rec.revised_item_name
7734            , p_revised_item_id          => l_rev_comp_unexp_rec.revised_item_id
7735            , p_alternate_bom_code       => l_rev_component_rec.alternate_bom_code -- Bug 2429272 Change 4
7736            , p_item_revision            => l_rev_component_rec.new_revised_item_revision
7737            , p_effective_date           => l_rev_component_rec.start_effective_date
7738            , p_change_notice            => l_rev_component_rec.eco_name
7739            , p_organization_id          => l_rev_comp_unexp_rec.organization_id
7740            , p_new_routing_revision     => l_rev_component_rec.new_routing_revision
7741            , p_from_end_item_number     => l_rev_component_rec.from_end_item_unit_number
7742            , p_entity_processed         => 'RC'
7743            , p_component_item_name      => l_rev_component_rec.component_item_name
7744            , p_transaction_type         => l_rev_component_rec.transaction_type
7745            , x_revised_item_sequence_id => l_rev_comp_unexp_rec.revised_item_sequence_id
7746            , x_bill_sequence_id         => l_rev_comp_unexp_rec.bill_sequence_id
7747            , x_component_sequence_id    => l_dummy
7748            , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
7749            , x_other_message            => l_other_message
7750            , x_other_token_tbl          => l_other_token_tbl
7751            , x_Return_Status            => l_return_status
7752           ) ;
7753 
7754            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status) ;
7755            END IF;
7756 
7757            IF l_return_status = Error_Handler.G_STATUS_ERROR
7758            THEN
7759                 RAISE EXC_SEV_QUIT_SIBLINGS;
7760            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7761            THEN
7762                 l_other_message := 'ENG_CMP_UUI_UNEXP_SKIP';
7763                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7764                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7765                 RAISE EXC_UNEXP_SKIP_OBJECT;
7766            END IF;
7767 
7768 
7769            BOM_Globals.Set_Unit_Controlled_Item
7770            ( p_inventory_item_id => l_rev_comp_unexp_rec.revised_item_id
7771            , p_organization_id  => l_rev_comp_unexp_rec.organization_id
7772            );
7773 
7774            BOM_Globals.Set_Unit_Controlled_Component
7775            ( p_inventory_item_id => l_rev_comp_unexp_rec.component_item_id
7776            , p_organization_id  => l_rev_comp_unexp_rec.organization_id
7777            );
7778 
7779            -- Process Flow step 5: Verify Revised Component's existence
7780            --
7781 
7782            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
7783            Bom_Validate_Bom_Component.Check_Existence
7784                 (  p_rev_component_rec          => l_rev_component_rec
7785                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
7786                 ,  x_old_rev_component_rec      => l_old_rev_component_rec
7787                 ,  x_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
7788                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
7789                 ,  x_return_status              => l_Return_Status
7790                 );
7791 
7792            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7793 
7794            IF l_return_status = Error_Handler.G_STATUS_ERROR
7795            THEN
7796                 l_other_message := 'BOM_CMP_EXS_SEV_ERROR';
7797                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7798                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7799                 l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
7800                 l_other_token_tbl(2).token_value := l_rev_component_rec.revised_item_name;
7801                 RAISE EXC_SEV_QUIT_BRANCH;
7802            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7803            THEN
7804                 l_other_message := 'BOM_CMP_EXS_UNEXP_SKIP';
7805                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7806                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7807                 l_other_token_tbl(2).token_name := 'REVISED_ITEM_NAME';
7808                 l_other_token_tbl(2).token_value := l_rev_component_rec.revised_item_name
7809 ;
7810                 RAISE EXC_UNEXP_SKIP_OBJECT;
7811            END IF;
7812 
7813            -- Process Flow step 6: Check lineage
7814            --
7815 
7816            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check lineage');          END IF;
7817            Bom_Validate_Bom_Component.Check_Lineage
7818                 (  p_rev_component_rec          => l_rev_component_rec
7819                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
7820                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
7821                 ,  x_return_status              => l_Return_Status
7822                 );
7823 
7824            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7825 
7826            IF l_return_status = Error_Handler.G_STATUS_ERROR
7827            THEN
7828                    l_other_message := 'BOM_CMP_LIN_SEV_SKIP';
7829                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7830                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7831                    RAISE EXC_SEV_QUIT_BRANCH;
7832            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7833            THEN
7834                    l_other_message := 'ENG_CMP_LIN_UNEXP_SKIP';
7835                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7836                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7837                    RAISE EXC_UNEXP_SKIP_OBJECT;
7838            END IF;
7839 
7840            -- Process Flow step 7: Is Revised Component record an orphan ?
7841 
7842            IF NOT l_item_parent_exists
7843            THEN
7844 
7845                 -- Process Flow step 8(a and b): Is ECO impl/cancl, or in wkflw process ?
7846                 --
7847 
7848                 ENG_Validate_ECO.Check_Access
7849                 (  p_change_notice      => l_rev_component_rec.ECO_Name
7850                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
7851                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
7852                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
7853                 , x_Return_Status       => l_return_status
7854                 );
7855 
7856                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7857 
7858                 IF l_return_status = Error_Handler.G_STATUS_ERROR
7859                 THEN
7860                         l_other_message := 'BOM_CMP_ECOACC_FAT_FATAL';
7861                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7862                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7863                         l_return_status := 'F';
7864                         RAISE EXC_FAT_QUIT_OBJECT;
7865                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7866                 THEN
7867                         l_other_message := 'BOM_CMP_ECOACC_UNEXP_SKIP';
7868                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7869                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7870                         RAISE EXC_UNEXP_SKIP_OBJECT;
7871                 END IF;
7872 
7873                 -- Process Flow step 9(a and b): check that user has access to revised item
7874                 --
7875 
7876                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
7877                 ENG_Validate_Revised_Item.Check_Access
7878                 (  p_change_notice      => l_rev_component_rec.ECO_Name
7879                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
7880                 ,  p_revised_item_id    => l_rev_comp_unexp_rec.revised_item_id
7881                 ,  p_new_item_revision  => l_rev_component_rec.new_revised_item_revision
7882                 ,  p_effectivity_date   => l_rev_component_rec.start_effective_date
7883                 ,  p_new_routing_revsion   => l_rev_component_rec.new_routing_revision  -- Added by MK on 11/02/00
7884                 ,  p_from_end_item_number  => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
7885                 ,  p_revised_item_name  => l_rev_component_rec.revised_item_name
7886                 ,  p_entity_processed   => 'RC'
7887                 ,  p_alternate_bom_code => l_rev_component_rec.alternate_bom_code -- Bug 4210718
7888                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7889                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7890                 ,  x_return_status      => l_Return_Status
7891                 );
7892 
7893                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7894                 IF l_return_status = Error_Handler.G_STATUS_ERROR
7895                 THEN
7896                         l_other_message := 'BOM_CMP_RITACC_FAT_FATAL';
7897                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7898                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7899                         l_return_status := 'F';
7900                         RAISE EXC_FAT_QUIT_SIBLINGS;
7901                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7902                 THEN
7903                         l_other_message := 'BOM_CMP_RITACC_UNEXP_SKIP';
7904                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7905                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7906                         RAISE EXC_UNEXP_SKIP_OBJECT;
7907                 END IF;
7908 
7909                 -- Process Flow step 10: check that user has access to revised component
7910                 --
7911 
7912                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
7913                 Bom_Validate_Bom_Component.Check_Access
7914                 (  p_change_notice      => l_rev_component_rec.ECO_Name
7915                 ,  p_organization_id    => l_rev_comp_unexp_rec.organization_id
7916                 ,  p_revised_item_id    => l_rev_comp_unexp_rec.revised_item_id
7917                 ,  p_new_item_revision  => l_rev_component_rec.new_revised_item_revision
7918                 ,  p_effectivity_date   => l_rev_component_rec.start_effective_date
7919                 ,  p_new_routing_revsion  => l_rev_component_rec.new_routing_revision -- Added by MK on 11/02/00
7920                 ,  p_from_end_item_number => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
7921                 ,  p_revised_item_name  => l_rev_component_rec.revised_item_name
7922                 ,  p_component_item_id  => l_rev_comp_unexp_rec.component_item_id
7923                 ,  p_operation_seq_num  => l_rev_component_rec.operation_sequence_number
7924                 ,  p_bill_sequence_id   => l_rev_comp_unexp_rec.bill_sequence_id
7925                 ,  p_component_name     => l_rev_component_rec.component_item_name
7926                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7927                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7928                 ,  x_return_status      => l_Return_Status
7929                 );
7930 
7931                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7932 
7933                 IF l_return_status = Error_Handler.G_STATUS_ERROR
7934                 THEN
7935                         l_other_message := 'BOM_CMP_ACCESS_FAT_FATAL';
7936                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7937                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7938                         l_return_status := 'F';
7939                         RAISE EXC_FAT_QUIT_BRANCH;
7940                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
7941                 THEN
7942                         l_other_message := 'BOM_CMP_ACCESS_UNEXP_SKIP';
7943                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7944                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7945                         RAISE EXC_UNEXP_SKIP_OBJECT;
7946                 END IF;
7947 
7948            ELSE
7949            -- Bug No: 5246049
7950            -- Structure policy check should happen even if parent exists
7951                 l_structure_type_id := NULL;
7952                 l_strc_cp_not_allowed := 2;
7953 
7954                 ENG_Validate_Revised_Item.Check_Structure_Type_Policy
7955                     ( p_inventory_item_id   => l_rev_comp_unexp_rec.revised_item_id
7956                     , p_organization_id     => l_rev_comp_unexp_rec.organization_id
7957                     , p_alternate_bom_code  => l_rev_component_rec.alternate_bom_code
7958                     , x_structure_type_id   => l_structure_type_id
7959                     , x_strc_cp_not_allowed => l_strc_cp_not_allowed
7960                     );
7961                 IF l_strc_cp_not_allowed = 1
7962                 THEN
7963                         l_return_status := Error_Handler.G_STATUS_ERROR ;
7964                         l_Token_Tbl.DELETE;
7965                         l_Token_Tbl(1).token_name := 'STRUCTURE_NAME';
7966                         l_Token_Tbl(1).token_value := l_rev_component_rec.alternate_bom_code;
7967 
7968                         Error_Handler.Add_Error_Token
7969                         ( p_message_name       => 'ENG_BILL_CHANGES_NOT_ALLOWED'
7970                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
7971                         , p_token_tbl          => l_Token_Tbl
7972                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
7973                         );
7974 
7975                         l_other_message := 'BOM_CMP_QRY_CSEV_SKIP';
7976                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
7977                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
7978                         RAISE EXC_SEV_SKIP_BRANCH;
7979                 END IF;
7980            END IF;
7981 
7982            -- Process Flow step 11: Value to Id conversions
7983            --
7984 
7985            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-id conversions'); END IF;
7986            Bom_Val_To_Id.Rev_Component_VID
7987                 ( x_Return_Status       => l_return_status
7988                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
7989                 , p_rev_comp_unexp_Rec  => l_rev_comp_unexp_rec
7990                 , x_rev_comp_unexp_Rec  => l_rev_comp_unexp_rec
7991                 , p_rev_component_Rec   => l_rev_component_rec
7992                 );
7993 
7994            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
7995 
7996            IF l_return_status = Error_Handler.G_STATUS_ERROR
7997            THEN
7998                 IF l_rev_component_rec.transaction_type = 'CREATE'
7999                 THEN
8000                         l_other_message := 'BOM_CMP_VID_CSEV_SKIP';
8001                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8002                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8003                         RAISE EXC_SEV_SKIP_BRANCH;
8004                 ELSE
8005                         RAISE EXC_SEV_QUIT_RECORD;
8006                 END IF;
8007            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8008            THEN
8009                 l_other_message := 'BOM_CMP_VID_UNEXP_SKIP';
8010                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8011                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8012                 RAISE EXC_UNEXP_SKIP_OBJECT;
8013            ELSIF l_return_status ='S' AND
8014                 l_Mesg_Token_Tbl.COUNT <>0
8015            THEN
8016                 Eco_Error_Handler.Log_Error
8017                 (  p_rev_component_tbl  => x_rev_component_tbl
8018                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8019                 ,  p_sub_component_tbl  => x_sub_component_tbl
8020                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8021                 ,  p_error_status       => 'W'
8022                 ,  p_error_level        => 4
8023                 ,  p_entity_index       => I
8024                 ,  x_eco_rec            => l_eco_rec
8025                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8026                 ,  x_revised_item_tbl   => l_revised_item_tbl
8027                 ,  x_rev_component_tbl  => x_rev_component_tbl
8028                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8029                 ,  x_sub_component_tbl  => x_sub_component_tbl
8030                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8031                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8032                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8033                 );
8034            END IF;
8035 
8036            -- Process Flow step 12: Check required fields exist
8037            -- (also includes conditionally required fields)
8038            --
8039 
8040            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check required fields'); END IF;
8041            Bom_Validate_Bom_Component.Check_Required
8042                 ( x_return_status              => l_return_status
8043                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
8044                 , p_rev_component_rec          => l_rev_component_rec
8045                 );
8046 
8047            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8048 
8049            IF l_return_status = Error_Handler.G_STATUS_ERROR
8050            THEN
8051                 IF l_rev_component_rec.transaction_type = 'CREATE'
8052                 THEN
8053                         l_other_message := 'BOM_CMP_REQ_CSEV_SKIP';
8054                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8055                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8056                         RAISE EXC_SEV_SKIP_BRANCH;
8057                 ELSE
8058                         RAISE EXC_SEV_QUIT_RECORD;
8059                 END IF;
8060            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8061            THEN
8062                 l_other_message := 'BOM_CMP_REQ_UNEXP_SKIP';
8063                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8064                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8065                 RAISE EXC_UNEXP_SKIP_OBJECT;
8066            ELSIF l_return_status ='S' AND
8067                 l_Mesg_Token_Tbl.COUNT <>0
8068            THEN
8069                 Eco_Error_Handler.Log_Error
8070                 (  p_rev_component_tbl  => x_rev_component_tbl
8071                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8072                 ,  p_sub_component_tbl  => x_sub_component_tbl
8073                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8074                 ,  p_error_status       => 'W'
8075                 ,  p_error_level        => 4
8076                 ,  p_entity_index       => I
8077                 ,  x_eco_rec            => l_eco_rec
8078                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8079                 ,  x_revised_item_tbl   => l_revised_item_tbl
8080                 ,  x_rev_component_tbl  => x_rev_component_tbl
8081                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8082                 ,  x_sub_component_tbl  => x_sub_component_tbl
8083                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8084                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8085                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8086                 );
8087            END IF;
8088 
8089            -- Process Flow step 13: Attribute Validation for CREATE and UPDATE
8090            --
8091 
8092            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
8093            IF l_rev_component_rec.Transaction_Type IN
8094                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
8095            THEN
8096                 Bom_Validate_Bom_Component.Check_Attributes
8097                 ( x_return_status              => l_return_status
8098                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
8099                 , p_rev_component_rec          => l_rev_component_rec
8100                 , p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
8101                 );
8102 
8103                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8104 
8105                 IF l_return_status = Error_Handler.G_STATUS_ERROR
8106                 THEN
8107                    IF l_rev_component_rec.transaction_type = 'CREATE'
8108                    THEN
8109                         l_other_message := 'BOM_CMP_ATTVAL_CSEV_SKIP';
8110                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8111                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8112                         RAISE EXC_SEV_QUIT_BRANCH;
8113                    ELSE
8114                         RAISE EXC_SEV_QUIT_RECORD;
8115                    END IF;
8116                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8117                 THEN
8118                    l_other_message := 'BOM_CMP_ATTVAL_UNEXP_SKIP';
8119                    l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8120                    l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8121                    RAISE EXC_UNEXP_SKIP_OBJECT;
8122                 ELSIF l_return_status ='S' AND
8123                       l_Mesg_Token_Tbl.COUNT <>0
8124                 THEN
8125                    Eco_Error_Handler.Log_Error
8126                         (  p_rev_component_tbl  => x_rev_component_tbl
8127                         ,  p_ref_designator_tbl => x_ref_designator_tbl
8128                         ,  p_sub_component_tbl  => x_sub_component_tbl
8129                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
8130                         ,  p_error_status       => 'W'
8131                         ,  p_error_level        => 4
8132                         ,  p_entity_index       => I
8133                         ,  x_eco_rec            => l_eco_rec
8134                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
8135                         ,  x_revised_item_tbl   => l_revised_item_tbl
8136                         ,  x_rev_component_tbl  => x_rev_component_tbl
8137                         ,  x_ref_designator_tbl => x_ref_designator_tbl
8138                         ,  x_sub_component_tbl  => x_sub_component_tbl
8139                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8140                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8141                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8142                         );
8143                 END IF;
8144            END IF;
8145 
8146            IF (l_rev_component_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
8147                AND l_rev_component_rec.acd_type IN ( 2, 3 ))
8148            THEN
8149 
8150                 Bom_Bom_Component_Util.Query_Row
8151                    ( p_component_item_id
8152                                 => l_rev_comp_unexp_rec.component_item_id
8153                    , p_operation_sequence_number
8154                                 => l_rev_component_rec.old_operation_sequence_number
8155                    , p_effectivity_date
8156                                 => l_rev_component_rec.old_effectivity_date
8157                    , p_from_end_item_number
8158                                => l_rev_component_rec.old_from_end_item_unit_number
8159                    , p_bill_sequence_id
8160                                 => l_rev_comp_unexp_rec.bill_sequence_id
8161                    , x_Rev_Component_Rec
8162                                 => l_old_rev_component_rec
8163                    , x_Rev_Comp_Unexp_Rec
8164                                 => l_old_rev_comp_unexp_rec
8165                    , x_return_status
8166                                 => l_return_status
8167                    , p_mesg_token_tbl   =>
8168                         l_mesg_token_tbl
8169                    , x_mesg_token_tbl   => l_mesg_token_tbl
8170                    );
8171 
8172                 IF l_return_status <> Eng_Globals.G_RECORD_FOUND
8173                 THEN
8174                         l_return_status := Error_Handler.G_STATUS_ERROR ;
8175                         l_Token_Tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8176                         l_Token_Tbl(1).token_value := l_rev_component_rec.component_item_name;
8177 
8178                         Error_Handler.Add_Error_Token
8179                         ( p_message_name       => 'ENG_CMP_CREATE_REC_NOT_FOUND' --'BOM_CMP_CREATE_REC_NOT_FOUND' -- Bug 3612008 :Modified incorrect message_name
8180                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
8181                         , p_token_tbl          => l_Token_Tbl
8182                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
8183                         );
8184 
8185                         l_other_message := 'BOM_CMP_QRY_CSEV_SKIP';
8186                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8187                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8188                         RAISE EXC_SEV_SKIP_BRANCH;
8189                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8190                 THEN
8191                         l_other_message := 'BOM_CMP_QRY_UNEXP_SKIP';
8192                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8193                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8194                    RAISE EXC_UNEXP_SKIP_OBJECT;
8195                 END IF;
8196             END IF;
8197 
8198             -- Process flow step 15 - Populate NULL columns for Update and
8199             -- Delete, and Creates with ACD_Type 'Add'.
8200 
8201             IF (l_rev_component_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
8202                 AND l_rev_component_rec.acd_type = 2)
8203                OR
8204                l_rev_component_rec.transaction_type IN (ENG_GLOBALS.G_OPR_UPDATE,
8205                                                         ENG_GLOBALS.G_OPR_DELETE)
8206             THEN
8207                     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populate NULL columns'); END IF;
8208                     Bom_Default_Bom_Component.Populate_Null_Columns
8209                     (   p_rev_component_rec     => l_rev_Component_Rec
8210                     ,   p_old_rev_Component_Rec => l_old_rev_Component_Rec
8211                     ,   p_rev_comp_unexp_rec    => l_rev_comp_unexp_rec
8212                     ,   p_old_rev_comp_unexp_rec=> l_old_rev_comp_unexp_rec
8213                     ,   x_rev_Component_Rec     => l_rev_Component_Rec
8214                     ,   x_rev_comp_unexp_rec    => l_rev_comp_unexp_rec
8215                     );
8216 
8217            ELSIF l_rev_component_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
8218 
8219                 -- Process Flow step 16: Default missing values for Operation CREATE
8220                 --
8221 
8222                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
8223                 Bom_Default_Bom_Component.Attribute_Defaulting
8224                 (   p_rev_component_rec         => l_rev_component_rec
8225                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
8226                 ,   x_rev_component_rec         => l_rev_component_rec
8227                 ,   x_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
8228                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
8229                 ,   x_return_status             => l_return_status
8230                 );
8231 
8232                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8233 
8234                 IF l_return_status = Error_Handler.G_STATUS_ERROR
8235                 THEN
8236                         l_other_message := 'BOM_CMP_ATTDEF_CSEV_SKIP';
8237                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8238                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8239                         RAISE EXC_SEV_SKIP_BRANCH;
8240                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8241                 THEN
8242                         l_other_message := 'BOM_CMP_ATTDEF_UNEXP_SKIP';
8243                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8244                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8245                         RAISE EXC_UNEXP_SKIP_OBJECT;
8246                 ELSIF l_return_status ='S' AND
8247                         l_Mesg_Token_Tbl.COUNT <>0
8248                 THEN
8249                         Eco_Error_Handler.Log_Error
8250                         (  p_rev_component_tbl  => x_rev_component_tbl
8251                         ,  p_ref_designator_tbl => x_ref_designator_tbl
8252                         ,  p_sub_component_tbl  => x_sub_component_tbl
8253                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
8254                         ,  p_error_status       => 'W'
8255                         ,  p_error_level        => 4
8256                         ,  p_entity_index       => I
8257                         ,  x_eco_rec            => l_eco_rec
8258                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
8259                         ,  x_revised_item_tbl   => l_revised_item_tbl
8260                         ,  x_rev_component_tbl  => x_rev_component_tbl
8261                         ,  x_ref_designator_tbl => x_ref_designator_tbl
8262                         ,  x_sub_component_tbl  => x_sub_component_tbl
8263                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8264                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8265                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8266                         );
8267                 END IF;
8268            END IF;
8269 
8270            -- Process Flow step 17: Entity defaulting for CREATE and UPDATE
8271            --
8272 
8273            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting'); END IF;
8274            IF l_rev_component_rec.Transaction_Type IN
8275                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
8276            THEN
8277                 Bom_Default_Bom_Component.Entity_Defaulting
8278                 (   p_rev_component_rec         => l_rev_component_rec
8279                 ,   p_old_rev_component_rec     => l_old_rev_component_rec
8280                 ,   x_rev_component_rec         => l_rev_component_rec
8281                 );
8282 
8283                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8284 
8285                 IF l_return_status = Error_Handler.G_STATUS_ERROR
8286                 THEN
8287                    IF l_rev_component_rec.transaction_type = 'CREATE'
8288                    THEN
8289                         l_other_message := 'BOM_CMP_ENTDEF_CSEV_SKIP';
8290                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8291                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8292                         RAISE EXC_SEV_SKIP_BRANCH;
8293                    ELSE
8294                         RAISE EXC_SEV_QUIT_RECORD;
8295                    END IF;
8296                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8297                 THEN
8298                         l_other_message := 'BOM_CMP_ENTDEF_UNEXP_SKIP';
8299                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8300                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8301                         RAISE EXC_UNEXP_SKIP_OBJECT;
8302                 ELSIF l_return_status ='S' AND
8303                         l_Mesg_Token_Tbl.COUNT <>0
8304                 THEN
8305                         Eco_Error_Handler.Log_Error
8306                         (  p_rev_component_tbl  => x_rev_component_tbl
8307                         ,  p_ref_designator_tbl => x_ref_designator_tbl
8308                         ,  p_sub_component_tbl  => x_sub_component_tbl
8309                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
8310                         ,  p_error_status       => 'W'
8311                         ,  p_error_level        => 4
8312                         ,  p_entity_index       => I
8313                         ,  x_eco_rec            => l_eco_rec
8314                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
8315                         ,  x_revised_item_tbl   => l_revised_item_tbl
8316                         ,  x_rev_component_tbl  => x_rev_component_tbl
8317                         ,  x_ref_designator_tbl => x_ref_designator_tbl
8318                         ,  x_sub_component_tbl  => x_sub_component_tbl
8319                         ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8320                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8321                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8322                         );
8323                 END IF;
8324            END IF;
8325 
8326            -- Process Flow step 18 - Entity Level Validation
8327            --
8328 
8329            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
8330            Bom_Validate_Bom_Component.Check_Entity
8331                 (  p_rev_component_rec          => l_rev_component_rec
8332                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
8333                 ,  p_old_rev_component_rec      => l_old_rev_component_rec
8334                 ,  p_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
8335                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
8336                 ,  x_return_status              => l_Return_Status
8337                 );
8338 
8339            --IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8340 
8341            IF l_return_status = Error_Handler.G_STATUS_ERROR
8342            THEN
8343                 IF l_rev_component_rec.transaction_type = 'CREATE'
8344                 THEN
8345                         l_other_message := 'BOM_CMP_ENTVAL_CSEV_SKIP';
8346                         l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8347                         l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8348                         RAISE EXC_SEV_QUIT_BRANCH;
8349                 ELSE
8350                         RAISE EXC_SEV_QUIT_RECORD;
8351                 END IF;
8352            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8353            THEN
8354                 l_other_message := 'BOM_CMP_ENTVAL_UNEXP_SKIP';
8355                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8356                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8357                 RAISE EXC_UNEXP_SKIP_OBJECT;
8358            ELSIF l_return_status ='S' AND
8359                 l_Mesg_Token_Tbl.COUNT <>0
8360            THEN
8361                 Eco_Error_Handler.Log_Error
8362                 (  p_rev_component_tbl  => x_rev_component_tbl
8363                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8364                 ,  p_sub_component_tbl  => x_sub_component_tbl
8365                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8366                 ,  p_error_status       => 'W'
8367                 ,  p_error_level        => 4
8368                 ,  p_entity_index       => I
8369                 ,  x_eco_rec            => l_eco_rec
8370                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8371                 ,  x_revised_item_tbl   => l_revised_item_tbl
8372                 ,  x_rev_component_tbl  => x_rev_component_tbl
8373                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8374                 ,  x_sub_component_tbl  => x_sub_component_tbl
8375                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8376                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8377                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8378                 );
8379            END IF;
8380 
8381            -- Process Flow step 16 : Database Writes
8382            --
8383 
8384            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
8385            Bom_Bom_Component_Util.Perform_Writes
8386                 (   p_rev_component_rec         => l_rev_component_rec
8387                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
8388                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
8389                 ,   x_return_status             => l_return_status
8390                 );
8391 
8392            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8393 
8394            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
8395            THEN
8396                 l_other_message := 'BOM_CMP_WRITES_UNEXP_SKIP';
8397                 l_other_token_tbl(1).token_name := 'REVISED_COMPONENT_NAME';
8398                 l_other_token_tbl(1).token_value := l_rev_component_rec.component_item_name;
8399                 RAISE EXC_UNEXP_SKIP_OBJECT;
8400            ELSIF l_return_status ='S' AND
8401               l_Mesg_Token_Tbl.COUNT <>0
8402            THEN
8403                 Eco_Error_Handler.Log_Error
8404                 (  p_rev_component_tbl  => x_rev_component_tbl
8405                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8406                 ,  p_sub_component_tbl  => x_sub_component_tbl
8407                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8408                 ,  p_error_status       => 'W'
8409                 ,  p_error_level        => 4
8410                 ,  p_entity_index       => I
8411                 ,  x_eco_rec            => l_eco_rec
8412                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8413                 ,  x_revised_item_tbl   => l_revised_item_tbl
8414                 ,  x_rev_component_tbl  => x_rev_component_tbl
8415                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8416                 ,  x_sub_component_tbl  => x_sub_component_tbl
8417                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8418                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8419                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8420                 );
8421            END IF;
8422 
8423 
8424                 -- END IF; -- END IF statement that checks RETURN STATUS
8425 
8426                 --  Load tables.
8427 
8428                 x_rev_component_tbl(I)          := l_rev_component_rec;
8429 
8430                 -- Indicate that children need to be processed
8431 
8432                 l_process_children := TRUE;
8433                 -- END IF;
8434 
8435 
8436         ELSE
8437 
8438 
8439 IF Bom_Globals.Get_Debug = 'Y' THEN
8440     Error_Handler.Write_Debug('This record does not patch with the parent that called it . . .  ') ;
8441     Error_Handler.Write_Debug('so may be this is an comp in another branch . . . '
8442                                || l_rev_component_rec.component_item_name ) ;
8443 END IF ;
8444 
8445                 l_process_children := FALSE;
8446 
8447         END IF; -- END IF statement that checks RETURN STATUS
8448 
8449 
8450     --  For loop exception handler.
8451 
8452 
8453     EXCEPTION
8454 
8455        WHEN EXC_SEV_QUIT_RECORD THEN
8456 
8457         Eco_Error_Handler.Log_Error
8458                 (  p_rev_component_tbl  => x_rev_component_tbl
8459                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8460                 ,  p_sub_component_tbl  => x_sub_component_tbl
8461                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8462                 ,  p_error_status       => FND_API.G_RET_STS_ERROR
8463                 ,  p_error_scope        => Error_Handler.G_SCOPE_RECORD
8464                 ,  p_error_level        => 4
8465                 ,  p_entity_index       => I
8466                 ,  x_eco_rec            => l_eco_rec
8467                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8468                 ,  x_revised_item_tbl   => l_revised_item_tbl
8469                 ,  x_rev_component_tbl  => x_rev_component_tbl
8470                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8471                 ,  x_sub_component_tbl  => x_sub_component_tbl
8472                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8473                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8474                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8475                 );
8476 
8477         l_process_children := TRUE;
8478 
8479         IF l_bo_return_status = 'S'
8480         THEN
8481                 l_bo_return_status     := l_return_status;
8482         END IF;
8483         x_return_status                := l_bo_return_status;
8484         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8485         --x_rev_component_tbl            := l_rev_component_tbl;
8486         --x_ref_designator_tbl           := l_ref_designator_tbl;
8487         --x_sub_component_tbl            := l_sub_component_tbl;
8488 
8489        WHEN EXC_SEV_QUIT_BRANCH THEN
8490 
8491         Eco_Error_Handler.Log_Error
8492                 (  p_rev_component_tbl  => x_rev_component_tbl
8493                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8494                 ,  p_sub_component_tbl  => x_sub_component_tbl
8495                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8496                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
8497                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
8498                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
8499                 ,  p_other_message      => l_other_message
8500                 ,  p_other_token_tbl    => l_other_token_tbl
8501                 ,  p_error_level        => 4
8502                 ,  p_entity_index       => I
8503                 ,  x_eco_rec            => l_eco_rec
8504                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8505                 ,  x_revised_item_tbl   => l_revised_item_tbl
8506                 ,  x_rev_component_tbl  => x_rev_component_tbl
8507                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8508                 ,  x_sub_component_tbl  => x_sub_component_tbl
8509                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8510                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8511                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8512                 );
8513 
8514         l_process_children := FALSE;
8515 
8516         IF l_bo_return_status = 'S'
8517         THEN
8518                 l_bo_return_status     := l_return_status;
8519         END IF;
8520         x_return_status                := l_bo_return_status;
8521         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8522         --x_rev_component_tbl            := l_rev_component_tbl;
8523         --x_ref_designator_tbl           := l_ref_designator_tbl;
8524         --x_sub_component_tbl            := l_sub_component_tbl;
8525 
8526        WHEN EXC_SEV_SKIP_BRANCH THEN
8527 
8528         Eco_Error_Handler.Log_Error
8529                 (  p_rev_component_tbl  => x_rev_component_tbl
8530                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8531                 ,  p_sub_component_tbl  => x_sub_component_tbl
8532                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8533                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
8534                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
8535                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
8536                 ,  p_other_message      => l_other_message
8537                 ,  p_other_token_tbl    => l_other_token_tbl
8538                 ,  p_error_level        => 4
8539                 ,  p_entity_index       => I
8540                 ,  x_eco_rec            => l_eco_rec
8541                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8542                 ,  x_revised_item_tbl   => l_revised_item_tbl
8543                 ,  x_rev_component_tbl  => x_rev_component_tbl
8544                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8545                 ,  x_sub_component_tbl  => x_sub_component_tbl
8546                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8547                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8548                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8549                 );
8550 
8551         l_process_children := FALSE;
8552 
8553         IF l_bo_return_status = 'S'
8554         THEN
8555                 l_bo_return_status     := l_return_status;
8556         END IF;
8557         x_return_status                := l_bo_return_status;
8558         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8559         --x_rev_component_tbl            := l_rev_component_tbl;
8560         --x_ref_designator_tbl           := l_ref_designator_tbl;
8561         --x_sub_component_tbl            := l_sub_component_tbl;
8562 
8563        WHEN EXC_SEV_QUIT_SIBLINGS THEN
8564 
8565         Eco_Error_Handler.Log_Error
8566                 (  p_rev_component_tbl  => x_rev_component_tbl
8567                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8568                 ,  p_sub_component_tbl  => x_sub_component_tbl
8569                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8570                 ,  p_error_status       => Error_Handler.G_STATUS_ERROR
8571                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
8572                 ,  p_other_status       => Error_Handler.G_STATUS_ERROR
8573                 ,  p_other_message      => l_other_message
8574                 ,  p_other_token_tbl    => l_other_token_tbl
8575                 ,  p_error_level        => 4
8576                 ,  p_entity_index       => I
8577                 ,  x_eco_rec            => l_eco_rec
8578                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8579                 ,  x_revised_item_tbl   => l_revised_item_tbl
8580                 ,  x_rev_component_tbl  => x_rev_component_tbl
8581                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8582                 ,  x_sub_component_tbl  => x_sub_component_tbl
8583                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8584                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8585                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8586                 );
8587 
8588         l_process_children := FALSE;
8589 
8590         IF l_bo_return_status = 'S'
8591         THEN
8592                 l_bo_return_status     := l_return_status;
8593         END IF;
8594         x_return_status                := l_bo_return_status;
8595         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8596         --x_rev_component_tbl            := l_rev_component_tbl;
8597         --x_ref_designator_tbl           := l_ref_designator_tbl;
8598         --x_sub_component_tbl            := l_sub_component_tbl;
8599 
8600        WHEN EXC_FAT_QUIT_BRANCH THEN
8601 
8602         Eco_Error_Handler.Log_Error
8603                 (  p_rev_component_tbl  => x_rev_component_tbl
8604                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8605                 ,  p_sub_component_tbl  => x_sub_component_tbl
8606                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8607                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
8608                 ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
8609                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
8610                 ,  p_other_message      => l_other_message
8611                 ,  p_other_token_tbl    => l_other_token_tbl
8612                 ,  p_error_level        => 4
8613                 ,  p_entity_index       => I
8614                 ,  x_eco_rec            => l_eco_rec
8615                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8616                 ,  x_revised_item_tbl   => l_revised_item_tbl
8617                 ,  x_rev_component_tbl  => x_rev_component_tbl
8618                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8619                 ,  x_sub_component_tbl  => x_sub_component_tbl
8620                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8621                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8622                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8623                 );
8624 
8625         l_process_children := FALSE;
8626 
8627         x_return_status                := Error_Handler.G_STATUS_FATAL;
8628         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8629         --x_rev_component_tbl            := l_rev_component_tbl;
8630         --x_ref_designator_tbl           := l_ref_designator_tbl;
8631         --x_sub_component_tbl            := l_sub_component_tbl;
8632 
8633        WHEN EXC_FAT_QUIT_SIBLINGS THEN
8634 
8635         Eco_Error_Handler.Log_Error
8636                 (  p_rev_component_tbl  => x_rev_component_tbl
8637                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8638                 ,  p_sub_component_tbl  => x_sub_component_tbl
8639                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8640                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
8641                 ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
8642                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
8643                 ,  p_other_message      => l_other_message
8644                 ,  p_other_token_tbl    => l_other_token_tbl
8645                 ,  p_error_level        => 4
8646                 ,  p_entity_index       => I
8647                 ,  x_eco_rec            => l_eco_rec
8648                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8649                 ,  x_revised_item_tbl   => l_revised_item_tbl
8650                 ,  x_rev_component_tbl  => x_rev_component_tbl
8651                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8652                 ,  x_sub_component_tbl  => x_sub_component_tbl
8653                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8654                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8655                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8656                 );
8657 
8658         l_process_children := FALSE;
8659 
8660         x_return_status                := Error_Handler.G_STATUS_FATAL;
8661         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8662         --x_rev_component_tbl            := l_rev_component_tbl;
8663         --x_ref_designator_tbl           := l_ref_designator_tbl;
8664         --x_sub_component_tbl            := l_sub_component_tbl;
8665 
8666        WHEN EXC_FAT_QUIT_OBJECT THEN
8667 
8668         Eco_Error_Handler.Log_Error
8669                 (  p_rev_component_tbl  => x_rev_component_tbl
8670                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8671                 ,  p_sub_component_tbl  => x_sub_component_tbl
8672                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8673                 ,  p_error_status       => Error_Handler.G_STATUS_FATAL
8674                 ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
8675                 ,  p_other_status       => Error_Handler.G_STATUS_FATAL
8676                 ,  p_other_message      => l_other_message
8677                 ,  p_other_token_tbl    => l_other_token_tbl
8678                 ,  p_error_level        => 4
8679                 ,  p_entity_index       => I
8680                 ,  x_eco_rec            => l_eco_rec
8681                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8682                 ,  x_revised_item_tbl   => l_revised_item_tbl
8683                 ,  x_rev_component_tbl  => x_rev_component_tbl
8684                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8685                 ,  x_sub_component_tbl  => x_sub_component_tbl
8686                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8687                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8688                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8689                 );
8690 
8691         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8692         --x_rev_component_tbl            := l_rev_component_tbl;
8693         --x_ref_designator_tbl           := l_ref_designator_tbl;
8694         --x_sub_component_tbl            := l_sub_component_tbl;
8695 
8696         l_return_status := 'Q';
8697 
8698        WHEN EXC_UNEXP_SKIP_OBJECT THEN
8699 
8700 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Unexpected error caught in Rev Comps . . . '); END IF;
8701 
8702         Eco_Error_Handler.Log_Error
8703                 (  p_rev_component_tbl  => x_rev_component_tbl
8704                 ,  p_ref_designator_tbl => x_ref_designator_tbl
8705                 ,  p_sub_component_tbl  => x_sub_component_tbl
8706                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
8707                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
8708                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
8709                 ,  p_other_message      => l_other_message
8710                 ,  p_other_token_tbl    => l_other_token_tbl
8711                 ,  p_error_level        => 4
8712                 ,  p_entity_index       => I
8713                 ,  x_ECO_rec            => l_ECO_rec
8714                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
8715                 ,  x_revised_item_tbl   => l_revised_item_tbl
8716                 ,  x_rev_component_tbl  => x_rev_component_tbl
8717                 ,  x_ref_designator_tbl => x_ref_designator_tbl
8718                 ,  x_sub_component_tbl  => x_sub_component_tbl
8719                 ,  x_rev_operation_tbl   => l_rev_operation_tbl   --L1
8720                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl --L1
8721                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl--L1
8722                 );
8723 
8724         --x_rev_component_tbl            := l_rev_component_tbl;
8725         --x_ref_designator_tbl           := l_ref_designator_tbl;
8726         --x_sub_component_tbl            := l_sub_component_tbl;
8727         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
8728 
8729         l_return_status := 'U';
8730 
8731 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Unexpected error in Rev Comps . . .'); END IF;
8732 
8733         END; -- END block
8734 
8735         IF l_return_status in ('Q', 'U')
8736         THEN
8737                 x_return_status := l_return_status;
8738 
8739 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Rev Comps returning with status ' || l_return_status ); END IF;
8740 
8741                 RETURN;
8742         END IF;
8743 
8744    IF l_process_children
8745    THEN
8746         -- Process Reference Designators that are direct children of this
8747         -- component
8748 
8749 IF Bom_Globals.Get_Debug = 'Y' THEN
8750     Error_Handler.Write_Debug('***********************************************************') ;
8751     Error_Handler.Write_Debug('Now processing direct children for the Rev Comp '
8752                               || l_rev_component_rec.component_item_name || '. . .'  );
8753     Error_Handler.Write_Debug('Now processing Ref Desig as direct children for the Rev Comp ') ;
8754 END IF;
8755 
8756 
8757         Ref_Desgs
8758         (   p_validation_level          => p_validation_level
8759         ,   p_change_notice             => l_rev_component_rec.ECO_Name
8760         ,   p_organization_id           => l_rev_comp_unexp_rec.organization_id
8761         ,   p_revised_item_name         => l_rev_component_rec.revised_item_name
8762         ,   p_alternate_bom_code        => l_rev_component_rec.alternate_bom_code  -- Bug 3991176
8763         ,   p_effectivity_date          => l_rev_component_rec.start_effective_date
8764         ,   p_item_revision             => l_rev_component_rec.new_revised_item_revision
8765         ,   p_routing_revision          => l_rev_component_rec.new_routing_revision      -- Added by MK on 11/02/00
8766         ,   p_from_end_item_number      => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
8767         ,   p_component_item_name       => l_rev_component_rec.component_item_name
8768         ,   p_operation_seq_num         => l_rev_component_rec.operation_sequence_number
8769         ,   p_ref_designator_tbl        => x_ref_designator_tbl
8770         ,   p_sub_component_tbl         => x_sub_component_tbl
8771         ,   x_ref_designator_tbl        => x_ref_designator_tbl
8772         ,   x_sub_component_tbl         => x_sub_component_tbl
8773         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
8774         ,   x_return_status             => l_return_status
8775         );
8776 
8777         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
8778         THEN
8779                 l_bo_return_status := l_return_status;
8780         END IF;
8781 
8782         -- Process Substitute Components that are direct children of this
8783         -- component
8784 
8785 IF Bom_Globals.Get_Debug = 'Y' THEN
8786     Error_Handler.Write_Debug('***********************************************************') ;
8787     Error_Handler.Write_Debug('Now processing Ref Desig as direct children for the Rev Comp ') ;
8788 END IF ;
8789 
8790         Sub_Comps
8791         (   p_validation_level          => p_validation_level
8792         ,   p_change_notice             => l_rev_component_rec.ECO_Name
8793         ,   p_organization_id           => l_rev_comp_unexp_rec.organization_id
8794         ,   p_revised_item_name         => l_rev_component_rec.revised_item_name
8795         ,   p_alternate_bom_code        => l_rev_component_rec.alternate_bom_code  -- Bug 3991176
8796         ,   p_effectivity_date          => l_rev_component_rec.start_effective_date
8797         ,   p_item_revision             => l_rev_component_rec.new_revised_item_revision
8798         ,   p_routing_revision          => l_rev_component_rec.new_routing_revision      -- Added by MK on 11/02/00
8799         ,   p_from_end_item_number      => l_rev_component_rec.from_end_item_unit_number -- Added by MK on 11/02/00
8800         ,   p_component_item_name       => l_rev_component_rec.component_item_name
8801         ,   p_operation_seq_num         => l_rev_component_rec.operation_sequence_number
8802         ,   p_sub_component_tbl         => x_sub_component_tbl
8803         ,   x_sub_component_tbl         => x_sub_component_tbl
8804         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
8805         ,   x_return_status             => l_return_status
8806         );
8807 
8808         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
8809         THEN
8810                 l_bo_return_status := l_return_status;
8811         END IF;
8812 
8813         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Finished processing children for ' || l_rev_component_rec.component_item_name || ' . . . ' || l_return_status ); END IF;
8814 
8815     END IF;  -- Process children
8816     END IF; -- End of processing records for which the return status is null
8817     END LOOP; -- END Revised Components processing loop
8818 
8819     --  Load OUT parameters
8820 
8821         IF NVL(l_bo_return_status, 'S') <> 'S'
8822      THEN
8823 IF Bom_Globals.Get_Debug = 'Y' THEN
8824         Error_Handler.write_Debug('Return status before returning from Rev Comps: ' || l_bo_return_status);
8825 END IF;
8826         x_return_status     := l_bo_return_status;
8827 
8828      END IF;
8829 
8830      --x_rev_component_tbl        := l_rev_component_tbl;
8831      --x_ref_designator_tbl       := l_ref_designator_tbl;
8832      --x_sub_component_tbl        := l_sub_component_tbl;
8833      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
8834 
8835 END Rev_Comps;
8836 
8837 --  Process_Rev_Item
8838 PROCEDURE Process_Rev_Item
8839 (   p_validation_level              IN  NUMBER
8840 ,   p_change_notice                 IN  VARCHAR2 := NULL
8841 ,   p_organization_id               IN  NUMBER := NULL
8842 ,   I                               IN  NUMBER
8843 ,   p_revised_item_rec              IN  ENG_Eco_PUB.Revised_Item_Rec_Type
8844 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
8845 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
8846 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
8847 ,   p_rev_operation_tbl             IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
8848 ,   p_rev_op_resource_tbl           IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
8849 ,   p_rev_sub_resource_tbl          IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
8850 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
8851 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
8852 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
8853 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
8854 ,   x_rev_operation_tbl             IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
8855 ,   x_rev_op_resource_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
8856 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
8857 ,   x_revised_item_unexp_rec        OUT NOCOPY ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type
8858 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
8859 ,   x_return_status                 OUT NOCOPY VARCHAR2
8860 ,   x_disable_revision              OUT NOCOPY NUMBER --Bug no:3034642
8861 )
8862 IS
8863 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
8864 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
8865 l_other_message         VARCHAR2(2000);
8866 l_err_text              VARCHAR2(2000);
8867 l_valid                 BOOLEAN := TRUE;
8868 l_eco_parent_exists     BOOLEAN := FALSE;
8869 l_Return_Status         VARCHAR2(1);
8870 l_bo_return_status      VARCHAR2(1);
8871 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
8872 l_old_eco_rec           ENG_Eco_PUB.Eco_Rec_Type;
8873 l_old_eco_unexp_rec     ENG_Eco_PUB.Eco_Unexposed_Rec_Type;
8874 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
8875 l_revised_item_rec      ENG_Eco_PUB.Revised_Item_Rec_Type;
8876 --l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type := p_revised_item_tbl;
8877 l_rev_item_unexp_rec    ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
8878 l_rev_item_miss_rec     ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
8879 l_old_revised_item_rec  ENG_Eco_PUB.Revised_Item_Rec_Type;
8880 l_old_rev_item_unexp_rec ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
8881 --l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
8882 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
8883 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
8884 --l_rev_operation_tbl     Bom_Rtg_Pub.Rev_Operation_Tbl_Type := p_rev_operation_tbl;  --L1
8885 --l_rev_op_resource_tbl   Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type :=p_rev_op_resource_tbl; --L1
8886 --l_rev_sub_resource_tbl  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type :=p_rev_sub_resource_tbl; --L1
8887 l_return_value          NUMBER;
8888 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
8889 
8890 l_process_children      BOOLEAN := TRUE;
8891 
8892 EXC_SEV_QUIT_RECORD     EXCEPTION;
8893 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
8894 EXC_SEV_QUIT_BRANCH     EXCEPTION;
8895 EXC_SEV_QUIT_OBJECT     EXCEPTION;
8896 EXC_SEV_SKIP_BRANCH     EXCEPTION;
8897 EXC_FAT_QUIT_OBJECT     EXCEPTION;
8898 EXC_FAT_QUIT_BRANCH     EXCEPTION;
8899 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
8900 
8901 	-- Bug 2918350 // kamohan
8902 	-- Start Changes
8903 
8904 	l_chk_co_sch eng_engineering_changes.status_type%TYPE;
8905 
8906 	-- End Changes
8907 
8908 BEGIN
8909     l_return_status := FND_API.G_RET_STS_SUCCESS;
8910     l_bo_return_status := FND_API.G_RET_STS_SUCCESS;
8911     x_return_status := FND_API.G_RET_STS_SUCCESS;
8912 
8913     x_rev_component_tbl    := p_rev_component_tbl;
8914     x_ref_designator_tbl   := p_ref_designator_tbl;
8915     x_sub_component_tbl    := p_sub_component_tbl;
8916     x_rev_operation_tbl    := p_rev_operation_tbl;  --L1
8917     x_rev_op_resource_tbl  := p_rev_op_resource_tbl; --L1
8918     x_rev_sub_resource_tbl := p_rev_sub_resource_tbl; --L1
8919     BEGIN
8920         --  Load local records.
8921 
8922         l_revised_item_rec := p_revised_item_rec;
8923 
8924 
8925 
8926         -- make sure that the unexposed record does not have remains of
8927         -- any previous processing. This could be possible in the consequent
8928         -- iterations of this loop
8929         l_rev_item_unexp_rec := l_rev_item_miss_rec;
8930         l_Rev_Item_Unexp_Rec.organization_id := ENG_GLOBALS.Get_org_id;
8931 
8932 
8933         l_revised_item_rec.transaction_type :=
8934                 UPPER(l_revised_item_rec.transaction_type);
8935 
8936         --
8937         -- be sure to set the process_children to false at the start of each
8938         -- iteration to avoid faulty processing of children at the end of the loop
8939         --
8940         l_process_children := FALSE;
8941 
8942         IF p_change_notice IS NOT NULL AND
8943            p_organization_id IS NOT NULL
8944         THEN
8945                 l_eco_parent_exists := TRUE;
8946         END IF;
8947 
8948         -- Process Flow Step 2: Check if record has not yet been processed and
8949         -- that it is the child of the parent that called this procedure
8950         --
8951 
8952 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Revised Item . . . ' || l_revised_item_rec.revised_item_name); END IF;
8953 
8954         IF --(l_revised_item_rec.return_status IS NULL OR
8955             --l_revised_item_rec.return_status = FND_API.G_MISS_CHAR)
8956            --AND
8957            (NOT l_eco_parent_exists
8958             OR
8959             (l_eco_parent_exists AND
8960              (l_revised_item_rec.ECO_Name = p_change_notice AND
8961               l_rev_item_unexp_rec.organization_id = p_organization_id)))
8962         THEN
8963 
8964            l_return_status := FND_API.G_RET_STS_SUCCESS;
8965 
8966            l_revised_item_rec.return_status := FND_API.G_RET_STS_SUCCESS;
8967 
8968            -- Check if transaction_type is valid
8969            --
8970 
8971            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
8972            ENG_GLOBALS.Transaction_Type_Validity
8973            (   p_transaction_type       => l_revised_item_rec.transaction_type
8974            ,   p_entity                 => 'Rev_Items'
8975            ,   p_entity_id              => l_revised_item_rec.revised_item_name
8976            ,   x_valid                  => l_valid
8977            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
8978            );
8979 
8980            IF NOT l_valid
8981            THEN
8982                 l_return_status := Error_Handler.G_STATUS_ERROR;
8983                 RAISE EXC_SEV_QUIT_RECORD;
8984            END IF;
8985 
8986            -- Process Flow step 4: Convert user unique index to unique index
8987            --
8988 
8989            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index'); END IF;
8990            ENG_Val_To_Id.Revised_Item_UUI_To_UI
8991                 ( p_revised_item_rec   => l_revised_item_rec
8992                 , p_rev_item_unexp_rec => l_rev_item_unexp_rec
8993                 , x_rev_item_unexp_rec => l_rev_item_unexp_rec
8994                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
8995                 , x_Return_Status      => l_return_status
8996                 );
8997 
8998            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
8999 
9000            IF l_return_status = Error_Handler.G_STATUS_ERROR
9001            THEN
9002                 l_other_message := 'ENG_RIT_UUI_SEV_ERROR';
9003                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9004                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9005                 RAISE EXC_SEV_QUIT_BRANCH;
9006            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9007            THEN
9008                 l_other_message := 'ENG_RIT_UUI_UNEXP_SKIP';
9009                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9010                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9011                 RAISE EXC_UNEXP_SKIP_OBJECT;
9012            END IF;
9013 
9014            BOM_Globals.Set_Unit_Controlled_Item
9015            ( p_inventory_item_id => l_rev_item_unexp_rec.revised_item_id
9016            , p_organization_id  => l_rev_item_unexp_rec.organization_id
9017            );
9018 
9019            -- Process Flow step 5: Verify ECO's existence in database, if
9020            -- the revised item is being created on an ECO and the business
9021            -- object does not carry the ECO header
9022 
9023            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check parent existence'); END IF;
9024 
9025            IF l_revised_item_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
9026               AND
9027               NOT l_eco_parent_exists
9028            THEN
9029                 ENG_Validate_ECO.Check_Existence
9030                 ( p_change_notice       => l_revised_item_rec.ECO_Name
9031                 , p_organization_id     => l_rev_item_unexp_rec.organization_id
9032                 , p_organization_code   => l_revised_item_rec.organization_code
9033                 , p_calling_entity      => 'CHILD'
9034                 , p_transaction_type    => 'XXX'
9035                 , x_eco_rec             => l_old_eco_rec
9036                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
9037                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
9038                 , x_return_status       => l_Return_Status
9039                 );
9040 
9041                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9042 
9043                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9044                 THEN
9045                    l_other_message := 'ENG_PARENTECO_NOT_EXIST';
9046                    l_other_token_tbl(1).token_name := 'ECO_NAME';
9047                    l_other_token_tbl(1).token_value := l_revised_item_rec.ECO_Name;
9048                    l_other_token_tbl(2).token_name := 'ORGANIZATION_CODE';
9049                    l_other_token_tbl(2).token_value := l_revised_item_rec.organization_code;
9050                    RAISE EXC_SEV_QUIT_OBJECT;
9051                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9052                 THEN
9053                    l_other_message := 'ENG_RIT_LIN_UNEXP_SKIP';
9054                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9055                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9056                    RAISE EXC_UNEXP_SKIP_OBJECT;
9057                 END IF;
9058            END IF;
9059 
9060          IF l_revised_item_rec.Transaction_Type IN
9061                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
9062            THEN
9063 
9064 	-- Bug 2918350
9065 	-- Start Changes
9066 	IF p_change_notice IS NOT NULL AND p_organization_id IS NOT NULL THEN
9067 		l_chk_co_sch := ret_co_status ( p_change_notice, p_organization_id);
9068 	ELSE
9069 		l_chk_co_sch := ret_co_status ( l_revised_item_rec.eco_name, l_rev_item_unexp_rec.organization_id);
9070 	END IF;
9071 
9072 	IF l_chk_co_sch = 4 THEN
9073 		l_return_status := error_handler.g_status_error;
9074 		error_handler.add_error_token (p_message_name        => 'ENG_REV_ITM_NOT_UPD',
9075 			p_mesg_token_tbl      => l_mesg_token_tbl,
9076 			x_mesg_token_tbl      => l_mesg_token_tbl,
9077 			p_token_tbl           => l_token_tbl
9078 			);
9079 		RAISE exc_sev_quit_record;
9080 	END IF;
9081 
9082 	-- End Changes
9083        END IF;
9084 
9085           -- Bug No.:3614144 added by sseraphi to convert  new revision in small case to upper case while import
9086           -- adding this conversion before validations start.
9087 	   IF l_revised_item_rec.New_Revised_Item_Revision IS NOT null
9088 	   THEN
9089                 l_revised_item_rec.New_Revised_Item_Revision := UPPER(l_revised_item_rec.New_Revised_Item_Revision);
9090 	   END IF;
9091 	    IF l_revised_item_rec.Updated_Revised_Item_Revision IS NOT null
9092 	   THEN
9093                 l_revised_item_rec.Updated_Revised_Item_Revision := UPPER(l_revised_item_rec.Updated_Revised_Item_Revision);
9094 	   END IF;
9095            -- Process Flow step 5: Verify Revised Item's existence
9096            --
9097 
9098 	   IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
9099            ENG_Validate_Revised_Item.Check_Existence
9100                 (  p_revised_item_rec           => l_revised_item_rec
9101                 ,  p_rev_item_unexp_rec         => l_rev_item_unexp_rec
9102                 ,  x_old_revised_item_rec       => l_old_revised_item_rec
9103                 ,  x_old_rev_item_unexp_rec     => l_old_rev_item_unexp_rec
9104                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
9105                 ,  x_return_status              => l_Return_Status
9106 		,  x_disable_revision           => x_disable_revision  --BUG 3034642
9107                 );
9108 
9109            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9110 
9111            IF l_return_status = Error_Handler.G_STATUS_ERROR
9112            THEN
9113                 l_other_message := 'ENG_RIT_EXS_SEV_ERROR';
9114                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9115                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9116                 l_other_token_tbl(2).token_name := 'ECO_NAME';
9117                 l_other_token_tbl(2).token_value := l_revised_item_rec.eco_name;
9118                 RAISE EXC_SEV_QUIT_BRANCH;
9119            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9120            THEN
9121                 l_other_message := 'ENG_RIT_EXS_UNEXP_SKIP';
9122                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9123                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9124                 l_other_token_tbl(2).token_name := 'ECO_NAME';
9125                 l_other_token_tbl(2).token_value := l_revised_item_rec.eco_name;
9126                 RAISE EXC_UNEXP_SKIP_OBJECT;
9127            END IF;
9128 
9129 
9130            -- Process Flow step 6: Is Revised Item record an orphan ?
9131 
9132            IF NOT l_eco_parent_exists
9133            THEN
9134 
9135                 -- Process Flow step 7(a): Is ECO impl/cancl, or in wkflw process ?
9136                 --
9137 
9138                 ENG_Validate_ECO.Check_Access
9139                 ( p_change_notice       => l_revised_item_rec.ECO_Name
9140                 , p_organization_id     => l_rev_item_unexp_rec.organization_id
9141                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
9142                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
9143                 , x_Return_Status       => l_return_status
9144                 );
9145 
9146                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9147 
9148                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9149                 THEN
9150                         l_other_message := 'ENG_RIT_ECOACC_FAT_FATAL';
9151                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9152                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9153                         l_return_status := 'F';
9154                         RAISE EXC_FAT_QUIT_OBJECT;
9155                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9156                 THEN
9157                         l_other_message := 'ENG_RIT_ECOACC_UNEXP_SKIP';
9158                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9159                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9160                         RAISE EXC_UNEXP_SKIP_OBJECT;
9161                 END IF;
9162 
9163                 -- Process Flow step 7(b): check that user has access to revised item
9164                 --
9165 
9166                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
9167                 ENG_Validate_Revised_Item.Check_Access
9168                 (  p_change_notice      => l_revised_item_rec.ECO_Name
9169                 ,  p_organization_id    => l_rev_item_unexp_rec.organization_id
9170                 ,  p_revised_item_id    => l_rev_item_unexp_rec.revised_item_id
9171                 ,  p_new_item_revision  => l_revised_item_rec.new_revised_item_revision
9172                 ,  p_effectivity_date   => l_revised_item_rec.start_effective_date
9173                 ,  p_new_routing_revsion   => l_revised_item_rec.new_routing_revision  -- Added by MK on 11/02/00
9174                 ,  p_from_end_item_number  => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
9175                 ,  p_revised_item_name  => l_revised_item_rec.revised_item_name
9176                 ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
9177                 ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
9178                 ,  x_return_status      => l_Return_Status
9179                 );
9180 
9181                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9182 
9183                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9184                 THEN
9185                         l_other_message := 'ENG_RIT_ACCESS_FAT_FATAL';
9186                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9187                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9188                         l_return_status := 'F';
9189                         RAISE EXC_FAT_QUIT_BRANCH;
9190                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9191                 THEN
9192                         l_other_message := 'ENG_RIT_ACCESS_UNEXP_SKIP';
9193                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9194                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9195                         RAISE EXC_UNEXP_SKIP_OBJECT;
9196                 END IF;
9197 
9198            END IF;
9199 
9200            /****  Following Process Flow is for ECO Routing ***/
9201            --
9202            -- Process Flow step 8:  Flow Routing's operability for routing.
9203            -- (for future release, flow routing is not supported in current release
9204            -- Added by MK on 08/24/2000
9205            --
9206            /* Comment out for current release
9207            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Non-Flow Routing'); END IF;
9208 
9209            Bom_Validate_Rtg_Header.Check_flow_routing_operability ;
9210            (  p_assembly_item_name  =>  l_revised_item_rec.revised_item_name
9211             , p_cfm_routing_flag    =>  l_rev_item_unexp_rec.cfm_routing_flag
9212                                         -- in future, this shoud be exposed column
9213             , p_organization_id     =>  l_rev_item_unexp_rec.organization_id
9214             , x_mesg_token_tbl      =>  l_mesg_token_tbl
9215             , x_return_status       =>  l_return_status
9216             );
9217 
9218            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9219 
9220 
9221            IF l_return_status = Error_Handler.G_STATUS_ERROR
9222            THEN
9223                 l_other_message := 'BOM_RTG_FRACC_ERROR';
9224                 l_other_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
9225                 l_other_token_tbl(1).token_value :=
9226                                         l_revised_item_rec.revised_item_name;
9227                 RAISE EXC_SEV_QUIT_BRANCH;
9228            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9229            THEN
9230                 l_other_message := 'BOM_RTG_FRACC_UNEXP_SKIP';
9231                 l_other_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
9232                 l_other_token_tbl(1).token_value :=
9233                                         l_revised_item_rec.revised_item_name;
9234                 RAISE EXC_UNEXP_SKIP_OBJECT;
9235            END IF;
9236            */
9237 
9238 
9239 
9240            -- Process Flow step 9: Value to Id conversions
9241            --
9242 
9243            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-id conversions'); END IF;
9244            ENG_Val_To_Id.Revised_Item_VID
9245                 ( x_Return_Status       => l_return_status
9246                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
9247                 , p_rev_item_unexp_Rec  => l_rev_item_unexp_rec
9248                 , x_rev_item_unexp_Rec  => l_rev_item_unexp_rec
9249                 , p_revised_item_Rec    => l_revised_item_rec
9250                 );
9251 
9252            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9253 
9254            IF l_return_status = Error_Handler.G_STATUS_ERROR
9255            THEN
9256                 IF l_revised_item_rec.transaction_type = 'CREATE'
9257                 THEN
9258                         l_other_message := 'ENG_RIT_VID_CSEV_SKIP';
9259                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9260                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9261                         RAISE EXC_SEV_SKIP_BRANCH;
9262                 ELSE
9263                         RAISE EXC_SEV_QUIT_RECORD;
9264                 END IF;
9265            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9266            THEN
9267                 RAISE EXC_UNEXP_SKIP_OBJECT;
9268            ELSIF l_return_status ='S' AND
9269                 l_Mesg_Token_Tbl.COUNT <>0
9270            THEN
9271                 Eco_Error_Handler.Log_Error
9272                 (  p_revised_item_tbl   => x_revised_item_tbl
9273                 ,  p_rev_component_tbl  => x_rev_component_tbl
9274                 ,  p_ref_designator_tbl => x_ref_designator_tbl
9275                 ,  p_sub_component_tbl  => x_sub_component_tbl
9276                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9277                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9278                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9279                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
9280                 ,  p_error_status       => 'W'
9281                 ,  p_error_level        => 3
9282                 ,  p_entity_index       => I
9283                 ,  x_eco_rec            => l_eco_rec
9284                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
9285                 ,  x_revised_item_tbl   => x_revised_item_tbl
9286                 ,  x_rev_component_tbl  => x_rev_component_tbl
9287                 ,  x_ref_designator_tbl => x_ref_designator_tbl
9288                 ,  x_sub_component_tbl  => x_sub_component_tbl
9289                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
9290                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9291                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9292                 );
9293            END IF;
9294 
9295 	   -- Process Flow step 10: Attribute Validation for CREATE and UPDATE
9296            --
9297 
9298 
9299            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
9300            IF l_revised_item_rec.Transaction_Type IN
9301                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
9302            THEN
9303                 ENG_Validate_Revised_Item.Check_Attributes
9304                 ( x_return_status              => l_return_status
9305                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
9306                 , p_revised_item_rec           => l_revised_item_rec
9307                 , p_rev_item_unexp_rec         => l_rev_item_unexp_rec
9308                 , p_old_revised_item_rec       => l_old_revised_item_rec
9309                 , p_old_rev_item_unexp_rec     => l_old_rev_item_unexp_rec
9310                 );
9311 
9312                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9313 
9314                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9315                 THEN
9316                    IF l_revised_item_rec.transaction_type = 'CREATE'
9317                    THEN
9318                         l_other_message := 'ENG_RIT_ATTVAL_CSEV_SKIP';
9319                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9320                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9321                         RAISE EXC_SEV_SKIP_BRANCH;
9322                    ELSE
9323                         RAISE EXC_SEV_QUIT_RECORD;
9324                    END IF;
9325                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9326                 THEN
9327                    l_other_message := 'ENG_RIT_ATTVAL_UNEXP_SKIP';
9328                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9329                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9330                    RAISE EXC_UNEXP_SKIP_OBJECT;
9331                 ELSIF l_return_status ='S' AND
9332                       l_Mesg_Token_Tbl.COUNT <>0
9333                 THEN
9334                    Eco_Error_Handler.Log_Error
9335                         (  p_revised_item_tbl   => x_revised_item_tbl
9336                         ,  p_rev_component_tbl  => x_rev_component_tbl
9337                         ,  p_ref_designator_tbl => x_ref_designator_tbl
9338                         ,  p_sub_component_tbl  => x_sub_component_tbl
9339                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9340                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9341                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9342                         ,  p_mesg_token_tbl     =>  l_mesg_token_tbl
9343                         ,  p_error_status       => 'W'
9344                         ,  p_error_level        => 3
9345                         ,  p_entity_index       => I
9346                         ,  x_eco_rec            => l_eco_rec
9347                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
9348                         ,  x_revised_item_tbl   => x_revised_item_tbl
9349                         ,  x_rev_component_tbl  => x_rev_component_tbl
9350                         ,  x_ref_designator_tbl => x_ref_designator_tbl
9351                         ,  x_sub_component_tbl  => x_sub_component_tbl
9352                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9353                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9354                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9355                         );
9356                 END IF;
9357            END IF;
9358 
9359            IF l_revised_item_rec.Transaction_Type IN
9360                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
9361            THEN
9362 
9363                 -- Process flow step 11 - Populate NULL columns for Update and
9364                 -- Delete.
9365 
9366                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
9367                 Eng_Default_Revised_Item.Populate_NULL_Columns
9368                 (   p_revised_item_rec          => l_revised_item_rec
9369                 ,   p_old_revised_item_rec      => l_old_revised_item_rec
9370                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
9371                 ,   p_old_rev_item_unexp_rec    => l_old_rev_item_unexp_rec
9372                 ,   x_revised_item_rec          => l_revised_item_rec
9373                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
9374                 );
9375 
9376            ELSIF l_revised_item_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
9377 
9378                 -- Process Flow step 12: Default missing values for Operation CREATE
9379                 --
9380 
9381                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
9382                 Eng_Default_Revised_Item.Attribute_Defaulting
9383                 (   p_revised_item_rec          => l_revised_item_rec
9384                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
9385                 ,   x_revised_item_rec          => l_revised_item_rec
9386                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
9387                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
9388                 ,   x_return_status             => l_return_status
9389                 );
9390 
9391                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9392 
9393                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9394                 THEN
9395                         l_other_message := 'ENG_RIT_ATTDEF_SEV_SKIP';
9396                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9397                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9398                         RAISE EXC_SEV_SKIP_BRANCH;
9399                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9400                 THEN
9401                         l_other_message := 'ENG_RIT_ATTDEF_UNEXP_SKIP';
9402                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9403                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9404                         RAISE EXC_UNEXP_SKIP_OBJECT;
9405                 ELSIF l_return_status ='S' AND
9406                         l_Mesg_Token_Tbl.COUNT <>0
9407                 THEN
9408                         Eco_Error_Handler.Log_Error
9409                         (  p_revised_item_tbl   => x_revised_item_tbl
9410                         ,  p_rev_component_tbl  => x_rev_component_tbl
9411                         ,  p_ref_designator_tbl => x_ref_designator_tbl
9412                         ,  p_sub_component_tbl  => x_sub_component_tbl
9413                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9414                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9415                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9416                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
9417                         ,  p_error_status       => 'S'
9418                         ,  p_error_level        => 3
9419                         ,  p_entity_index       => I
9420                         ,  x_eco_rec            => l_eco_rec
9421                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
9422                         ,  x_revised_item_tbl   => x_revised_item_tbl
9423                         ,  x_rev_component_tbl  => x_rev_component_tbl
9424                         ,  x_ref_designator_tbl => x_ref_designator_tbl
9425                         ,  x_sub_component_tbl  => x_sub_component_tbl
9426                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9427                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9428                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9429                         );
9430                 END IF;
9431            END IF;
9432 
9433            -- Process Flow step 13 - Conditionally required attributes check
9434            --
9435 
9436            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Conditionally required attributes check'); END IF;
9437 
9438            --
9439            -- Put conditionally required check procedure here
9440            --
9441 
9442            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9443 
9444            ENG_Validate_Revised_Item.Check_Required
9445                 ( x_return_status              => l_return_status
9446                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
9447                 , p_revised_item_rec           => l_revised_item_rec
9448                 );
9449 
9450            IF l_return_status = Error_Handler.G_STATUS_ERROR
9451            THEN
9452                 IF l_revised_item_rec.transaction_type = 'CREATE'
9453                 THEN
9454                         l_other_message := 'ENG_RIT_CONREQ_CSEV_SKIP';
9455                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9456                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9457                         RAISE EXC_SEV_SKIP_BRANCH;
9458                 ELSE
9459                         RAISE EXC_SEV_QUIT_RECORD;
9460                 END IF;
9461            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9462            THEN
9463                 l_other_message := 'ENG_RIT_CONREQ_UNEXP_SKIP';
9464                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9465                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9466                 RAISE EXC_UNEXP_SKIP_OBJECT;
9467            ELSIF l_return_status ='S' AND
9468                 l_Mesg_Token_Tbl.COUNT <>0
9469            THEN
9470                 Eco_Error_Handler.Log_Error
9471                 (  p_revised_item_tbl       => x_revised_item_tbl
9472                 ,  p_rev_component_tbl      => x_rev_component_tbl
9473                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
9474                 ,  p_sub_component_tbl      => x_sub_component_tbl
9475                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9476                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9477                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9478                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
9479                 ,  p_error_status           => 'W'
9480                 ,  p_error_level            => 3
9481                 ,  p_entity_index           => I
9482                 ,  x_eco_rec                => l_eco_rec
9483                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
9484                 ,  x_revised_item_tbl       => x_revised_item_tbl
9485                 ,  x_rev_component_tbl      => x_rev_component_tbl
9486                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
9487                 ,  x_sub_component_tbl      => x_sub_component_tbl
9488                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
9489                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9490                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9491                 );
9492            END IF;
9493 
9494            -- Process Flow step 14: Entity defaulting for CREATE and UPDATE
9495            --
9496 
9497            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting'); END IF;
9498            IF l_revised_item_rec.Transaction_Type IN
9499                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
9500            THEN
9501                 ENG_Default_Revised_Item.Entity_Defaulting
9502                 (   p_revised_item_rec          => l_revised_item_rec
9503                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
9504                 ,   p_old_revised_item_rec      => l_old_revised_item_rec
9505                 ,   p_old_rev_item_unexp_rec    => l_old_rev_item_unexp_rec
9506                 ,   x_revised_item_rec          => l_revised_item_rec
9507                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
9508                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
9509                 ,   x_return_status             => l_return_status
9510                 );
9511 
9512                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9513 
9514                 IF l_return_status = Error_Handler.G_STATUS_ERROR
9515                 THEN
9516                    IF l_revised_item_rec.transaction_type = 'CREATE'
9517                    THEN
9518                         l_other_message := 'ENG_RIT_ENTDEF_CSEV_SKIP';
9519                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9520                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9521                         RAISE EXC_SEV_SKIP_BRANCH;
9522                    ELSE
9523                         RAISE EXC_SEV_QUIT_RECORD;
9524                    END IF;
9525                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9526                 THEN
9527                         l_other_message := 'ENG_RIT_ENTDEF_UNEXP_SKIP';
9528                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9529                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9530                         RAISE EXC_UNEXP_SKIP_OBJECT;
9531                 ELSIF l_return_status ='S' AND
9532                         l_Mesg_Token_Tbl.COUNT <>0
9533                 THEN
9534                         Eco_Error_Handler.Log_Error
9535                         (  p_revised_item_tbl    => x_revised_item_tbl
9536                         ,  p_rev_component_tbl   => x_rev_component_tbl
9537                         ,  p_ref_designator_tbl  => x_ref_designator_tbl
9538                         ,  p_sub_component_tbl   => x_sub_component_tbl
9539                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9540                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9541                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9542                         ,  p_mesg_token_tbl      => l_mesg_token_tbl
9543                         ,  p_error_status        => 'W'
9544                         ,  p_error_level         => 3
9545                         ,  p_entity_index        => I
9546                         ,  x_eco_rec             => l_eco_rec
9547                         ,  x_eco_revision_tbl    => l_eco_revision_tbl
9548                         ,  x_revised_item_tbl    => x_revised_item_tbl
9549                         ,  x_rev_component_tbl   => x_rev_component_tbl
9550                         ,  x_ref_designator_tbl  => x_ref_designator_tbl
9551                         ,  x_sub_component_tbl   => x_sub_component_tbl
9552                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9553                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9554                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9555                         );
9556                 END IF;
9557            END IF;
9558 
9559            -- Process Flow step 15 - Entity Level Validation
9560            --
9561 
9562            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
9563 
9564            IF l_revised_item_rec.transaction_type = 'DELETE'
9565            THEN
9566                 Eng_Validate_Revised_Item.Check_Entity_Delete
9567                 (  p_revised_item_rec     => l_revised_item_rec
9568                 ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
9569                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
9570                 ,  x_return_status        => l_Return_Status
9571                 );
9572            ELSE
9573                 Eng_Validate_Revised_Item.Check_Entity
9574                 (  p_revised_item_rec     => l_revised_item_rec
9575                 ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
9576                 ,  p_old_revised_item_rec => l_old_revised_item_rec
9577                 ,  p_old_rev_item_unexp_rec => l_old_rev_item_unexp_rec
9578                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
9579                 ,  x_return_status        => l_Return_Status
9580                 );
9581            END IF;
9582 
9583            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9584 
9585            IF l_return_status = Error_Handler.G_STATUS_ERROR
9586            THEN
9587                 IF l_revised_item_rec.transaction_type = 'CREATE'
9588                 THEN
9589                         l_other_message := 'ENG_RIT_ENTVAL_CSEV_SKIP';
9590                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9591                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9592                         RAISE EXC_SEV_SKIP_BRANCH;
9593                 ELSE
9594                         RAISE EXC_SEV_QUIT_RECORD;
9595                 END IF;
9596            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9597            THEN
9598                 l_other_message := 'ENG_RIT_ENTVAL_UNEXP_SKIP';
9599                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9600                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9601                 RAISE EXC_UNEXP_SKIP_OBJECT;
9602            ELSIF l_return_status ='S' AND
9603                 l_Mesg_Token_Tbl.COUNT <>0
9604            THEN
9605                 Eco_Error_Handler.Log_Error
9606                 (  p_revised_item_tbl       => x_revised_item_tbl
9607                 ,  p_rev_component_tbl      => x_rev_component_tbl
9608                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
9609                 ,  p_sub_component_tbl      => x_sub_component_tbl
9610                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9611                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9612                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9613                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
9614                 ,  p_error_status           => 'W'
9615                 ,  p_error_level            => 3
9616                 ,  p_entity_index           => I
9617                 ,  x_eco_rec                => l_eco_rec
9618                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
9619                 ,  x_revised_item_tbl       => x_revised_item_tbl
9620                 ,  x_rev_component_tbl      => x_rev_component_tbl
9621                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
9622                 ,  x_sub_component_tbl      => x_sub_component_tbl
9623                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
9624                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9625                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9626                 );
9627            END IF;
9628 
9629            -- Process Flow step 16 : Database Writes
9630            --
9631 
9632            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
9633            ENG_Revised_Item_Util.Perform_Writes
9634                 (   p_revised_item_rec          => l_revised_item_rec
9635                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
9636                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
9637                 ,   x_return_status             => l_return_status
9638                 );
9639 
9640            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
9641 
9642            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
9643            THEN
9644                 l_other_message := 'ENG_RIT_WRITES_UNEXP_SKIP';
9645                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
9646                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
9647                 RAISE EXC_UNEXP_SKIP_OBJECT;
9648            ELSIF l_return_status ='S' AND
9649               l_Mesg_Token_Tbl.COUNT <>0
9650            THEN
9651                 Eco_Error_Handler.Log_Error
9652                 (  p_revised_item_tbl       => x_revised_item_tbl
9653                 ,  p_rev_component_tbl      => x_rev_component_tbl
9654                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
9655                 ,  p_sub_component_tbl      => x_sub_component_tbl
9656                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9657                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9658                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9659                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
9660                 ,  p_error_status           => 'W'
9661                 ,  p_error_level            => 3
9662                 ,  p_entity_index           => I
9663                 ,  x_eco_rec                => l_eco_rec
9664                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
9665                 ,  x_revised_item_tbl       => x_revised_item_tbl
9666                 ,  x_rev_component_tbl      => x_rev_component_tbl
9667                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
9668                 ,  x_sub_component_tbl      => x_sub_component_tbl
9669                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
9670                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9671                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9672                 );
9673            END IF;
9674 
9675 IF Bom_Globals.Get_Debug = 'Y' THEN
9676      Error_Handler.Write_Debug('Writing to the database for Rev Item is completed with '||l_return_status );
9677 END IF;
9678 
9679         END IF; -- END IF statement that checks RETURN STATUS
9680 
9681         --  Load tables.
9682 
9683         x_revised_item_tbl(I)          := l_revised_item_rec;
9684 
9685         --
9686         -- If everything goes well then, process children
9687         --
9688         l_process_children := TRUE;
9689 
9690      -- Reset system_information flags
9691 
9692      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9693      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9694      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9695      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9696 
9697     --  For loop exception handler.
9698 
9699 
9700     EXCEPTION
9701 
9702        WHEN EXC_SEV_QUIT_RECORD THEN
9703 
9704         Eco_Error_Handler.Log_Error
9705                 (  p_revised_item_tbl       => x_revised_item_tbl
9706                 ,  p_rev_component_tbl      => x_rev_component_tbl
9707                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
9708                 ,  p_sub_component_tbl      => x_sub_component_tbl
9709                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9710                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9711                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9712                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
9713                 ,  p_error_status           => FND_API.G_RET_STS_ERROR
9714                 ,  p_error_scope            => Error_Handler.G_SCOPE_RECORD
9715                 ,  p_error_level            => 3
9716                 ,  p_entity_index           => I
9717                 ,  x_eco_rec                => l_eco_rec
9718                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
9719                 ,  x_revised_item_tbl       => x_revised_item_tbl
9720                 ,  x_rev_component_tbl      => x_rev_component_tbl
9721                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
9722                 ,  x_sub_component_tbl      => x_sub_component_tbl
9723                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
9724                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9725                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9726                 );
9727 
9728         l_process_children := TRUE;
9729 
9730         IF l_bo_return_status = 'S'
9731         THEN
9732                 l_bo_return_status     := l_return_status;
9733         END IF;
9734         x_return_status                := l_bo_return_status;
9735         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9736         --x_revised_item_tbl             := l_revised_item_tbl;
9737         --x_rev_component_tbl            := l_rev_component_tbl;
9738         --x_ref_designator_tbl           := l_ref_designator_tbl;
9739         --x_sub_component_tbl            := l_sub_component_tbl;
9740         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9741         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9742         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9743 
9744         -- Reset system_information flags
9745 
9746      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9747      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9748      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9749      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9750 
9751        WHEN EXC_SEV_QUIT_BRANCH THEN
9752 
9753         Eco_Error_Handler.Log_Error
9754                 (  p_revised_item_tbl    => x_revised_item_tbl
9755                 ,  p_rev_component_tbl   => x_rev_component_tbl
9756                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
9757                 ,  p_sub_component_tbl   => x_sub_component_tbl
9758                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9759                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9760                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9761                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
9762                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
9763                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
9764                 ,  p_other_status        => Error_Handler.G_STATUS_ERROR
9765                 ,  p_other_message       => l_other_message
9766                 ,  p_other_token_tbl     => l_other_token_tbl
9767                 ,  p_error_level         => 3
9768                 ,  p_entity_index        => I
9769                 ,  x_eco_rec             => l_eco_rec
9770                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
9771                 ,  x_revised_item_tbl    => x_revised_item_tbl
9772                 ,  x_rev_component_tbl   => x_rev_component_tbl
9773                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
9774                 ,  x_sub_component_tbl   => x_sub_component_tbl
9775                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9776                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9777                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9778                 );
9779 
9780         l_process_children := FALSE;
9781 
9782         IF l_bo_return_status = 'S'
9783         THEN
9784                 l_bo_return_status     := l_return_status;
9785         END IF;
9786         x_return_status                := l_bo_return_status;
9787         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9788         --x_revised_item_tbl             := l_revised_item_tbl;
9789         --x_rev_component_tbl            := l_rev_component_tbl;
9790         --x_ref_designator_tbl           := l_ref_designator_tbl;
9791         --x_sub_component_tbl            := l_sub_component_tbl;
9792         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9793         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9794         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9795 
9796         -- Reset system_information flags
9797 
9798      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9799      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9800      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9801      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9802 
9803        WHEN EXC_SEV_SKIP_BRANCH THEN
9804 
9805         Eco_Error_Handler.Log_Error
9806                 (  p_revised_item_tbl    => x_revised_item_tbl
9807                 ,  p_rev_component_tbl   => x_rev_component_tbl
9808                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
9809                 ,  p_sub_component_tbl   => x_sub_component_tbl
9810                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9811                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9812                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9813                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
9814                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
9815                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
9816                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
9817                 ,  p_other_message       => l_other_message
9818                 ,  p_other_token_tbl     => l_other_token_tbl
9819                 ,  p_error_level         => 3
9820                 ,  p_entity_index        => I
9821                 ,  x_eco_rec             => l_eco_rec
9822                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
9823                 ,  x_revised_item_tbl    => x_revised_item_tbl
9824                 ,  x_rev_component_tbl   => x_rev_component_tbl
9825                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
9826                 ,  x_sub_component_tbl   => x_sub_component_tbl
9827                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9828                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9829                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9830                 );
9831 
9832         l_process_children := FALSE;
9833 
9834         IF l_bo_return_status = 'S'
9835         THEN
9836                 l_bo_return_status     := l_return_status;
9837         END IF;
9838         x_return_status                := l_bo_return_status;
9839         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9840         --x_revised_item_tbl             := l_revised_item_tbl;
9841         --x_rev_component_tbl            := l_rev_component_tbl;
9842         --x_ref_designator_tbl           := l_ref_designator_tbl;
9843         --x_sub_component_tbl            := l_sub_component_tbl;
9844         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9845         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9846         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9847 
9848         -- Reset system_information flags
9849 
9850      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9851      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9852      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9853      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9854 
9855         WHEN EXC_SEV_QUIT_OBJECT THEN
9856 
9857         Eco_Error_Handler.Log_Error
9858             (  p_revised_item_tbl       => x_revised_item_tbl
9859              , p_rev_component_tbl      => x_rev_component_tbl
9860              , p_ref_designator_tbl     => x_ref_designator_tbl
9861              , p_sub_component_tbl      => x_sub_component_tbl
9862              , p_rev_operation_tbl      => x_rev_operation_tbl    --L1
9863              , p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
9864              , p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
9865              , p_error_status           => Error_Handler.G_STATUS_ERROR
9866              , p_error_scope            => Error_Handler.G_SCOPE_ALL
9867              , p_error_level            => Error_Handler.G_BO_LEVEL
9868              , p_other_message          => l_other_message
9869              , p_other_status           => Error_Handler.G_STATUS_ERROR
9870              , p_other_token_tbl        => l_other_token_tbl
9871              , x_eco_rec                => l_eco_rec
9872              , x_eco_revision_tbl       => l_eco_revision_tbl
9873              , x_revised_item_tbl       => x_revised_item_tbl
9874              , x_rev_component_tbl      => x_rev_component_tbl
9875              , x_ref_designator_tbl     => x_ref_designator_tbl
9876              , x_sub_component_tbl      => x_sub_component_tbl
9877              , x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9878              , x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9879              , x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9880              );
9881 
9882         IF l_bo_return_status = 'S'
9883         THEN
9884                 l_bo_return_status     := l_return_status;
9885         END IF;
9886         x_return_status                := l_bo_return_status;
9887         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9888         --x_revised_item_tbl             := l_revised_item_tbl;
9889         --x_rev_component_tbl            := l_rev_component_tbl;
9890         --x_ref_designator_tbl           := l_ref_designator_tbl;
9891         --x_sub_component_tbl            := l_sub_component_tbl;
9892         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9893         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9894         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9895 
9896         -- Reset system_information flags
9897 
9898      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9899      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9900      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9901      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9902 
9903        WHEN EXC_FAT_QUIT_BRANCH THEN
9904 
9905         Eco_Error_Handler.Log_Error
9906                 (  p_revised_item_tbl    => x_revised_item_tbl
9907                 ,  p_rev_component_tbl   => x_rev_component_tbl
9908                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
9909                 ,  p_sub_component_tbl   => x_sub_component_tbl
9910                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9911                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9912                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9913                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
9914                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
9915                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
9916                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
9917                 ,  p_other_message       => l_other_message
9918                 ,  p_other_token_tbl     => l_other_token_tbl
9919                 ,  p_error_level         => 3
9920                 ,  p_entity_index        => I
9921                 ,  x_eco_rec             => l_eco_rec
9922                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
9923                 ,  x_revised_item_tbl    => x_revised_item_tbl
9924                 ,  x_rev_component_tbl   => x_rev_component_tbl
9925                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
9926                 ,  x_sub_component_tbl   => x_sub_component_tbl
9927                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9928                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9929                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9930                 );
9931 
9932         l_process_children := FALSE;
9933 
9934         x_return_status                := Error_Handler.G_STATUS_FATAL;
9935         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9936         --x_revised_item_tbl             := l_revised_item_tbl;
9937         --x_rev_component_tbl            := l_rev_component_tbl;
9938         --x_ref_designator_tbl           := l_ref_designator_tbl;
9939         --x_sub_component_tbl            := l_sub_component_tbl;
9940         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9941         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9942         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9943 
9944         -- Reset system_information flags
9945 
9946      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9947      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9948      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9949      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9950 
9951        WHEN EXC_FAT_QUIT_OBJECT THEN
9952 
9953         Eco_Error_Handler.Log_Error
9954                 (  p_revised_item_tbl    => x_revised_item_tbl
9955                 ,  p_rev_component_tbl   => x_rev_component_tbl
9956                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
9957                 ,  p_sub_component_tbl   => x_sub_component_tbl
9958                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
9959                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9960                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9961                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
9962                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
9963                 ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
9964                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
9965                 ,  p_other_message       => l_other_message
9966                 ,  p_other_token_tbl     => l_other_token_tbl
9967                 ,  p_error_level         => 3
9968                 ,  p_entity_index        => I
9969                 ,  x_eco_rec             => l_eco_rec
9970                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
9971                 ,  x_revised_item_tbl    => x_revised_item_tbl
9972                 ,  x_rev_component_tbl   => x_rev_component_tbl
9973                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
9974                 ,  x_sub_component_tbl   => x_sub_component_tbl
9975                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
9976                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
9977                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
9978                 );
9979 
9980         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
9981         --x_revised_item_tbl             := l_revised_item_tbl;
9982         --x_rev_component_tbl            := l_rev_component_tbl;
9983         --x_ref_designator_tbl           := l_ref_designator_tbl;
9984         --x_sub_component_tbl            := l_sub_component_tbl;
9985         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
9986         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
9987         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
9988 
9989         -- Reset system_information flags
9990 
9991      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
9992      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
9993      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
9994      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
9995 
9996         l_return_status := 'Q';
9997 
9998        WHEN EXC_UNEXP_SKIP_OBJECT THEN
9999 
10000         Eco_Error_Handler.Log_Error
10001                 (  p_revised_item_tbl    => x_revised_item_tbl
10002                 ,  p_rev_component_tbl   => x_rev_component_tbl
10003                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
10004                 ,  p_sub_component_tbl   => x_sub_component_tbl
10005                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
10006                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10007                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10008                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
10009                 ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
10010                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
10011                 ,  p_other_message       => l_other_message
10012                 ,  p_other_token_tbl     => l_other_token_tbl
10013                 ,  p_error_level         => 3
10014                 ,  x_ECO_rec             => l_ECO_rec
10015                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
10016                 ,  x_revised_item_tbl    => x_revised_item_tbl
10017                 ,  x_rev_component_tbl   => x_rev_component_tbl
10018                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
10019                 ,  x_sub_component_tbl   => x_sub_component_tbl
10020                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
10021                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10022                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10023                 );
10024 
10025         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
10026         --x_revised_item_tbl             := l_revised_item_tbl;
10027         --x_rev_component_tbl            := l_rev_component_tbl;
10028         --x_ref_designator_tbl           := l_ref_designator_tbl;
10029         --x_sub_component_tbl            := l_sub_component_tbl;
10030         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
10031         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
10032         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
10033 
10034         -- Reset system_information flags
10035 
10036      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
10037      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
10038      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
10039      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
10040 
10041         l_return_status := 'U';
10042 
10043         END; -- END block
10044 
10045         IF l_return_status in ('Q', 'U')
10046         THEN
10047                 x_return_status := l_return_status;
10048                 RETURN;
10049         END IF;
10050 
10051     IF l_process_children
10052     THEN
10053 
10054 
10055         -- L1: The following is for ECO enhancement
10056         -- Process operations that are orphans
10057         -- (without immediate revised component parents) but are
10058         -- indirect children of this item
10059         --
10060         -- Modified by MK on 11/30/00 Moved eco for routing procedure before BOMs.
10061         --
10062 
10063 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Op children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
10064 
10065         Rev_Operation_Sequences
10066         (   p_validation_level          => p_validation_level
10067         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10068         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10069         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10070         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10071         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
10072         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10073         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10074         ,   p_rev_operation_tbl         => x_rev_operation_tbl
10075         ,   p_rev_op_resource_tbl       => x_rev_op_resource_tbl
10076         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10077         ,   x_rev_operation_tbl         => x_rev_operation_tbl
10078         ,   x_rev_op_resource_tbl       => x_rev_op_resource_tbl
10079         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10080         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10081         ,   x_return_status             => l_return_status
10082         );
10083 
10084         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10085         THEN
10086                 l_bo_return_status := l_return_status;
10087         END IF;
10088 
10089 
10090 
10091         -- Process resource that are orphans
10092         -- (without immediate revised component parents) but are
10093         -- indirect children of this item
10094 
10095 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Op Res children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
10096 
10097 
10098         Rev_Operation_Resources
10099         (   p_validation_level          => p_validation_level
10100         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10101         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10102         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10103         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10104         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
10105         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10106         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10107         ,   p_rev_op_resource_tbl       => x_rev_op_resource_tbl
10108         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10109         ,   x_rev_op_resource_tbl       => x_rev_op_resource_tbl
10110         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10111         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10112         ,   x_return_status             => l_return_status
10113         );
10114        IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10115        THEN
10116                 l_bo_return_status := l_return_status;
10117        END IF;
10118 
10119         -- Process substitute resources that are orphans
10120         -- (without immediate revised component parents) but are
10121         -- indirect children of this item
10122 
10123 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Sub Op Res children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
10124 
10125 
10126        Rev_Sub_Operation_Resources
10127         (   p_validation_level          => p_validation_level
10128         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10129         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10130         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10131         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10132         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
10133         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10134         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10135         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10136         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
10137         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10138         ,   x_return_status             => l_return_status
10139         );
10140         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10141         THEN
10142                 l_bo_return_status := l_return_status;
10143         END IF;
10144 
10145         -- L1: The above is for ECO enhancement
10146 
10147 
10148         -- Process Revised Components that are direct children of this item
10149 
10150 IF Bom_Globals.Get_Debug = 'Y' THEN
10151     Error_Handler.Write_Debug('***********************************************************') ;
10152     Error_Handler.Write_Debug('Now processing direct children for the Rev Item '
10153                               || l_revised_item_rec.revised_item_name || '. . .'  );
10154     Error_Handler.Write_Debug('Processing Rev Comp as children of Revised item ' || l_revised_item_rec.revised_item_name);
10155 END IF;
10156 
10157         Rev_Comps
10158         (   p_validation_level          => p_validation_level
10159         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10160         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10161         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10162         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code -- Bug 2429272 Change 4
10163         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10164         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
10165         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10166         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10167         ,   p_rev_component_tbl         => x_rev_component_tbl
10168         ,   p_ref_designator_tbl        => x_ref_designator_tbl
10169         ,   p_sub_component_tbl         => x_sub_component_tbl
10170         ,   x_rev_component_tbl         => x_rev_component_tbl
10171         ,   x_ref_designator_tbl        => x_ref_designator_tbl
10172         ,   x_sub_component_tbl         => x_sub_component_tbl
10173         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10174         ,   x_return_status             => l_return_status
10175 	,   x_bill_sequence_id          => l_rev_item_unexp_rec.bill_sequence_id
10176         );
10177 
10178 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Rev_Comps return status ' || l_return_status); END IF;
10179 
10180         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10181         THEN
10182 
10183 IF Bom_Globals.Get_Debug = 'Y' THEN
10184         Error_Handler.Write_Debug('Rev_Comps returned in Rev_Items . . .BO Status: ' || l_return_status);
10185 END IF;
10186 
10187                 l_bo_return_status := l_return_status;
10188         END IF;
10189 
10190         -- Process Reference Designators that are orphans
10191         -- (without immediate revised component parents) but are
10192         -- indirect children of this item
10193 
10194 IF Bom_Globals.Get_Debug = 'Y' THEN
10195     Error_Handler.Write_Debug('***********************************************************') ;
10196     Error_Handler.Write_Debug('Processing Ref Desgs as children of Revised item ' || l_revised_item_rec.revised_item_name);
10197 END IF;
10198 
10199 
10200         Ref_Desgs
10201         (   p_validation_level          => p_validation_level
10202         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10203         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10204         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10205         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code  -- Bug 3991176
10206         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10207         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
10208         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10209         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10210         ,   p_ref_designator_tbl        => x_ref_designator_tbl
10211         ,   p_sub_component_tbl         => x_sub_component_tbl
10212         ,   x_ref_designator_tbl        => x_ref_designator_tbl
10213         ,   x_sub_component_tbl         => x_sub_component_tbl
10214         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10215         ,   x_return_status             => l_return_status
10216         );
10217 
10218         -- Process Substitute Components that are orphans
10219         -- (without immediate revised component parents) but are
10220         -- indirect children of this item
10221 
10222         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10223         THEN
10224                 l_bo_return_status := l_return_status;
10225         END IF;
10226 
10227 IF Bom_Globals.Get_Debug = 'Y' THEN
10228     Error_Handler.Write_Debug('***********************************************************') ;
10229     Error_Handler.Write_Debug('Processing Sub Comps children of Revised item ' || l_revised_item_rec.revised_item_name);
10230 END IF;
10231 
10232         Sub_Comps
10233         (   p_validation_level          => p_validation_level
10234         ,   p_change_notice             => l_revised_item_rec.ECO_Name
10235         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
10236         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
10237         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code  -- Bug 3991176
10238         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
10239         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
10240         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
10241         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10242         ,   p_sub_component_tbl         => x_sub_component_tbl
10243         ,   x_sub_component_tbl         => x_sub_component_tbl
10244         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10245         ,   x_return_status             => l_return_status
10246         );
10247 
10248         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
10249         THEN
10250                 l_bo_return_status := l_return_status;
10251         END IF;
10252 
10253 
10254     END IF; -- END Process children
10255     x_revised_item_unexp_rec := l_rev_item_unexp_rec;
10256     x_return_status := l_bo_return_status;
10257 
10258 END Process_Rev_Item;
10259 
10260 
10261 --  Rev_Items
10262 
10263 PROCEDURE Rev_Items
10264 (   p_validation_level              IN  NUMBER
10265 ,   p_change_notice                 IN  VARCHAR2 := NULL
10266 ,   p_organization_id               IN  NUMBER := NULL
10267 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
10268 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
10269 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
10270 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
10271 ,   p_rev_operation_tbl             IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
10272 ,   p_rev_op_resource_tbl           IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
10273 ,   p_rev_sub_resource_tbl          IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
10274 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
10275 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
10276 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
10277 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
10278 ,   x_rev_operation_tbl             IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
10279 ,   x_rev_op_resource_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
10280 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
10281 ,   x_Mesg_Token_Tbl                OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
10282 ,   x_return_status                 OUT NOCOPY VARCHAR2
10283 ,   x_disable_revision              OUT NOCOPY NUMBER --Bug no:3034642
10284 )
10285 IS
10286 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
10287 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
10288 l_other_message         VARCHAR2(2000);
10289 l_err_text              VARCHAR2(2000);
10290 l_valid                 BOOLEAN := TRUE;
10291 l_eco_parent_exists     BOOLEAN := FALSE;
10292 l_Return_Status         VARCHAR2(1);
10293 l_bo_return_status      VARCHAR2(1);
10294 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
10295 l_old_eco_rec           ENG_Eco_PUB.Eco_Rec_Type;
10296 l_old_eco_unexp_rec     ENG_Eco_PUB.Eco_Unexposed_Rec_Type;
10297 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
10298 l_revised_item_rec      ENG_Eco_PUB.Revised_Item_Rec_Type;
10299 --l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type := p_revised_item_tbl;
10300 l_rev_item_unexp_rec    ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
10301 l_rev_item_miss_rec     ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
10302 l_old_revised_item_rec  ENG_Eco_PUB.Revised_Item_Rec_Type;
10303 l_old_rev_item_unexp_rec ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type;
10304 --l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
10305 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
10306 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
10307 --l_rev_operation_tbl     Bom_Rtg_Pub.Rev_Operation_Tbl_Type := p_rev_operation_tbl;  --L1
10308 --l_rev_op_resource_tbl   Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type :=p_rev_op_resource_tbl; --L1
10309 --l_rev_sub_resource_tbl  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type :=p_rev_sub_resource_tbl; --L1
10310 l_return_value          NUMBER;
10311 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
10312 
10313 l_process_children      BOOLEAN := TRUE;
10314 
10315 EXC_SEV_QUIT_RECORD     EXCEPTION;
10316 EXC_SEV_QUIT_SIBLINGS   EXCEPTION;
10317 EXC_SEV_QUIT_BRANCH     EXCEPTION;
10318 EXC_SEV_QUIT_OBJECT     EXCEPTION;
10319 EXC_SEV_SKIP_BRANCH     EXCEPTION;
10320 EXC_FAT_QUIT_OBJECT     EXCEPTION;
10321 EXC_FAT_QUIT_BRANCH     EXCEPTION;
10322 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
10323 
10324 	-- Bug 2918350 // kamohan
10325 	-- Start Changes
10326 
10327 	l_chk_co_sch eng_engineering_changes.status_type%TYPE;
10328 
10329 	-- End Changes
10330 
10331 BEGIN
10332 
10333     --  Init local table variables.
10334 
10335     l_return_status := FND_API.G_RET_STS_SUCCESS;
10336     l_bo_return_status := FND_API.G_RET_STS_SUCCESS;
10337     x_return_status := FND_API.G_RET_STS_SUCCESS;
10338 
10339     x_revised_item_tbl             := p_revised_item_tbl;
10340     x_rev_component_tbl            := p_rev_component_tbl;
10341     x_ref_designator_tbl           := p_ref_designator_tbl;
10342     x_sub_component_tbl            := p_sub_component_tbl;
10343     x_rev_operation_tbl            := p_rev_operation_tbl;  --L1
10344     x_rev_op_resource_tbl          := p_rev_op_resource_tbl; --L1
10345     x_rev_sub_resource_tbl         := p_rev_sub_resource_tbl; --L1
10346 
10347     -- l_Rev_Item_Unexp_Rec.organization_id := ENG_GLOBALS.Get_org_id;
10348 
10349     FOR I IN 1..x_revised_item_tbl.COUNT LOOP
10350     IF (x_revised_item_tbl(I).return_status IS NULL OR
10351          x_revised_item_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
10352 
10353     BEGIN
10354 
10355         --  Load local records.
10356 
10357         l_revised_item_rec := x_revised_item_tbl(I);
10358 
10359 
10360 
10361         -- make sure that the unexposed record does not have remains of
10362         -- any previous processing. This could be possible in the consequent
10363         -- iterations of this loop
10364         l_rev_item_unexp_rec := l_rev_item_miss_rec;
10365         l_Rev_Item_Unexp_Rec.organization_id := ENG_GLOBALS.Get_org_id;
10366 
10367 
10368         l_revised_item_rec.transaction_type :=
10369                 UPPER(l_revised_item_rec.transaction_type);
10370 
10371         --
10372         -- be sure to set the process_children to false at the start of each
10373         -- iteration to avoid faulty processing of children at the end of the loop
10374         --
10375         l_process_children := FALSE;
10376 
10377         IF p_change_notice IS NOT NULL AND
10378            p_organization_id IS NOT NULL
10379         THEN
10380                 l_eco_parent_exists := TRUE;
10381         END IF;
10382 
10383         -- Process Flow Step 2: Check if record has not yet been processed and
10384         -- that it is the child of the parent that called this procedure
10385         --
10386 
10387 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Revised Item . . . ' || l_revised_item_rec.revised_item_name); END IF;
10388 
10389         IF --(l_revised_item_rec.return_status IS NULL OR
10390             --l_revised_item_rec.return_status = FND_API.G_MISS_CHAR)
10391            --AND
10392            (NOT l_eco_parent_exists
10393             OR
10394             (l_eco_parent_exists AND
10395              (l_revised_item_rec.ECO_Name = p_change_notice AND
10396               l_rev_item_unexp_rec.organization_id = p_organization_id)))
10397         THEN
10398 
10399            l_return_status := FND_API.G_RET_STS_SUCCESS;
10400 
10401            l_revised_item_rec.return_status := FND_API.G_RET_STS_SUCCESS;
10402 
10403            -- Check if transaction_type is valid
10404            --
10405 
10406            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
10407            ENG_GLOBALS.Transaction_Type_Validity
10408            (   p_transaction_type       => l_revised_item_rec.transaction_type
10409            ,   p_entity                 => 'Rev_Items'
10410            ,   p_entity_id              => l_revised_item_rec.revised_item_name
10411            ,   x_valid                  => l_valid
10412            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
10413            );
10414 
10415            IF NOT l_valid
10416            THEN
10417                 l_return_status := Error_Handler.G_STATUS_ERROR;
10418                 RAISE EXC_SEV_QUIT_RECORD;
10419            END IF;
10420 
10421            -- Process Flow step 4: Convert user unique index to unique index
10422            --
10423 
10424            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index'); END IF;
10425            ENG_Val_To_Id.Revised_Item_UUI_To_UI
10426                 ( p_revised_item_rec   => l_revised_item_rec
10427                 , p_rev_item_unexp_rec => l_rev_item_unexp_rec
10428                 , x_rev_item_unexp_rec => l_rev_item_unexp_rec
10429                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
10430                 , x_Return_Status      => l_return_status
10431                 );
10432 
10433            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10434 
10435            IF l_return_status = Error_Handler.G_STATUS_ERROR
10436            THEN
10437                 l_other_message := 'ENG_RIT_UUI_SEV_ERROR';
10438                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10439                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10440                 RAISE EXC_SEV_QUIT_BRANCH;
10441            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10442            THEN
10443                 l_other_message := 'ENG_RIT_UUI_UNEXP_SKIP';
10444                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10445                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10446                 RAISE EXC_UNEXP_SKIP_OBJECT;
10447            END IF;
10448 
10449            BOM_Globals.Set_Unit_Controlled_Item
10450            ( p_inventory_item_id => l_rev_item_unexp_rec.revised_item_id
10451            , p_organization_id  => l_rev_item_unexp_rec.organization_id
10452            );
10453 
10454            -- Process Flow step 5: Verify ECO's existence in database, if
10455            -- the revised item is being created on an ECO and the business
10456            -- object does not carry the ECO header
10457 
10458            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check parent existence'); END IF;
10459 
10460            IF l_revised_item_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
10461               AND
10462               NOT l_eco_parent_exists
10463            THEN
10464                 ENG_Validate_ECO.Check_Existence
10465                 ( p_change_notice       => l_revised_item_rec.ECO_Name
10466                 , p_organization_id     => l_rev_item_unexp_rec.organization_id
10467                 , p_organization_code   => l_revised_item_rec.organization_code
10468                 , p_calling_entity      => 'CHILD'
10469                 , p_transaction_type    => 'XXX'
10470                 , x_eco_rec             => l_old_eco_rec
10471                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
10472                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10473                 , x_return_status       => l_Return_Status
10474                 );
10475 
10476                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10477 
10478                 IF l_return_status = Error_Handler.G_STATUS_ERROR
10479                 THEN
10480                    l_other_message := 'ENG_PARENTECO_NOT_EXIST';
10481                    l_other_token_tbl(1).token_name := 'ECO_NAME';
10482                    l_other_token_tbl(1).token_value := l_revised_item_rec.ECO_Name;
10483                    l_other_token_tbl(2).token_name := 'ORGANIZATION_CODE';
10484                    l_other_token_tbl(2).token_value := l_revised_item_rec.organization_code;
10485                    RAISE EXC_SEV_QUIT_OBJECT;
10486                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10487                 THEN
10488                    l_other_message := 'ENG_RIT_LIN_UNEXP_SKIP';
10489                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10490                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10491                    RAISE EXC_UNEXP_SKIP_OBJECT;
10492                 END IF;
10493            END IF;
10494 
10495          IF l_revised_item_rec.Transaction_Type IN
10496                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
10497            THEN
10498 
10499 	-- Bug 2918350
10500 	-- Start Changes
10501 	IF p_change_notice IS NOT NULL AND p_organization_id IS NOT NULL THEN
10502 		l_chk_co_sch := ret_co_status ( p_change_notice, p_organization_id);
10503 	ELSE
10504 		l_chk_co_sch := ret_co_status ( l_revised_item_rec.eco_name, l_rev_item_unexp_rec.organization_id);
10505 	END IF;
10506 
10507 	-- Added for bug 5756870
10508 	-- The update case when the CO is in scheduled status is handled saperately
10509 	IF  (l_revised_item_rec.Transaction_Type <> ENG_GLOBALS.G_OPR_UPDATE )
10510 		AND (l_chk_co_sch = 4) THEN
10511 		l_return_status := error_handler.g_status_error;
10512 		error_handler.add_error_token (p_message_name        => 'ENG_REV_ITM_NOT_UPD',
10513 			p_mesg_token_tbl      => l_mesg_token_tbl,
10514 			x_mesg_token_tbl      => l_mesg_token_tbl,
10515 			p_token_tbl           => l_token_tbl
10516 			);
10517 		RAISE exc_sev_quit_record;
10518 	END IF;
10519 
10520 	-- End Changes
10521        END IF;
10522 
10523           -- Bug No.:3614144 added by sseraphi to convert  new revision in small case to upper case while import
10524           -- adding this conversion before validations start.
10525 	   IF l_revised_item_rec.New_Revised_Item_Revision IS NOT null
10526 	   THEN
10527                 l_revised_item_rec.New_Revised_Item_Revision := UPPER(l_revised_item_rec.New_Revised_Item_Revision);
10528 	   END IF;
10529 	    IF l_revised_item_rec.Updated_Revised_Item_Revision IS NOT null
10530 	   THEN
10531                 l_revised_item_rec.Updated_Revised_Item_Revision := UPPER(l_revised_item_rec.Updated_Revised_Item_Revision);
10532 	   END IF;
10533            -- Process Flow step 5: Verify Revised Item's existence
10534            --
10535 
10536 	   IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
10537            ENG_Validate_Revised_Item.Check_Existence
10538                 (  p_revised_item_rec           => l_revised_item_rec
10539                 ,  p_rev_item_unexp_rec         => l_rev_item_unexp_rec
10540                 ,  x_old_revised_item_rec       => l_old_revised_item_rec
10541                 ,  x_old_rev_item_unexp_rec     => l_old_rev_item_unexp_rec
10542                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
10543                 ,  x_return_status              => l_Return_Status
10544 		,  x_disable_revision           => x_disable_revision  --BUG 3034642
10545                 );
10546 
10547            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10548 
10549            IF l_return_status = Error_Handler.G_STATUS_ERROR
10550            THEN
10551                 l_other_message := 'ENG_RIT_EXS_SEV_ERROR';
10552                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10553                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10554                 l_other_token_tbl(2).token_name := 'ECO_NAME';
10555                 l_other_token_tbl(2).token_value := l_revised_item_rec.eco_name;
10556                 RAISE EXC_SEV_QUIT_BRANCH;
10557            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10558            THEN
10559                 l_other_message := 'ENG_RIT_EXS_UNEXP_SKIP';
10560                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10561                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10562                 l_other_token_tbl(2).token_name := 'ECO_NAME';
10563                 l_other_token_tbl(2).token_value := l_revised_item_rec.eco_name;
10564                 RAISE EXC_UNEXP_SKIP_OBJECT;
10565            END IF;
10566 
10567 
10568            -- Process Flow step 6: Is Revised Item record an orphan ?
10569 
10570            IF NOT l_eco_parent_exists
10571            THEN
10572 
10573                 -- Process Flow step 7(a): Is ECO impl/cancl, or in wkflw process ?
10574                 --
10575 		-- Added for bug 5756870
10576 		-- In case if the transaciton is update, pass parameter to avoid scheduled date validations
10577 		IF  (l_revised_item_rec.Transaction_Type = ENG_GLOBALS.G_OPR_UPDATE ) THEN
10578 			ENG_Validate_ECO.Check_Access
10579 			( p_change_notice       => l_revised_item_rec.ECO_Name
10580 			, p_organization_id     => l_rev_item_unexp_rec.organization_id
10581 			, p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10582 			, x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10583 			, x_Return_Status       => l_return_status
10584 			, p_check_scheduled_status  => FALSE -- bug 5756870 , don't check for scheduled date validation..
10585 			);
10586 		ELSE
10587 
10588 			-- If the transaction is not update, fire the default validations...
10589 			ENG_Validate_ECO.Check_Access
10590 			( p_change_notice       => l_revised_item_rec.ECO_Name
10591 			, p_organization_id     => l_rev_item_unexp_rec.organization_id
10592 			, p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10593 			, x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10594 			, x_Return_Status       => l_return_status
10595 			, p_check_scheduled_status  => TRUE -- bug 5756870
10596 			);
10597 		END IF;
10598 
10599                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10600 
10601                 IF l_return_status = Error_Handler.G_STATUS_ERROR
10602                 THEN
10603                         l_other_message := 'ENG_RIT_ECOACC_FAT_FATAL';
10604                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10605                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10606                         l_return_status := 'F';
10607                         RAISE EXC_FAT_QUIT_OBJECT;
10608                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10609                 THEN
10610                         l_other_message := 'ENG_RIT_ECOACC_UNEXP_SKIP';
10611                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10612                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10613                         RAISE EXC_UNEXP_SKIP_OBJECT;
10614                 END IF;
10615            END IF;
10616 
10617            -- Process Flow step 7(b): check that user has access to revised item
10618            --
10619            -- Bug No: 5246049
10620            -- Moved validation outside 'IF NOT l_eco_parent_exists' as validation should happen in all cases
10621 
10622            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
10623 		IF  (l_revised_item_rec.Transaction_Type = ENG_GLOBALS.G_OPR_UPDATE ) THEN
10624 		   ENG_Validate_Revised_Item.Check_Access
10625 		   (  p_change_notice      => l_revised_item_rec.ECO_Name
10626 		   ,  p_organization_id    => l_rev_item_unexp_rec.organization_id
10627 		   ,  p_revised_item_id    => l_rev_item_unexp_rec.revised_item_id
10628 		   ,  p_new_item_revision  => l_revised_item_rec.new_revised_item_revision
10629 		   ,  p_effectivity_date   => l_revised_item_rec.start_effective_date
10630 		   ,  p_new_routing_revsion   => l_revised_item_rec.new_routing_revision  -- Added by MK on 11/02/00
10631 		   ,  p_from_end_item_number  => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10632 		   ,  p_revised_item_name  => l_revised_item_rec.revised_item_name
10633 		   ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
10634 		   ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
10635 		   ,  x_return_status      => l_Return_Status
10636 		   , p_check_scheduled_status  => FALSE -- bug 5756870 , don't check for scheduled date validation..
10637 		   );
10638 		ELSE
10639 			ENG_Validate_Revised_Item.Check_Access
10640 		   (  p_change_notice      => l_revised_item_rec.ECO_Name
10641 		   ,  p_organization_id    => l_rev_item_unexp_rec.organization_id
10642 		   ,  p_revised_item_id    => l_rev_item_unexp_rec.revised_item_id
10643 		   ,  p_new_item_revision  => l_revised_item_rec.new_revised_item_revision
10644 		   ,  p_effectivity_date   => l_revised_item_rec.start_effective_date
10645 		   ,  p_new_routing_revsion   => l_revised_item_rec.new_routing_revision  -- Added by MK on 11/02/00
10646 		   ,  p_from_end_item_number  => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
10647 		   ,  p_revised_item_name  => l_revised_item_rec.revised_item_name
10648 		   ,  p_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
10649 		   ,  x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
10650 		   ,  x_return_status      => l_Return_Status
10651 		   , p_check_scheduled_status  => TRUE -- bug 5756870 , don't check for scheduled date validation..
10652 		   );
10653 
10654 		END IF;
10655 
10656 
10657            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10658 
10659            IF l_return_status = Error_Handler.G_STATUS_ERROR
10660            THEN
10661                    l_other_message := 'ENG_RIT_ACCESS_FAT_FATAL';
10662                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10663                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10664                    l_return_status := 'F';
10665                    RAISE EXC_FAT_QUIT_BRANCH;
10666            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10667            THEN
10668                    l_other_message := 'ENG_RIT_ACCESS_UNEXP_SKIP';
10669                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10670                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10671                    RAISE EXC_UNEXP_SKIP_OBJECT;
10672            END IF;
10673 
10674 
10675 
10676            /****  Following Process Flow is for ECO Routing ***/
10677            --
10678            -- Process Flow step 8:  Flow Routing's operability for routing.
10679            -- (for future release, flow routing is not supported in current release
10680            -- Added by MK on 08/24/2000
10681            --
10682            /* Comment out for current release
10683            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Non-Flow Routing'); END IF;
10684 
10685            Bom_Validate_Rtg_Header.Check_flow_routing_operability ;
10686            (  p_assembly_item_name  =>  l_revised_item_rec.revised_item_name
10687             , p_cfm_routing_flag    =>  l_rev_item_unexp_rec.cfm_routing_flag
10688                                         -- in future, this shoud be exposed column
10689             , p_organization_id     =>  l_rev_item_unexp_rec.organization_id
10690             , x_mesg_token_tbl      =>  l_mesg_token_tbl
10691             , x_return_status       =>  l_return_status
10692             );
10693 
10694            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10695 
10696 
10697            IF l_return_status = Error_Handler.G_STATUS_ERROR
10698            THEN
10699                 l_other_message := 'BOM_RTG_FRACC_ERROR';
10700                 l_other_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
10701                 l_other_token_tbl(1).token_value :=
10702                                         l_revised_item_rec.revised_item_name;
10703                 RAISE EXC_SEV_QUIT_BRANCH;
10704            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10705            THEN
10706                 l_other_message := 'BOM_RTG_FRACC_UNEXP_SKIP';
10707                 l_other_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
10708                 l_other_token_tbl(1).token_value :=
10709                                         l_revised_item_rec.revised_item_name;
10710                 RAISE EXC_UNEXP_SKIP_OBJECT;
10711            END IF;
10712            */
10713 
10714 
10715 
10716            -- Process Flow step 9: Value to Id conversions
10717            --
10718 
10719            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-id conversions'); END IF;
10720            ENG_Val_To_Id.Revised_Item_VID
10721                 ( x_Return_Status       => l_return_status
10722                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10723                 , p_rev_item_unexp_Rec  => l_rev_item_unexp_rec
10724                 , x_rev_item_unexp_Rec  => l_rev_item_unexp_rec
10725                 , p_revised_item_Rec    => l_revised_item_rec
10726                 );
10727 
10728            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10729 
10730            IF l_return_status = Error_Handler.G_STATUS_ERROR
10731            THEN
10732                 IF l_revised_item_rec.transaction_type = 'CREATE'
10733                 THEN
10734                         l_other_message := 'ENG_RIT_VID_CSEV_SKIP';
10735                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10736                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10737                         RAISE EXC_SEV_SKIP_BRANCH;
10738                 ELSE
10739                         RAISE EXC_SEV_QUIT_RECORD;
10740                 END IF;
10741            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10742            THEN
10743                 RAISE EXC_UNEXP_SKIP_OBJECT;
10744            ELSIF l_return_status ='S' AND
10745                 l_Mesg_Token_Tbl.COUNT <>0
10746            THEN
10747                 Eco_Error_Handler.Log_Error
10748                 (  p_revised_item_tbl   => x_revised_item_tbl
10749                 ,  p_rev_component_tbl  => x_rev_component_tbl
10750                 ,  p_ref_designator_tbl => x_ref_designator_tbl
10751                 ,  p_sub_component_tbl  => x_sub_component_tbl
10752                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
10753                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
10754                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
10755                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
10756                 ,  p_error_status       => 'W'
10757                 ,  p_error_level        => 3
10758                 ,  p_entity_index       => I
10759                 ,  x_eco_rec            => l_eco_rec
10760                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
10761                 ,  x_revised_item_tbl   => x_revised_item_tbl
10762                 ,  x_rev_component_tbl  => x_rev_component_tbl
10763                 ,  x_ref_designator_tbl => x_ref_designator_tbl
10764                 ,  x_sub_component_tbl  => x_sub_component_tbl
10765                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
10766                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
10767                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
10768                 );
10769            END IF;
10770 
10771 	     -- Check for access if the status is scheduled...
10772 	   -- Added for bug 5756870
10773 	   --Note: we need not check if the transaction type is anything other than update
10774 	   -- because it has been check above, and execution will not make it to this line in such cases
10775 
10776 	   IF(l_chk_co_sch = 4 OR l_old_revised_item_rec.status_type = 4) THEN
10777 		   ENG_Validate_Revised_Item.Check_Access_Scheduled(
10778 			  x_Return_Status       => l_return_status
10779 			, x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
10780 			, p_rev_item_unexp_Rec  => l_rev_item_unexp_rec
10781 			, p_revised_item_Rec    => l_revised_item_rec
10782 			);
10783 
10784 
10785 			   IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10786 
10787 			   IF l_return_status = Error_Handler.G_STATUS_ERROR
10788 			   THEN
10789 
10790 				   l_other_message := 'ENG_RIT_SCHEDULE_ACCESS_FATAL';
10791 				   l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10792 				   l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10793 				   l_return_status := 'F';
10794 				   RAISE EXC_FAT_QUIT_BRANCH;
10795 			   ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10796 			   THEN
10797 
10798 				   l_other_message := 'ENG_RIT_SCHEDULE_ACCESS_UNEXP';
10799 				   l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10800 				   l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10801 				   RAISE EXC_UNEXP_SKIP_OBJECT;
10802 			   END IF;
10803 
10804 			   if( p_rev_component_tbl.COUNT <> 0
10805 			      OR   p_ref_designator_tbl.COUNT<> 0
10806 			      OR   p_sub_component_tbl.COUNT<> 0
10807 			      OR   p_rev_operation_tbl.COUNT<> 0
10808 			      OR    p_rev_op_resource_tbl.COUNT<> 0
10809 			      OR   p_rev_sub_resource_tbl.COUNT<> 0 ) THEN
10810 
10811 				l_other_message := 'ENG_RIT_NO_CHILD_IN_SCHEDULED';
10812 				l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10813 				l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10814 				l_return_status := 'F';
10815 				RAISE EXC_FAT_QUIT_BRANCH;
10816 			   END IF;
10817 
10818 	   END IF;
10819 
10820 
10821 	   -- Process Flow step 10: Attribute Validation for CREATE and UPDATE
10822            --
10823 
10824 
10825            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
10826            IF l_revised_item_rec.Transaction_Type IN
10827                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
10828            THEN
10829                 ENG_Validate_Revised_Item.Check_Attributes
10830                 ( x_return_status              => l_return_status
10831                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
10832                 , p_revised_item_rec           => l_revised_item_rec
10833                 , p_rev_item_unexp_rec         => l_rev_item_unexp_rec
10834                 , p_old_revised_item_rec       => l_old_revised_item_rec
10835                 , p_old_rev_item_unexp_rec     => l_old_rev_item_unexp_rec
10836                 );
10837 
10838                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10839 
10840                 IF l_return_status = Error_Handler.G_STATUS_ERROR
10841                 THEN
10842                    IF l_revised_item_rec.transaction_type = 'CREATE'
10843                    THEN
10844                         l_other_message := 'ENG_RIT_ATTVAL_CSEV_SKIP';
10845                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10846                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10847                         RAISE EXC_SEV_SKIP_BRANCH;
10848                    ELSE
10849                         RAISE EXC_SEV_QUIT_RECORD;
10850                    END IF;
10851                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10852                 THEN
10853                    l_other_message := 'ENG_RIT_ATTVAL_UNEXP_SKIP';
10854                    l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10855                    l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10856                    RAISE EXC_UNEXP_SKIP_OBJECT;
10857                 ELSIF l_return_status ='S' AND
10858                       l_Mesg_Token_Tbl.COUNT <>0
10859                 THEN
10860                    Eco_Error_Handler.Log_Error
10861                         (  p_revised_item_tbl   => x_revised_item_tbl
10862                         ,  p_rev_component_tbl  => x_rev_component_tbl
10863                         ,  p_ref_designator_tbl => x_ref_designator_tbl
10864                         ,  p_sub_component_tbl  => x_sub_component_tbl
10865                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
10866                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10867                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10868                         ,  p_mesg_token_tbl     =>  l_mesg_token_tbl
10869                         ,  p_error_status       => 'W'
10870                         ,  p_error_level        => 3
10871                         ,  p_entity_index       => I
10872                         ,  x_eco_rec            => l_eco_rec
10873                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
10874                         ,  x_revised_item_tbl   => x_revised_item_tbl
10875                         ,  x_rev_component_tbl  => x_rev_component_tbl
10876                         ,  x_ref_designator_tbl => x_ref_designator_tbl
10877                         ,  x_sub_component_tbl  => x_sub_component_tbl
10878                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
10879                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10880                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10881                         );
10882                 END IF;
10883            END IF;
10884 
10885            IF l_revised_item_rec.Transaction_Type IN
10886                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
10887            THEN
10888 
10889                 -- Process flow step 11 - Populate NULL columns for Update and
10890                 -- Delete.
10891 
10892                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
10893                 Eng_Default_Revised_Item.Populate_NULL_Columns
10894                 (   p_revised_item_rec          => l_revised_item_rec
10895                 ,   p_old_revised_item_rec      => l_old_revised_item_rec
10896                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
10897                 ,   p_old_rev_item_unexp_rec    => l_old_rev_item_unexp_rec
10898                 ,   x_revised_item_rec          => l_revised_item_rec
10899                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
10900                 );
10901 
10902            ELSIF l_revised_item_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
10903 
10904                 -- Process Flow step 12: Default missing values for Operation CREATE
10905                 --
10906 
10907                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
10908                 Eng_Default_Revised_Item.Attribute_Defaulting
10909                 (   p_revised_item_rec          => l_revised_item_rec
10910                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
10911                 ,   x_revised_item_rec          => l_revised_item_rec
10912                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
10913                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
10914                 ,   x_return_status             => l_return_status
10915                 );
10916 
10917                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10918 
10919                 IF l_return_status = Error_Handler.G_STATUS_ERROR
10920                 THEN
10921                         l_other_message := 'ENG_RIT_ATTDEF_SEV_SKIP';
10922                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10923                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10924                         RAISE EXC_SEV_SKIP_BRANCH;
10925                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10926                 THEN
10927                         l_other_message := 'ENG_RIT_ATTDEF_UNEXP_SKIP';
10928                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10929                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10930                         RAISE EXC_UNEXP_SKIP_OBJECT;
10931                 ELSIF l_return_status ='S' AND
10932                         l_Mesg_Token_Tbl.COUNT <>0
10933                 THEN
10934                         Eco_Error_Handler.Log_Error
10935                         (  p_revised_item_tbl   => x_revised_item_tbl
10936                         ,  p_rev_component_tbl  => x_rev_component_tbl
10937                         ,  p_ref_designator_tbl => x_ref_designator_tbl
10938                         ,  p_sub_component_tbl  => x_sub_component_tbl
10939                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
10940                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10941                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10942                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
10943                         ,  p_error_status       => 'S'
10944                         ,  p_error_level        => 3
10945                         ,  p_entity_index       => I
10946                         ,  x_eco_rec            => l_eco_rec
10947                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
10948                         ,  x_revised_item_tbl   => x_revised_item_tbl
10949                         ,  x_rev_component_tbl  => x_rev_component_tbl
10950                         ,  x_ref_designator_tbl => x_ref_designator_tbl
10951                         ,  x_sub_component_tbl  => x_sub_component_tbl
10952                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
10953                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
10954                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
10955                         );
10956                 END IF;
10957            END IF;
10958 
10959            -- Process Flow step 13 - Conditionally required attributes check
10960            --
10961 
10962            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Conditionally required attributes check'); END IF;
10963 
10964            --
10965            -- Put conditionally required check procedure here
10966            --
10967 
10968            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
10969 
10970            ENG_Validate_Revised_Item.Check_Required
10971                 ( x_return_status              => l_return_status
10972                 , x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
10973                 , p_revised_item_rec           => l_revised_item_rec
10974                 );
10975 
10976            IF l_return_status = Error_Handler.G_STATUS_ERROR
10977            THEN
10978                 IF l_revised_item_rec.transaction_type = 'CREATE'
10979                 THEN
10980                         l_other_message := 'ENG_RIT_CONREQ_CSEV_SKIP';
10981                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10982                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10983                         RAISE EXC_SEV_SKIP_BRANCH;
10984                 ELSE
10985                         RAISE EXC_SEV_QUIT_RECORD;
10986                 END IF;
10987            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
10988            THEN
10989                 l_other_message := 'ENG_RIT_CONREQ_UNEXP_SKIP';
10990                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
10991                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
10992                 RAISE EXC_UNEXP_SKIP_OBJECT;
10993            ELSIF l_return_status ='S' AND
10994                 l_Mesg_Token_Tbl.COUNT <>0
10995            THEN
10996                 Eco_Error_Handler.Log_Error
10997                 (  p_revised_item_tbl       => x_revised_item_tbl
10998                 ,  p_rev_component_tbl      => x_rev_component_tbl
10999                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
11000                 ,  p_sub_component_tbl      => x_sub_component_tbl
11001                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
11002                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11003                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11004                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
11005                 ,  p_error_status           => 'W'
11006                 ,  p_error_level            => 3
11007                 ,  p_entity_index           => I
11008                 ,  x_eco_rec                => l_eco_rec
11009                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
11010                 ,  x_revised_item_tbl       => x_revised_item_tbl
11011                 ,  x_rev_component_tbl      => x_rev_component_tbl
11012                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
11013                 ,  x_sub_component_tbl      => x_sub_component_tbl
11014                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
11015                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11016                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11017                 );
11018            END IF;
11019 
11020            -- Process Flow step 14: Entity defaulting for CREATE and UPDATE
11021            --
11022 
11023            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting'); END IF;
11024            IF l_revised_item_rec.Transaction_Type IN
11025                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
11026            THEN
11027                 ENG_Default_Revised_Item.Entity_Defaulting
11028                 (   p_revised_item_rec          => l_revised_item_rec
11029                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
11030                 ,   p_old_revised_item_rec      => l_old_revised_item_rec
11031                 ,   p_old_rev_item_unexp_rec    => l_old_rev_item_unexp_rec
11032                 ,   x_revised_item_rec          => l_revised_item_rec
11033                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
11034                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11035                 ,   x_return_status             => l_return_status
11036                 );
11037 
11038                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
11039 
11040                 IF l_return_status = Error_Handler.G_STATUS_ERROR
11041                 THEN
11042                    IF l_revised_item_rec.transaction_type = 'CREATE'
11043                    THEN
11044                         l_other_message := 'ENG_RIT_ENTDEF_CSEV_SKIP';
11045                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
11046                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
11047                         RAISE EXC_SEV_SKIP_BRANCH;
11048                    ELSE
11049                         RAISE EXC_SEV_QUIT_RECORD;
11050                    END IF;
11051                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
11052                 THEN
11053                         l_other_message := 'ENG_RIT_ENTDEF_UNEXP_SKIP';
11054                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
11055                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
11056                         RAISE EXC_UNEXP_SKIP_OBJECT;
11057                 ELSIF l_return_status ='S' AND
11058                         l_Mesg_Token_Tbl.COUNT <>0
11059                 THEN
11060                         Eco_Error_Handler.Log_Error
11061                         (  p_revised_item_tbl    => x_revised_item_tbl
11062                         ,  p_rev_component_tbl   => x_rev_component_tbl
11063                         ,  p_ref_designator_tbl  => x_ref_designator_tbl
11064                         ,  p_sub_component_tbl   => x_sub_component_tbl
11065                         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11066                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11067                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11068                         ,  p_mesg_token_tbl      => l_mesg_token_tbl
11069                         ,  p_error_status        => 'W'
11070                         ,  p_error_level         => 3
11071                         ,  p_entity_index        => I
11072                         ,  x_eco_rec             => l_eco_rec
11073                         ,  x_eco_revision_tbl    => l_eco_revision_tbl
11074                         ,  x_revised_item_tbl    => x_revised_item_tbl
11075                         ,  x_rev_component_tbl   => x_rev_component_tbl
11076                         ,  x_ref_designator_tbl  => x_ref_designator_tbl
11077                         ,  x_sub_component_tbl   => x_sub_component_tbl
11078                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11079                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11080                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11081                         );
11082                 END IF;
11083            END IF;
11084 
11085            -- Process Flow step 15 - Entity Level Validation
11086            --
11087 
11088            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
11089 
11090            IF l_revised_item_rec.transaction_type = 'DELETE'
11091            THEN
11092                 Eng_Validate_Revised_Item.Check_Entity_Delete
11093                 (  p_revised_item_rec     => l_revised_item_rec
11094                 ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
11095                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
11096                 ,  x_return_status        => l_Return_Status
11097                 );
11098            ELSE
11099                 Eng_Validate_Revised_Item.Check_Entity
11100                 (  p_revised_item_rec     => l_revised_item_rec
11101                 ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
11102                 ,  p_old_revised_item_rec => l_old_revised_item_rec
11103                 ,  p_old_rev_item_unexp_rec => l_old_rev_item_unexp_rec
11104                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
11105                 ,  x_return_status        => l_Return_Status
11106                 );
11107            END IF;
11108 
11109            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
11110 
11111            IF l_return_status = Error_Handler.G_STATUS_ERROR
11112            THEN
11113                 IF l_revised_item_rec.transaction_type = 'CREATE'
11114                 THEN
11115                         l_other_message := 'ENG_RIT_ENTVAL_CSEV_SKIP';
11116                         l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
11117                         l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
11118                         RAISE EXC_SEV_SKIP_BRANCH;
11119                 ELSE
11120                         RAISE EXC_SEV_QUIT_RECORD;
11121                 END IF;
11122            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
11123            THEN
11124                 l_other_message := 'ENG_RIT_ENTVAL_UNEXP_SKIP';
11125                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
11126                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
11127                 RAISE EXC_UNEXP_SKIP_OBJECT;
11128            ELSIF l_return_status ='S' AND
11129                 l_Mesg_Token_Tbl.COUNT <>0
11130            THEN
11131                 Eco_Error_Handler.Log_Error
11132                 (  p_revised_item_tbl       => x_revised_item_tbl
11133                 ,  p_rev_component_tbl      => x_rev_component_tbl
11134                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
11135                 ,  p_sub_component_tbl      => x_sub_component_tbl
11136                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
11137                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11138                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11139                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
11140                 ,  p_error_status           => 'W'
11141                 ,  p_error_level            => 3
11142                 ,  p_entity_index           => I
11143                 ,  x_eco_rec                => l_eco_rec
11144                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
11145                 ,  x_revised_item_tbl       => x_revised_item_tbl
11146                 ,  x_rev_component_tbl      => x_rev_component_tbl
11147                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
11148                 ,  x_sub_component_tbl      => x_sub_component_tbl
11149                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
11150                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11151                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11152                 );
11153            END IF;
11154 
11155            -- Process Flow step 16 : Database Writes
11156            --
11157 
11158            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
11159            ENG_Revised_Item_Util.Perform_Writes
11160                 (   p_revised_item_rec          => l_revised_item_rec
11161                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
11162                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11163                 ,   x_return_status             => l_return_status
11164                 );
11165 
11166            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
11167 
11168            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
11169            THEN
11170                 l_other_message := 'ENG_RIT_WRITES_UNEXP_SKIP';
11171                 l_other_token_tbl(1).token_name := 'REVISED_ITEM_NAME';
11172                 l_other_token_tbl(1).token_value := l_revised_item_rec.revised_item_name;
11173                 RAISE EXC_UNEXP_SKIP_OBJECT;
11174            ELSIF l_return_status ='S' AND
11175               l_Mesg_Token_Tbl.COUNT <>0
11176            THEN
11177                 Eco_Error_Handler.Log_Error
11178                 (  p_revised_item_tbl       => x_revised_item_tbl
11179                 ,  p_rev_component_tbl      => x_rev_component_tbl
11180                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
11181                 ,  p_sub_component_tbl      => x_sub_component_tbl
11182                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
11183                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11184                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11185                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
11186                 ,  p_error_status           => 'W'
11187                 ,  p_error_level            => 3
11188                 ,  p_entity_index           => I
11189                 ,  x_eco_rec                => l_eco_rec
11190                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
11191                 ,  x_revised_item_tbl       => x_revised_item_tbl
11192                 ,  x_rev_component_tbl      => x_rev_component_tbl
11193                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
11194                 ,  x_sub_component_tbl      => x_sub_component_tbl
11195                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
11196                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11197                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11198                 );
11199            END IF;
11200 
11201 IF Bom_Globals.Get_Debug = 'Y' THEN
11202      Error_Handler.Write_Debug('Writing to the database for Rev Item is completed with '||l_return_status );
11203 END IF;
11204 
11205         END IF; -- END IF statement that checks RETURN STATUS
11206 
11207         --  Load tables.
11208 
11209         x_revised_item_tbl(I)          := l_revised_item_rec;
11210 
11211         --
11212         -- If everything goes well then, process children
11213         --
11214         l_process_children := TRUE;
11215 
11216      -- Reset system_information flags
11217 
11218      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11219      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11220      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11221      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11222 
11223     --  For loop exception handler.
11224 
11225 
11226     EXCEPTION
11227 
11228        WHEN EXC_SEV_QUIT_RECORD THEN
11229 
11230         Eco_Error_Handler.Log_Error
11231                 (  p_revised_item_tbl       => x_revised_item_tbl
11232                 ,  p_rev_component_tbl      => x_rev_component_tbl
11233                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
11234                 ,  p_sub_component_tbl      => x_sub_component_tbl
11235                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
11236                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11237                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11238                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
11239                 ,  p_error_status           => FND_API.G_RET_STS_ERROR
11240                 ,  p_error_scope            => Error_Handler.G_SCOPE_RECORD
11241                 ,  p_error_level            => 3
11242                 ,  p_entity_index           => I
11243                 ,  x_eco_rec                => l_eco_rec
11244                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
11245                 ,  x_revised_item_tbl       => x_revised_item_tbl
11246                 ,  x_rev_component_tbl      => x_rev_component_tbl
11247                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
11248                 ,  x_sub_component_tbl      => x_sub_component_tbl
11249                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
11250                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11251                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11252                 );
11253 
11254         l_process_children := TRUE;
11255 
11256         IF l_bo_return_status = 'S'
11257         THEN
11258                 l_bo_return_status     := l_return_status;
11259         END IF;
11260         x_return_status                := l_bo_return_status;
11261         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11262         --x_revised_item_tbl             := l_revised_item_tbl;
11263         --x_rev_component_tbl            := l_rev_component_tbl;
11264         --x_ref_designator_tbl           := l_ref_designator_tbl;
11265         --x_sub_component_tbl            := l_sub_component_tbl;
11266         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11267         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11268         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11269 
11270         -- Reset system_information flags
11271 
11272      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11273      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11274      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11275      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11276 
11277        WHEN EXC_SEV_QUIT_BRANCH THEN
11278 
11279         Eco_Error_Handler.Log_Error
11280                 (  p_revised_item_tbl    => x_revised_item_tbl
11281                 ,  p_rev_component_tbl   => x_rev_component_tbl
11282                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
11283                 ,  p_sub_component_tbl   => x_sub_component_tbl
11284                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11285                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11286                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11287                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
11288                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
11289                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
11290                 ,  p_other_status        => Error_Handler.G_STATUS_ERROR
11291                 ,  p_other_message       => l_other_message
11292                 ,  p_other_token_tbl     => l_other_token_tbl
11293                 ,  p_error_level         => 3
11294                 ,  p_entity_index        => I
11295                 ,  x_eco_rec             => l_eco_rec
11296                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
11297                 ,  x_revised_item_tbl    => x_revised_item_tbl
11298                 ,  x_rev_component_tbl   => x_rev_component_tbl
11299                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
11300                 ,  x_sub_component_tbl   => x_sub_component_tbl
11301                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11302                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11303                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11304                 );
11305 
11306         l_process_children := FALSE;
11307 
11308         IF l_bo_return_status = 'S'
11309         THEN
11310                 l_bo_return_status     := l_return_status;
11311         END IF;
11312         x_return_status                := l_bo_return_status;
11313         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11314         --x_revised_item_tbl             := l_revised_item_tbl;
11315         --x_rev_component_tbl            := l_rev_component_tbl;
11316         --x_ref_designator_tbl           := l_ref_designator_tbl;
11317         --x_sub_component_tbl            := l_sub_component_tbl;
11318         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11319         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11320         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11321 
11322         -- Reset system_information flags
11323 
11324      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11325      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11326      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11327      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11328 
11329        WHEN EXC_SEV_SKIP_BRANCH THEN
11330 
11331         Eco_Error_Handler.Log_Error
11332                 (  p_revised_item_tbl    => x_revised_item_tbl
11333                 ,  p_rev_component_tbl   => x_rev_component_tbl
11334                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
11335                 ,  p_sub_component_tbl   => x_sub_component_tbl
11336                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11337                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11338                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11339                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
11340                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
11341                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
11342                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
11343                 ,  p_other_message       => l_other_message
11344                 ,  p_other_token_tbl     => l_other_token_tbl
11345                 ,  p_error_level         => 3
11346                 ,  p_entity_index        => I
11347                 ,  x_eco_rec             => l_eco_rec
11348                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
11349                 ,  x_revised_item_tbl    => x_revised_item_tbl
11350                 ,  x_rev_component_tbl   => x_rev_component_tbl
11351                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
11352                 ,  x_sub_component_tbl   => x_sub_component_tbl
11353                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11354                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11355                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11356                 );
11357 
11358         l_process_children := FALSE;
11359 
11360         IF l_bo_return_status = 'S'
11361         THEN
11362                 l_bo_return_status     := l_return_status;
11363         END IF;
11364         x_return_status                := l_bo_return_status;
11365         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11366         --x_revised_item_tbl             := l_revised_item_tbl;
11367         --x_rev_component_tbl            := l_rev_component_tbl;
11368         --x_ref_designator_tbl           := l_ref_designator_tbl;
11369         --x_sub_component_tbl            := l_sub_component_tbl;
11370         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11371         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11372         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11373 
11374         -- Reset system_information flags
11375 
11376      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11377      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11378      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11379      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11380 
11381         WHEN EXC_SEV_QUIT_OBJECT THEN
11382 
11383         Eco_Error_Handler.Log_Error
11384             (  p_revised_item_tbl       => x_revised_item_tbl
11385              , p_rev_component_tbl      => x_rev_component_tbl
11386              , p_ref_designator_tbl     => x_ref_designator_tbl
11387              , p_sub_component_tbl      => x_sub_component_tbl
11388              , p_rev_operation_tbl      => x_rev_operation_tbl    --L1
11389              , p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
11390              , p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
11391              , p_error_status           => Error_Handler.G_STATUS_ERROR
11392              , p_error_scope            => Error_Handler.G_SCOPE_ALL
11393              , p_error_level            => Error_Handler.G_BO_LEVEL
11394              , p_other_message          => l_other_message
11395              , p_other_status           => Error_Handler.G_STATUS_ERROR
11396              , p_other_token_tbl        => l_other_token_tbl
11397              , x_eco_rec                => l_eco_rec
11398              , x_eco_revision_tbl       => l_eco_revision_tbl
11399              , x_revised_item_tbl       => x_revised_item_tbl
11400              , x_rev_component_tbl      => x_rev_component_tbl
11401              , x_ref_designator_tbl     => x_ref_designator_tbl
11402              , x_sub_component_tbl      => x_sub_component_tbl
11403              , x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11404              , x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11405              , x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11406              );
11407 
11408         IF l_bo_return_status = 'S'
11409         THEN
11410                 l_bo_return_status     := l_return_status;
11411         END IF;
11412         x_return_status                := l_bo_return_status;
11413         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11414         --x_revised_item_tbl             := l_revised_item_tbl;
11415         --x_rev_component_tbl            := l_rev_component_tbl;
11416         --x_ref_designator_tbl           := l_ref_designator_tbl;
11417         --x_sub_component_tbl            := l_sub_component_tbl;
11418         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11419         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11420         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11421 
11422         -- Reset system_information flags
11423 
11424      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11425      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11426      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11427      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11428 
11429        WHEN EXC_FAT_QUIT_BRANCH THEN
11430 
11431         Eco_Error_Handler.Log_Error
11432                 (  p_revised_item_tbl    => x_revised_item_tbl
11433                 ,  p_rev_component_tbl   => x_rev_component_tbl
11434                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
11435                 ,  p_sub_component_tbl   => x_sub_component_tbl
11436                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11437                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11438                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11439                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
11440                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
11441                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
11442                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
11443                 ,  p_other_message       => l_other_message
11444                 ,  p_other_token_tbl     => l_other_token_tbl
11445                 ,  p_error_level         => 3
11446                 ,  p_entity_index        => I
11447                 ,  x_eco_rec             => l_eco_rec
11448                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
11449                 ,  x_revised_item_tbl    => x_revised_item_tbl
11450                 ,  x_rev_component_tbl   => x_rev_component_tbl
11451                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
11452                 ,  x_sub_component_tbl   => x_sub_component_tbl
11453                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11454                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11455                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11456                 );
11457 
11458         l_process_children := FALSE;
11459 
11460         x_return_status                := Error_Handler.G_STATUS_FATAL;
11461         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11462         --x_revised_item_tbl             := l_revised_item_tbl;
11463         --x_rev_component_tbl            := l_rev_component_tbl;
11464         --x_ref_designator_tbl           := l_ref_designator_tbl;
11465         --x_sub_component_tbl            := l_sub_component_tbl;
11466         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11467         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11468         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11469 
11470         -- Reset system_information flags
11471 
11472      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11473      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11474      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11475      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11476 
11477        WHEN EXC_FAT_QUIT_OBJECT THEN
11478 
11479         Eco_Error_Handler.Log_Error
11480                 (  p_revised_item_tbl    => x_revised_item_tbl
11481                 ,  p_rev_component_tbl   => x_rev_component_tbl
11482                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
11483                 ,  p_sub_component_tbl   => x_sub_component_tbl
11484                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11485                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11486                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11487                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
11488                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
11489                 ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
11490                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
11491                 ,  p_other_message       => l_other_message
11492                 ,  p_other_token_tbl     => l_other_token_tbl
11493                 ,  p_error_level         => 3
11494                 ,  p_entity_index        => I
11495                 ,  x_eco_rec             => l_eco_rec
11496                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
11497                 ,  x_revised_item_tbl    => x_revised_item_tbl
11498                 ,  x_rev_component_tbl   => x_rev_component_tbl
11499                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
11500                 ,  x_sub_component_tbl   => x_sub_component_tbl
11501                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11502                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11503                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11504                 );
11505 
11506         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11507         --x_revised_item_tbl             := l_revised_item_tbl;
11508         --x_rev_component_tbl            := l_rev_component_tbl;
11509         --x_ref_designator_tbl           := l_ref_designator_tbl;
11510         --x_sub_component_tbl            := l_sub_component_tbl;
11511         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11512         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11513         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11514 
11515         -- Reset system_information flags
11516 
11517      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11518      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11519      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11520      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11521 
11522         l_return_status := 'Q';
11523 
11524        WHEN EXC_UNEXP_SKIP_OBJECT THEN
11525 
11526         Eco_Error_Handler.Log_Error
11527                 (  p_revised_item_tbl    => x_revised_item_tbl
11528                 ,  p_rev_component_tbl   => x_rev_component_tbl
11529                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
11530                 ,  p_sub_component_tbl   => x_sub_component_tbl
11531                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
11532                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11533                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11534                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
11535                 ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
11536                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
11537                 ,  p_other_message       => l_other_message
11538                 ,  p_other_token_tbl     => l_other_token_tbl
11539                 ,  p_error_level         => 3
11540                 ,  x_ECO_rec             => l_ECO_rec
11541                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
11542                 ,  x_revised_item_tbl    => x_revised_item_tbl
11543                 ,  x_rev_component_tbl   => x_rev_component_tbl
11544                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
11545                 ,  x_sub_component_tbl   => x_sub_component_tbl
11546                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
11547                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
11548                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
11549                 );
11550 
11551         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
11552         --x_revised_item_tbl             := l_revised_item_tbl;
11553         --x_rev_component_tbl            := l_rev_component_tbl;
11554         --x_ref_designator_tbl           := l_ref_designator_tbl;
11555         --x_sub_component_tbl            := l_sub_component_tbl;
11556         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
11557         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
11558         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
11559 
11560         -- Reset system_information flags
11561 
11562      ENG_GLOBALS.Set_RITEM_Impl( p_ritem_impl   => NULL);
11563      ENG_GLOBALS.Set_RITEM_Cancl( p_ritem_cancl => NULL);
11564      ENG_GLOBALS.Set_Bill_Sequence_Id( p_bill_sequence_id => NULL);
11565      ENG_GLOBALS.Set_Current_Revision( p_current_revision => NULL);
11566 
11567         l_return_status := 'U';
11568 
11569         END; -- END block
11570 
11571         IF l_return_status in ('Q', 'U')
11572         THEN
11573                 x_return_status := l_return_status;
11574                 RETURN;
11575         END IF;
11576 
11577     IF l_process_children
11578     THEN
11579 
11580 
11581         -- L1: The following is for ECO enhancement
11582         -- Process operations that are orphans
11583         -- (without immediate revised component parents) but are
11584         -- indirect children of this item
11585         --
11586         -- Modified by MK on 11/30/00 Moved eco for routing procedure before BOMs.
11587         --
11588 
11589 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Op children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
11590 
11591         Rev_Operation_Sequences
11592         (   p_validation_level          => p_validation_level
11593         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11594         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11595         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11596         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11597         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
11598         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11599         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11600         ,   p_rev_operation_tbl         => x_rev_operation_tbl
11601         ,   p_rev_op_resource_tbl       => x_rev_op_resource_tbl
11602         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11603         ,   x_rev_operation_tbl         => x_rev_operation_tbl
11604         ,   x_rev_op_resource_tbl       => x_rev_op_resource_tbl
11605         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11606         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11607         ,   x_return_status             => l_return_status
11608         );
11609 
11610         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11611         THEN
11612                 l_bo_return_status := l_return_status;
11613         END IF;
11614 
11615 
11616 
11617         -- Process resource that are orphans
11618         -- (without immediate revised component parents) but are
11619         -- indirect children of this item
11620 
11621 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Op Res children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
11622 
11623 
11624         Rev_Operation_Resources
11625         (   p_validation_level          => p_validation_level
11626         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11627         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11628         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11629         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11630         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
11631         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11632         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11633         ,   p_rev_op_resource_tbl       => x_rev_op_resource_tbl
11634         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11635         ,   x_rev_op_resource_tbl       => x_rev_op_resource_tbl
11636         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11637         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11638         ,   x_return_status             => l_return_status
11639         );
11640        IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11641        THEN
11642                 l_bo_return_status := l_return_status;
11643        END IF;
11644 
11645         -- Process substitute resources that are orphans
11646         -- (without immediate revised component parents) but are
11647         -- indirect children of this item
11648 
11649 -- IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Rev Sub Op Res children of Revised item . . . ' || l_revised_item_rec.revised_item_name); END IF;
11650 
11651 
11652        Rev_Sub_Operation_Resources
11653         (   p_validation_level          => p_validation_level
11654         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11655         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11656         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11657         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11658         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision -- Added by MK on 11/02/00
11659         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11660         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11661         ,   p_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11662         ,   x_rev_sub_resource_tbl      => x_rev_sub_resource_tbl
11663         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11664         ,   x_return_status             => l_return_status
11665         );
11666         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11667         THEN
11668                 l_bo_return_status := l_return_status;
11669         END IF;
11670 
11671         -- L1: The above is for ECO enhancement
11672 
11673 
11674         -- Process Revised Components that are direct children of this item
11675 
11676 IF Bom_Globals.Get_Debug = 'Y' THEN
11677     Error_Handler.Write_Debug('***********************************************************') ;
11678     Error_Handler.Write_Debug('Now processing direct children for the Rev Item '
11679                               || l_revised_item_rec.revised_item_name || '. . .'  );
11680     Error_Handler.Write_Debug('Processing Rev Comp as children of Revised item ' || l_revised_item_rec.revised_item_name);
11681 END IF;
11682 
11683         Rev_Comps
11684         (   p_validation_level          => p_validation_level
11685         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11686         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11687         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11688         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code -- Bug 2429272 Change 4
11689         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11690         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
11691         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11692         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11693         ,   p_rev_component_tbl         => x_rev_component_tbl
11694         ,   p_ref_designator_tbl        => x_ref_designator_tbl
11695         ,   p_sub_component_tbl         => x_sub_component_tbl
11696         ,   x_rev_component_tbl         => x_rev_component_tbl
11697         ,   x_ref_designator_tbl        => x_ref_designator_tbl
11698         ,   x_sub_component_tbl         => x_sub_component_tbl
11699         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11700         ,   x_return_status             => l_return_status
11701 	,   x_bill_sequence_id          => l_rev_item_unexp_rec.bill_sequence_id
11702         );
11703 
11704 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Rev_Comps return status ' || l_return_status); END IF;
11705 
11706         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11707         THEN
11708 
11709 IF Bom_Globals.Get_Debug = 'Y' THEN
11710         Error_Handler.Write_Debug('Rev_Comps returned in Rev_Items . . .BO Status: ' || l_return_status);
11711 END IF;
11712 
11713                 l_bo_return_status := l_return_status;
11714         END IF;
11715 
11716         -- Process Reference Designators that are orphans
11717         -- (without immediate revised component parents) but are
11718         -- indirect children of this item
11719 
11720 IF Bom_Globals.Get_Debug = 'Y' THEN
11721     Error_Handler.Write_Debug('***********************************************************') ;
11722     Error_Handler.Write_Debug('Processing Ref Desgs as children of Revised item ' || l_revised_item_rec.revised_item_name);
11723 END IF;
11724 
11725 
11726         Ref_Desgs
11727         (   p_validation_level          => p_validation_level
11728         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11729         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11730         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11731         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code  -- Bug 3991176
11732         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11733         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
11734         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11735         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11736         ,   p_ref_designator_tbl        => x_ref_designator_tbl
11737         ,   p_sub_component_tbl         => x_sub_component_tbl
11738         ,   x_ref_designator_tbl        => x_ref_designator_tbl
11739         ,   x_sub_component_tbl         => x_sub_component_tbl
11740         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11741         ,   x_return_status             => l_return_status
11742         );
11743 
11744         -- Process Substitute Components that are orphans
11745         -- (without immediate revised component parents) but are
11746         -- indirect children of this item
11747 
11748         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11749         THEN
11750                 l_bo_return_status := l_return_status;
11751         END IF;
11752 
11753 IF Bom_Globals.Get_Debug = 'Y' THEN
11754     Error_Handler.Write_Debug('***********************************************************') ;
11755     Error_Handler.Write_Debug('Processing Sub Comps children of Revised item ' || l_revised_item_rec.revised_item_name);
11756 END IF;
11757 
11758         Sub_Comps
11759         (   p_validation_level          => p_validation_level
11760         ,   p_change_notice             => l_revised_item_rec.ECO_Name
11761         ,   p_organization_id           => l_rev_item_unexp_rec.organization_id
11762         ,   p_revised_item_name         => l_revised_item_rec.revised_item_name
11763         ,   p_alternate_bom_code        => l_revised_item_rec.alternate_bom_code  -- Bug 3991176
11764         ,   p_effectivity_date          => l_revised_item_rec.start_effective_date
11765         ,   p_item_revision             => l_revised_item_rec.new_revised_item_revision
11766         ,   p_routing_revision          => l_revised_item_rec.new_routing_revision      -- Added by MK on 11/02/00
11767         ,   p_from_end_item_number      => l_revised_item_rec.from_end_item_unit_number -- Added by MK on 11/02/00
11768         ,   p_sub_component_tbl         => x_sub_component_tbl
11769         ,   x_sub_component_tbl         => x_sub_component_tbl
11770         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
11771         ,   x_return_status             => l_return_status
11772         );
11773 
11774         IF l_return_status <> FND_API.G_RET_STS_SUCCESS
11775         THEN
11776                 l_bo_return_status := l_return_status;
11777         END IF;
11778 
11779 
11780     END IF; -- END Process children
11781     END IF; -- End of processing records for which the return status is null
11782     END LOOP; -- END Revised Items processing loop
11783 
11784     --  Load OUT parameters
11785 
11786     IF NVL(l_bo_return_status, 'S') <> 'S'
11787     THEN
11788         x_return_status        := l_bo_return_status;
11789 
11790 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Rev Items returning with ' || l_bo_return_status); END IF;
11791 
11792     END IF;
11793     --x_revised_item_tbl         := l_revised_item_tbl;
11794     --x_rev_component_tbl        := l_rev_component_tbl;
11795     --x_ref_designator_tbl       := l_ref_designator_tbl;
11796     --x_sub_component_tbl        := l_sub_component_tbl;
11797     --x_rev_operation_tbl        := l_rev_operation_tbl;     --L1
11798     --x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --L1
11799     --x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --L1
11800     x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
11801 
11802 END Rev_Items;
11803 
11804 
11805 -- Eng Change Enhancement: Change Line
11806 /****************************************************************************
11807 * Procedure : Change_Line
11808 * Parameters IN   : Change Line Table and all the other entities
11809 * Parameters OUT  : Change Line Table and all the other entities
11810 * Purpose   : This procedure will process all the Change Line records.
11811 *****************************************************************************/
11812 PROCEDURE Change_Line
11813 (   p_validation_level            IN  NUMBER
11814 ,   p_change_notice               IN  VARCHAR2 := NULL
11815 ,   p_organization_id             IN  NUMBER := NULL
11816 ,   p_change_line_tbl             IN  ENG_Eco_PUB.Change_Line_Tbl_Type -- Eng Change
11817 ,   p_revised_item_tbl            IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
11818 ,   p_rev_component_tbl           IN  BOM_BO_PUB.Rev_Component_Tbl_Type
11819 ,   p_ref_designator_tbl          IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
11820 ,   p_sub_component_tbl           IN  BOM_BO_PUB.Sub_Component_Tbl_Type
11821 ,   p_rev_operation_tbl           IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
11822 ,   p_rev_op_resource_tbl         IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
11823 ,   p_rev_sub_resource_tbl        IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
11824 ,   x_change_line_tbl             IN OUT NOCOPY ENG_Eco_PUB.Change_Line_Tbl_Type      -- Eng Change
11825 ,   x_revised_item_tbl            IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
11826 ,   x_rev_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
11827 ,   x_ref_designator_tbl          IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
11828 ,   x_sub_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
11829 ,   x_rev_operation_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type    --L1--
11830 ,   x_rev_op_resource_tbl         IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type  --L1--
11831 ,   x_rev_sub_resource_tbl        IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type --L1--
11832 ,   x_Mesg_Token_Tbl              OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
11833 ,   x_return_status               OUT NOCOPY VARCHAR2
11834 )
11835 IS
11836 
11837 /* Exposed and Unexposed record */
11838 l_eco_rec               ENG_Eco_PUB.Eco_Rec_Type;
11839 l_eco_revision_tbl      ENG_Eco_PUB.ECO_Revision_Tbl_Type;
11840 
11841 l_change_line_rec            Eng_Eco_Pub.Change_Line_Rec_Type ;
11842 l_change_line_unexp_rec      Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type;
11843 l_old_change_line_rec        Eng_Eco_Pub.Change_Line_Rec_Type ;
11844 l_old_change_line_unexp_rec  Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type;
11845 
11846 /* Error Handling Variables */
11847 l_token_tbl             Error_Handler.Token_Tbl_Type ;
11848 l_mesg_token_tbl        Error_Handler.Mesg_Token_Tbl_Type;
11849 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
11850 l_other_message         VARCHAR2(2000);
11851 l_err_text              VARCHAR2(2000);
11852 
11853 /* Others */
11854 l_old_eco_rec           ENG_Eco_PUB.Eco_Rec_Type;
11855 l_old_eco_unexp_rec     ENG_Eco_PUB.Eco_Unexposed_Rec_Type;
11856 
11857 l_return_status         VARCHAR2(1);
11858 l_bo_return_status      VARCHAR2(1);
11859 l_eco_parent_exists     BOOLEAN := FALSE;
11860 l_process_children      BOOLEAN := TRUE;
11861 l_valid                 BOOLEAN := TRUE;
11862 
11863 /* Error handler definations */
11864 EXC_SEV_QUIT_RECORD     EXCEPTION ;
11865 EXC_SEV_QUIT_BRANCH     EXCEPTION ;
11866 EXC_SEV_SKIP_BRANCH     EXCEPTION ;
11867 EXC_FAT_QUIT_OBJECT     EXCEPTION ;
11868 EXC_UNEXP_SKIP_OBJECT   EXCEPTION ;
11869 
11870 EXC_FAT_QUIT_BRANCH     EXCEPTION ;
11871 EXC_SEV_QUIT_OBJECT     EXCEPTION;
11872 
11873 l_chk_co_sch eng_engineering_changes.status_type%TYPE;
11874 l_change_subject_unexp_rec  Eng_Eco_Pub.Change_Subject_Unexp_Rec_Type;
11875 
11876 BEGIN
11877 
11878 
11879   --  Init local table variables.
11880   l_return_status        := FND_API.G_RET_STS_SUCCESS ;
11881   l_bo_return_status     := FND_API.G_RET_STS_SUCCESS ;
11882   --l_change_line_tbl      := p_change_line_tbl ;
11883   x_change_line_tbl      := p_change_line_tbl;
11884   x_revised_item_tbl     := p_revised_item_tbl;
11885   x_rev_component_tbl    := p_rev_component_tbl;
11886   x_ref_designator_tbl   := p_ref_designator_tbl;
11887   x_sub_component_tbl    := p_sub_component_tbl ;
11888   x_rev_operation_tbl    := p_rev_operation_tbl;
11889   x_rev_op_resource_tbl  := p_rev_op_resource_tbl;
11890   x_rev_sub_resource_tbl := p_rev_sub_resource_tbl;
11891 
11892 
11893   -- Begin block that processes Change Lines. This block holds the exception handlers
11894   -- for change line errors.
11895   FOR I IN 1..x_change_line_tbl.COUNT LOOP
11896   -- Process Flow Step 2: Check if record has not yet been processed and
11897   -- that it is the child of the parent that called this procedure
11898   --
11899   IF (x_change_line_tbl(I).return_status IS NULL OR
11900        x_change_line_tbl(I).return_status = FND_API.G_MISS_CHAR)
11901   THEN
11902 
11903   BEGIN
11904 
11905         --  Load local records.
11906         l_change_line_rec := x_change_line_tbl(I);
11907         l_change_line_rec.transaction_type :=
11908         UPPER(l_change_line_rec.transaction_type);
11909         --l_change_line_unexp_rec.organization_id := Eng_Globals.Get_Org_Id;
11910 
11911         --
11912         -- Initialize the Unexposed Record for every iteration of the Loop
11913         -- so that sequence numbers get generated for every new row.
11914         --
11915 
11916              l_change_line_unexp_rec := NULL;
11917 
11918         --l_change_line_unexp_rec.change_line_id   := NULL ;
11919         --l_change_line_unexp_rec.change_type_id   := NULL ;
11920         --l_change_line_unexp_rec.item_id          := NULL ;
11921         --l_change_line_unexp_rec.item_revision_id := NULL ;
11922 
11923           --Organization_id is required for validations when we attach revised_items/lines to already existing ECO's
11924           l_change_line_unexp_rec.organization_id := Eng_Globals.Get_Org_Id;
11925 
11926 
11927 
11928         --
11929         -- be sure to set the process_children to false at the start of each
11930         -- iteration to avoid faulty processing of children at the end of the loop
11931         --
11932         l_process_children := FALSE;
11933 
11934         IF p_change_notice IS NOT NULL AND
11935            p_organization_id IS NOT NULL
11936         THEN
11937                 l_eco_parent_exists := TRUE;
11938         END IF;
11939 
11940         -- Process Flow Step 2: Check if record has not yet been processed and
11941         -- that it is the child of the parent that called this procedure
11942         --
11943 
11944 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Processing Change Line . . . ' || l_change_line_rec.name); END IF;
11945 
11946         --IF (l_change_line_rec.return_status IS NULL OR
11947             --l_change_line_rec.return_status = FND_API.G_MISS_CHAR)
11948         --THEN
11949 
11950            l_return_status := FND_API.G_RET_STS_SUCCESS;
11951            l_change_line_rec.return_status := FND_API.G_RET_STS_SUCCESS;
11952 
11953            -- Check if transaction_type is valid
11954            --
11955 
11956 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check transaction_type validity'); END IF;
11957 
11958            ENG_GLOBALS.Transaction_Type_Validity
11959            (   p_transaction_type       => l_change_line_rec.transaction_type
11960            ,   p_entity                 => 'Change_Lines'
11961            ,   p_entity_id              => l_change_line_rec.name
11962            ,   x_valid                  => l_valid
11963            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
11964            );
11965 
11966            IF NOT l_valid
11967            THEN
11968                 l_return_status := Error_Handler.G_STATUS_ERROR;
11969                 RAISE EXC_SEV_QUIT_RECORD;
11970            END IF;
11971 
11972            --
11973            -- Process Flow step 4: Convert user unique index to unique index
11974            --
11975 
11976 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Converting user unique index to unique index'); END IF;
11977 
11978            ENG_Val_To_Id.Change_Line_UUI_To_UI
11979            ( p_change_line_rec       => l_change_line_rec
11980            , p_change_line_unexp_rec => l_change_line_unexp_rec
11981            , x_change_line_unexp_rec => l_change_line_unexp_rec
11982            , x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl
11983            , x_Return_Status         => l_return_status
11984            );
11985 
11986 
11987 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
11988 
11989            IF l_return_status = Error_Handler.G_STATUS_ERROR
11990            THEN
11991 
11992                 l_other_message := 'ENG_CL_UUI_SEV_ERROR';
11993                 l_other_token_tbl(1).token_name := 'LINE_NAME';
11994                 l_other_token_tbl(1).token_value := l_change_line_rec.name ;
11995                 RAISE EXC_SEV_QUIT_BRANCH;
11996 
11997            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
11998            THEN
11999                 l_other_message := 'ENG_CL_UUI_UNEXP_SKIP';
12000                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12001                 l_other_token_tbl(1).token_value := l_change_line_rec.name ;
12002                 RAISE EXC_UNEXP_SKIP_OBJECT;
12003 
12004            END IF;
12005 
12006            --
12007            -- Process Flow step 4(b): Check required fields exist
12008            --
12009 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Required'); END IF;
12010            ENG_Validate_Change_Line.Check_Required
12011                 ( x_return_status        => l_return_status
12012                 , x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
12013                 , p_change_line_rec      => l_change_line_rec
12014                 );
12015 
12016            IF l_return_status = Error_Handler.G_STATUS_ERROR
12017            THEN
12018                 IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12019                 THEN
12020                         l_other_message := 'ENG_CL_REQ_CSEV_SKIP';
12021                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12022                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12023                         RAISE EXC_SEV_SKIP_BRANCH;
12024                 ELSE
12025                         RAISE EXC_SEV_QUIT_RECORD;
12026                 END IF;
12027            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12028            THEN
12029                 l_other_message := 'ENG_CL_REQ_UNEXP_SKIP';
12030                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12031                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12032                 RAISE EXC_UNEXP_SKIP_OBJECT;
12033 
12034            ELSIF l_return_status ='S' AND
12035                  l_Mesg_Token_Tbl.COUNT <>0
12036            THEN
12037                     Eco_Error_Handler.Log_Error
12038                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12039                     ,  p_revised_item_tbl    => x_revised_item_tbl
12040                     ,  p_rev_component_tbl   => x_rev_component_tbl
12041                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12042                     ,  p_sub_component_tbl   => x_sub_component_tbl
12043                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12044                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12045                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12046                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12047                     ,  p_error_status        => 'W'
12048                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12049                     ,  p_entity_index        => I
12050                     ,  x_ECO_rec             => l_eco_rec
12051                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12052                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12053                     ,  x_revised_item_tbl    => x_revised_item_tbl
12054                     ,  x_rev_component_tbl   => x_rev_component_tbl
12055                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12056                     ,  x_sub_component_tbl   => x_sub_component_tbl
12057                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12058                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12059                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12060                     );
12061 
12062            END IF;
12063 
12064 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12065 
12066 
12067            -- Process Flow step 5: Verify ECO's existence in database, if
12068            -- the revised item is being created on an ECO and the business
12069            -- object does not carry the ECO header
12070 
12071 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check parent existence'); END IF;
12072 
12073            IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12074            AND  NOT l_eco_parent_exists
12075            THEN
12076                 ENG_Validate_ECO.Check_Existence
12077                 ( p_change_notice       => l_change_line_rec.eco_name
12078                 , p_organization_id     => l_change_line_unexp_rec.organization_id
12079                 , p_organization_code   => l_change_line_rec.organization_code
12080                 , p_calling_entity      => 'CHILD'
12081                 , p_transaction_type    => 'XXX'
12082                 , x_eco_rec             => l_old_eco_rec
12083                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
12084                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
12085                 , x_return_status       => l_Return_Status
12086                 );
12087 
12088 		IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12089 
12090                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12091                 THEN
12092                    l_other_message := 'ENG_PARENTECO_NOT_EXIST';
12093                    l_other_token_tbl(1).token_name := 'ECO_NAME';
12094                    l_other_token_tbl(1).token_value := l_change_line_rec.ECO_Name;
12095                    l_other_token_tbl(2).token_name := 'ORGANIZATION_CODE';
12096                    l_other_token_tbl(2).token_value := l_change_line_rec.organization_code;
12097                    RAISE EXC_SEV_QUIT_OBJECT;
12098                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12099                 THEN
12100                    l_other_message := 'ENG_CL_LIN_UNEXP_SKIP';
12101                    l_other_token_tbl(1).token_name := 'LINE_NAME';
12102                    l_other_token_tbl(1).token_value := l_change_line_rec.name;
12103                    RAISE EXC_UNEXP_SKIP_OBJECT;
12104                 END IF;
12105 
12106            END IF;
12107 
12108 	   IF l_change_line_rec.Transaction_Type IN
12109                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
12110            THEN
12111 		-- Bug 2918350
12112 		-- Start Changes
12113 
12114 		IF p_change_notice IS NOT NULL AND p_organization_id IS NOT NULL THEN
12115 			l_chk_co_sch := ret_co_status ( p_change_notice, p_organization_id);
12116 		ELSE
12117 			l_chk_co_sch := ret_co_status (l_change_line_rec.eco_name, l_change_line_unexp_rec.organization_id);
12118 		END IF;
12119 
12120 		IF l_chk_co_sch = 4 THEN
12121 			l_return_status := error_handler.g_status_error;
12122 			error_handler.add_error_token (p_message_name        => 'ENG_CHG_LN_NOT_UPD',
12123 				p_mesg_token_tbl      => l_mesg_token_tbl,
12124 				x_mesg_token_tbl      => l_mesg_token_tbl,
12125 				p_token_tbl           => l_token_tbl
12126 			);
12127 			RAISE exc_sev_quit_record;
12128 		END IF;
12129     	  END IF;
12130 		-- End Changes
12131 
12132 		-- Process Flow step 5: Verify Revised Item's existence
12133 	        --
12134 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check existence'); END IF;
12135 
12136            ENG_Validate_Change_Line.Check_Existence
12137                 (  p_change_line_rec            => l_change_line_rec
12138                 ,  p_change_line_unexp_rec      => l_change_line_unexp_rec
12139                 ,  x_old_change_line_rec        => l_old_change_line_rec
12140                 ,  x_old_change_line_unexp_rec  => l_old_change_line_unexp_rec
12141                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
12142                 ,  x_return_status              => l_Return_Status
12143                 );
12144 
12145 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12146 
12147            IF l_return_status = Error_Handler.G_STATUS_ERROR
12148            THEN
12149                 l_other_message := 'ENG_CL_EXS_SEV_ERROR';
12150                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12151                 l_other_token_tbl(1).token_value := l_change_line_rec.name;
12152                 l_other_token_tbl(2).token_name := 'ECO_NAME';
12153                 l_other_token_tbl(2).token_value := l_change_line_rec.eco_name;
12154                 RAISE EXC_SEV_QUIT_BRANCH;
12155            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12156            THEN
12157                 l_other_message := 'ENG_CL_EXS_UNEXP_SKIP';
12158                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12159                 l_other_token_tbl(1).token_value := l_change_line_rec.name;
12160                 l_other_token_tbl(2).token_name := 'ECO_NAME';
12161                 l_other_token_tbl(2).token_value := l_change_line_rec.eco_name;
12162                 RAISE EXC_UNEXP_SKIP_OBJECT;
12163            END IF;
12164 
12165 
12166            -- Process Flow step 6: Is Revised Item record an orphan ?
12167 
12168            IF NOT l_eco_parent_exists
12169            THEN
12170 
12171                 -- Process Flow step 7: Is ECO impl/cancl, or in wkflw process ?
12172                 --
12173 
12174                 ENG_Validate_ECO.Check_Access
12175                 ( p_change_notice       => l_change_line_rec.ECO_Name
12176                 , p_organization_id     => l_change_line_unexp_rec.organization_id
12177                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
12178                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
12179                 , x_Return_Status       => l_return_status
12180                 );
12181 
12182 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12183 
12184                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12185                 THEN
12186                         l_other_message := 'ENG_CL_ECOACC_FAT_FATAL';
12187                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12188                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12189                         l_return_status := 'F';
12190                         RAISE EXC_FAT_QUIT_OBJECT;
12191                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12192                 THEN
12193                         l_other_message := 'ENG_RIT_ECOACC_UNEXP_SKIP';
12194                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12195                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12196                         RAISE EXC_UNEXP_SKIP_OBJECT;
12197                 END IF;
12198 
12199            END IF;
12200 
12201 
12202            -- Process Flow step 7: Value to Id conversions
12203            --
12204 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-id conversions'); END IF;
12205 
12206            ENG_Val_To_Id.Change_Line_VID
12207                 ( p_change_line_rec       => l_change_line_rec
12208                 , p_change_line_unexp_rec => l_change_line_unexp_rec
12209                 , x_change_line_unexp_rec => l_change_line_unexp_rec
12210                 , x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl
12211                 , x_Return_Status         => l_return_status
12212                 );
12213 
12214 
12215 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12216 
12217            IF l_return_status = Error_Handler.G_STATUS_ERROR
12218            THEN
12219                 IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12220                 THEN
12221                         l_other_message := 'ENG_RIT_VID_CSEV_SKIP';
12222                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12223                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12224                         RAISE EXC_SEV_SKIP_BRANCH;
12225                 ELSE
12226                         RAISE EXC_SEV_QUIT_RECORD;
12227                 END IF;
12228            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12229            THEN
12230                 RAISE EXC_UNEXP_SKIP_OBJECT;
12231            ELSIF l_return_status ='S' AND
12232                 l_Mesg_Token_Tbl.COUNT <>0
12233            THEN
12234                 Eco_Error_Handler.Log_Error
12235                 (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12236                 ,  p_revised_item_tbl    => x_revised_item_tbl
12237                 ,  p_rev_component_tbl   => x_rev_component_tbl
12238                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
12239                 ,  p_sub_component_tbl   => x_sub_component_tbl
12240                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12241                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12242                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12243                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
12244                 ,  p_error_status        => 'W'
12245                 ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12246                 ,  p_entity_index        => I
12247                 ,  x_ECO_rec             => l_eco_rec
12248                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
12249                 ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12250                 ,  x_revised_item_tbl    => x_revised_item_tbl
12251                 ,  x_rev_component_tbl   => x_rev_component_tbl
12252                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
12253                 ,  x_sub_component_tbl   => x_sub_component_tbl
12254                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12255                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12256                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12257                 );
12258 
12259            END IF;
12260 
12261 
12262            -- Process Flow step8: check that user has access to item associated to change line
12263            --
12264 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check access'); END IF;
12265            IF l_change_line_unexp_rec.pk1_value IS NOT NULL THEN
12266 
12267                 ENG_Validate_Change_Line.Check_Access
12268                 (  p_change_line_rec        => l_change_line_rec
12269                 ,  p_change_line_unexp_rec  => l_change_line_unexp_rec
12270                 ,  p_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
12271                 ,  x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
12272                 ,  x_return_status          => l_Return_Status
12273                 );
12274 
12275 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12276 
12277                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12278                 THEN
12279                         l_other_message := 'ENG_CL_ACCESS_FAT_FATAL';
12280                         l_other_token_tbl(1).token_name := 'OBJECT_NAME';
12281                         l_other_token_tbl(1).token_value := l_change_line_rec.pk1_name;
12282                         l_other_token_tbl(2).token_name := 'LINE_NAME';
12283                         l_other_token_tbl(2).token_value := l_change_line_rec.name;
12284                         l_return_status := 'F';
12285                         RAISE EXC_FAT_QUIT_BRANCH;
12286                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12287                 THEN
12288                         l_other_message := 'ENG_CL_ACCESS_UNEXP_SKIP';
12289                         l_other_token_tbl(1).token_name := 'OBJECT_NAME';
12290                         l_other_token_tbl(1).token_value := l_change_line_rec.pk1_name;
12291                         l_other_token_tbl(2).token_name := 'LINE_NAME';
12292                         l_other_token_tbl(2).token_value := l_change_line_rec.name;
12293                         RAISE EXC_UNEXP_SKIP_OBJECT;
12294                 END IF;
12295 
12296            END IF ;
12297 
12298            --
12299            -- Process Flow step 10: Attribute Validation for CREATE and UPDATE
12300            --
12301 
12302 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Validation'); END IF;
12303            IF l_change_line_rec.Transaction_Type IN
12304                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
12305            THEN
12306                 ENG_Validate_Change_Line.Check_Attributes
12307                 ( x_return_status             => l_return_status
12308                 , x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
12309                 , p_change_line_rec           => l_change_line_rec
12310                 , p_change_line_unexp_rec     => l_change_line_unexp_rec
12311                 , p_old_change_line_rec       => l_old_change_line_rec
12312                 , p_old_change_line_unexp_rec => l_old_change_line_unexp_rec
12313                 );
12314 
12315 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12316 
12317                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12318                 THEN
12319                    IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12320                    THEN
12321                         l_other_message := 'ENG_RIT_ATTVAL_CSEV_SKIP';
12322                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12323                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12324 
12325                         RAISE EXC_SEV_SKIP_BRANCH;
12326                    ELSE
12327                         RAISE EXC_SEV_QUIT_RECORD;
12328                    END IF;
12329                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12330                 THEN
12331 
12332                    l_other_message := 'ENG_RIT_ATTVAL_UNEXP_SKIP';
12333                    l_other_token_tbl(1).token_name := 'LINE_NAME';
12334                    l_other_token_tbl(1).token_value := l_change_line_rec.name;
12335 
12336                    RAISE EXC_UNEXP_SKIP_OBJECT;
12337 
12338                 ELSIF l_return_status ='S' AND
12339                       l_Mesg_Token_Tbl.COUNT <>0
12340                 THEN
12341 
12342                     Eco_Error_Handler.Log_Error
12343                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12344                     ,  p_revised_item_tbl    => x_revised_item_tbl
12345                     ,  p_rev_component_tbl   => x_rev_component_tbl
12346                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12347                     ,  p_sub_component_tbl   => x_sub_component_tbl
12348                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12349                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12350                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12351                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12352                     ,  p_error_status        => 'W'
12353                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12354                     ,  p_entity_index        => I
12355                     ,  x_ECO_rec             => l_eco_rec
12356                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12357                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12358                     ,  x_revised_item_tbl    => x_revised_item_tbl
12359                     ,  x_rev_component_tbl   => x_rev_component_tbl
12360                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12361                     ,  x_sub_component_tbl   => x_sub_component_tbl
12362                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12363                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12364                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12365                     );
12366 
12367                 END IF;
12368 
12369            END IF;
12370 
12371            IF l_change_line_rec.Transaction_Type IN
12372                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
12373            THEN
12374 
12375                 -- Process flow step 11 - Populate NULL columns for Update and
12376                 -- Delete.
12377 
12378 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
12379 
12380                 Eng_Default_Change_Line.Populate_NULL_Columns
12381                 ( p_change_line_rec           => l_change_line_rec
12382                 , p_change_line_unexp_rec     => l_change_line_unexp_rec
12383                 , p_old_change_line_rec       => l_old_change_line_rec
12384                 , p_old_change_line_unexp_rec => l_old_change_line_unexp_rec
12385                 , x_change_line_rec           => l_change_line_rec
12386                 , x_change_line_unexp_rec     => l_change_line_unexp_rec
12387                 );
12388 
12389            ELSIF l_change_line_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
12390 
12391                 -- Process Flow step 12: Default missing values for Operation CREATE
12392                 --
12393 
12394 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
12395                 Eng_Default_Change_Line.Attribute_Defaulting
12396                 ( p_change_line_rec           => l_change_line_rec
12397                 , p_change_line_unexp_rec     => l_change_line_unexp_rec
12398                 , x_change_line_rec           => l_change_line_rec
12399                 , x_change_line_unexp_rec     => l_change_line_unexp_rec
12400                 , x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
12401                 , x_return_status             => l_return_status
12402                 );
12403 
12404 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12405 
12406                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12407                 THEN
12408                         l_other_message := 'ENG_CL_ATTDEF_SEV_SKIP';
12409                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12410                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12411                         RAISE EXC_SEV_SKIP_BRANCH;
12412                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12413                 THEN
12414                         l_other_message := 'ENG_CL_ATTDEF_UNEXP_SKIP';
12415                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12416                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12417 
12418                         RAISE EXC_UNEXP_SKIP_OBJECT;
12419                 ELSIF l_return_status ='S' AND
12420                         l_Mesg_Token_Tbl.COUNT <>0
12421                 THEN
12422                     Eco_Error_Handler.Log_Error
12423                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12424                     ,  p_revised_item_tbl    => x_revised_item_tbl
12425                     ,  p_rev_component_tbl   => x_rev_component_tbl
12426                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12427                     ,  p_sub_component_tbl   => x_sub_component_tbl
12428                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12429                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12430                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12431                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12432                     ,  p_error_status        => 'W'
12433                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12434                     ,  p_entity_index        => I
12435                     ,  x_ECO_rec             => l_eco_rec
12436                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12437                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12438                     ,  x_revised_item_tbl    => x_revised_item_tbl
12439                     ,  x_rev_component_tbl   => x_rev_component_tbl
12440                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12441                     ,  x_sub_component_tbl   => x_sub_component_tbl
12442                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12443                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12444                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12445                     );
12446 
12447                 END IF;
12448            END IF;
12449 
12450            -- Process Flow step 13 - Conditionally required attributes check
12451            --
12452 
12453 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Conditionally required attributes check'); END IF;
12454 
12455            --
12456            -- Put conditionally required check procedure here
12457            --
12458 
12459 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12460 
12461            ENG_Validate_Change_Line.Check_Conditionally_Required
12462                (  p_change_line_rec           => l_change_line_rec
12463                 , p_change_line_unexp_rec     => l_change_line_unexp_rec
12464                 , x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
12465                 , x_return_status             => l_return_status
12466                 );
12467 
12468            IF l_return_status = Error_Handler.G_STATUS_ERROR
12469            THEN
12470                 IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12471                 THEN
12472                         l_other_message := 'ENG_CL_CONREQ_CSEV_SKIP';
12473                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12474                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12475                         RAISE EXC_SEV_SKIP_BRANCH;
12476                 ELSE
12477                         RAISE EXC_SEV_QUIT_RECORD;
12478                 END IF;
12479            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12480            THEN
12481                 l_other_message := 'ENG_CL_CONREQ_UNEXP_SKIP';
12482                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12483                 l_other_token_tbl(1).token_value := l_change_line_rec.name;
12484                 RAISE EXC_UNEXP_SKIP_OBJECT;
12485 
12486            ELSIF l_return_status ='S' AND
12487                 l_Mesg_Token_Tbl.COUNT <>0
12488            THEN
12489                     Eco_Error_Handler.Log_Error
12490                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12491                     ,  p_revised_item_tbl    => x_revised_item_tbl
12492                     ,  p_rev_component_tbl   => x_rev_component_tbl
12493                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12494                     ,  p_sub_component_tbl   => x_sub_component_tbl
12495                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12496                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12497                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12498                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12499                     ,  p_error_status        => 'W'
12500                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12501                     ,  p_entity_index        => I
12502                     ,  x_ECO_rec             => l_eco_rec
12503                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12504                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12505                     ,  x_revised_item_tbl    => x_revised_item_tbl
12506                     ,  x_rev_component_tbl   => x_rev_component_tbl
12507                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12508                     ,  x_sub_component_tbl   => x_sub_component_tbl
12509                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12510                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12511                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12512                     );
12513 
12514            END IF;
12515 
12516            -- Process Flow step 14: Entity defaulting for CREATE and UPDATE
12517            --
12518 
12519 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity defaulting'); END IF;
12520 
12521            IF l_change_line_rec.Transaction_Type IN
12522                 (ENG_GLOBALS.G_OPR_CREATE, ENG_GLOBALS.G_OPR_UPDATE)
12523            THEN
12524 
12525                 ENG_Default_Change_Line.Entity_Defaulting
12526                 ( p_change_line_rec           => l_change_line_rec
12527                 , p_change_line_unexp_rec     => l_change_line_unexp_rec
12528                 , p_old_change_line_rec       => l_old_change_line_rec
12529                 , p_old_change_line_unexp_rec => l_old_change_line_unexp_rec
12530                 , x_change_line_rec           => l_change_line_rec
12531                 , x_change_line_unexp_rec     => l_change_line_unexp_rec
12532                 , x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
12533                 , x_return_status             => l_return_status
12534                 );
12535 
12536 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12537 
12538                 IF l_return_status = Error_Handler.G_STATUS_ERROR
12539                 THEN
12540                    IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12541                    THEN
12542                         l_other_message := 'ENG_CL_ENTDEF_CSEV_SKIP';
12543                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12544                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12545                         RAISE EXC_SEV_SKIP_BRANCH;
12546                    ELSE
12547                         RAISE EXC_SEV_QUIT_RECORD;
12548                    END IF;
12549                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12550                 THEN
12551                         l_other_message := 'ENG_CL_ENTDEF_UNEXP_SKIP';
12552                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12553                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12554                         RAISE EXC_UNEXP_SKIP_OBJECT;
12555                 ELSIF l_return_status ='S' AND
12556                         l_Mesg_Token_Tbl.COUNT <>0
12557                 THEN
12558                     Eco_Error_Handler.Log_Error
12559                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12560                     ,  p_revised_item_tbl    => x_revised_item_tbl
12561                     ,  p_rev_component_tbl   => x_rev_component_tbl
12562                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12563                     ,  p_sub_component_tbl   => x_sub_component_tbl
12564                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12565                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12566                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12567                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12568                     ,  p_error_status        => 'W'
12569                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12570                     ,  p_entity_index        => I
12571                     ,  x_ECO_rec             => l_eco_rec
12572                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12573                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12574                     ,  x_revised_item_tbl    => x_revised_item_tbl
12575                     ,  x_rev_component_tbl   => x_rev_component_tbl
12576                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12577                     ,  x_sub_component_tbl   => x_sub_component_tbl
12578                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12579                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12580                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12581                     );
12582 
12583                 END IF;
12584            END IF;
12585 
12586            -- Process Flow step 15 - Entity Level Validation
12587            --
12588 
12589 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
12590 
12591            IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_DELETE
12592            THEN
12593                 ENG_Validate_Change_Line.Check_Entity_Delete
12594                 (  p_change_line_rec       => l_change_line_rec
12595                 ,  p_change_line_unexp_rec => l_change_line_unexp_rec
12596                 ,  x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl
12597                 ,  x_return_status         => l_Return_Status
12598                 );
12599            ELSE
12600                 ENG_Validate_Change_Line.Check_Entity
12601                 (  p_change_line_rec           => l_change_line_rec
12602                 ,  p_change_line_unexp_rec     => l_change_line_unexp_rec
12603                 ,  p_old_change_line_rec       => l_old_change_line_rec
12604                 ,  p_old_change_line_unexp_rec => l_old_change_line_unexp_rec
12605                 ,  x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
12606                 ,  x_return_status             => l_Return_Status
12607                 );
12608            END IF;
12609 
12610 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12611 
12612            IF l_return_status = Error_Handler.G_STATUS_ERROR
12613            THEN
12614                 IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12615                 THEN
12616                         l_other_message := 'ENG_CL_ENTVAL_CSEV_SKIP';
12617                         l_other_token_tbl(1).token_name := 'LINE_NAME';
12618                         l_other_token_tbl(1).token_value := l_change_line_rec.name;
12619                         RAISE EXC_SEV_SKIP_BRANCH;
12620                 ELSE
12621                         RAISE EXC_SEV_QUIT_RECORD;
12622                 END IF;
12623            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12624            THEN
12625                 l_other_message := 'ENG_CL_ENTVAL_UNEXP_SKIP';
12626                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12627                 l_other_token_tbl(1).token_value := l_change_line_rec.name;
12628                 RAISE EXC_UNEXP_SKIP_OBJECT;
12629            ELSIF l_return_status ='S' AND
12630                 l_Mesg_Token_Tbl.COUNT <>0
12631            THEN
12632                     Eco_Error_Handler.Log_Error
12633                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12634                     ,  p_revised_item_tbl    => x_revised_item_tbl
12635                     ,  p_rev_component_tbl   => x_rev_component_tbl
12636                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12637                     ,  p_sub_component_tbl   => x_sub_component_tbl
12638                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12639                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12640                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12641                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12642                     ,  p_error_status        => 'W'
12643                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12644                     ,  p_entity_index        => I
12645                     ,  x_ECO_rec             => l_eco_rec
12646                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12647                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12648                     ,  x_revised_item_tbl    => x_revised_item_tbl
12649                     ,  x_rev_component_tbl   => x_rev_component_tbl
12650                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12651                     ,  x_sub_component_tbl   => x_sub_component_tbl
12652                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12653                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12654                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12655                     );
12656 
12657            END IF;
12658 
12659            -- Process Flow step 16 : Database Writes
12660            --
12661 
12662            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
12663 
12664            ENG_Change_Line_Util.Perform_Writes
12665                 (  p_change_line_rec       => l_change_line_rec
12666                 ,  p_change_line_unexp_rec => l_change_line_unexp_rec
12667                 ,  x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl
12668                 ,  x_return_status         => l_Return_Status
12669                 );
12670            IF l_return_status ='S' THEN
12671                --11.5.10 subjects
12672                ENG_Change_Line_Util.Change_Subjects(
12673                    p_change_line_rec          => l_change_line_rec
12674                  , p_change_line_unexp_rec    => l_change_line_unexp_rec
12675                  , x_change_subject_unexp_rec => l_change_subject_unexp_rec
12676                  , x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
12677                  , x_return_status            => l_Return_Status);
12678                --11.5.10
12679            END IF;
12680            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
12681            -- Bug 4033384: Added error handling for subject validation for l_return_status G_STATUS_ERROR
12682            IF l_return_status = Error_Handler.G_STATUS_ERROR
12683            THEN
12684                 IF l_change_line_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
12685                 THEN
12686                     l_other_message := 'ENG_CL_ENTVAL_CSEV_SKIP';
12687                     l_other_token_tbl(1).token_name := 'LINE_NAME';
12688                     l_other_token_tbl(1).token_value := l_change_line_rec.name;
12689                     RAISE EXC_SEV_SKIP_BRANCH;
12690                 ELSE
12691                     RAISE EXC_SEV_QUIT_RECORD;
12692                 END IF;
12693            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
12694            THEN
12695                 l_other_message := 'ENG_CL_WRITES_UNEXP_SKIP';
12696                 l_other_token_tbl(1).token_name := 'LINE_NAME';
12697                 l_other_token_tbl(1).token_value := l_change_line_rec.name;
12698                 RAISE EXC_UNEXP_SKIP_OBJECT;
12699            ELSIF l_return_status ='S' AND
12700               l_Mesg_Token_Tbl.COUNT <>0
12701            THEN
12702                     Eco_Error_Handler.Log_Error
12703                     (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12704                     ,  p_revised_item_tbl    => x_revised_item_tbl
12705                     ,  p_rev_component_tbl   => x_rev_component_tbl
12706                     ,  p_ref_designator_tbl  => x_ref_designator_tbl
12707                     ,  p_sub_component_tbl   => x_sub_component_tbl
12708                     ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12709                     ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12710                     ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12711                     ,  p_mesg_token_tbl      => l_mesg_token_tbl
12712                     ,  p_error_status        => 'W'
12713                     ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12714                     ,  p_entity_index        => I
12715                     ,  x_ECO_rec             => l_eco_rec
12716                     ,  x_eco_revision_tbl    => l_eco_revision_tbl
12717                     ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12718                     ,  x_revised_item_tbl    => x_revised_item_tbl
12719                     ,  x_rev_component_tbl   => x_rev_component_tbl
12720                     ,  x_ref_designator_tbl  => x_ref_designator_tbl
12721                     ,  x_sub_component_tbl   => x_sub_component_tbl
12722                     ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12723                     ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12724                     ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12725                     );
12726 
12727            END IF;
12728 
12729 IF Bom_Globals.Get_Debug = 'Y' THEN
12730      Error_Handler.Write_Debug('Writing to the database for Change Line is completed with '||l_return_status );
12731 END IF;
12732 
12733         --END IF; -- END IF statement that checks RETURN STATUS
12734 
12735         --  Load tables.
12736 
12737         x_change_line_tbl(I)          := l_change_line_rec;
12738 
12739   --  For loop exception handler.
12740 
12741   EXCEPTION
12742 
12743     WHEN EXC_SEV_QUIT_RECORD THEN
12744 
12745         Eco_Error_Handler.Log_Error
12746         (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12747         ,  p_revised_item_tbl    => x_revised_item_tbl
12748         ,  p_rev_component_tbl   => x_rev_component_tbl
12749         ,  p_ref_designator_tbl  => x_ref_designator_tbl
12750         ,  p_sub_component_tbl   => x_sub_component_tbl
12751         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12752         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12753         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12754         ,  p_mesg_token_tbl      => l_mesg_token_tbl
12755         ,  p_error_status        => FND_API.G_RET_STS_ERROR
12756         ,  p_error_scope         => Error_Handler.G_SCOPE_RECORD
12757         ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12758         ,  p_entity_index        => I
12759         ,  x_ECO_rec             => l_ECO_rec
12760         ,  x_eco_revision_tbl    => l_eco_revision_tbl
12761         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12762         ,  x_revised_item_tbl    => x_revised_item_tbl
12763         ,  x_rev_component_tbl   => x_rev_component_tbl
12764         ,  x_ref_designator_tbl  => x_ref_designator_tbl
12765         ,  x_sub_component_tbl   => x_sub_component_tbl
12766         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12767         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12768         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12769         );
12770 
12771 
12772         IF l_bo_return_status = 'S'
12773         THEN
12774             l_bo_return_status  := l_return_status;
12775         END IF;
12776 
12777         x_return_status                := l_bo_return_status;
12778         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
12779 
12780         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
12781         --x_revised_item_tbl             := l_revised_item_tbl;
12782         --x_rev_component_tbl            := l_rev_component_tbl;
12783         --x_ref_designator_tbl           := l_ref_designator_tbl;
12784         --x_sub_component_tbl            := l_sub_component_tbl;
12785         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
12786         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
12787         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
12788 
12789     WHEN EXC_SEV_QUIT_BRANCH THEN
12790 
12791         Eco_Error_Handler.Log_Error
12792         (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12793         ,  p_revised_item_tbl    => x_revised_item_tbl
12794         ,  p_rev_component_tbl   => x_rev_component_tbl
12795         ,  p_ref_designator_tbl  => x_ref_designator_tbl
12796         ,  p_sub_component_tbl   => x_sub_component_tbl
12797         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12798         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12799         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12800         ,  p_mesg_token_tbl      => l_mesg_token_tbl
12801         ,  p_error_status        => Error_Handler.G_STATUS_ERROR
12802         ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
12803         ,  p_other_status        => Error_Handler.G_STATUS_ERROR
12804         ,  p_other_message       => l_other_message
12805         ,  p_other_token_tbl     => l_other_token_tbl
12806         ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12807         ,  p_entity_index        => I
12808         ,  x_eco_rec             => l_eco_rec
12809         ,  x_eco_revision_tbl    => l_eco_revision_tbl
12810         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12811         ,  x_revised_item_tbl    => x_revised_item_tbl
12812         ,  x_rev_component_tbl   => x_rev_component_tbl
12813         ,  x_ref_designator_tbl  => x_ref_designator_tbl
12814         ,  x_sub_component_tbl   => x_sub_component_tbl
12815         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12816         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12817         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12818         );
12819 
12820         IF l_bo_return_status = 'S'
12821         THEN
12822             l_bo_return_status  := l_return_status;
12823         END IF;
12824 
12825 
12826         x_return_status                := l_bo_return_status;
12827         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
12828 
12829         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
12830         --x_revised_item_tbl             := l_revised_item_tbl;
12831         --x_rev_component_tbl            := l_rev_component_tbl;
12832         --x_ref_designator_tbl           := l_ref_designator_tbl;
12833         --x_sub_component_tbl            := l_sub_component_tbl;
12834         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
12835         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
12836         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
12837 
12838         RETURN;
12839 
12840     WHEN EXC_SEV_SKIP_BRANCH THEN
12841 
12842         Eco_Error_Handler.Log_Error
12843         (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12844         ,  p_revised_item_tbl    => x_revised_item_tbl
12845         ,  p_rev_component_tbl   => x_rev_component_tbl
12846         ,  p_ref_designator_tbl  => x_ref_designator_tbl
12847         ,  p_sub_component_tbl   => x_sub_component_tbl
12848         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12849         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12850         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12851         ,  p_mesg_token_tbl      => l_mesg_token_tbl
12852         ,  p_error_status        => Error_Handler.G_STATUS_ERROR
12853         ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
12854         ,  p_other_message       => l_other_message
12855         ,  p_other_token_tbl     => l_other_token_tbl
12856         ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
12857         ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12858         ,  p_entity_index        => I
12859         ,  x_ECO_rec             => l_ECO_rec
12860         ,  x_eco_revision_tbl    => l_eco_revision_tbl
12861         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12862         ,  x_revised_item_tbl    => x_revised_item_tbl
12863         ,  x_rev_component_tbl   => x_rev_component_tbl
12864         ,  x_ref_designator_tbl  => x_ref_designator_tbl
12865         ,  x_sub_component_tbl   => x_sub_component_tbl
12866         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12867         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12868         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12869         );
12870 
12871         IF l_bo_return_status = 'S'
12872         THEN
12873            l_bo_return_status          := l_return_status ;
12874         END IF;
12875 
12876         x_return_status                := l_bo_return_status;
12877         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
12878 
12879         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
12880         --x_revised_item_tbl             := l_revised_item_tbl;
12881         --x_rev_component_tbl            := l_rev_component_tbl;
12882         --x_ref_designator_tbl           := l_ref_designator_tbl;
12883         --x_sub_component_tbl            := l_sub_component_tbl;
12884         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
12885         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
12886         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
12887 
12888         RETURN;
12889 
12890     WHEN EXC_FAT_QUIT_OBJECT THEN
12891 
12892         Eco_Error_Handler.Log_Error
12893         (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12894         ,  p_revised_item_tbl    => x_revised_item_tbl
12895         ,  p_rev_component_tbl   => x_rev_component_tbl
12896         ,  p_ref_designator_tbl  => x_ref_designator_tbl
12897         ,  p_sub_component_tbl   => x_sub_component_tbl
12898         ,  p_mesg_token_tbl      => l_mesg_token_tbl
12899         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12900         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12901         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12902         ,  p_error_status        => Error_Handler.G_STATUS_FATAL
12903         ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
12904         ,  p_other_message       => l_other_message
12905         ,  p_other_status        => Error_Handler.G_STATUS_FATAL
12906         ,  p_other_token_tbl     => l_other_token_tbl
12907         ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12908         ,  p_entity_index        => I
12909         ,  x_ECO_rec             => l_ECO_rec
12910         ,  x_eco_revision_tbl    => l_eco_revision_tbl
12911         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12912         ,  x_revised_item_tbl    => x_revised_item_tbl
12913         ,  x_rev_component_tbl   => x_rev_component_tbl
12914         ,  x_ref_designator_tbl  => x_ref_designator_tbl
12915         ,  x_sub_component_tbl   => x_sub_component_tbl
12916         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12917         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12918         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12919         );
12920 
12921         l_return_status := 'Q';
12922 
12923         x_return_status                := l_return_status;
12924         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
12925 
12926         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
12927         --x_revised_item_tbl             := l_revised_item_tbl;
12928         --x_rev_component_tbl            := l_rev_component_tbl;
12929         --x_ref_designator_tbl           := l_ref_designator_tbl;
12930         --x_sub_component_tbl            := l_sub_component_tbl;
12931         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
12932         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
12933         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
12934 
12935 
12936     WHEN EXC_UNEXP_SKIP_OBJECT THEN
12937 
12938         Eco_Error_Handler.Log_Error
12939         (  p_change_line_tbl     => x_change_line_tbl -- Eng Change
12940         ,  p_revised_item_tbl    => x_revised_item_tbl
12941         ,  p_rev_component_tbl   => x_rev_component_tbl
12942         ,  p_ref_designator_tbl  => x_ref_designator_tbl
12943         ,  p_sub_component_tbl   => x_sub_component_tbl
12944         ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
12945         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12946         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12947         ,  p_mesg_token_tbl      => l_mesg_token_tbl
12948         ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
12949         ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
12950         ,  p_other_message       => l_other_message
12951         ,  p_other_token_tbl     => l_other_token_tbl
12952         ,  p_error_level         => ECO_Error_Handler.G_CL_LEVEL
12953         ,  x_ECO_rec             => l_ECO_rec
12954         ,  x_eco_revision_tbl    => l_eco_revision_tbl
12955         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
12956         ,  x_revised_item_tbl    => x_revised_item_tbl
12957         ,  x_rev_component_tbl   => x_rev_component_tbl
12958         ,  x_ref_designator_tbl  => x_ref_designator_tbl
12959         ,  x_sub_component_tbl   => x_sub_component_tbl
12960         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
12961         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
12962         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
12963         );
12964 
12965         l_return_status := 'U';
12966 
12967         x_return_status                := l_return_status;
12968         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
12969 
12970         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
12971         --x_revised_item_tbl             := l_revised_item_tbl;
12972         --x_rev_component_tbl            := l_rev_component_tbl;
12973         --x_ref_designator_tbl           := l_ref_designator_tbl;
12974         --x_sub_component_tbl            := l_sub_component_tbl;
12975         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
12976         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
12977         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
12978 
12979   END; -- END Change Line processing block
12980   END IF; -- End of processing records for which the return status is null
12981   END LOOP; -- END Change Line processing loop
12982 
12983   IF l_return_status in ('Q', 'U')
12984   THEN
12985         x_return_status := l_return_status;
12986         RETURN;
12987   END IF;
12988 
12989 
12990 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Change Line returning with ' || l_bo_return_status); END IF;
12991 
12992   IF NVL(l_bo_return_status, 'S') <> 'S'
12993   THEN
12994         x_return_status        := l_bo_return_status;
12995 
12996   END IF;
12997 
12998   --  Load OUT parameters
12999   --x_change_line_tbl          := l_change_line_tbl ;      -- Eng Change
13000   --x_revised_item_tbl         := l_revised_item_tbl;
13001   --x_rev_component_tbl        := l_rev_component_tbl;
13002   --x_ref_designator_tbl       := l_ref_designator_tbl;
13003   --x_sub_component_tbl        := l_sub_component_tbl;
13004   --x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
13005   --x_rev_operation_tbl        := l_rev_operation_tbl;     --L1
13006   --x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --L1
13007   --x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --L1
13008 
13009 END Change_Line ;
13010 
13011 
13012 
13013 --  Eco_Rev
13014 PROCEDURE Eco_Rev
13015 (   p_validation_level            IN  NUMBER
13016 ,   p_change_notice               IN  VARCHAR2 := NULL
13017 ,   p_organization_id             IN  NUMBER := NULL
13018 ,   p_eco_revision_tbl            IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type
13019 ,   p_change_line_tbl             IN  ENG_Eco_PUB.Change_Line_Tbl_Type    -- Eng Change
13020 ,   p_revised_item_tbl            IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
13021 ,   p_rev_component_tbl           IN  BOM_BO_PUB.Rev_Component_Tbl_Type
13022 ,   p_ref_designator_tbl          IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
13023 ,   p_sub_component_tbl           IN  BOM_BO_PUB.Sub_Component_Tbl_Type
13024 ,   p_rev_operation_tbl           IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
13025 ,   p_rev_op_resource_tbl         IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
13026 ,   p_rev_sub_resource_tbl        IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
13027 ,   x_eco_revision_tbl            IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
13028 ,   x_change_line_tbl             IN OUT NOCOPY ENG_Eco_PUB.Change_Line_Tbl_Type      -- Eng Change
13029 ,   x_revised_item_tbl            IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
13030 ,   x_rev_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
13031 ,   x_ref_designator_tbl          IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
13032 ,   x_sub_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
13033 ,   x_rev_operation_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
13034 ,   x_rev_op_resource_tbl         IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
13035 ,   x_rev_sub_resource_tbl        IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
13036 ,   x_Mesg_Token_Tbl              OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
13037 ,   x_return_status               OUT NOCOPY VARCHAR2
13038 )
13039 IS
13040 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
13041 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
13042 l_other_message         VARCHAR2(2000);
13043 l_err_text              VARCHAR2(2000);
13044 l_valid                 BOOLEAN := TRUE;
13045 l_Return_Status         VARCHAR2(1);
13046 l_bo_return_status      VARCHAR2(1);
13047 l_eco_parent_exists     BOOLEAN := FALSE;
13048 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type;
13049 l_old_eco_rec           ENG_Eco_PUB.Eco_Rec_Type;
13050 l_old_eco_unexp_rec     ENG_Eco_PUB.Eco_Unexposed_Rec_Type;
13051 l_eco_revision_rec      ENG_Eco_PUB.Eco_Revision_Rec_Type;
13052 --l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type := p_eco_revision_tbl;
13053 l_eco_rev_unexp_rec     ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type;
13054 l_old_eco_rev_rec       ENG_Eco_PUB.Eco_Revision_Rec_Type := NULL;
13055 l_old_eco_rev_unexp_rec ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type := NULL;
13056 --l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type := p_revised_item_tbl;
13057 --l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
13058 --l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
13059 --l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
13060 --l_rev_operation_tbl     Bom_Rtg_Pub.Rev_Operation_Tbl_Type := p_rev_operation_tbl;  --L1
13061 --l_rev_op_resource_tbl   Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type :=p_rev_op_resource_tbl; --L1
13062 --l_rev_sub_resource_tbl  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type :=p_rev_sub_resource_tbl; --L1
13063 --l_change_line_tbl       Eng_Eco_Pub.Change_Line_Tbl_Type := p_change_line_tbl; -- Eng Change
13064 
13065 
13066 l_return_value          NUMBER;
13067 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
13068 
13069 EXC_SEV_QUIT_RECORD     EXCEPTION;
13070 EXC_SEV_QUIT_OBJECT     EXCEPTION;
13071 EXC_FAT_QUIT_OBJECT     EXCEPTION;
13072 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
13073 
13074 	-- Bug 2918350 // kamohan
13075 	-- Start Changes
13076 
13077 	l_chk_co_sch eng_engineering_changes.status_type%TYPE;
13078 
13079 	-- Bug 2918350 // kamohan
13080 	-- End Changes
13081 
13082 BEGIN
13083 
13084 
13085     l_return_status := 'S';
13086     l_bo_return_status := 'S';
13087 
13088     --  Init local table variables.
13089 
13090     x_eco_revision_tbl                  := p_eco_revision_tbl;
13091     x_revised_item_tbl                  := p_revised_item_tbl;
13092     x_rev_component_tbl                 := p_rev_component_tbl;
13093     x_ref_designator_tbl                := p_ref_designator_tbl;
13094     x_sub_component_tbl                 := p_sub_component_tbl;
13095     x_rev_operation_tbl                 := p_rev_operation_tbl;
13096     x_rev_op_resource_tbl               := p_rev_op_resource_tbl;
13097     x_rev_sub_resource_tbl              := p_rev_sub_resource_tbl;
13098     x_change_line_tbl                   := p_change_line_tbl;
13099 
13100     l_eco_rev_unexp_rec.organization_id := ENG_GLOBALS.Get_org_id;
13101 
13102     FOR I IN 1..x_eco_revision_tbl.COUNT LOOP
13103     IF (x_eco_revision_tbl(I).return_status IS NULL OR
13104          x_eco_revision_tbl(I).return_status = FND_API.G_MISS_CHAR) THEN
13105 
13106     BEGIN
13107 
13108         --  Load local records.
13109 
13110         l_eco_revision_rec := x_eco_revision_tbl(I);
13111 
13112         l_eco_revision_rec.transaction_type :=
13113                 UPPER(l_eco_revision_rec.transaction_type);
13114 
13115         IF p_change_notice IS NOT NULL AND
13116            p_organization_id IS NOT NULL
13117         THEN
13118                 l_eco_parent_exists := TRUE;
13119         END IF;
13120 
13121         -- Process Flow Step 2: Check if record has not yet been processed and
13122         -- that it is the child of the parent that called this procedure
13123         --
13124 
13125         IF --(l_eco_revision_rec.return_status IS NULL OR
13126             --l_eco_revision_rec.return_status = FND_API.G_MISS_CHAR)
13127            --AND
13128            (NOT l_eco_parent_exists
13129             OR
13130             (l_eco_parent_exists AND
13131              (l_eco_revision_rec.ECO_Name = p_change_notice AND
13132               l_eco_rev_unexp_rec.organization_id = p_organization_id)))
13133         THEN
13134 
13135            l_return_status := FND_API.G_RET_STS_SUCCESS;
13136 
13137            l_eco_revision_rec.return_status := FND_API.G_RET_STS_SUCCESS;
13138 
13139            -- Check if transaction_type is valid
13140            --
13141 
13142            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Transaction Type validity'); END IF;
13143            ENG_GLOBALS.Transaction_Type_Validity
13144            (   p_transaction_type       => l_eco_revision_rec.transaction_type
13145            ,   p_entity                 => 'ECO_Rev'
13146            ,   p_entity_id              => l_eco_revision_rec.revision
13147            ,   x_valid                  => l_valid
13148            ,   x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
13149            );
13150 
13151            IF NOT l_valid
13152            THEN
13153                 l_return_status := Error_Handler.G_STATUS_ERROR;
13154                 RAISE EXC_SEV_QUIT_RECORD;
13155            END IF;
13156 
13157            -- Process Flow step 3: Value-to-ID conversions
13158            --
13159 
13160            ENG_Val_To_Id.ECO_Revision_UUI_To_UI
13161                (  p_eco_revision_rec   => l_eco_revision_rec
13162                 , p_eco_rev_unexp_rec  => l_eco_rev_unexp_rec
13163                 , x_eco_rev_unexp_rec  => l_eco_rev_unexp_rec
13164                 , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
13165                 , x_Return_Status      => l_return_status
13166                );
13167 
13168            -- Process Flow step 4: Verify that Revision is not NULL or MISSING
13169           --
13170 
13171            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check if Revision is missing or null'); END IF;
13172            ENG_Validate_Eco_Revision.Check_Required
13173                 (  x_return_status              => l_return_status
13174                 ,  p_eco_revision_rec           => l_eco_revision_rec
13175                 ,  x_mesg_token_tbl             => l_Mesg_Token_Tbl
13176                 );
13177 
13178            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13179 
13180            IF l_return_status = Error_Handler.G_STATUS_ERROR
13181            THEN
13182                 RAISE EXC_SEV_QUIT_RECORD;
13183            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13184            THEN
13185                 l_other_message := 'ENG_REV_KEYCOL_UNEXP_SKIP';
13186                 l_other_token_tbl(1).token_name := 'REVISION';
13187                 l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13188                 RAISE EXC_UNEXP_SKIP_OBJECT;
13189            END IF;
13190 
13191            -- Process Flow step 5: Verify ECO's existence in database, if
13192            -- the revised item is being created on an ECO and the business
13193            -- object does not carry the ECO header
13194 
13195            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check parent existence'); END IF;
13196 
13197            IF l_eco_revision_rec.transaction_type = ENG_GLOBALS.G_OPR_CREATE
13198               AND
13199               NOT l_eco_parent_exists
13200            THEN
13201                 ENG_Validate_ECO.Check_Existence
13202                 ( p_change_notice       => l_eco_revision_rec.ECO_Name
13203                 , p_organization_id     => l_eco_rev_unexp_rec.organization_id
13204                 , p_organization_code   => l_eco_revision_rec.organization_code
13205                 , p_calling_entity      => 'CHILD'
13206                 , p_transaction_type    => 'XXX'
13207                 , x_eco_rec             => l_old_eco_rec
13208                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
13209                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
13210                 , x_return_status       => l_Return_Status
13211                 );
13212 
13213                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13214 
13215                 IF l_return_status = Error_Handler.G_STATUS_ERROR
13216                 THEN
13217                    l_other_message := 'ENG_PARENTECO_NOT_EXIST';
13218                    l_other_token_tbl(1).token_name := 'ECO_NAME';
13219                    l_other_token_tbl(1).token_value := l_eco_revision_rec.ECO_Name;
13220                    l_other_token_tbl(2).token_name := 'ORGANIZATION_CODE';
13221                    l_other_token_tbl(2).token_value := l_eco_revision_rec.organization_code;
13222                    RAISE EXC_SEV_QUIT_OBJECT;
13223                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13224                 THEN
13225                    l_other_message := 'ENG_REV_LIN_UNEXP_SKIP';
13226                    l_other_token_tbl(1).token_name := 'REVISION';
13227                    l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13228                    RAISE EXC_UNEXP_SKIP_OBJECT;
13229                 END IF;
13230            END IF;
13231 
13232 	-- Bug 2918350
13233 	-- Start Changes
13234 	 IF l_eco_revision_rec.Transaction_Type IN
13235                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
13236            THEN
13237 
13238 	IF p_change_notice IS NOT NULL AND p_organization_id IS NOT NULL THEN
13239 		l_chk_co_sch := ret_co_status ( p_change_notice, p_organization_id);
13240 	ELSE
13241 		l_chk_co_sch := ret_co_status (l_eco_revision_rec.eco_name, l_eco_rev_unexp_rec.organization_id);
13242 	END IF;
13243 
13244 	IF l_chk_co_sch = 4 THEN
13245 		l_return_status := error_handler.g_status_error;
13246 		error_handler.add_error_token (p_message_name        => 'ENG_ECO_REV_NOT_UPD',
13247 			p_mesg_token_tbl      => l_mesg_token_tbl,
13248 			x_mesg_token_tbl      => l_mesg_token_tbl,
13249 			p_token_tbl           => l_token_tbl
13250 			);
13251 		RAISE exc_sev_quit_record;
13252 	END IF;
13253         end if;
13254 	-- End Changes
13255 
13256            -- Process Flow step 4: Verify Revision's existence
13257            --
13258 
13259            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check Existence'); END IF;
13260            ENG_Validate_ECO_Revision.Check_Existence
13261                 (  p_eco_revision_rec           => l_eco_revision_rec
13262                 ,  p_eco_rev_unexp_rec          => l_eco_rev_unexp_rec
13263                 ,  x_old_eco_revision_rec       => l_old_eco_rev_rec
13264                 ,  x_old_eco_rev_unexp_rec      => l_old_eco_rev_unexp_rec
13265                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
13266                 ,  x_return_status              => l_Return_Status
13267                 );
13268 
13269            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13270 
13271            IF l_return_status = Error_Handler.G_STATUS_ERROR
13272            THEN
13273                 RAISE EXC_SEV_QUIT_RECORD;
13274            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13275            THEN
13276                 l_other_message := 'ENG_REV_EXS_UNEXP_SKIP';
13277                 l_other_token_tbl(1).token_name := 'REVISION';
13278                 l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13279                 RAISE EXC_UNEXP_SKIP_OBJECT;
13280            END IF;
13281 
13282 
13283            -- Process Flow step 5: Is ECO Revision record an orphan ?
13284 
13285            IF NOT l_eco_parent_exists
13286            THEN
13287 
13288                 -- Process Flow step 6(a and b): Is ECO impl/cancl,
13289                 -- or in wkflw process ?
13290                 --
13291 
13292                 ENG_Validate_ECO.Check_Access
13293                 ( p_change_notice       => l_eco_revision_rec.ECO_Name
13294                 , p_organization_id     => l_eco_rev_unexp_rec.organization_id
13295                 , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
13296                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
13297                 , x_Return_Status       => l_return_status
13298                 );
13299 
13300                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13301 
13302                 IF l_return_status = Error_Handler.G_STATUS_ERROR
13303                 THEN
13304                         l_other_message := 'ENG_REV_ACCESS_FAT_FATAL';
13305                         l_other_token_tbl(1).token_name := 'REVISION';
13306                         l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13307                         l_return_status := 'F';
13308                         RAISE EXC_FAT_QUIT_OBJECT;
13309                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13310                 THEN
13311                         l_other_message := 'ENG_REV_ACCESS_UNEXP_ERROR';
13312                         l_other_token_tbl(1).token_name := 'REVISION';
13313                         l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13314                         RAISE EXC_UNEXP_SKIP_OBJECT;
13315                 END IF;
13316 
13317            END IF;
13318 
13319            IF l_eco_revision_rec.Transaction_Type IN
13320                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
13321            THEN
13322 
13323                 -- Process flow step 7 - Populate NULL columns for Update and
13324                 -- Delete.
13325 
13326                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
13327                 Eng_Default_ECO_Revision.Populate_NULL_Columns
13328                 (   p_eco_revision_rec          => l_eco_revision_rec
13329                 ,   p_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
13330                 ,   p_old_eco_revision_rec      => l_old_eco_rev_rec
13331                 ,   p_old_eco_rev_unexp_rec     => l_old_eco_rev_unexp_rec
13332                 ,   x_eco_revision_rec          => l_eco_revision_rec
13333                 ,   x_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
13334                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
13335                 );
13336 
13337            ELSIF l_eco_revision_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
13338 
13339                 -- Process Flow step 8: Default missing values for Operation CREATE
13340 
13341                  IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
13342                  Eng_Default_ECO_revision.Attribute_Defaulting
13343                         (   p_eco_revision_rec          => l_eco_revision_rec
13344                         ,   p_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
13345                         ,   x_eco_revision_rec          => l_eco_revision_rec
13346                         ,   x_eco_rev_unexp_rec         => l_eco_rev_unexp_Rec
13347                         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
13348                         ,   x_return_status             => l_Return_Status
13349                         );
13350 
13351                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13352 
13353                 IF l_return_status = Error_Handler.G_STATUS_ERROR
13354                 THEN
13355                         RAISE EXC_SEV_QUIT_RECORD;
13356                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13357                 THEN
13358                         l_other_message := 'ENG_REV_ATTDEF_UNEXP_SKIP';
13359                         l_other_token_tbl(1).token_name := 'REVISION';
13360                         l_other_token_tbl(1).token_value :=
13361                                                  l_eco_revision_rec.revision;
13362                         RAISE EXC_UNEXP_SKIP_OBJECT;
13363                 ELSIF l_return_status ='S' AND
13364                         l_Mesg_Token_Tbl.COUNT <>0
13365                 THEN
13366                         Eco_Error_Handler.Log_Error
13367                         (  p_eco_revision_tbl    => x_eco_revision_tbl
13368                         ,  p_change_line_tbl     => x_change_line_tbl -- Eng Change
13369                         ,  p_revised_item_tbl    => x_revised_item_tbl
13370                         ,  p_rev_component_tbl   => x_rev_component_tbl
13371                         ,  p_ref_designator_tbl  => x_ref_designator_tbl
13372                         ,  p_sub_component_tbl   => x_sub_component_tbl
13373                         ,  p_rev_operation_tbl   => x_rev_operation_tbl   --L1
13374                         ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl --L1
13375                         ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl--L1
13376                         ,  p_mesg_token_tbl      => l_mesg_token_tbl
13377                         ,  p_error_status        => 'W'
13378                         ,  p_error_level         => 2
13379                         ,  p_entity_index        => I
13380                         ,  x_eco_rec             => l_eco_rec
13381                         ,  x_eco_revision_tbl    => x_eco_revision_tbl
13382                         ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
13383                         ,  x_revised_item_tbl    => x_revised_item_tbl
13384                         ,  x_rev_component_tbl   => x_rev_component_tbl
13385                         ,  x_ref_designator_tbl  => x_ref_designator_tbl
13386                         ,  x_sub_component_tbl   => x_sub_component_tbl
13387                         ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
13388                         ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
13389                         ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
13390                         );
13391                 END IF;
13392            END IF;
13393 
13394            -- Process Flow step 10 - Entity Level Validation
13395 
13396            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
13397            Eng_Validate_ECO_Revision.Check_Entity
13398                 (  x_return_status        => l_Return_Status
13399                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
13400                 ,  p_eco_revision_rec     => l_eco_revision_rec
13401                 ,  p_eco_rev_unexp_rec    => l_eco_rev_unexp_rec
13402                 );
13403 
13404            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13405 
13406            IF l_return_status = Error_Handler.G_STATUS_ERROR
13407            THEN
13408                 RAISE EXC_SEV_QUIT_RECORD;
13409            ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13410            THEN
13411                 l_other_message := 'ENG_REV_ENTVAL_UNEXP_ERROR';
13412                 l_other_token_tbl(1).token_name := 'REVISION';
13413                 l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13414                 RAISE EXC_UNEXP_SKIP_OBJECT;
13415            ELSIF l_return_status ='S' AND
13416                 l_Mesg_Token_Tbl.COUNT <>0
13417            THEN
13418                 Eco_Error_Handler.Log_Error
13419                 (  p_eco_revision_tbl       => x_eco_revision_tbl
13420                 ,  p_change_line_tbl        => x_change_line_tbl -- Eng Change
13421                 ,  p_revised_item_tbl       => x_revised_item_tbl
13422                 ,  p_rev_component_tbl      => x_rev_component_tbl
13423                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
13424                 ,  p_sub_component_tbl      => x_sub_component_tbl
13425                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
13426                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13427                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13428                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
13429                 ,  p_error_status           => 'W'
13430                 ,  p_error_level            => 2
13431                 ,  p_entity_index           => I
13432                 ,  x_eco_rec                => l_eco_rec
13433                 ,  x_eco_revision_tbl       => x_eco_revision_tbl
13434                 ,  x_change_line_tbl        => x_change_line_tbl -- Eng Change
13435                 ,  x_revised_item_tbl       => x_revised_item_tbl
13436                 ,  x_rev_component_tbl      => x_rev_component_tbl
13437                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
13438                 ,  x_sub_component_tbl      => x_sub_component_tbl
13439                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
13440                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13441                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13442                 );
13443            END IF;
13444 
13445            -- Process Flow step 11 : Database Writes
13446 
13447            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
13448            ENG_ECO_Revision_Util.Perform_Writes
13449                 (   p_eco_revision_rec          => l_eco_revision_rec
13450                 ,   p_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
13451                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
13452                 ,   x_return_status             => l_return_status
13453                 );
13454 
13455            IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
13456 
13457            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
13458            THEN
13459                 l_other_message := 'ENG_REV_WRITES_UNEXP_ERROR';
13460                 l_other_token_tbl(1).token_name := 'REVISION';
13461                 l_other_token_tbl(1).token_value := l_eco_revision_rec.revision;
13462                 RAISE EXC_UNEXP_SKIP_OBJECT;
13463            ELSIF l_return_status ='S' AND
13464               l_Mesg_Token_Tbl.COUNT <>0
13465            THEN
13466                 Eco_Error_Handler.Log_Error
13467                 (  p_eco_revision_tbl      => x_eco_revision_tbl
13468                 ,  p_change_line_tbl       => x_change_line_tbl -- Eng Change
13469                 ,  p_revised_item_tbl      => x_revised_item_tbl
13470                 ,  p_rev_component_tbl     => x_rev_component_tbl
13471                 ,  p_ref_designator_tbl    => x_ref_designator_tbl
13472                 ,  p_sub_component_tbl     => x_sub_component_tbl
13473                 ,  p_rev_operation_tbl     => x_rev_operation_tbl    --L1
13474                 ,  p_rev_op_resource_tbl   => x_rev_op_resource_tbl  --L1
13475                 ,  p_rev_sub_resource_tbl  => x_rev_sub_resource_tbl --L1
13476                 ,  p_mesg_token_tbl        => l_mesg_token_tbl
13477                 ,  p_error_status          => 'W'
13478                 ,  p_error_level           => 2
13479                 ,  x_eco_rec               => l_eco_rec
13480                 ,  x_eco_revision_tbl      => x_eco_revision_tbl
13481                 ,  x_change_line_tbl       => x_change_line_tbl -- Eng Change
13482                 ,  x_revised_item_tbl      => x_revised_item_tbl
13483                 ,  x_rev_component_tbl     => x_rev_component_tbl
13484                 ,  x_ref_designator_tbl    => x_ref_designator_tbl
13485                 ,  x_sub_component_tbl     => x_sub_component_tbl
13486                 ,  x_rev_operation_tbl     => x_rev_operation_tbl    --L1
13487                 ,  x_rev_op_resource_tbl   => x_rev_op_resource_tbl  --L1
13488                 ,  x_rev_sub_resource_tbl  => x_rev_sub_resource_tbl --L1
13489                 );
13490            END IF;
13491 
13492         END IF; -- End IF that checks RETURN STATUS AND PARENT-CHILD RELATIONSHIP
13493 
13494         --  Load tables.
13495 
13496         x_eco_revision_tbl(I)          := l_eco_revision_rec;
13497 
13498         --  For loop exception handler.
13499 
13500 
13501      EXCEPTION
13502 
13503        WHEN EXC_SEV_QUIT_RECORD THEN
13504 
13505         Eco_Error_Handler.Log_Error
13506                 (  p_eco_revision_tbl       => x_eco_revision_tbl
13507                 ,  p_change_line_tbl        => x_change_line_tbl -- Eng Change
13508                 ,  p_revised_item_tbl       => x_revised_item_tbl
13509                 ,  p_rev_component_tbl      => x_rev_component_tbl
13510                 ,  p_ref_designator_tbl     => x_ref_designator_tbl
13511                 ,  p_sub_component_tbl      => x_sub_component_tbl
13512                 ,  p_rev_operation_tbl      => x_rev_operation_tbl    --L1
13513                 ,  p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13514                 ,  p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13515                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
13516                 ,  p_error_status           => FND_API.G_RET_STS_ERROR
13517                 ,  p_error_scope            => Error_Handler.G_SCOPE_RECORD
13518                 ,  p_error_level            => 2
13519                 ,  p_entity_index           => I
13520                 ,  x_eco_rec                => l_eco_rec
13521                 ,  x_eco_revision_tbl       => x_eco_revision_tbl
13522                 ,  x_change_line_tbl        => x_change_line_tbl -- Eng Change
13523                 ,  x_revised_item_tbl       => x_revised_item_tbl
13524                 ,  x_rev_component_tbl      => x_rev_component_tbl
13525                 ,  x_ref_designator_tbl     => x_ref_designator_tbl
13526                 ,  x_sub_component_tbl      => x_sub_component_tbl
13527                 ,  x_rev_operation_tbl      => x_rev_operation_tbl    --L1
13528                 ,  x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13529                 ,  x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13530                 );
13531 
13532         IF l_bo_return_status = 'S'
13533         THEN
13534                 l_bo_return_status     := l_return_status;
13535         END IF;
13536 
13537         x_return_status                := l_bo_return_status;
13538         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
13539         --x_eco_revision_tbl             := l_eco_revision_tbl;
13540         --x_revised_item_tbl             := l_revised_item_tbl;
13541         --x_rev_component_tbl            := l_rev_component_tbl;
13542         --x_ref_designator_tbl           := l_ref_designator_tbl;
13543         --x_sub_component_tbl            := l_sub_component_tbl;
13544         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
13545         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
13546         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
13547         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
13548 
13549         WHEN EXC_SEV_QUIT_OBJECT THEN
13550 
13551         Eco_Error_Handler.Log_Error
13552             (  p_eco_revision_tbl       => x_eco_revision_tbl
13553              , p_change_line_tbl        => x_change_line_tbl -- Eng Change
13554              , p_revised_item_tbl       => x_revised_item_tbl
13555              , p_rev_component_tbl      => x_rev_component_tbl
13556              , p_ref_designator_tbl     => x_ref_designator_tbl
13557              , p_sub_component_tbl      => x_sub_component_tbl
13558              , p_rev_operation_tbl      => x_rev_operation_tbl    --L1
13559              , p_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13560              , p_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13561              , p_error_status           => Error_Handler.G_STATUS_ERROR
13562              , p_error_scope            => Error_Handler.G_SCOPE_ALL
13563              , p_error_level            => Error_Handler.G_BO_LEVEL
13564              , p_other_message          => l_other_message
13565              , p_other_status           => Error_Handler.G_STATUS_ERROR
13566              , p_other_token_tbl        => l_other_token_tbl
13567              , x_eco_rec                => l_eco_rec
13568              , x_eco_revision_tbl       => x_eco_revision_tbl
13569              , x_change_line_tbl        => x_change_line_tbl -- Eng Change
13570              , x_revised_item_tbl       => x_revised_item_tbl
13571              , x_rev_component_tbl      => x_rev_component_tbl
13572              , x_ref_designator_tbl     => x_ref_designator_tbl
13573              , x_sub_component_tbl      => x_sub_component_tbl
13574              , x_rev_operation_tbl      => x_rev_operation_tbl    --L1
13575              , x_rev_op_resource_tbl    => x_rev_op_resource_tbl  --L1
13576              , x_rev_sub_resource_tbl   => x_rev_sub_resource_tbl --L1
13577              );
13578 
13579         IF l_bo_return_status = 'S'
13580         THEN
13581                 l_bo_return_status     := l_return_status;
13582         END IF;
13583 
13584         x_return_status                := l_bo_return_status;
13585         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
13586         --x_eco_revision_tbl             := l_eco_revision_tbl;
13587         --x_revised_item_tbl             := l_revised_item_tbl;
13588         --x_rev_component_tbl            := l_rev_component_tbl;
13589         --x_ref_designator_tbl           := l_ref_designator_tbl;
13590         --x_sub_component_tbl            := l_sub_component_tbl;
13591         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
13592         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
13593         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
13594         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
13595 
13596        WHEN EXC_FAT_QUIT_OBJECT THEN
13597 
13598         Eco_Error_Handler.Log_Error
13599                 (  p_eco_revision_tbl    => x_eco_revision_tbl
13600                 ,  p_change_line_tbl     => x_change_line_tbl -- Eng Change
13601                 ,  p_revised_item_tbl    => x_revised_item_tbl
13602                 ,  p_rev_component_tbl   => x_rev_component_tbl
13603                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
13604                 ,  p_sub_component_tbl   => x_sub_component_tbl
13605                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
13606                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
13607                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
13608                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
13609                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
13610                 ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
13611                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
13612                 ,  p_other_message       => l_other_message
13613                 ,  p_other_token_tbl     => l_other_token_tbl
13614                 ,  p_error_level         => 2
13615                 ,  p_entity_index        => I
13616                 ,  x_eco_rec             => l_eco_rec
13617                 ,  x_eco_revision_tbl    => x_eco_revision_tbl
13618                 ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
13619                 ,  x_revised_item_tbl    => x_revised_item_tbl
13620                 ,  x_rev_component_tbl   => x_rev_component_tbl
13621                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
13622                 ,  x_sub_component_tbl   => x_sub_component_tbl
13623                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
13624                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
13625                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
13626                 );
13627 
13628         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
13629         --x_eco_revision_tbl             := l_eco_revision_tbl;
13630         --x_revised_item_tbl             := l_revised_item_tbl;
13631         --x_rev_component_tbl            := l_rev_component_tbl;
13632         --x_ref_designator_tbl           := l_ref_designator_tbl;
13633         --x_sub_component_tbl            := l_sub_component_tbl;
13634         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
13635         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
13636         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
13637         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
13638 
13639         l_return_status := 'Q';
13640 
13641        WHEN EXC_UNEXP_SKIP_OBJECT THEN
13642 
13643         Eco_Error_Handler.Log_Error
13644                 (  p_eco_revision_tbl    => x_eco_revision_tbl
13645                 ,  p_change_line_tbl     => x_change_line_tbl -- Eng Change
13646                 ,  p_revised_item_tbl    => x_revised_item_tbl
13647                 ,  p_rev_component_tbl   => x_rev_component_tbl
13648                 ,  p_ref_designator_tbl  => x_ref_designator_tbl
13649                 ,  p_sub_component_tbl   => x_sub_component_tbl
13650                 ,  p_rev_operation_tbl   => x_rev_operation_tbl    --L1
13651                 ,  p_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
13652                 ,  p_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
13653                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
13654                 ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
13655                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
13656                 ,  p_other_message       => l_other_message
13657                 ,  p_other_token_tbl     => l_other_token_tbl
13658                 ,  p_error_level         => 2
13659                 ,  x_ECO_rec             => l_ECO_rec
13660                 ,  x_eco_revision_tbl    => x_eco_revision_tbl
13661                 ,  x_change_line_tbl     => x_change_line_tbl -- Eng Change
13662                 ,  x_revised_item_tbl    => x_revised_item_tbl
13663                 ,  x_rev_component_tbl   => x_rev_component_tbl
13664                 ,  x_ref_designator_tbl  => x_ref_designator_tbl
13665                 ,  x_sub_component_tbl   => x_sub_component_tbl
13666                 ,  x_rev_operation_tbl   => x_rev_operation_tbl    --L1
13667                 ,  x_rev_op_resource_tbl => x_rev_op_resource_tbl  --L1
13668                 ,  x_rev_sub_resource_tbl=> x_rev_sub_resource_tbl --L1
13669                 );
13670 
13671         IF l_bo_return_status = 'S'
13672         THEN
13673                 l_bo_return_status     := l_return_status;
13674         END IF;
13675 
13676         x_return_status                := l_bo_return_status;
13677         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
13678         --x_eco_revision_tbl             := l_eco_revision_tbl;
13679         --x_revised_item_tbl             := l_revised_item_tbl;
13680         --x_rev_component_tbl            := l_rev_component_tbl;
13681         --x_ref_designator_tbl           := l_ref_designator_tbl;
13682         --x_sub_component_tbl            := l_sub_component_tbl;
13683         --x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
13684         --x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
13685         --x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
13686         --x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
13687 
13688         l_return_status := 'U';
13689 
13690         END; -- END block
13691      END IF; -- End of processing records for which the return status is null
13692      END LOOP; -- END Revisions processing loop
13693 
13694     IF l_return_status in ('Q', 'U')
13695     THEN
13696         x_return_status := l_return_status;
13697         RETURN;
13698     END IF;
13699 
13700      --  Load OUT parameters
13701 
13702      x_return_status            := l_bo_return_status;
13703      --x_eco_revision_tbl         := l_eco_revision_tbl;
13704      --x_revised_item_tbl         := l_revised_item_tbl;
13705      --x_rev_component_tbl        := l_rev_component_tbl;
13706      --x_ref_designator_tbl       := l_ref_designator_tbl;
13707      --x_sub_component_tbl        := l_sub_component_tbl;
13708      --x_rev_operation_tbl        := l_rev_operation_tbl;     --L1
13709      --x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --L1
13710      --x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --L1
13711      --x_change_line_tbl          := l_change_line_tbl ;      -- Eng Change
13712 
13713      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
13714 
13715 END Eco_Rev;
13716 
13717 PROCEDURE Create_Change_Lifecycle (
13718 	p_change_id	 IN	NUMBER,
13719 	p_change_type_id IN	NUMBER,
13720 	p_user_id        IN	NUMBER,
13721 	p_login_id       IN	NUMBER,
13722 	x_Mesg_Token_Tbl IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type,
13723 	x_return_status	 IN OUT NOCOPY VARCHAR2 )
13724 IS
13725 
13726   l_lifecycle_status_id NUMBER;
13727   l_return_status       VARCHAR2(1);
13728   l_err_text            VARCHAR2(2000) ;
13729   l_Mesg_Token_Tbl      Error_Handler.Mesg_Token_Tbl_Type ;
13730 
13731   /* Cursor to Fetch all the life cycle Statuses for corresponding Type. */
13732   CURSOR c_lifecycle_statuses IS
13733   SELECT *
13734   FROM eng_lifecycle_statuses
13735   WHERE entity_name = 'ENG_CHANGE_TYPE'
13736   AND entity_id1 = p_change_type_id;
13737 
13738 BEGIN
13739 	 FOR cls IN c_lifecycle_statuses
13740 	 LOOP
13741                   -- fetch the CHANGE_LIFECYCLE_STATUS_ID from sequence
13742 		SELECT ENG_LIFECYCLE_STATUSES_S.NEXTVAL
13743 		INTO l_lifecycle_status_id
13744 		FROM dual;
13745 
13746 		  -- Insert the Statuses data
13747 		INSERT INTO ENG_LIFECYCLE_STATUSES
13748 		(   CHANGE_LIFECYCLE_STATUS_ID
13749 		  , ENTITY_NAME
13750 		  , ENTITY_ID1
13751 		  , ENTITY_ID2
13752 		  , ENTITY_ID3
13753 		  , ENTITY_ID4
13754 		  , ENTITY_ID5
13755 		  , SEQUENCE_NUMBER
13756 		  , STATUS_CODE
13757 		  , START_DATE
13758 		  , COMPLETION_DATE
13759 		  , CHANGE_WF_ROUTE_ID
13760 		  , AUTO_PROMOTE_STATUS
13761 		  , AUTO_DEMOTE_STATUS
13762 		  , WORKFLOW_STATUS
13763 		  , CHANGE_EDITABLE_FLAG
13764 		  , CREATION_DATE
13765 		  , CREATED_BY
13766 		  , LAST_UPDATE_DATE
13767 		  , LAST_UPDATED_BY
13768 		  , LAST_UPDATE_LOGIN
13769 		  , ITERATION_NUMBER
13770 		  , ACTIVE_FLAG
13771 		  , CHANGE_WF_ROUTE_TEMPLATE_ID
13772 		)
13773 		VALUES
13774 		(   l_lifecycle_status_id
13775 		  , 'ENG_CHANGE'
13776 		  , p_change_id
13777 		  , NULL -- cls.ENTITY_ID2
13778 		  , NULL -- cls.ENTITY_ID3
13779 		  , NULL -- cls.ENTITY_ID4
13780 		  , NULL -- cls.ENTITY_ID5
13781 		  , cls.SEQUENCE_NUMBER
13782 		  , cls.STATUS_CODE
13783 		  , NULL -- cls.START_DATE
13784 		  , NULL -- cls.COMPLETION_DATE
13785 		  , NULL -- cls.CHANGE_WF_ROUTE_ID
13786 		  , cls.AUTO_PROMOTE_STATUS
13787 		  , cls.AUTO_DEMOTE_STATUS
13788 		  , NULL -- cls.WORKFLOW_STATUS
13789 		  , cls.CHANGE_EDITABLE_FLAG
13790 		  , SYSDATE
13791 		  , p_user_id
13792 		  , SYSDATE
13793 		  , p_user_id
13794 		  , p_login_id
13795 		  , 0 -- cls.ITERATION_NUMBER
13796 		  , 'Y' -- cls.ACTIVE_FLAG
13797 		  , cls.CHANGE_WF_ROUTE_ID -- cls.CHANGE_WF_ROUTE_TEMPLATE_ID
13798 		);
13799 
13800 		-- Inserting the status properties
13801 		INSERT INTO  eng_status_properties(
13802 		   CHANGE_LIFECYCLE_STATUS_ID
13803 		 , STATUS_CODE
13804 		 , PROMOTION_STATUS_FLAG
13805 		 , CREATION_DATE
13806 		 , CREATED_BY
13807 		 , LAST_UPDATE_DATE
13808 		 , LAST_UPDATED_BY
13809 		 , LAST_UPDATE_LOGIN
13810 		) SELECT l_lifecycle_status_id, status_code, PROMOTION_STATUS_FLAG,
13811 		         sysdate, p_user_id, sysdate, p_user_id, p_login_id
13812 		  FROM eng_status_properties
13813 		  WHERE CHANGE_LIFECYCLE_STATUS_ID = cls.CHANGE_LIFECYCLE_STATUS_ID;
13814 	 END LOOP; -- End loop c_lifecycle_statuses
13815 EXCEPTION
13816 WHEN OTHERS THEN
13817 
13818 	IF BOM_Globals.Get_Debug = 'Y'
13819 	THEN
13820 		Error_Handler.Write_Debug('Unexpected Error occured in Insert in Create_Change_Lifecycle . . .' || SQLERRM);
13821 	END IF;
13822 
13823 	IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
13824 	THEN
13825 		l_err_text := G_PKG_NAME||' : Utility (Create_Change_Lifecycle Lifecycle Insert) '||SUBSTR(SQLERRM, 1, 200);
13826 
13827 		Error_Handler.Add_Error_Token
13828 		(  p_message_name   => NULL
13829 		 , p_message_text   => l_err_text
13830 		 , p_mesg_token_tbl => l_mesg_token_tbl
13831 		 , x_mesg_token_tbl => l_mesg_token_tbl
13832 		);
13833 	END IF ;
13834 
13835 	-- Return the status and message table.
13836 	x_return_status := Error_Handler.G_STATUS_UNEXPECTED;
13837 	x_mesg_token_tbl := l_mesg_token_tbl ;
13838 
13839 END Create_Change_Lifecycle;
13840 
13841 PROCEDURE Create_Tasks
13842 (   p_change_id                IN  NUMBER
13843 ,   p_change_type_id           IN  NUMBER
13844 ,   p_organization_id          IN  NUMBER
13845 ,   p_transaction_type         IN VARCHAR2
13846 ,   p_approval_status_type	IN NUMBER	-- Bug 3436684
13847 ,   x_Mesg_Token_Tbl           OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
13848 ,   x_return_status            OUT NOCOPY VARCHAR2
13849 )
13850 IS
13851 
13852 
13853 CURSOR c_change_tasks (v_change_type_id    IN NUMBER,
13854                        v_organization_id   IN NUMBER)
13855 IS
13856   SELECT tsk.sequence_number,
13857          tsk.required_flag,
13858 	 tsk.default_assignee_id,
13859          tsk.default_assignee_type,
13860 	 tsk.task_name,
13861 	 tsk.description,
13862          typtsk.complete_before_status_code,
13863 	 typtsk.start_after_status_code,
13864          typtsk.change_type_id
13865    FROM eng_change_tasks_vl tsk,
13866         eng_change_type_org_tasks typtsk
13867    WHERE tsk.organization_id = typtsk.organization_id
13868    AND typtsk.organization_id = v_organization_id
13869    AND tsk.change_template_id = typtsk.change_template_or_task_id
13870    AND typtsk.template_or_task_flag ='E'
13871    AND typtsk.change_type_id = v_change_type_id;
13872 
13873 /*CURSOR c_grp_assignee ( v_default_assignee_id IN NUMBER)
13874 IS
13875   SELECT member_person_id
13876   FROM ego_group_members_v
13877   WHERE group_id = v_default_assignee_id;
13878 */-- Commented for Bug 3311072
13879 CURSOR c_role_assignee (v_assignee_id IN NUMBER,
13880 		        v_assignee_type IN VARCHAR)
13881 IS
13882   SELECT fg.grantee_orig_system_id
13883   FROM fnd_grants fg,
13884        fnd_menus_tl tl,
13885        fnd_menus m,
13886        (SELECT distinct f.object_id,
13887                e.menu_id
13888         FROM fnd_form_functions f,
13889 	     fnd_menu_entries e
13890 	WHERE e.function_id = f.function_id) r,
13891 	fnd_objects o
13892   WHERE fg.grantee_orig_system='HZ_PARTY'
13893   AND fg.grantee_type = 'USER'
13894   AND fg.menu_id = tl.menu_id
13895   AND fg.object_id = o.object_id
13896   AND tl.menu_id = r.menu_id
13897   AND m.menu_id = tl.menu_id
13898   AND tl.menu_id = v_assignee_id
13899   AND tl.LANGUAGE= USERENV('LANG')
13900   AND r.object_id = o.object_id
13901   AND o.obj_name = v_assignee_type;
13902 
13903     v_assignee_id               NUMBER;
13904     v_assignee_type		VARCHAR2(80);
13905     l_change_line_rec           Eng_Eco_Pub.Change_Line_Rec_Type;
13906     l_change_line_unexp_rec     Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type;
13907     l_dest_change_id            NUMBER;
13908     l_msg_token_tbl        Error_Handler.Mesg_Token_Tbl_Type;
13909     l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
13910     l_sql_stmt			VARCHAR2(1000);
13911 
13912 BEGIN
13913 
13914 
13915 
13916 
13917     IF p_transaction_type = 'CREATE'
13918     THEN
13919 
13920       BOM_globals.set_debug('N');
13921 
13922 
13923 
13924       FOR change_line IN c_change_tasks(p_change_type_id, p_organization_id)
13925       LOOP
13926 
13927         SELECT eng_change_lines_s.nextval INTO l_change_line_unexp_rec.change_line_id FROM SYS.DUAL;
13928         l_change_line_unexp_rec.change_id := p_change_id;
13929         l_change_line_unexp_rec.change_type_id := -1;
13930         l_change_line_rec.sequence_number := change_line.sequence_number;
13931         l_change_line_rec.name := change_line.task_name;
13932         l_change_line_rec.description := change_line.description;
13933         l_change_line_rec.complete_before_status_code := change_line.complete_before_status_code;
13934         l_change_line_rec.start_after_status_code := change_line.start_after_status_code;
13935         l_change_line_rec.required_flag := change_line.required_flag;
13936 	l_change_line_unexp_rec.Approval_Status_Type := p_approval_status_type; -- Bug 3436684
13937 	l_change_line_unexp_rec.status_code := 1; -- Bug 3436684
13938 
13939 	--setting the Assignee_Id
13940 	IF change_line.default_assignee_type = 'PERSON' or change_line.default_assignee_type = 'GROUP'
13941 	THEN
13942 	  l_change_line_unexp_rec.assignee_id := change_line.default_assignee_id;
13943 
13944 	/*ELSIF change_line.default_assignee_type = 'GROUP'
13945 	THEN
13946 		--
13947 		-- Changes Added for bug 3311072
13948 
13949 		l_sql_stmt := ' SELECT member_person_id '
13950 			|| ' FROM ego_group_members_v '
13951 			|| ' WHERE group_id = :1 ';
13952 		BEGIN
13953 			EXECUTE IMMEDIATE l_sql_stmt INTO v_assignee_id USING change_line.default_assignee_id;
13954 			l_change_line_unexp_rec.assignee_id := v_assignee_id;
13955 		EXCEPTION
13956 		WHEN NO_DATA_FOUND THEN
13957 			l_change_line_unexp_rec.assignee_id := NULL;
13958 		WHEN OTHERS THEN
13959 			IF BOM_Globals.Get_Debug = 'Y'
13960 			THEN
13961 				Error_Handler.Write_Debug('Unexpected Error occured in Insert . . .' || SQLERRM);
13962 			END IF;
13963 		END;*/
13964 	   /*OPEN c_grp_assignee(change_line.default_assignee_id);
13965 	   FETCH c_grp_assignee INTO v_assignee_id;
13966 	   IF (c_grp_assignee%FOUND)
13967 	   THEN
13968 	     l_change_line_unexp_rec.assignee_id := v_assignee_id;
13969 	   END IF;
13970 	   CLOSE c_grp_assignee;*/-- Commented for bug 3311072
13971 	   -- End changes for bug 3311072
13972 
13973 	ELSE
13974 	   OPEN c_role_assignee(change_line.default_assignee_id, change_line.default_assignee_type);
13975 	   FETCH c_role_assignee INTO v_assignee_id;
13976 	   IF (c_role_assignee%FOUND)
13977 	   THEN
13978 	     l_change_line_unexp_rec.assignee_id := v_assignee_id;
13979 	   END IF;
13980 	   CLOSE c_role_assignee;
13981 
13982 	END IF;
13983 	Eng_Change_Line_Util.Insert_Row
13984         (  p_change_line_rec => l_change_line_rec
13985          , p_change_line_unexp_rec => l_change_line_unexp_rec
13986          , x_Mesg_Token_Tbl => l_msg_token_tbl
13987          , x_return_status => l_return_status
13988         );
13989      x_return_status :=l_return_status ;
13990       END LOOP;
13991     END IF;
13992 
13993 
13994 END Create_Tasks;
13995 
13996 
13997 PROCEDURE Create_Relation(
13998     p_change_id                IN  NUMBER
13999 ,   p_organization_id          IN  NUMBER
14000 ,   x_Mesg_Token_Tbl           OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
14001 ,   x_return_status            OUT NOCOPY VARCHAR2
14002 )
14003 is
14004 -- Error Handlig Variables
14005     l_return_status       VARCHAR2(1);
14006     l_err_text            VARCHAR2(2000) ;
14007     l_Mesg_Token_Tbl      Error_Handler.Mesg_Token_Tbl_Type ;
14008     l_new_prop_relation   NUMBER;
14009   begin
14010 
14011  select ENG_CHANGE_OBJ_RELATIONSHIPS_S.nextval
14012   into l_new_prop_relation
14013   from dual;
14014 
14015   insert into eng_change_obj_relationships (
14016   CHANGE_RELATIONSHIP_ID,
14017   CHANGE_ID,
14018   RELATIONSHIP_CODE,
14019   OBJECT_TO_NAME,
14020   OBJECT_TO_ID1,
14021   OBJECT_TO_ID2,
14022   OBJECT_TO_ID3,
14023   OBJECT_TO_ID4,
14024   OBJECT_TO_ID5,
14025   CREATION_DATE,
14026   CREATED_BY,
14027   LAST_UPDATE_DATE,
14028   LAST_UPDATED_BY,
14029   LAST_UPDATE_LOGIN )
14030   values(
14031    l_new_prop_relation,
14032    ENGECOBO.GLOBAL_CHANGE_ID,
14033    'PROPAGATED_TO',
14034    'ENG_CHANGE',
14035    p_change_id,
14036    ENGECOBO.GLOBAL_ORG_ID,
14037    p_organization_id,
14038    null,
14039    null,
14040    sysdate,
14041    Eng_Globals.Get_User_Id,
14042    sysdate,
14043    Eng_Globals.Get_User_Id,
14044    Eng_Globals.Get_Login_id
14045   );
14046 
14047 
14048 EXCEPTION
14049 
14050     WHEN OTHERS THEN
14051        IF BOM_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
14052          ('Unexpected Error occured in Insert . . .' || SQLERRM);
14053        END IF;
14054 
14055 
14056 
14057         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
14058        THEN
14059           l_err_text := G_PKG_NAME || ' : Utility (Relationship  Insert) ' ||
14060                                         SUBSTR(SQLERRM, 1, 200);
14061 
14062           Error_Handler.Add_Error_Token
14063           (  p_message_name   => NULL
14064            , p_message_text   => l_err_text
14065            , p_mesg_token_tbl => l_mesg_token_tbl
14066            , x_mesg_token_tbl => l_mesg_token_tbl
14067           ) ;
14068        END IF ;
14069 
14070        -- Return the status and message table.
14071        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
14072        x_mesg_token_tbl := l_mesg_token_tbl ;
14073 
14074 end Create_Relation;
14075 
14076 
14077 
14078 
14079 
14080 
14081 
14082 
14083 
14084 
14085 
14086 
14087 
14088 PROCEDURE Eco_Header
14089 (   p_validation_level            IN  NUMBER
14090 ,   p_ECO_rec                     IN  ENG_Eco_PUB.Eco_Rec_Type
14091 ,   p_eco_revision_tbl            IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type
14092 ,   p_change_line_tbl             IN  ENG_Eco_PUB.Change_Line_Tbl_Type    -- Eng Change
14093 ,   p_revised_item_tbl            IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
14094 ,   p_rev_component_tbl           IN  BOM_BO_PUB.Rev_Component_Tbl_Type
14095 ,   p_ref_designator_tbl          IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
14096 ,   p_sub_component_tbl           IN  BOM_BO_PUB.Sub_Component_Tbl_Type
14097 ,   p_rev_operation_tbl           IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type   --L1
14098 ,   p_rev_op_resource_tbl         IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type --L1
14099 ,   p_rev_sub_resource_tbl        IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type--L1
14100 ,   x_ECO_rec                     IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
14101 ,   x_eco_revision_tbl            IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
14102 ,   x_change_line_tbl             IN OUT NOCOPY ENG_Eco_PUB.Change_Line_Tbl_Type      -- Eng Change
14103 ,   x_revised_item_tbl            IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
14104 ,   x_rev_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
14105 ,   x_ref_designator_tbl          IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
14106 ,   x_sub_component_tbl           IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
14107 ,   x_rev_operation_tbl           IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type    --L1--
14108 ,   x_rev_op_resource_tbl         IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type  --L1--
14109 ,   x_rev_sub_resource_tbl        IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type --L1--
14110 ,   x_Mesg_Token_Tbl              OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
14111 ,   x_return_status               OUT NOCOPY VARCHAR2
14112 ,   x_disable_revision            OUT NOCOPY NUMBER --Bug no:3034642
14113 )
14114 IS
14115 
14116 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
14117 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
14118 l_other_message         VARCHAR2(50);
14119 l_err_text              VARCHAR2(2000);
14120 l_valid                 BOOLEAN := TRUE;
14121 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
14122 l_bo_return_status      VARCHAR2(1) := 'S';
14123 l_ECO_Rec               Eng_Eco_Pub.ECO_Rec_Type;
14124 l_ECO_Unexp_Rec         Eng_Eco_Pub.ECO_Unexposed_Rec_Type;
14125 l_Old_ECO_Rec           Eng_Eco_Pub.ECO_Rec_Type := NULL;
14126 l_Old_ECO_Unexp_Rec     Eng_Eco_Pub.ECO_Unexposed_Rec_Type := NULL;
14127 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type := p_eco_revision_tbl;
14128 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type := p_revised_item_tbl;
14129 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
14130 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
14131 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
14132 
14133 l_rev_operation_tbl     Bom_Rtg_Pub.Rev_Operation_Tbl_Type
14134                                                 := p_rev_operation_tbl;  --L1
14135 l_rev_op_resource_tbl   Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type
14136                                                 :=p_rev_op_resource_tbl; --L1
14137 l_rev_sub_resource_tbl  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type
14138                                                 :=p_rev_sub_resource_tbl;--L1
14139 
14140 l_change_line_tbl       Eng_Eco_Pub.Change_Line_Tbl_Type := p_change_line_tbl; -- Eng Change
14141 l_status_check_required BOOLEAN := TRUE; -- Added for enhancement 541
14142     -- Bug 2916558 // kamohan
14143     -- Start Changes
14144 
14145     CURSOR check_co_type ( p_change_notice VARCHAR2, p_organization_id NUMBER) IS
14146      SELECT ecot.type_name CHANGE_ORDER_TYPE, eec.assignee_id
14147        FROM eng_engineering_changes eec, eng_change_order_types_vl ecot
14148       WHERE eec.change_notice =p_change_notice
14149            AND eec.organization_id = p_organization_id
14150 	   AND eec.change_order_type_id = ecot.change_order_type_id;
14151 
14152     chk_co_type check_co_type%ROWTYPE;
14153 
14154     l_organization_id NUMBER;
14155 
14156     -- Bug 2916558 // kamohan
14157     -- End Changes
14158 
14159 l_return_value          NUMBER;
14160 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
14161 
14162 EXC_SEV_QUIT_RECORD     EXCEPTION;
14163 EXC_SEV_QUIT_BRANCH     EXCEPTION;
14164 EXC_SEV_SKIP_BRANCH     EXCEPTION;
14165 EXC_FAT_QUIT_OBJECT     EXCEPTION;
14166 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
14167 l_user_id               NUMBER;
14168 l_login_id              NUMBER;
14169 l_prog_appid            NUMBER;
14170 l_prog_id               NUMBER;
14171 l_request_id            NUMBER;
14172 l_profile_exist     BOOLEAN;
14173 l_package_name   varchar2(100) :='EGO_CHANGETYPE_EXPLOSION.explodeTemplates';
14174 l_change_subject_unexp_rec  Eng_Eco_Pub.Change_Subject_Unexp_Rec_Type;
14175 
14176 -- Changes for bug 3426896
14177 l_pls_msg_count			NUMBER;
14178 l_pls_msg_data			VARCHAR2(3000);
14179 l_plsql_block			VARCHAR2(1000);
14180 -- End changes for bug 3426896
14181 
14182 BEGIN
14183 
14184     -- Begin block that processes header. This block holds the exception handlers
14185     -- for header errors.
14186 
14187     BEGIN
14188 
14189         --  Load entity and record-specific details into system_information record
14190 	l_ECO_Unexp_rec.organization_id := ENG_GLOBALS.Get_Org_Id;
14191 	l_ECO_rec := p_ECO_rec;
14192         l_ECO_rec.transaction_type := UPPER(l_eco_rec.transaction_type);
14193 
14194         -- Process Flow Step 2: Check if record has not yet been processed
14195         --
14196 
14197         IF l_ECO_rec.return_status IS NOT NULL AND
14198            l_ECO_rec.return_status <> FND_API.G_MISS_CHAR
14199         THEN
14200                 x_return_status                := l_return_status;
14201                 x_ECO_rec                      := l_ECO_rec;
14202                 x_eco_revision_tbl             := l_eco_revision_tbl;
14203                 x_revised_item_tbl             := l_revised_item_tbl;
14204                 x_rev_component_tbl            := l_rev_component_tbl;
14205                 x_ref_designator_tbl           := l_ref_designator_tbl;
14206                 x_sub_component_tbl            := l_sub_component_tbl;
14207                 x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
14208                 x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
14209                 x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
14210                 x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
14211 
14212                 RETURN;
14213         END IF;
14214 
14215         l_return_status := FND_API.G_RET_STS_SUCCESS;
14216         l_eco_rec.return_status := FND_API.G_RET_STS_SUCCESS;
14217 
14218         -- Check if transaction_type is valid
14219         --
14220 
14221         ENG_GLOBALS.Transaction_Type_Validity
14222         (   p_transaction_type  => l_ECO_rec.transaction_type
14223         ,   p_entity            => 'ECO_Header'
14224         ,   p_entity_id         => l_ECO_rec.ECO_Name
14225         ,   x_valid             => l_valid
14226         ,   x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
14227         );
14228 	IF NOT l_valid
14229         THEN
14230                 l_return_status := Error_Handler.G_STATUS_ERROR;
14231                 RAISE EXC_SEV_QUIT_RECORD;
14232         END IF;
14233 
14234 
14235         -- Process Flow step 3: Verify ECO's existence
14236         --
14237         ENG_Validate_Eco.Check_Existence
14238                 ( p_change_notice       => l_eco_rec.ECO_Name
14239                 , p_organization_id     => l_eco_unexp_rec.organization_id
14240                 , p_organization_code   => l_eco_rec.organization_code
14241                 , p_calling_entity      => 'ECO'
14242                 , p_transaction_type    => l_eco_rec.transaction_type
14243                 , x_eco_rec             => l_old_eco_rec
14244                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
14245                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
14246                 , x_return_status       => l_Return_Status
14247                 );
14248 	IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14249 
14250         IF l_return_status = Error_Handler.G_STATUS_ERROR
14251         THEN
14252                 l_other_message := 'ENG_ECO_EXS_SEV_ERROR';
14253                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14254                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14255                 RAISE EXC_SEV_QUIT_BRANCH;
14256         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14257         THEN
14258                 l_other_message := 'ENG_ECO_EXS_UNEXP_SKIP';
14259                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14260                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14261                 RAISE EXC_UNEXP_SKIP_OBJECT;
14262         END IF;
14263 
14264         -- Process Flow step : Convert User unique index to unique index
14265         -- Added for bug 3591992
14266 
14267         ENG_Val_To_Id.ECO_Header_UUI_To_UI
14268         (  p_eco_rec        => l_ECO_rec
14269          , p_eco_unexp_rec  => l_eco_unexp_rec
14270          , x_eco_unexp_rec  => l_eco_unexp_rec
14271          , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
14272          , x_Return_Status  => l_return_status
14273         );
14274 	-- Process Flow step 4: Change Order Value-Id conversion
14275         --
14276 	 ENG_Val_To_Id.Change_Order_VID
14277 	 (p_ECO_rec               => l_ECO_rec
14278 	 ,p_old_eco_unexp_rec     => l_old_eco_unexp_rec
14279          ,P_eco_unexp_rec         => l_eco_unexp_rec
14280 	 ,x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl
14281          ,x_return_status         => l_return_status
14282 	 );
14283 	IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14284 
14285         IF l_return_status = Error_Handler.G_STATUS_ERROR
14286         THEN
14287             IF l_ECO_rec.transaction_type = 'CREATE'
14288             THEN
14289                 l_other_message := 'ENG_ECO_CHGVID_CSEV_SKIP';
14290                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14291                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14292                 RAISE EXC_SEV_SKIP_BRANCH;
14293             ELSE
14294                 RAISE EXC_SEV_QUIT_RECORD;
14295             END IF;
14296         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14297         THEN
14298                 l_other_message := 'ENG_ECO_CHGVID_UNEXP_SKIP';
14299                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14300                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14301                 RAISE EXC_UNEXP_SKIP_OBJECT;
14302         END IF;
14303 
14304         -- Process Flow step 5(a): Is ECO implemented/canceled, or in wkflw process
14305         -- AND
14306         -- Process Flow step 5(b): Does user have access to change order type
14307         --
14308 
14309 	-- Added for enhancement 5414834
14310 	IF(l_eco_unexp_rec.Status_Type = 5)
14311 	THEN
14312 	   l_status_check_required := FALSE;
14313 	END IF;
14314 
14315         ENG_Validate_ECO.Check_Access
14316         ( p_change_notice       => l_ECO_rec.ECO_Name
14317         , p_organization_id     => l_eco_unexp_rec.organization_id
14318         , p_change_type_code    => l_eco_rec.change_type_code
14319         , p_change_order_type_id=> l_eco_unexp_rec.change_order_type_id
14320         , p_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
14321         , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
14322         , x_Return_Status       => l_return_status
14323 	, p_status_check_required => l_status_check_required
14324         );
14325 
14326        -- Bug 2916558 // kamohan
14327 	-- Start Changes
14328 
14329 	-- Check if the CO record is updated
14330 	IF l_eco_rec.transaction_type = eng_launch_eco_oi_pk.g_update THEN
14331 
14332 		-- Find the Organization ID corresponding to the Organization Code
14333 		l_organization_id := eng_val_to_id.organization
14334 					( l_eco_rec.organization_code, l_err_text);
14335 
14336 		-- Get the system change_order_type along with the assignee id
14337 		OPEN check_co_type(l_eco_rec.eco_name, l_organization_id);
14338 		FETCH check_co_type INTO chk_co_type;
14339 		CLOSE check_co_type;
14340 
14341 		-- If it is PLM CO and when the user tries to change the change order type
14342 		-- raise an error and stop processing the record
14343 		IF ( NVL(chk_co_type.change_order_type, '***') <> l_eco_rec.change_type_code AND chk_co_type.assignee_id IS NOT NULL) THEN
14344 			l_return_status := error_handler.g_status_error;
14345 			error_handler.add_error_token (p_message_name        => 'ENG_CHG_ORD_TYP_CNUPD',
14346 				p_mesg_token_tbl      => l_mesg_token_tbl,
14347 				x_mesg_token_tbl      => l_mesg_token_tbl,
14348 				p_token_tbl           => l_token_tbl
14349 				);
14350 			RAISE exc_sev_quit_record;
14351 		END IF;
14352 	END IF;
14353 	-- Bug 2916558 // kamohan
14354 	-- End Changes
14355 
14356         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14357 
14358         IF l_return_status = Error_Handler.G_STATUS_ERROR
14359         THEN
14360                 l_other_message := 'ENG_ECO_ACCESS_FAT_FATAL';
14361                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14362                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14363                 l_return_status := 'F';
14364                 RAISE EXC_FAT_QUIT_OBJECT;
14365         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14366         THEN
14367                 l_other_message := 'ENG_ECO_ACCESS_UNEXP_SKIP';
14368                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14369                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14370                 RAISE EXC_UNEXP_SKIP_OBJECT;
14371         END IF;
14372 
14373         -- Process Flow step 6: Value-to-ID conversions
14374         --
14375 
14376         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Value-Id conversions'); END IF;
14377 
14378         ENG_Val_To_Id.ECO_Header_VID
14379         (  x_Return_Status   => l_return_status
14380         ,  x_Mesg_Token_Tbl  => l_Mesg_Token_Tbl
14381         ,  p_ECO_Rec         => l_ECO_Rec
14382         ,  p_ECO_Unexp_Rec   => l_ECO_Unexp_Rec
14383         ,  x_ECO_Unexp_Rec   => l_ECO_Unexp_Rec
14384         );
14385 	IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14386 
14387         IF l_return_status = Error_Handler.G_STATUS_ERROR
14388         THEN
14389             IF l_ECO_rec.transaction_type = 'CREATE'
14390             THEN
14391                 l_other_message := 'ENG_ECO_VID_CSEV_SKIP';
14392                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14393                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14394                 RAISE EXC_SEV_SKIP_BRANCH;
14395             ELSE
14396                 RAISE EXC_SEV_QUIT_RECORD;
14397             END IF;
14398         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14399         THEN
14400                 l_other_message := 'ENG_ECO_VID_UNEXP_SKIP';
14401                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14402                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14403                 RAISE EXC_UNEXP_SKIP_OBJECT;
14404         ELSIF l_return_status ='S' AND
14405               l_Mesg_Token_Tbl.COUNT <>0
14406         THEN
14407                 Eco_Error_Handler.Log_Error
14408                 (  p_ECO_rec                => l_ECO_rec
14409                 ,  p_eco_revision_tbl       => l_eco_revision_tbl
14410                 ,  p_change_line_tbl        => l_change_line_tbl -- Eng Change
14411                 ,  p_revised_item_tbl       => l_revised_item_tbl
14412                 ,  p_rev_component_tbl      => l_rev_component_tbl
14413                 ,  p_ref_designator_tbl     => l_ref_designator_tbl
14414                 ,  p_sub_component_tbl      => l_sub_component_tbl
14415                 ,  p_rev_operation_tbl      => l_rev_operation_tbl    --L1
14416                 ,  p_rev_op_resource_tbl    => l_rev_op_resource_tbl  --L1
14417                 ,  p_rev_sub_resource_tbl   => l_rev_sub_resource_tbl --L1
14418                 ,  p_mesg_token_tbl         => l_mesg_token_tbl
14419                 ,  p_error_status           => 'W'
14420                 ,  p_error_level            => 1
14421                 ,  x_ECO_rec                => l_ECO_rec
14422                 ,  x_eco_revision_tbl       => l_eco_revision_tbl
14423                 ,  x_change_line_tbl        => l_change_line_tbl -- Eng Change
14424                 ,  x_revised_item_tbl       => l_revised_item_tbl
14425                 ,  x_rev_component_tbl      => l_rev_component_tbl
14426                 ,  x_ref_designator_tbl     => l_ref_designator_tbl
14427                 ,  x_sub_component_tbl      => l_sub_component_tbl
14428                 ,  x_rev_operation_tbl      => l_rev_operation_tbl    --L1
14429                 ,  x_rev_op_resource_tbl    => l_rev_op_resource_tbl  --L1
14430                 ,  x_rev_sub_resource_tbl   => l_rev_sub_resource_tbl --L1
14431                 );
14432         END IF;
14433 
14434         -- Process Flow step 7: Attribute Validation for Create and Update
14435         --
14436 
14437         IF l_ECO_rec.transaction_type IN
14438                 (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_CREATE)
14439         THEN
14440                 IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute validation'); END IF;
14441 
14442                 ENG_Validate_ECO.Check_Attributes
14443                 (   x_return_status            => l_return_status
14444                 ,   x_err_text                 => l_err_text
14445                 ,   x_Mesg_Token_Tbl           => l_Mesg_Token_Tbl
14446                 ,   p_ECO_rec                  => l_ECO_rec
14447                 ,   p_Unexp_ECO_rec            => l_ECO_Unexp_Rec
14448                 ,   p_old_ECO_rec              => l_Old_ECO_Rec
14449                 ,   p_old_Unexp_ECO_rec        => l_Old_ECO_Unexp_Rec
14450 		,   p_change_line_tbl          => l_change_line_tbl --Bug no:2908248
14451 		,   p_revised_item_tbl         => l_revised_item_tbl --Bug 2908248
14452                 );
14453 		IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14454 
14455                 IF l_return_status = Error_Handler.G_STATUS_ERROR
14456                 THEN
14457                         IF l_ECO_rec.transaction_type = 'CREATE'
14458                         THEN
14459                                 l_other_message := 'ENG_ECO_ATTVAL_CSEV_SKIP';
14460                                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14461                                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14462                                 RAISE EXC_SEV_SKIP_BRANCH;
14463                         ELSE
14464                                 RAISE EXC_SEV_QUIT_RECORD;
14465                         END IF;
14466                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14467                 THEN
14468                         l_other_message := 'ENG_ECO_ATTVAL_UNEXP_SKIP';
14469                         l_other_token_tbl(1).token_name := 'ECO_NAME';
14470                         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14471 
14472                         RAISE EXC_UNEXP_SKIP_OBJECT;
14473                 ELSIF l_return_status ='S' AND
14474                         l_Mesg_Token_Tbl.COUNT <>0
14475                 THEN
14476                         Eco_Error_Handler.Log_Error
14477                         (  p_ECO_rec             => l_ECO_rec
14478                         ,  p_eco_revision_tbl    => l_eco_revision_tbl
14479                         ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14480                         ,  p_revised_item_tbl    => l_revised_item_tbl
14481                         ,  p_rev_component_tbl   => l_rev_component_tbl
14482                         ,  p_ref_designator_tbl  => l_ref_designator_tbl
14483                         ,  p_sub_component_tbl   => l_sub_component_tbl
14484                         ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14485                         ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14486                         ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14487                         ,  p_mesg_token_tbl      => l_mesg_token_tbl
14488                         ,  p_error_status        => 'W'
14489                         ,  p_error_level         => 1
14490                         ,  x_ECO_rec             => l_ECO_rec
14491                         ,  x_eco_revision_tbl    => l_eco_revision_tbl
14492                         ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14493                         ,  x_revised_item_tbl    => l_revised_item_tbl
14494                         ,  x_rev_component_tbl   => l_rev_component_tbl
14495                         ,  x_ref_designator_tbl  => l_ref_designator_tbl
14496                         ,  x_sub_component_tbl   => l_sub_component_tbl
14497                         ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14498                         ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14499                         ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14500                         );
14501                 END IF;
14502         END IF;
14503 
14504         IF l_ECO_Rec.Transaction_Type IN
14505            (ENG_GLOBALS.G_OPR_UPDATE, ENG_GLOBALS.G_OPR_DELETE)
14506         THEN
14507 
14508          -- Process flow step 8 - Populate NULL columns for Update and
14509          -- Delete.
14510 
14511          IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Populating NULL Columns'); END IF;
14512          Eng_Default_ECO.Populate_NULL_Columns
14513                 (   p_ECO_rec           => l_ECO_Rec
14514                 ,   p_Unexp_ECO_rec     => l_ECO_Unexp_Rec
14515                 ,   p_Old_ECO_rec       => l_Old_ECO_Rec
14516                 ,   p_Old_Unexp_ECO_rec => l_Old_ECO_Unexp_Rec
14517                 ,   x_ECO_rec           => l_ECO_Rec
14518                 ,   x_Unexp_ECO_rec     => l_ECO_Unexp_Rec
14519                 );
14520 
14521      ELSIF l_ECO_Rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE THEN
14522 
14523          -- Process Flow step 9: Default missing values for Operation CREATE
14524 
14525          IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Attribute Defaulting'); END IF;
14526          Eng_Default_ECO.Attribute_Defaulting
14527                 (   p_ECO_rec           => l_ECO_Rec
14528                 ,   p_Unexp_ECO_Rec     => l_ECO_Unexp_Rec
14529                 ,   x_ECO_rec           => l_ECO_Rec
14530                 ,   x_Unexp_ECO_Rec     => l_ECO_Unexp_Rec
14531                 ,   x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
14532                 ,   x_return_status     => l_Return_Status
14533                 );
14534 
14535          IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14536 
14537         IF l_return_status = Error_Handler.G_STATUS_ERROR
14538         THEN
14539             IF l_ECO_rec.transaction_type = 'CREATE'
14540             THEN
14541                 l_other_message := 'ENG_ECO_ATTDEF_CSEV_SKIP';
14542                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14543                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14544                 RAISE EXC_SEV_SKIP_BRANCH;
14545             ELSE
14546                 RAISE EXC_SEV_QUIT_RECORD;
14547             END IF;
14548         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14549         THEN
14550                 l_other_message := 'ENG_ECO_ATTDEF_UNEXP_SKIP';
14551                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14552                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14553                 RAISE EXC_UNEXP_SKIP_OBJECT;
14554         ELSIF l_return_status ='S' AND
14555               l_Mesg_Token_Tbl.COUNT <>0
14556         THEN
14557                 Eco_Error_Handler.Log_Error
14558                 (  p_ECO_rec             => l_ECO_rec
14559                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
14560                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14561                 ,  p_revised_item_tbl    => l_revised_item_tbl
14562                 ,  p_rev_component_tbl   => l_rev_component_tbl
14563                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
14564                 ,  p_sub_component_tbl   => l_sub_component_tbl
14565                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14566                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14567                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14568                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
14569                 ,  p_error_status        => 'W'
14570                 ,  p_error_level         => 1
14571                 ,  x_ECO_rec             => l_ECO_rec
14572                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
14573                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14574                 ,  x_revised_item_tbl    => l_revised_item_tbl
14575                 ,  x_rev_component_tbl   => l_rev_component_tbl
14576                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
14577                 ,  x_sub_component_tbl   => l_sub_component_tbl
14578                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14579                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14580                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14581                 );
14582         END IF;
14583      END IF;
14584 
14585      -- Process Flow step 10 - Check Conditionally Required Fields
14586      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Check conditionally required attributes'); END IF;
14587      ENG_Validate_ECO.Conditionally_Required
14588                 (   x_return_status     => l_return_status
14589                 ,   x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
14590                 ,   p_ECO_rec           => l_ECO_rec
14591                 ,   p_Unexp_ECO_rec     => l_ECO_Unexp_Rec
14592                 ,   p_old_ECO_rec       => l_old_ECO_rec
14593                 ,   p_old_Unexp_ECO_rec => l_old_ECO_unexp_rec
14594                 );
14595      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14596 
14597      IF l_return_status = Error_Handler.G_STATUS_ERROR
14598      THEN
14599         IF l_ECO_rec.transaction_type = 'CREATE'
14600         THEN
14601                 l_other_message := 'ENG_ECO_CONREQ_CSEV_SKIP';
14602                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14603                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14604                 RAISE EXC_SEV_SKIP_BRANCH;
14605         ELSE
14606                 RAISE EXC_SEV_QUIT_RECORD;
14607         END IF;
14608      ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14609      THEN
14610         l_other_message := 'ENG_ECO_CONREQ_UNEXP_SKIP';
14611         l_other_token_tbl(1).token_name := 'ECO_NAME';
14612         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14613         RAISE EXC_UNEXP_SKIP_OBJECT;
14614      ELSIF l_return_status ='S' AND
14615            l_Mesg_Token_Tbl.COUNT <>0
14616      THEN
14617         Eco_Error_Handler.Log_Error
14618                 (  p_ECO_rec             => l_ECO_rec
14619                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
14620                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14621                 ,  p_revised_item_tbl    => l_revised_item_tbl
14622                 ,  p_rev_component_tbl   => l_rev_component_tbl
14623                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
14624                 ,  p_sub_component_tbl   => l_sub_component_tbl
14625                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14626                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14627                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14628                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
14629                 ,  p_error_status        => 'W'
14630                 ,  p_error_level         => 1
14631                 ,  x_ECO_rec             => l_ECO_rec
14632                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
14633                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14634                 ,  x_revised_item_tbl    => l_revised_item_tbl
14635                 ,  x_rev_component_tbl   => l_rev_component_tbl
14636                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
14637                 ,  x_sub_component_tbl   => l_sub_component_tbl
14638                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14639                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14640                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14641                 );
14642      END IF;
14643 
14644      -- Process Flow step 11 - Entity Level Defaulting
14645      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity Defaulting'); END IF;
14646      ENG_Default_ECO.Entity_Defaulting
14647                 (   p_ECO_rec            => l_ECO_rec
14648                 ,   p_Unexp_ECO_rec      => l_ECO_unexp_rec
14649                 ,   p_Old_ECO_rec        => l_old_ECO_rec
14650                 ,   p_Old_Unexp_ECO_rec  => l_old_ECO_unexp_rec
14651                 ,   x_ECO_rec            => l_ECO_rec
14652                 ,   x_Unexp_ECO_rec      => l_ECO_unexp_rec
14653                 ,   x_return_status      => l_return_status
14654                 ,   x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
14655                 );
14656      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14657 
14658      IF l_return_status = Error_Handler.G_STATUS_ERROR
14659      THEN
14660         IF l_ECO_rec.transaction_type = 'CREATE'
14661         THEN
14662                 l_other_message := 'ENG_ECO_ENTDEF_CSEV_SKIP';
14663                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14664                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14665                 RAISE EXC_SEV_SKIP_BRANCH;
14666         ELSE
14667                 RAISE EXC_SEV_QUIT_RECORD;
14668         END IF;
14669      ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14670      THEN
14671         l_other_message := 'ENG_ECO_ENTDEF_UNEXP_SKIP';
14672         l_other_token_tbl(1).token_name := 'ECO_NAME';
14673         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14674         RAISE EXC_UNEXP_SKIP_OBJECT;
14675      ELSIF l_return_status ='S' AND
14676            l_Mesg_Token_Tbl.COUNT <>0
14677      THEN
14678         Eco_Error_Handler.Log_Error
14679                 (  p_ECO_rec             => l_ECO_rec
14680                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
14681                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14682                 ,  p_revised_item_tbl    => l_revised_item_tbl
14683                 ,  p_rev_component_tbl   => l_rev_component_tbl
14684                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
14685                 ,  p_sub_component_tbl   => l_sub_component_tbl
14686                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14687                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14688                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14689                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
14690                 ,  p_error_status        => 'W'
14691                 ,  p_error_level         => 1
14692                 ,  x_ECO_rec             => l_ECO_rec
14693                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
14694                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14695                 ,  x_revised_item_tbl    => l_revised_item_tbl
14696                 ,  x_rev_component_tbl   => l_rev_component_tbl
14697                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
14698                 ,  x_sub_component_tbl   => l_sub_component_tbl
14699                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14700                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14701                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14702                 );
14703      END IF;
14704 
14705      -- Process Flow step 12 - Entity Level Validation
14706 
14707      IF l_eco_rec.transaction_type = 'DELETE'
14708      THEN
14709        IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Calling Check_Delete...'); END IF;
14710        ENG_Validate_ECO.Check_Delete
14711                ( p_eco_rec             => l_eco_rec
14712                , p_Unexp_ECO_rec       => l_ECO_Unexp_Rec
14713                , x_return_status       => l_return_status
14714                , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
14715                );
14716      END IF;
14717 
14718 
14719      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Entity validation'); END IF;
14720      Eng_Validate_ECO.Check_Entity
14721                 (  x_return_status        => l_Return_Status
14722                 ,  x_err_text             => l_err_text
14723                 ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
14724                 ,  p_ECO_rec              => l_ECO_Rec
14725                 ,  p_Unexp_ECO_Rec        => l_ECO_Unexp_Rec
14726                 ,  p_old_ECO_rec          => l_old_ECO_rec
14727                 ,  p_old_unexp_ECO_rec    => l_old_ECO_unexp_rec
14728                 );
14729 
14730      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14731 
14732      IF l_return_status = Error_Handler.G_STATUS_ERROR
14733      THEN
14734         IF l_ECO_rec.transaction_type = 'CREATE'
14735         THEN
14736                 l_other_message := 'ENG_ECO_ENTVAL_CSEV_SKIP';
14737                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14738                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14739                 RAISE EXC_SEV_SKIP_BRANCH;
14740         ELSE
14741                 RAISE EXC_SEV_QUIT_RECORD;
14742         END IF;
14743      ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14744      THEN
14745                 l_other_message := 'ENG_ECO_ENTVAL_UNEXP_SKIP';
14746                 l_other_token_tbl(1).token_name := 'ECO_NAME';
14747                 l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14748         RAISE EXC_UNEXP_SKIP_OBJECT;
14749      ELSIF l_return_status ='S' AND
14750            l_Mesg_Token_Tbl.COUNT <>0
14751      THEN
14752         Eco_Error_Handler.Log_Error
14753                 (  p_ECO_rec             => l_ECO_rec
14754                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
14755                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14756                 ,  p_revised_item_tbl    => l_revised_item_tbl
14757                 ,  p_rev_component_tbl   => l_rev_component_tbl
14758                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
14759                 ,  p_sub_component_tbl   => l_sub_component_tbl
14760                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14761                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14762                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14763                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
14764                 ,  p_error_status        => 'W'
14765                 ,  p_error_level         => 1
14766                 ,  x_ECO_rec             => l_ECO_rec
14767                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
14768                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14769                 ,  x_revised_item_tbl    => l_revised_item_tbl
14770                 ,  x_rev_component_tbl   => l_rev_component_tbl
14771                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
14772                 ,  x_sub_component_tbl   => l_sub_component_tbl
14773                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14774                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14775                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14776                 );
14777      END IF;
14778 
14779      -- Process Flow step 13 : Database Writes
14780      SAVEPOINT EngEcoPvt_Eco_Header; -- bug 3572721
14781      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Writing to the database'); END IF;
14782      ENG_ECO_Util.Perform_Writes
14783                 (   p_ECO_rec          => l_ECO_rec
14784                 ,   p_Unexp_ECO_rec    => l_ECO_unexp_rec
14785                 ,   p_old_ECO_rec      => l_old_ECO_rec
14786                 ,   x_Mesg_Token_Tbl   => l_Mesg_Token_Tbl
14787                 ,   x_return_status    => l_return_status
14788                 );
14789 
14790      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('return_status: ' || l_return_status); END IF;
14791 
14792      IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14793      THEN
14794         l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
14795         l_other_token_tbl(1).token_name := 'ECO_NAME';
14796         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14797         RAISE EXC_UNEXP_SKIP_OBJECT;
14798      ELSIF l_return_status ='S' AND
14799            l_Mesg_Token_Tbl.COUNT <>0
14800      THEN
14801         Eco_Error_Handler.Log_Error
14802                 (  p_ECO_rec             => l_ECO_rec
14803                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
14804                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14805                 ,  p_revised_item_tbl    => l_revised_item_tbl
14806                 ,  p_rev_component_tbl   => l_rev_component_tbl
14807                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
14808                 ,  p_sub_component_tbl   => l_sub_component_tbl
14809                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14810                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14811                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14812                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
14813                 ,  p_error_status        => 'W'
14814                 ,  p_error_level         => 1
14815                 ,  x_ECO_rec             => l_ECO_rec
14816                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
14817                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14818                 ,  x_revised_item_tbl    => l_revised_item_tbl
14819                 ,  x_rev_component_tbl   => l_rev_component_tbl
14820                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
14821                 ,  x_sub_component_tbl   => l_sub_component_tbl
14822                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14823                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14824                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14825                 );
14826      END IF;
14827 
14828      --
14829      -- Subjects Handling
14830      --
14831      IF l_return_status = 'S' AND nvl(l_ECO_rec.plm_or_erp_change, 'PLM')='PLM'
14832      THEN
14833          ENG_Eco_Util.Change_Subjects
14834          ( p_eco_rec             =>       l_ECO_rec
14835          , p_ECO_Unexp_Rec       =>       l_ECO_unexp_rec
14836          , x_change_subject_unexp_rec  =>l_change_subject_unexp_rec
14837          , x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl --bug 3572721
14838          , x_return_status  => l_return_status);
14839 
14840 	 -- Added subjects error Handling for bug 3572721
14841          IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Subjects created with status  ' || l_return_status);
14842          END IF;
14843          IF l_return_status = Error_Handler.G_STATUS_ERROR
14844          THEN
14845             Rollback TO EngEcoPvt_Eco_Header; -- bug 3572721
14846             RAISE EXC_SEV_SKIP_BRANCH;
14847          ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14848          THEN
14849             l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
14850             l_other_token_tbl(1).token_name := 'ECO_NAME';
14851             l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14852             RAISE EXC_UNEXP_SKIP_OBJECT;
14853          END IF;
14854      END IF;
14855 
14856    l_profile_exist := FND_PROFILE.DEFINED ( 'EGO_ITEM_RESTRICT_INV_ACTIONS' );
14857 
14858   if 	 l_return_status ='S'and  l_ECO_rec.plm_or_erp_change='PLM' and
14859          l_ECO_rec.transaction_type = Eng_Globals.G_OPR_CREATE  then
14860 
14861 --    if l_profile_exist = TRUE    then
14862          /*    The procedure first explodes and inserts the Statuses for
14863               the given Type, Routes for each Status, Steps for each Route,
14864           People for each Step, and Persons for each Group and Role. */
14865 
14866     l_user_id           := Eng_Globals.Get_User_Id;
14867     l_login_id          := Eng_Globals.Get_Login_Id;
14868     l_request_id        := ENG_GLOBALS.Get_request_id;
14869     l_prog_appid        := ENG_GLOBALS.Get_prog_appid;
14870     l_prog_id           := ENG_GLOBALS.Get_prog_id;
14871 
14872     /*
14873        --subjects handling
14874 
14875      ENG_Eco_Util.Change_Subjects
14876         ( p_eco_rec             =>       l_ECO_rec
14877         , p_ECO_Unexp_Rec       =>       l_ECO_unexp_rec
14878         , x_change_subject_unexp_rec  =>l_change_subject_unexp_rec
14879         , x_Mesg_Token_Tbl        => l_Mesg_Token_Tbl --bug 3572721
14880         , x_return_status  => l_return_status);
14881 
14882      -- Added subjects error Handling for bug 3572721
14883      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Subjects created with status  ' || l_return_status);
14884      END IF;
14885      IF l_return_status = Error_Handler.G_STATUS_ERROR
14886      THEN
14887         Rollback TO EngEcoPvt_Eco_Header; -- bug 3572721
14888         RAISE EXC_SEV_SKIP_BRANCH;
14889      ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14890      THEN
14891         l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
14892         l_other_token_tbl(1).token_name := 'ECO_NAME';
14893         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14894         RAISE EXC_UNEXP_SKIP_OBJECT;
14895      END IF;
14896      */
14897 
14898        --tasks craetion
14899        Create_Tasks
14900 		(   p_change_id           => l_eco_unexp_rec.change_id
14901 		,   p_change_type_id      => l_ECO_unexp_rec.change_order_type_id
14902 		,   p_organization_id     => l_eco_unexp_rec.organization_id
14903 		,   p_transaction_type    => l_ECO_rec.transaction_type
14904 		,   p_approval_status_type=> l_eco_unexp_rec.approval_status_type  -- Bug 3436684
14905 		,   x_Mesg_Token_Tbl      => l_mesg_token_tbl
14906 		,   x_return_status       => l_return_status
14907 		);
14908 
14909 	-- Changes for bug 3547737
14910       /*execute immediate 'begin ' || l_package_name || '(:1,:2, :3,:4,:5,:6,:7,:8); end;'
14911            using
14912 	    in l_ECO_unexp_rec.change_id ,
14913 	    in l_ECO_unexp_rec.change_order_type_id,
14914 	   in l_user_id ,
14915 	   in l_login_id,
14916 	   in l_prog_appid,
14917 	   in l_prog_id ,
14918 	   in l_request_id,
14919 	   in out l_err_text;*/ -- Commented.
14920 
14921 	-- Creating the lifecycle for the change object from its header level definition
14922 
14923 	Create_Change_Lifecycle(
14924 	   p_change_id		=> l_eco_unexp_rec.change_id
14925 	 , p_change_type_id	=> l_ECO_unexp_rec.change_order_type_id
14926 	 , p_user_id		=> l_user_id
14927 	 , p_login_id		=> l_login_id
14928 	 , x_Mesg_Token_Tbl	=> l_mesg_token_tbl
14929 	 , x_return_status	=> l_return_status);
14930 
14931 	IF (l_return_status = Error_Handler.G_STATUS_UNEXPECTED)
14932 	THEN
14933 		l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
14934 		l_other_token_tbl(1).token_name := 'ECO_NAME';
14935 		l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14936 		RAISE EXC_UNEXP_SKIP_OBJECT;
14937 	END IF;
14938 	-- End Changes for bug 3547737
14939 
14940    IF l_ECO_Unexp_Rec.Status_Type <> 0 AND l_ECO_Unexp_Rec.Status_Code <> 0
14941    THEN
14942 	-- Changes for bug 3426896
14943 	-- Initializing the lifecycle
14944 	BEGIN
14945 		l_pls_msg_count := 0;
14946 		l_plsql_block := 'BEGIN '
14947 			|| 'ENG_CHANGE_LIFECYCLE_UTIL.Init_Lifecycle('
14948 			|| '  p_api_version		=> :1'
14949 			|| ', p_change_id		=> :2'
14950 			|| ', x_return_status	=> :3'
14951 			|| ', x_msg_count		=> :4'
14952 			|| ', x_msg_data		=> :5'
14953 			|| ', p_api_caller		=> :6'
14954 			|| '); END;';
14955 		EXECUTE IMMEDIATE l_plsql_block USING IN 1.0, IN l_eco_unexp_rec.change_id,
14956 		OUT l_return_status, OUT l_pls_msg_count, OUT l_pls_msg_data, IN 'CP';
14957 
14958 		IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
14959 		THEN
14960 			l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
14961 			l_other_token_tbl(1).token_name := 'ECO_NAME';
14962 			l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
14963 			RAISE EXC_UNEXP_SKIP_OBJECT;
14964 		ELSIF l_return_status ='S' AND l_pls_msg_count <> 0
14965 		THEN
14966 
14967 			FOR I IN 1..l_pls_msg_count
14968             LOOP
14969 				Error_Handler.Add_Error_Token
14970                                 ( p_Message_Text => FND_MSG_PUB.get(I, 'F')
14971                                 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
14972                                 , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
14973                                 );
14974 
14975             END LOOP;
14976 			Eco_Error_Handler.Log_Error
14977 				(  p_ECO_rec             => l_ECO_rec
14978 				,  p_eco_revision_tbl    => l_eco_revision_tbl
14979 				,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
14980 				,  p_revised_item_tbl    => l_revised_item_tbl
14981 				,  p_rev_component_tbl   => l_rev_component_tbl
14982 				,  p_ref_designator_tbl  => l_ref_designator_tbl
14983 				,  p_sub_component_tbl   => l_sub_component_tbl
14984 				,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
14985 				,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14986 				,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
14987 				,  p_mesg_token_tbl      => l_mesg_token_tbl
14988 				,  p_error_status        => 'W'
14989 				,  p_error_level         => 1
14990 				,  x_ECO_rec             => l_ECO_rec
14991 				,  x_eco_revision_tbl    => l_eco_revision_tbl
14992 				,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
14993 				,  x_revised_item_tbl    => l_revised_item_tbl
14994 				,  x_rev_component_tbl   => l_rev_component_tbl
14995 				,  x_ref_designator_tbl  => l_ref_designator_tbl
14996 				,  x_sub_component_tbl   => l_sub_component_tbl
14997 				,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
14998 				,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
14999 				,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15000 				);
15001 		END IF;
15002 	EXCEPTION
15003 	WHEN OTHERS THEN
15004 		IF Bom_Globals.Get_Debug = 'Y'
15005 		THEN
15006 			Error_Handler.Write_Debug('Lifecycle initialized with status ' || l_return_status);
15007 		END IF;
15008 		l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
15009 		l_other_token_tbl(1).token_name := 'ECO_NAME';
15010 		l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
15011 		RAISE EXC_UNEXP_SKIP_OBJECT;
15012 
15013 	END;
15014    END IF;
15015 	-- End changes for bug 3426896
15016 	IF (ENGECOBO.GLOBAL_CHANGE_ID <> -1)
15017 	THEN
15018       --relationship creation
15019         Create_Relation(
15020             p_change_id           =>  l_eco_unexp_rec.change_id
15021           , p_organization_id     => l_eco_unexp_rec.organization_id
15022           , x_Mesg_Token_Tbl      => l_mesg_token_tbl
15023           , x_return_status       => l_return_status);
15024         -- Fix for Bug 4517503
15025         -- Resetting the global value of ENGECOBO.GLOBAL_CHANGE_ID which is used to
15026         -- detaermine whether a relation is to be created or not.
15027         -- ECO BO is also being called by IOI in the same session when auto-enabling
15028         -- component items and since the value  was retained , ended up creating a
15029         -- relationship for NIR.
15030         -- So as to avaoid this it has to be reset once the relation has been created.
15031         ENGECOBO.GLOBAL_CHANGE_ID := -1;
15032         -- End of Fix for Bug 4517503
15033 
15034 	END IF;
15035 
15036 
15037   --  end if; --end of if
15038 
15039   end if;
15040 
15041 
15042 
15043      IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Tasks created with status  ' || l_return_status);
15044      END IF;
15045 
15046      IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
15047      THEN
15048         l_other_message := 'ENG_ECO_WRITES_UNEXP_SKIP';
15049         l_other_token_tbl(1).token_name := 'ECO_NAME';
15050         l_other_token_tbl(1).token_value := l_ECO_rec.ECO_Name;
15051         RAISE EXC_UNEXP_SKIP_OBJECT;
15052      ELSIF l_return_status ='S' AND
15053            l_Mesg_Token_Tbl.COUNT <>0
15054      THEN
15055      Eco_Error_Handler.Log_Error
15056                 (  p_ECO_rec             => l_ECO_rec
15057                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15058                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15059                 ,  p_revised_item_tbl    => l_revised_item_tbl
15060                 ,  p_rev_component_tbl   => l_rev_component_tbl
15061                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15062                 ,  p_sub_component_tbl   => l_sub_component_tbl
15063                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15064                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15065                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15066                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15067                 ,  p_error_status        => 'W'
15068                 ,  p_error_level         => 1
15069                 ,  x_ECO_rec             => l_ECO_rec
15070                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15071                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15072                 ,  x_revised_item_tbl    => l_revised_item_tbl
15073                 ,  x_rev_component_tbl   => l_rev_component_tbl
15074                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15075                 ,  x_sub_component_tbl   => l_sub_component_tbl
15076                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15077                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15078                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15079                 );
15080        END IF;
15081 
15082   EXCEPTION
15083 
15084     WHEN EXC_SEV_QUIT_RECORD THEN
15085 
15086         Eco_Error_Handler.Log_Error
15087                 (  p_ECO_rec             => l_ECO_rec
15088                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15089                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15090                 ,  p_revised_item_tbl    => l_revised_item_tbl
15091                 ,  p_rev_component_tbl   => l_rev_component_tbl
15092                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15093                 ,  p_sub_component_tbl   => l_sub_component_tbl
15094                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15095                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15096                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15097                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15098                 ,  p_error_status        => FND_API.G_RET_STS_ERROR
15099                 ,  p_error_scope         => Error_Handler.G_SCOPE_RECORD
15100                 ,  p_error_level         => 1
15101                 ,  x_ECO_rec             => l_ECO_rec
15102                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15103                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15104                 ,  x_revised_item_tbl    => l_revised_item_tbl
15105                 ,  x_rev_component_tbl   => l_rev_component_tbl
15106                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15107                 ,  x_sub_component_tbl   => l_sub_component_tbl
15108                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15109                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15110                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15111                 );
15112 
15113         x_return_status                := l_return_status;
15114         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
15115         x_ECO_rec                      := l_ECO_rec;
15116         x_eco_revision_tbl             := l_eco_revision_tbl;
15117         x_revised_item_tbl             := l_revised_item_tbl;
15118         x_rev_component_tbl            := l_rev_component_tbl;
15119         x_ref_designator_tbl           := l_ref_designator_tbl;
15120         x_sub_component_tbl            := l_sub_component_tbl;
15121         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
15122         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
15123         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
15124         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
15125 
15126        WHEN EXC_SEV_QUIT_BRANCH THEN
15127 
15128         Eco_Error_Handler.Log_Error
15129                 (  p_ECO_rec             => l_ECO_rec
15130                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15131                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15132                 ,  p_revised_item_tbl    => l_revised_item_tbl
15133                 ,  p_rev_component_tbl   => l_rev_component_tbl
15134                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15135                 ,  p_sub_component_tbl   => l_sub_component_tbl
15136                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15137                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15138                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15139                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15140                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
15141                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
15142                 ,  p_other_status        => Error_Handler.G_STATUS_ERROR
15143                 ,  p_other_message       => l_other_message
15144                 ,  p_other_token_tbl     => l_other_token_tbl
15145                 ,  p_error_level         => 1
15146                 ,  x_eco_rec             => l_eco_rec
15147                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15148                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15149                 ,  x_revised_item_tbl    => l_revised_item_tbl
15150                 ,  x_rev_component_tbl   => l_rev_component_tbl
15151                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15152                 ,  x_sub_component_tbl   => l_sub_component_tbl
15153                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15154                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15155                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15156                 );
15157 
15158         x_return_status                := l_return_status;
15159         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
15160         x_eco_rec                      := l_eco_rec;
15161         x_eco_revision_tbl             := l_eco_revision_tbl;
15162         x_revised_item_tbl             := l_revised_item_tbl;
15163         x_rev_component_tbl            := l_rev_component_tbl;
15164         x_ref_designator_tbl           := l_ref_designator_tbl;
15165         x_sub_component_tbl            := l_sub_component_tbl;
15166         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
15167         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
15168         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
15169         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
15170 
15171         RETURN;
15172 
15173     WHEN EXC_SEV_SKIP_BRANCH THEN
15174 
15175         Eco_Error_Handler.Log_Error
15176                 (  p_ECO_rec             => l_ECO_rec
15177                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15178                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15179                 ,  p_revised_item_tbl    => l_revised_item_tbl
15180                 ,  p_rev_component_tbl   => l_rev_component_tbl
15181                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15182                 ,  p_sub_component_tbl   => l_sub_component_tbl
15183                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15184                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15185                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15186                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15187                 ,  p_error_status        => Error_Handler.G_STATUS_ERROR
15188                 ,  p_error_scope         => Error_Handler.G_SCOPE_CHILDREN
15189                 ,  p_other_message       => l_other_message
15190                 ,  p_other_token_tbl     => l_other_token_tbl
15191                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
15192                 ,  p_error_level         => 1
15193                 ,  x_ECO_rec             => l_ECO_rec
15194                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15195                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15196                 ,  x_revised_item_tbl    => l_revised_item_tbl
15197                 ,  x_rev_component_tbl   => l_rev_component_tbl
15198                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15199                 ,  x_sub_component_tbl   => l_sub_component_tbl
15200                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15201                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15202                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15203                 );
15204 
15205         x_return_status                := l_return_status;
15206         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
15207         x_ECO_rec                      := l_ECO_rec;
15208         x_eco_revision_tbl             := l_eco_revision_tbl;
15209         x_revised_item_tbl             := l_revised_item_tbl;
15210         x_rev_component_tbl            := l_rev_component_tbl;
15211         x_ref_designator_tbl           := l_ref_designator_tbl;
15212         x_sub_component_tbl            := l_sub_component_tbl;
15213         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
15214         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
15215         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
15216         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
15217 
15218         RETURN;
15219 
15220     WHEN EXC_FAT_QUIT_OBJECT THEN
15221 
15222         Eco_Error_Handler.Log_Error
15223                 (  p_ECO_rec             => l_ECO_rec
15224                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15225                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15226                 ,  p_revised_item_tbl    => l_revised_item_tbl
15227                 ,  p_rev_component_tbl   => l_rev_component_tbl
15228                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15229                 ,  p_sub_component_tbl   => l_sub_component_tbl
15230                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15231                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15232                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15233                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15234                 ,  p_error_status        => Error_Handler.G_STATUS_FATAL
15235                 ,  p_error_scope         => Error_Handler.G_SCOPE_ALL
15236                 ,  p_other_message       => l_other_message
15237                 ,  p_other_status        => Error_Handler.G_STATUS_FATAL
15238                 ,  p_other_token_tbl     => l_other_token_tbl
15239                 ,  p_error_level         => 1
15240                 ,  x_ECO_rec             => l_ECO_rec
15241                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15242                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15243                 ,  x_revised_item_tbl    => l_revised_item_tbl
15244                 ,  x_rev_component_tbl   => l_rev_component_tbl
15245                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15246                 ,  x_sub_component_tbl   => l_sub_component_tbl
15247                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15248                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15249                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15250                 );
15251 
15252         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
15253         x_ECO_rec                      := l_ECO_rec;
15254         x_eco_revision_tbl             := l_eco_revision_tbl;
15255         x_revised_item_tbl             := l_revised_item_tbl;
15256         x_rev_component_tbl            := l_rev_component_tbl;
15257         x_ref_designator_tbl           := l_ref_designator_tbl;
15258         x_sub_component_tbl            := l_sub_component_tbl;
15259         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
15260         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
15261         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
15262         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
15263         l_return_status := 'Q';
15264 
15265     WHEN EXC_UNEXP_SKIP_OBJECT THEN
15266 
15267         Eco_Error_Handler.Log_Error
15268                 (  p_ECO_rec             => l_ECO_rec
15269                 ,  p_eco_revision_tbl    => l_eco_revision_tbl
15270                 ,  p_change_line_tbl     => l_change_line_tbl -- Eng Change
15271                 ,  p_revised_item_tbl    => l_revised_item_tbl
15272                 ,  p_rev_component_tbl   => l_rev_component_tbl
15273                 ,  p_ref_designator_tbl  => l_ref_designator_tbl
15274                 ,  p_sub_component_tbl   => l_sub_component_tbl
15275                 ,  p_rev_operation_tbl   => l_rev_operation_tbl    --L1
15276                 ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15277                 ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15278                 ,  p_mesg_token_tbl      => l_mesg_token_tbl
15279                 ,  p_error_status        => Error_Handler.G_STATUS_UNEXPECTED
15280                 ,  p_other_status        => Error_Handler.G_STATUS_NOT_PICKED
15281                 ,  p_other_message       => l_other_message
15282                 ,  p_other_token_tbl     => l_other_token_tbl
15283                 ,  p_error_level         => 1
15284                 ,  x_ECO_rec             => l_ECO_rec
15285                 ,  x_eco_revision_tbl    => l_eco_revision_tbl
15286                 ,  x_change_line_tbl     => l_change_line_tbl -- Eng Change
15287                 ,  x_revised_item_tbl    => l_revised_item_tbl
15288                 ,  x_rev_component_tbl   => l_rev_component_tbl
15289                 ,  x_ref_designator_tbl  => l_ref_designator_tbl
15290                 ,  x_sub_component_tbl   => l_sub_component_tbl
15291                 ,  x_rev_operation_tbl   => l_rev_operation_tbl    --L1
15292                 ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl  --L1
15293                 ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl --L1
15294                 );
15295 
15296         x_return_status                := l_return_status;
15297         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
15298         x_ECO_rec                      := l_ECO_rec;
15299         x_eco_revision_tbl             := l_eco_revision_tbl;
15300         x_revised_item_tbl             := l_revised_item_tbl;
15301         x_rev_component_tbl            := l_rev_component_tbl;
15302         x_ref_designator_tbl           := l_ref_designator_tbl;
15303         x_sub_component_tbl            := l_sub_component_tbl;
15304         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
15305         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
15306         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
15307         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
15308         l_return_status := 'U';
15309 
15310   END; -- END Header processing block
15311 
15312     IF l_return_status in ('Q', 'U')
15313     THEN
15314         x_return_status := l_return_status;
15315         RETURN;
15316     END IF;
15317 
15318     l_bo_return_status := l_return_status;
15319 
15320     -- Process ECO Revisions that are chilren of this header
15321 
15322     Eco_Rev
15323         (   p_validation_level          => p_validation_level
15324         ,   p_change_notice             => l_eco_rec.ECO_Name
15325         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15326         ,   p_eco_revision_tbl          => l_eco_revision_tbl
15327         ,   p_change_line_tbl           => l_change_line_tbl -- Eng Change
15328         ,   p_revised_item_tbl          => l_revised_item_tbl
15329         ,   p_rev_component_tbl         => l_rev_component_tbl
15330         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15331         ,   p_sub_component_tbl         => l_sub_component_tbl
15332         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15333         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15334         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15335         ,   x_eco_revision_tbl          => l_eco_revision_tbl
15336         ,   x_change_line_tbl           => l_change_line_tbl -- Eng Change
15337         ,   x_revised_item_tbl          => l_revised_item_tbl
15338         ,   x_rev_component_tbl         => l_rev_component_tbl
15339         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15340         ,   x_sub_component_tbl         => l_sub_component_tbl
15341         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15342         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15343         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15344         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15345         ,   x_return_status             => l_return_status
15346         );
15347     IF l_return_status <> 'S'
15348     THEN
15349         l_bo_return_status := l_return_status;
15350     END IF;
15351 
15352    -- Process Change Line that are chilren of this header
15353    Change_Line
15354         (   p_validation_level          => p_validation_level
15355         ,   p_change_notice             => l_eco_rec.ECO_Name
15356         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15357         ,   p_change_line_tbl           => l_change_line_tbl      -- Eng Change
15358         ,   p_revised_item_tbl          => l_revised_item_tbl
15359         ,   p_rev_component_tbl         => l_rev_component_tbl
15360         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15361         ,   p_sub_component_tbl         => l_sub_component_tbl
15362         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15363         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15364         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15365         ,   x_change_line_tbl           => l_change_line_tbl      -- Eng Change
15366         ,   x_revised_item_tbl          => l_revised_item_tbl
15367         ,   x_rev_component_tbl         => l_rev_component_tbl
15368         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15369         ,   x_sub_component_tbl         => l_sub_component_tbl
15370         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15371         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15372         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15373         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15374         ,   x_return_status             => l_return_status
15375         );
15376 
15377     IF l_return_status <> 'S'
15378     THEN
15379         l_bo_return_status := l_return_status;
15380     END IF;
15381 
15382 
15383     -- Process Revised Items that are chilren of this header
15384 
15385     Rev_Items
15386         (   p_validation_level          => p_validation_level
15387         ,   p_change_notice             => l_eco_rec.ECO_Name
15388         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15389         ,   p_revised_item_tbl          => l_revised_item_tbl
15390         ,   p_rev_component_tbl         => l_rev_component_tbl
15391         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15392         ,   p_sub_component_tbl         => l_sub_component_tbl
15393         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15394         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15395         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15396         ,   x_revised_item_tbl          => l_revised_item_tbl
15397         ,   x_rev_component_tbl         => l_rev_component_tbl
15398         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15399         ,   x_sub_component_tbl         => l_sub_component_tbl
15400         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15401         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15402         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15403         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15404         ,   x_return_status             => l_return_status
15405 	,    x_disable_revision          => x_disable_revision        --Bug no:3034642
15406         );
15407 
15408     -- Bug 6657209. Reset the global variable after Rev_items are processed.
15409     Eng_Default_Revised_Item.G_OLD_SCHED_DATE := NULL;
15410 
15411     IF l_return_status <> 'S'
15412     THEN
15413         l_bo_return_status := l_return_status;
15414     END IF;
15415 
15416 
15417    -- L1: The following is for ECO enhancement
15418    -- Process operations that are orphans (without immediate revised
15419    -- item parents) but are indirect children of this header
15420     Rev_Operation_Sequences
15421        (    p_validation_level          => p_validation_level
15422         ,   p_change_notice             => l_eco_rec.ECO_Name
15423         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15424         ,   p_rev_operation_tbl         => l_rev_operation_tbl
15425         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
15426         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15427         ,   x_rev_operation_tbl         => l_rev_operation_tbl
15428         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
15429         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15430         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15431         ,   x_return_status             => l_return_status
15432      );
15433     IF l_return_status <> 'S'
15434     THEN
15435         l_bo_return_status := l_return_status;
15436     END IF;
15437 
15438    -- Process operation resources that are orphans (without immediate revised
15439    -- operation parents) but are indirect children of this header
15440        Rev_Operation_Resources
15441         (   p_validation_level          => p_validation_level
15442         ,   p_change_notice             => l_eco_rec.ECO_Name
15443         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15444         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
15445         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15446         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
15447         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15448         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15449         ,   x_return_status             => l_return_status
15450         );
15451     IF l_return_status <> 'S'
15452     THEN
15453         l_bo_return_status := l_return_status;
15454     END IF;
15455 
15456     -- Process substitute resources that are orphans (without immediate revised
15457     -- operaion parents) but are indirect children of this header
15458       Rev_Sub_Operation_Resources
15459         (   p_validation_level          => p_validation_level
15460         ,   p_change_notice             => l_eco_rec.ECO_Name
15461         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15462         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15463         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
15464         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15465         ,   x_return_status             => l_return_status
15466         );
15467     IF l_return_status <> 'S'
15468     THEN
15469         l_bo_return_status := l_return_status;
15470     END IF;
15471 
15472 
15473     -- Process Revised Components that are orphans (without immediate revised
15474     -- item parents) but are indirect children of this header
15475 
15476     Rev_Comps
15477         (   p_validation_level          => p_validation_level
15478         ,   p_change_notice             => l_eco_rec.ECO_Name
15479         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15480         ,   p_rev_component_tbl         => l_rev_component_tbl
15481         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15482         ,   p_sub_component_tbl         => l_sub_component_tbl
15483         ,   x_rev_component_tbl         => l_rev_component_tbl
15484         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15485         ,   x_sub_component_tbl         => l_sub_component_tbl
15486         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15487         ,   x_return_status             => l_return_status
15488         );
15489 
15490     IF l_return_status <> 'S'
15491     THEN
15492         l_bo_return_status := l_return_status;
15493     END IF;
15494 
15495     -- Process Reference Designators that are orphans (without immediate revised
15496     -- component parents) but are indirect children of this header
15497 
15498     Ref_Desgs
15499         (   p_validation_level          => p_validation_level
15500         ,   p_change_notice             => l_eco_rec.ECO_Name
15501         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15502         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15503         ,   p_sub_component_tbl         => l_sub_component_tbl
15504         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15505         ,   x_sub_component_tbl         => l_sub_component_tbl
15506         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15507         ,   x_return_status             => l_return_status
15508         );
15509 
15510     IF l_return_status <> 'S'
15511     THEN
15512         l_bo_return_status := l_return_status;
15513     END IF;
15514 
15515    -- Process Substitute Components that are orphans (without immediate revised
15516    -- component parents) but are indirect children of this header
15517 
15518     Sub_Comps
15519         (   p_validation_level          => p_validation_level
15520         ,   p_change_notice             => l_eco_rec.ECO_Name
15521         ,   p_organization_id           => l_eco_unexp_rec.organization_id
15522         ,   p_sub_component_tbl         => l_sub_component_tbl
15523         ,   x_sub_component_tbl         => l_sub_component_tbl
15524         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15525         ,   x_return_status             => l_return_status
15526         );
15527 
15528     IF l_return_status <> 'S'
15529     THEN
15530         l_bo_return_status := l_return_status;
15531     END IF;
15532 
15533 
15534   -- The above is for ECO enhancement
15535   --  Load OUT parameters
15536 
15537      x_return_status            := l_bo_return_status;
15538      x_ECO_rec                  := l_ECO_rec;
15539      x_eco_revision_tbl         := l_eco_revision_tbl;
15540      x_revised_item_tbl         := l_revised_item_tbl;
15541      x_rev_component_tbl        := l_rev_component_tbl;
15542      x_ref_designator_tbl       := l_ref_designator_tbl;
15543      x_sub_component_tbl        := l_sub_component_tbl;
15544      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
15545      x_rev_operation_tbl        := l_rev_operation_tbl;     --L1
15546      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --L1
15547      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --L1
15548      x_change_line_tbl          := l_change_line_tbl ;      -- Eng Change
15549 
15550 END Eco_Header;
15551 
15552 
15553 --  Start of Comments
15554 --  API name    Process_Eco
15555 --  Type        Private
15556 --  Function
15557 --
15558 --  Pre-reqs
15559 --
15560 --  Parameters
15561 --
15562 --  Version     Current version = 1.0
15563 --              Initial version = 1.0
15564 --
15565 --  Notes
15566 --
15567 --  End of Comments
15568 
15569 PROCEDURE Process_Eco
15570 (   p_api_version_number        IN  NUMBER
15571 ,   p_validation_level          IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
15572 ,   p_control_rec               IN  ENG_GLOBALS.Control_Rec_Type :=
15573                                     ENG_GLOBALS.G_MISS_CONTROL_REC
15574 ,   x_return_status             OUT NOCOPY VARCHAR2
15575 ,   x_msg_count                 OUT NOCOPY NUMBER
15576 ,   p_ECO_rec                   IN  ENG_Eco_PUB.Eco_Rec_Type :=
15577                                     ENG_Eco_PUB.G_MISS_ECO_REC
15578 ,   p_eco_revision_tbl          IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type :=
15579                                     ENG_Eco_PUB.G_MISS_ECO_REVISION_TBL
15580 ,   p_change_line_tbl           IN  ENG_Eco_PUB.Change_Line_Tbl_Type :=   -- Eng Change
15581                                     ENG_Eco_PUB.G_MISS_CHANGE_LINE_TBL
15582 ,   p_revised_item_tbl          IN  ENG_Eco_PUB.Revised_Item_Tbl_Type :=
15583                                     ENG_Eco_PUB.G_MISS_REVISED_ITEM_TBL
15584 ,   p_rev_component_tbl         IN  BOM_BO_PUB.Rev_Component_Tbl_Type :=
15585                                     BOM_BO_PUB.G_MISS_REV_COMPONENT_TBL
15586 ,   p_ref_designator_tbl        IN  BOM_BO_PUB.Ref_Designator_Tbl_Type :=
15587                                     BOM_BO_PUB.G_MISS_REF_DESIGNATOR_TBL
15588 ,   p_sub_component_tbl         IN  BOM_BO_PUB.Sub_Component_Tbl_Type :=
15589                                     BOM_BO_PUB.G_MISS_SUB_COMPONENT_TBL
15590 ,   p_rev_operation_tbl         IN  Bom_Rtg_Pub.Rev_Operation_Tbl_Type:=    --L1
15591                                     Bom_Rtg_Pub.G_MISS_REV_OPERATION_TBL
15592 ,   p_rev_op_resource_tbl       IN  Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := --L1
15593                                     Bom_Rtg_Pub.G_MISS_REV_OP_RESOURCE_TBL --L1
15594 ,   p_rev_sub_resource_tbl      IN  Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type:= --L1
15595                                     Bom_Rtg_Pub.G_MISS_REV_SUB_RESOURCE_TBL --L1
15596 ,   x_ECO_rec                   IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
15597 ,   x_eco_revision_tbl          IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
15598 ,   x_change_line_tbl           IN OUT NOCOPY ENG_Eco_PUB.Change_Line_Tbl_Type      -- Eng Change
15599 ,   x_revised_item_tbl          IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
15600 ,   x_rev_component_tbl         IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
15601 ,   x_ref_designator_tbl        IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
15602 ,   x_sub_component_tbl         IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
15603 ,   x_rev_operation_tbl         IN OUT NOCOPY Bom_Rtg_Pub.Rev_Operation_Tbl_Type    --L1--
15604 ,   x_rev_op_resource_tbl       IN OUT NOCOPY Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type  --L1--
15605 ,   x_rev_sub_resource_tbl      IN OUT NOCOPY Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type --L1--
15606  , x_disable_revision              OUT NOCOPY NUMBER --Bug no:3034642
15607 )
15608 IS
15609 l_api_version_number          CONSTANT NUMBER := 1.0;
15610 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Eco';
15611 l_err_text                    VARCHAR2(240);
15612 l_return_status               VARCHAR2(1);
15613 /* Added variable to hold business object status
15614    Added by AS on 03/17/99 to fix bug 852322
15615 */
15616 l_bo_return_status            VARCHAR2(1);
15617 
15618 l_control_rec                 ENG_GLOBALS.Control_Rec_Type;
15619 
15620 l_ECO_rec                     ENG_Eco_PUB.Eco_Rec_Type := p_ECO_rec;
15621 l_eco_revision_rec            ENG_Eco_PUB.Eco_Revision_Rec_Type;
15622 l_eco_revision_tbl            ENG_Eco_PUB.Eco_Revision_Tbl_Type;
15623 l_revised_item_rec            ENG_Eco_PUB.Revised_Item_Rec_Type;
15624 l_revised_item_tbl            ENG_Eco_PUB.Revised_Item_Tbl_Type;
15625 l_rev_component_rec           BOM_BO_PUB.Rev_Component_Rec_Type;
15626 l_rev_component_tbl           BOM_BO_PUB.Rev_Component_Tbl_Type;
15627 l_ref_designator_rec          BOM_BO_PUB.Ref_Designator_Rec_Type;
15628 l_ref_designator_tbl          BOM_BO_PUB.Ref_Designator_Tbl_Type;
15629 l_sub_component_rec           BOM_BO_PUB.Sub_Component_Rec_Type;
15630 l_sub_component_tbl           BOM_BO_PUB.Sub_Component_Tbl_Type;
15631 l_rev_operation_tbl           Bom_Rtg_Pub.Rev_Operation_Tbl_Type;     -- L1--
15632 l_rev_op_resource_tbl         Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type;   -- L1--
15633 l_rev_sub_resource_tbl        Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type;  -- L1--
15634 l_rev_operation_rec           Bom_Rtg_Pub.Rev_Operation_Rec_Type;     -- L1--
15635 l_rev_op_resource_rec         Bom_Rtg_Pub.Rev_Op_Resource_Rec_Type;   -- L1--
15636 l_rev_sub_resource_rec        Bom_Rtg_Pub.Rev_Sub_Resource_Rec_Type;  -- L1--
15637 l_change_line_rec             ENG_Eco_PUB.Change_Line_Rec_Type ;      -- Eng Change
15638 l_change_line_tbl             ENG_Eco_PUB.Change_Line_Tbl_Type ;      -- Eng Change
15639 
15640 l_mesg_token_tbl              Error_Handler.Mesg_Token_Tbl_Type;
15641 l_other_message               VARCHAR2(2000);
15642 l_other_token_tbl             Error_Handler.Token_Tbl_Type;
15643 
15644 EXC_ERR_PVT_API_MAIN          EXCEPTION;
15645 
15646 BEGIN
15647 
15648     --dbms_output.enable(1000000);
15649 
15650 
15651     --  Standard call to check for call compatibility
15652 
15653     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('The following objects will be processed as part of the same business object'); END IF;
15654     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| ECO           : ' || l_ECO_rec.eco_name); END IF;
15655     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| ECO REVISIONS : ' || to_char(p_eco_revision_tbl.COUNT)); END IF;
15656     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| CHANGE LINES  : ' || to_char(p_change_line_tbl.COUNT)); END IF;
15657     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| REVISED ITEMS : ' || to_char(p_revised_item_tbl.COUNT)); END IF;
15658     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| REVISED COMPS : ' || to_char(p_rev_component_tbl.COUNT)); END IF;
15659     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| SUBS. COMPS   : ' || to_Char(p_sub_component_tbl.COUNT)); END IF;
15660     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| REFD. DESGS   : ' || to_char(p_ref_designator_tbl.COUNT)); END IF;
15661 
15662 --L1--
15663     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| OPERATION     : ' || to_char(p_rev_operation_tbl.COUNT)); END IF;
15664     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| RESOURCE      : ' || to_char(p_rev_op_resource_tbl.COUNT)); END IF;
15665     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('| SUB RESOURCE  : ' || to_char(p_rev_sub_resource_tbl.COUNT)); END IF;
15666 --L1--
15667 
15668 
15669     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('|----------------------------------------------------');  END IF;
15670 
15671 /*------------------------------------
15672 -- Not used
15673 
15674     IF NOT FND_API.Compatible_API_Call
15675            (   l_api_version_number
15676            ,   p_api_version_number
15677            ,   l_api_name
15678            ,   G_PKG_NAME
15679            )
15680     THEN
15681         RAISE EXC_ERR_PVT_API_MAIN;
15682     END IF;
15683 ------------------------------------*/
15684 
15685 
15686     --  Init local variables
15687 
15688     l_ECO_rec                      := p_ECO_rec;
15689 
15690     --  Init local table variables.
15691 
15692     l_eco_revision_tbl             := p_eco_revision_tbl;
15693     l_revised_item_tbl             := p_revised_item_tbl;
15694     l_rev_component_tbl            := p_rev_component_tbl;
15695     l_ref_designator_tbl           := p_ref_designator_tbl;
15696     l_sub_component_tbl            := p_sub_component_tbl;
15697     l_rev_operation_tbl            := p_rev_operation_tbl;     --L1
15698     l_rev_op_resource_tbl          := p_rev_op_resource_tbl;   --L1
15699     l_rev_sub_resource_tbl         := p_rev_sub_resource_tbl;  --L1
15700     l_change_line_tbl              := p_change_line_tbl ;      -- Eng Change
15701 
15702 
15703 --  Added by AS on 03/17/99 to fix bug 852322
15704     l_bo_return_status := 'S';
15705 
15706     -- Load environment information into the SYSTEM_INFORMATION record
15707     -- (USER_ID, LOGIN_ID, PROG_APPID, PROG_ID)
15708 
15709 
15710     ENG_GLOBALS.Init_System_Info_Rec
15711                         (  x_mesg_token_tbl => l_mesg_token_tbl
15712                         ,  x_return_status  => l_return_status
15713                         );
15714 
15715     -- Initialize System_Information Unit_Effectivity flag
15716     -- Modified on Sep 27,2001 by bzhang
15717    /* IF FND_PROFILE.DEFINED('PJM:PJM_UNITEFF_NO_EFFECT') AND
15718        FND_PROFILE.VALUE('PJM:PJM_UNITEFF_NO_EFFECT') = 'Y'
15719    */
15720     IF PJM_UNIT_EFF.Enabled = 'Y'
15721     THEN
15722         BOM_Globals.Set_Unit_Effectivity (TRUE);
15723         ENG_Globals.Set_Unit_Effectivity (TRUE);
15724     ELSE
15725         BOM_Globals.Set_Unit_Effectivity (FALSE);
15726         ENG_Globals.Set_Unit_Effectivity (FALSE);
15727     END IF;
15728 
15729     IF l_return_status <> FND_API.G_RET_STS_SUCCESS
15730     THEN
15731         RAISE EXC_ERR_PVT_API_MAIN;
15732     END IF;
15733     --  Eco
15734     IF  (l_ECO_rec.ECO_Name <> FND_API.G_MISS_CHAR
15735          AND l_ECO_rec.ECO_Name IS NOT NULL)
15736     THEN
15737         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15738         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling ECO_Header'); END IF;
15739 
15740         Eco_Header
15741         (   p_validation_level          => p_validation_level
15742         ,   p_ECO_rec                   => l_ECO_rec
15743         ,   p_eco_revision_tbl          => l_eco_revision_tbl
15744         ,   p_change_line_tbl           => l_change_line_tbl      -- Eng Change
15745         ,   p_revised_item_tbl          => l_revised_item_tbl
15746         ,   p_rev_component_tbl         => l_rev_component_tbl
15747         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15748         ,   p_sub_component_tbl         => l_sub_component_tbl
15749         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15750         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15751         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15752         ,   x_ECO_rec                   => l_ECO_rec
15753         ,   x_eco_revision_tbl          => l_eco_revision_tbl
15754         ,   x_change_line_tbl           => l_change_line_tbl      -- Eng Change
15755         ,   x_revised_item_tbl          => l_revised_item_tbl
15756         ,   x_rev_component_tbl         => l_rev_component_tbl
15757         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15758         ,   x_sub_component_tbl         => l_sub_component_tbl
15759         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15760         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15761         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15762         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15763         ,   x_return_status             => l_return_status
15764 	 ,   x_disable_revision          =>x_disable_revision --Bug no:3034642
15765         );
15766 	IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('eco hdr return status: ' || l_eco_rec.return_status); END IF;
15767 
15768         -- Added by AS on 03/22/99 to fix bug 853529
15769 
15770         IF NVL(l_return_status, 'S') = 'Q'
15771         THEN
15772                 l_return_status := 'F';
15773                 RAISE G_EXC_QUIT_IMPORT;
15774         ELSIF NVL(l_return_status, 'S') = 'U'
15775         THEN
15776                 RAISE G_EXC_QUIT_IMPORT;
15777 
15778         --  Added by AS on 03/17/99 to fix bug 852322
15779         ELSIF NVL(l_return_status, 'S') <> 'S'
15780         THEN
15781                 l_bo_return_status := l_return_status;
15782         END IF;
15783 
15784    END IF;
15785 
15786    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
15787 
15788    --  Eco Revisions
15789    IF l_eco_revision_tbl.Count <> 0
15790    THEN
15791         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15792         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling ECO_Rev'); END IF;
15793 
15794         Eco_Rev
15795         (   p_validation_level          => p_validation_level
15796         ,   p_eco_revision_tbl          => l_eco_revision_tbl
15797         ,   p_change_line_tbl           => l_change_line_tbl      -- Eng Change
15798         ,   p_revised_item_tbl          => l_revised_item_tbl
15799         ,   p_rev_component_tbl         => l_rev_component_tbl
15800         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15801         ,   p_sub_component_tbl         => l_sub_component_tbl
15802         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15803         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15804         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15805         ,   x_eco_revision_tbl          => l_eco_revision_tbl
15806         ,   x_change_line_tbl           => l_change_line_tbl      -- Eng Change
15807         ,   x_revised_item_tbl          => l_revised_item_tbl
15808         ,   x_rev_component_tbl         => l_rev_component_tbl
15809         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15810         ,   x_sub_component_tbl         => l_sub_component_tbl
15811         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15812         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15813         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15814         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15815         ,   x_return_status             => l_return_status
15816         );
15817 	-- Added by AS on 03/22/99 to fix bug 853529
15818 
15819         IF NVL(l_return_status, 'S') = 'Q'
15820         THEN
15821                 l_return_status := 'F';
15822                 RAISE G_EXC_QUIT_IMPORT;
15823         ELSIF NVL(l_return_status, 'S') = 'U'
15824         THEN
15825                 RAISE G_EXC_QUIT_IMPORT;
15826 
15827         --  Added by AS on 03/17/99 to fix bug 852322
15828         ELSIF NVL(l_return_status, 'S') <> 'S'
15829         THEN
15830                 l_bo_return_status := l_return_status;
15831         END IF;
15832 
15833     END IF;
15834 
15835    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
15836 
15837 
15838    --  Change Lines
15839    IF l_change_line_tbl.Count <> 0
15840    THEN
15841         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15842         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling Change_Line'); END IF;
15843 
15844         Change_Line
15845         (   p_validation_level          => p_validation_level
15846         ,   p_change_line_tbl           => l_change_line_tbl      -- Eng Change
15847         ,   p_revised_item_tbl          => l_revised_item_tbl
15848         ,   p_rev_component_tbl         => l_rev_component_tbl
15849         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15850         ,   p_sub_component_tbl         => l_sub_component_tbl
15851         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15852         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15853         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15854         ,   x_change_line_tbl           => l_change_line_tbl      -- Eng Change
15855         ,   x_revised_item_tbl          => l_revised_item_tbl
15856         ,   x_rev_component_tbl         => l_rev_component_tbl
15857         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15858         ,   x_sub_component_tbl         => l_sub_component_tbl
15859         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15860         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15861         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15862         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15863         ,   x_return_status             => l_return_status
15864         );
15865 
15866         IF NVL(l_return_status, 'S') = 'Q'
15867         THEN
15868                 l_return_status := 'F';
15869                 RAISE G_EXC_QUIT_IMPORT;
15870         ELSIF NVL(l_return_status, 'S') = 'U'
15871         THEN
15872                 RAISE G_EXC_QUIT_IMPORT;
15873 
15874         ELSIF NVL(l_return_status, 'S') <> 'S'
15875         THEN
15876                 l_bo_return_status := l_return_status;
15877         END IF;
15878 
15879     END IF;
15880 
15881     IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
15882 
15883     --  Revised Items
15884 
15885     IF p_revised_item_tbl.COUNT <> 0
15886     THEN
15887         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15888         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling Rev_Items'); END IF;
15889 
15890         Rev_Items
15891         (   p_validation_level          => p_validation_level
15892         ,   p_revised_item_tbl          => l_revised_item_tbl
15893         ,   p_rev_component_tbl         => l_rev_component_tbl
15894         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15895         ,   p_sub_component_tbl         => l_sub_component_tbl
15896         ,   p_rev_operation_tbl         => l_rev_operation_tbl    --L1
15897         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15898         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15899         ,   x_revised_item_tbl          => l_revised_item_tbl
15900         ,   x_rev_component_tbl         => l_rev_component_tbl
15901         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15902         ,   x_sub_component_tbl         => l_sub_component_tbl
15903         ,   x_rev_operation_tbl         => l_rev_operation_tbl    --L1
15904         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl  --L1
15905         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl --L1
15906         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15907         ,   x_return_status             => l_return_status
15908 	,    x_disable_revision          => x_disable_revision        --Bug no:3034642
15909         );
15910 
15911        -- Bug 6657209. Reset the global variable after Rev_items are processed.
15912        Eng_Default_Revised_Item.G_OLD_SCHED_DATE := NULL;
15913 
15914 	-- Added by AS on 03/22/99 to fix bug 853529
15915 
15916         IF NVL(l_return_status, 'S') = 'Q'
15917         THEN
15918                 l_return_status := 'F';
15919                 RAISE G_EXC_QUIT_IMPORT;
15920         ELSIF NVL(l_return_status, 'S') = 'U'
15921         THEN
15922                 RAISE G_EXC_QUIT_IMPORT;
15923 
15924         --  Added by AS on 03/17/99 to fix bug 852322
15925         ELSIF NVL(l_return_status, 'S') <> 'S'
15926         THEN
15927                 l_bo_return_status := l_return_status;
15928         END IF;
15929 
15930     END IF;
15931 
15932    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
15933 
15934     --  Revised Components
15935 
15936     IF l_rev_component_tbl.Count <> 0
15937     THEN
15938         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15939         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling Rev_Comps'); END IF;
15940 
15941         Rev_Comps
15942         (   p_validation_level          => p_validation_level
15943         ,   p_rev_component_tbl         => l_rev_component_tbl
15944         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15945         ,   p_sub_component_tbl         => l_sub_component_tbl
15946         ,   x_rev_component_tbl         => l_rev_component_tbl
15947         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15948         ,   x_sub_component_tbl         => l_sub_component_tbl
15949         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15950         ,   x_return_status             => l_return_status
15951         );
15952 	-- Added by AS on 03/22/99 to fix bug 853529
15953 
15954         IF NVL(l_return_status, 'S') = 'Q'
15955         THEN
15956                 l_return_status := 'F';
15957                 RAISE G_EXC_QUIT_IMPORT;
15958         ELSIF NVL(l_return_status, 'S') = 'U'
15959         THEN
15960                 RAISE G_EXC_QUIT_IMPORT;
15961 
15962         --  Added by AS on 03/17/99 to fix bug 852322
15963         ELSIF NVL(l_return_status, 'S') <> 'S'
15964         THEN
15965                 l_bo_return_status := l_return_status;
15966         END IF;
15967 
15968     END IF;
15969 
15970    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
15971 
15972     --  Reference Designators
15973 
15974     IF l_ref_designator_tbl.Count <> 0
15975     THEN
15976         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
15977         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling Ref_Desgs'); END IF;
15978 
15979         Ref_Desgs
15980         (   p_validation_level          => p_validation_level
15981         ,   p_ref_designator_tbl        => l_ref_designator_tbl
15982         ,   p_sub_component_tbl         => l_sub_component_tbl
15983         ,   x_ref_designator_tbl        => l_ref_designator_tbl
15984         ,   x_sub_component_tbl         => l_sub_component_tbl
15985         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
15986         ,   x_return_status             => l_return_status
15987         );
15988 	-- Added by AS on 03/22/99 to fix bug 853529
15989 
15990         IF NVL(l_return_status, 'S') = 'Q'
15991         THEN
15992                 l_return_status := 'F';
15993                 RAISE G_EXC_QUIT_IMPORT;
15994         ELSIF NVL(l_return_status, 'S') = 'U'
15995         THEN
15996                 RAISE G_EXC_QUIT_IMPORT;
15997 
15998         --  Added by AS on 03/17/99 to fix bug 852322
15999         ELSIF NVL(l_return_status, 'S') <> 'S'
16000         THEN
16001                 l_bo_return_status := l_return_status;
16002         END IF;
16003 
16004     END IF;
16005 
16006    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
16007 
16008     --  Substitute Components
16009 
16010     IF l_Sub_Component_Tbl.Count <> 0
16011     THEN
16012         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
16013         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling Sub_Comps'); END IF;
16014 
16015         Sub_Comps
16016         (   p_validation_level          => p_validation_level
16017         ,   p_sub_component_tbl         => l_sub_component_tbl
16018         ,   x_sub_component_tbl         => l_sub_component_tbl
16019         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
16020         ,   x_return_status             => l_return_status
16021         );
16022 	-- Added by AS on 03/22/99 to fix bug 853529
16023 
16024         IF NVL(l_return_status, 'S') = 'Q'
16025         THEN
16026                 l_return_status := 'F';
16027                 RAISE G_EXC_QUIT_IMPORT;
16028         ELSIF NVL(l_return_status, 'S') = 'U'
16029         THEN
16030                 RAISE G_EXC_QUIT_IMPORT;
16031 
16032         --  Added by AS on 03/17/99 to fix bug 852322
16033         ELSIF NVL(l_return_status, 'S') <> 'S'
16034         THEN
16035                 l_bo_return_status := l_return_status;
16036         END IF;
16037 
16038     END IF;
16039 
16040    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
16041 
16042 
16043   --  L1:  Operation
16044 
16045     IF l_rev_operation_tbl.Count <> 0
16046     THEN
16047         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
16048         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling ECO operation'); END IF;
16049 
16050        Rev_Operation_Sequences
16051         (   p_validation_level          => p_validation_level
16052         ,   p_rev_operation_tbl         => l_rev_operation_tbl
16053         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
16054         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16055         ,   x_rev_operation_tbl         => l_rev_operation_tbl
16056         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
16057         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16058         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
16059         ,   x_return_status             => l_return_status
16060         );
16061 	IF NVL(l_return_status, 'S') = 'Q'
16062         THEN
16063                 l_return_status := 'F';
16064                 RAISE G_EXC_QUIT_IMPORT;
16065         ELSIF NVL(l_return_status, 'S') = 'U'
16066         THEN
16067                 RAISE G_EXC_QUIT_IMPORT;
16068 
16069         ELSIF NVL(l_return_status, 'S') <> 'S'
16070         THEN
16071                 l_bo_return_status := l_return_status;
16072         END IF;
16073 
16074     END IF;
16075 
16076    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
16077 
16078 --  L1:  Operation Resource
16079 
16080     IF l_rev_op_resource_tbl.Count <> 0
16081     THEN
16082         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
16083         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling ECO resource'); END IF;
16084 
16085         Rev_Operation_Resources
16086         (   p_validation_level          => p_validation_level
16087         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
16088         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16089         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
16090         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16091         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
16092         ,   x_return_status             => l_return_status
16093         );
16094 	IF NVL(l_return_status, 'S') = 'Q'
16095         THEN
16096                 l_return_status := 'F';
16097                 RAISE G_EXC_QUIT_IMPORT;
16098         ELSIF NVL(l_return_status, 'S') = 'U'
16099         THEN
16100                 RAISE G_EXC_QUIT_IMPORT;
16101 
16102         ELSIF NVL(l_return_status, 'S') <> 'S'
16103         THEN
16104                 l_bo_return_status := l_return_status;
16105         END IF;
16106 
16107     END IF;
16108 
16109    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
16110 
16111 --  L1: Substitute resource
16112 
16113     IF l_rev_sub_resource_tbl.Count <> 0
16114     THEN
16115         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug(' '); END IF;
16116         IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('PVT API: Calling ECO substitute resource'); END IF;
16117 
16118       Rev_Sub_Operation_Resources
16119         (   p_validation_level          => p_validation_level
16120         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16121         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
16122         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
16123         ,   x_return_status             => l_return_status
16124         );
16125 	IF NVL(l_return_status, 'S') = 'Q'
16126         THEN
16127                 l_return_status := 'F';
16128                 RAISE G_EXC_QUIT_IMPORT;
16129         ELSIF NVL(l_return_status, 'S') = 'U'
16130         THEN
16131                 RAISE G_EXC_QUIT_IMPORT;
16132 
16133         ELSIF NVL(l_return_status, 'S') <> 'S'
16134         THEN
16135                 l_bo_return_status := l_return_status;
16136         END IF;
16137 
16138     END IF;
16139 
16140    IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('BO error status: ' || l_bo_return_status); END IF;
16141 
16142     --  Done processing, load OUT parameters.
16143 
16144     --  Added by AS on 03/17/99 to fix bug 852322
16145     x_return_status                := l_bo_return_status;
16146 
16147     x_ECO_rec                      := l_ECO_rec;
16148     x_eco_revision_tbl             := l_eco_revision_tbl;
16149     x_revised_item_tbl             := l_revised_item_tbl;
16150     x_rev_component_tbl            := l_rev_component_tbl;
16151     x_ref_designator_tbl           := l_ref_designator_tbl;
16152     x_sub_component_tbl            := l_sub_component_tbl;
16153     x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
16154     x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
16155     x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
16156     x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
16157 
16158 
16159 
16160     -- Initialize System_Information Unit_Effectivity flag
16161 
16162 
16163     --  Clear API cache.
16164 
16165     IF p_control_rec.clear_api_cache THEN
16166 
16167         NULL;
16168 
16169     END IF;
16170 
16171     --  Clear API request tbl.
16172 
16173     IF p_control_rec.clear_api_requests THEN
16174 
16175         NULL;
16176 
16177     END IF;
16178 
16179     -- Reset system_information business object flags
16180 
16181     ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
16182     ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
16183     ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
16184     ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
16185     ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
16186     ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
16187     ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
16188     ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
16189 
16190 
16191     --Bug No: 3737881
16192     --Commenting out the following code as no 'Commit' should
16193     --be done in this API.
16194     --IF ENG_GLOBALS.G_ENG_LAUNCH_IMPORT = 1 THEN
16195     --       Error_Handler.Write_To_ConcurrentLog;
16196     --       Error_Handler.WRITE_TO_INTERFACETABLE;
16197     --       COMMIT;
16198     --END IF;
16199 
16200 EXCEPTION
16201 
16202     WHEN EXC_ERR_PVT_API_MAIN THEN
16203 
16204         Eco_Error_Handler.Log_Error
16205                 (  p_ECO_rec            => l_ECO_rec
16206                 ,  p_eco_revision_tbl   => l_eco_revision_tbl
16207                 ,  p_change_line_tbl    => l_change_line_tbl -- Eng Change
16208                 ,  p_revised_item_tbl   => l_revised_item_tbl
16209                 ,  p_rev_component_tbl  => l_rev_component_tbl
16210                 ,  p_ref_designator_tbl => l_ref_designator_tbl
16211                 ,  p_sub_component_tbl  => l_sub_component_tbl
16212                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --L1
16213                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --L1
16214                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --L1
16215                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
16216                 ,  p_error_status       => FND_API.G_RET_STS_UNEXP_ERROR
16217                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
16218                 ,  p_other_message      => l_other_message
16219                 ,  p_other_token_tbl    => l_other_token_tbl
16220                 ,  p_error_level        => 0
16221                 ,  x_ECO_rec            => l_ECO_rec
16222                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
16223                 ,  x_change_line_tbl    => l_change_line_tbl -- Eng Change
16224                 ,  x_revised_item_tbl   => l_revised_item_tbl
16225                 ,  x_rev_component_tbl  => l_rev_component_tbl
16226                 ,  x_ref_designator_tbl => l_ref_designator_tbl
16227                 ,  x_sub_component_tbl  => l_sub_component_tbl
16228                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --L1
16229                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --L1
16230                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --L1
16231                 );
16232 
16233         x_return_status                := l_return_status;
16234         x_ECO_rec                      := l_ECO_rec;
16235         x_eco_revision_tbl             := l_eco_revision_tbl;
16236         x_revised_item_tbl             := l_revised_item_tbl;
16237         x_rev_component_tbl            := l_rev_component_tbl;
16238         x_ref_designator_tbl           := l_ref_designator_tbl;
16239         x_sub_component_tbl            := l_sub_component_tbl;
16240         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
16241 
16242         -- Reset system_information business object flags
16243 
16244     ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
16245     ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
16246     ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
16247     ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
16248     ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
16249     ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
16250     ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
16251     ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
16252 
16253     WHEN G_EXC_QUIT_IMPORT THEN
16254 
16255         x_return_status                := l_return_status;
16256         x_ECO_rec                      := l_ECO_rec;
16257         x_eco_revision_tbl             := l_eco_revision_tbl;
16258         x_revised_item_tbl             := l_revised_item_tbl;
16259         x_rev_component_tbl            := l_rev_component_tbl;
16260         x_ref_designator_tbl           := l_ref_designator_tbl;
16261         x_sub_component_tbl            := l_sub_component_tbl;
16262         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
16263         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
16264         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
16265         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
16266 
16267         -- Reset system_information business object flags
16268 
16269     ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
16270     ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
16271     ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
16272     ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
16273     ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
16274     ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
16275     ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
16276     ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
16277 
16278     WHEN OTHERS THEN
16279 
16280         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
16281         THEN
16282                 l_err_text := G_PKG_NAME || ' : Process ECO '
16283                         || substrb(SQLERRM,1,200);
16284                 Error_Handler.Add_Error_Token
16285                         ( p_Message_Text => l_err_text
16286                         , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
16287                         , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
16288                         );
16289         END IF;
16290 
16291         Eco_Error_Handler.Log_Error
16292                 (  p_ECO_rec            => l_ECO_rec
16293                 ,  p_eco_revision_tbl   => l_eco_revision_tbl
16294                 ,  p_change_line_tbl    => l_change_line_tbl -- Eng Change
16295                 ,  p_revised_item_tbl   => l_revised_item_tbl
16296                 ,  p_rev_component_tbl  => l_rev_component_tbl
16297                 ,  p_ref_designator_tbl => l_ref_designator_tbl
16298                 ,  p_sub_component_tbl  => l_sub_component_tbl
16299                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --L1
16300                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --L1
16301                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --L1
16302                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
16303                 ,  p_error_status       => FND_API.G_RET_STS_UNEXP_ERROR
16304                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
16305                 ,  p_other_message      => l_other_message
16306                 ,  p_other_token_tbl    => l_other_token_tbl
16307                 ,  p_error_level        => 0
16308                 ,  x_ECO_rec            => l_ECO_rec
16309                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
16310                 ,  x_change_line_tbl    => l_change_line_tbl -- Eng Change
16311                 ,  x_revised_item_tbl   => l_revised_item_tbl
16312                 ,  x_rev_component_tbl  => l_rev_component_tbl
16313                 ,  x_ref_designator_tbl => l_ref_designator_tbl
16314                 ,  x_sub_component_tbl  => l_sub_component_tbl
16315                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --L1
16316                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --L1
16317                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --L1
16318                 );
16319 
16320         x_return_status                := l_return_status;
16321         x_ECO_rec                      := l_ECO_rec;
16322         x_eco_revision_tbl             := l_eco_revision_tbl;
16323         x_revised_item_tbl             := l_revised_item_tbl;
16324         x_rev_component_tbl            := l_rev_component_tbl;
16325         x_ref_designator_tbl           := l_ref_designator_tbl;
16326         x_sub_component_tbl            := l_sub_component_tbl;
16327         x_rev_operation_tbl            := l_rev_operation_tbl;     --L1
16328         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --L1
16329         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --L1
16330         x_change_line_tbl              := l_change_line_tbl ;      -- Eng Change
16331 
16332         -- Reset system_information business object flags
16333 
16334     ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
16335     ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
16336     ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
16337     ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
16338     ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
16339     ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
16340     ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
16341     ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
16342 
16343 END Process_Eco;
16344 
16345 --  Start of Comments
16346 --  API name    Lock_Eco
16347 --  Type        Private
16348 --  Function
16349 --
16350 --  Pre-reqs
16351 --
16352 --  Parameters
16353 --
16354 --  Version     Current version = 1.0
16355 --              Initial version = 1.0
16356 --
16357 --  Notes
16358 --
16359 --  End of Comments
16360 
16361 PROCEDURE Lock_Eco
16362 (   p_api_version_number            IN  NUMBER
16363 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
16364 ,   x_return_status                 OUT NOCOPY VARCHAR2
16365 ,   x_msg_count                     OUT NOCOPY NUMBER
16366 ,   x_msg_data                      OUT NOCOPY VARCHAR2
16367 ,   p_ECO_rec                       IN  ENG_Eco_PUB.Eco_Rec_Type :=
16368                                         ENG_Eco_PUB.G_MISS_ECO_REC
16369 ,   p_eco_revision_tbl              IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type :=
16370                                         ENG_Eco_PUB.G_MISS_ECO_REVISION_TBL
16371 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type :=
16372                                         ENG_Eco_PUB.G_MISS_REVISED_ITEM_TBL
16373 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type :=
16374                                         BOM_BO_PUB.G_MISS_REV_COMPONENT_TBL
16375 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type :=
16376                                         BOM_BO_PUB.G_MISS_REF_DESIGNATOR_TBL
16377 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type :=
16378                                         BOM_BO_PUB.G_MISS_SUB_COMPONENT_TBL
16379 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
16380 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
16381 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
16382 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
16383 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
16384 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
16385 ,   x_err_text                      OUT NOCOPY VARCHAR2
16386 )
16387 IS
16388 l_api_version_number          CONSTANT NUMBER := 1.0;
16389 l_api_name                    CONSTANT VARCHAR2(30):= 'Lock_Eco';
16390 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
16391 l_eco_revision_rec            ENG_Eco_PUB.Eco_Revision_Rec_Type;
16392 l_revised_item_rec            ENG_Eco_PUB.Revised_Item_Rec_Type;
16393 l_rev_component_rec           BOM_BO_PUB.Rev_Component_Rec_Type;
16394 l_ref_designator_rec          BOM_BO_PUB.Ref_Designator_Rec_Type;
16395 l_sub_component_rec           BOM_BO_PUB.Sub_Component_Rec_Type;
16396 BEGIN
16397 
16398     --  Standard call to check for call compatibility
16399 
16400 NULL;
16401 
16402 /*********************** Temporarily commented *****************************
16403 
16404     IF NOT FND_API.Compatible_API_Call
16405            (   l_api_version_number
16406            ,   p_api_version_number
16407            ,   l_api_name
16408            ,   G_PKG_NAME
16409            )
16410     THEN
16411         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16412     END IF;
16413 
16414     --  Initialize message list.
16415 
16416     IF FND_API.to_Boolean(p_init_msg_list) THEN
16417         FND_MSG_PUB.initialize;
16418     END IF;
16419 
16420     --  Set Savepoint
16421 
16422     SAVEPOINT Lock_Eco_PVT;
16423 
16424     --  Lock ECO
16425 
16426     IF p_ECO_rec.operation = ENG_GLOBALS.G_OPR_LOCK THEN
16427 
16428         ENG_Eco_Util.Lock_Row
16429         (   p_ECO_rec                     => p_ECO_rec
16430         ,   x_ECO_rec                     => x_ECO_rec
16431         ,   x_return_status               => l_return_status
16432         ,   x_err_text                    => x_err_text
16433         );
16434 
16435         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16436             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16437         ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16438             RAISE FND_API.G_EXC_ERROR;
16439         END IF;
16440 
16441 
16442     END IF;
16443 
16444     --  Lock eco_revision
16445 
16446     FOR I IN 1..p_eco_revision_tbl.COUNT LOOP
16447 
16448         IF p_eco_revision_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
16449 
16450             ENG_Eco_Revision_Util.Lock_Row
16451             (   p_eco_revision_rec            => p_eco_revision_tbl(I)
16452             ,   x_eco_revision_rec            => l_eco_revision_rec
16453             ,   x_return_status               => l_return_status
16454             ,   x_err_text                          => x_err_text
16455             );
16456 
16457             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16458                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16459             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16460                 RAISE FND_API.G_EXC_ERROR;
16461             END IF;
16462 
16463             x_eco_revision_tbl(I)          := l_eco_revision_rec;
16464 
16465         END IF;
16466 
16467     END LOOP;
16468 
16469     --  Lock revised_item
16470 
16471     FOR I IN 1..p_revised_item_tbl.COUNT LOOP
16472 
16473         IF p_revised_item_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
16474 
16475             ENG_Revised_Item_Util.Lock_Row
16476             (   p_revised_item_rec            => p_revised_item_tbl(I)
16477             ,   x_revised_item_rec            => l_revised_item_rec
16478             ,   x_return_status               => l_return_status
16479             ,   x_err_text                    => x_err_text
16480             );
16481 
16482             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16483                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16484             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16485                 RAISE FND_API.G_EXC_ERROR;
16486             END IF;
16487 
16488             x_revised_item_tbl(I)          := l_revised_item_rec;
16489 
16490         END IF;
16491 
16492     END LOOP;
16493 
16494     --  Lock rev_component
16495 
16496     FOR I IN 1..p_rev_component_tbl.COUNT LOOP
16497 
16498         IF p_rev_component_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
16499 
16500             Bom_Bom_Component_Util.Lock_Row
16501             (   p_rev_component_rec           => p_rev_component_tbl(I)
16502             ,   x_rev_component_rec           => l_rev_component_rec
16503             ,   x_return_status               => l_return_status
16504                 ,   x_err_text                      => x_err_text
16505             );
16506 
16507             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16508                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16509             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16510                 RAISE FND_API.G_EXC_ERROR;
16511             END IF;
16512 
16513             x_rev_component_tbl(I)         := l_rev_component_rec;
16514 
16515         END IF;
16516 
16517     END LOOP;
16518 
16519     --  Lock ref_designator
16520 
16521     FOR I IN 1..p_ref_designator_tbl.COUNT LOOP
16522 
16523         IF p_ref_designator_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
16524 
16525             Bom_Ref_Designator_Util.Lock_Row
16526             (   p_ref_designator_rec          => p_ref_designator_tbl(I)
16527             ,   x_ref_designator_rec          => l_ref_designator_rec
16528             ,   x_return_status               => l_return_status
16529             ,   x_err_text                    => x_err_text
16530             );
16531 
16532             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16533                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16534             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16535                 RAISE FND_API.G_EXC_ERROR;
16536             END IF;
16537 
16538             x_ref_designator_tbl(I)        := l_ref_designator_rec;
16539 
16540         END IF;
16541 
16542     END LOOP;
16543 
16544     --  Lock sub_component
16545 
16546     FOR I IN 1..p_sub_component_tbl.COUNT LOOP
16547 
16548         IF p_sub_component_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
16549 
16550             ENG_Sub_Component_Util.Lock_Row
16551             (   p_sub_component_rec           => p_sub_component_tbl(I)
16552             ,   x_sub_component_rec           => l_sub_component_rec
16553             ,   x_return_status               => l_return_status
16554             ,   x_err_text                    => x_err_text
16555             );
16556 
16557             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
16558                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
16559             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
16560                 RAISE FND_API.G_EXC_ERROR;
16561             END IF;
16562 
16563             x_sub_component_tbl(I)         := l_sub_component_rec;
16564 
16565         END IF;
16566 
16567     END LOOP;
16568 
16569     --  Set return status
16570 
16571     x_return_status := FND_API.G_RET_STS_SUCCESS;
16572 
16573     --  Get message count and data
16574 
16575     FND_MSG_PUB.Count_And_Get
16576     (   p_count                       => x_msg_count
16577     ,   p_data                        => x_msg_data
16578     );
16579 
16580 
16581 EXCEPTION
16582 
16583     WHEN FND_API.G_EXC_ERROR THEN
16584 
16585         x_return_status := FND_API.G_RET_STS_ERROR;
16586 
16587         --  Get message count and data
16588 
16589         FND_MSG_PUB.Count_And_Get
16590         (   p_count                       => x_msg_count
16591         ,   p_data                        => x_msg_data
16592         );
16593 
16594         --  Rollback
16595 
16596         ROLLBACK TO Lock_Eco_PVT;
16597 
16598     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
16599 
16600         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
16601 
16602         --  Get message count and data
16603 
16604         FND_MSG_PUB.Count_And_Get
16605         (   p_count                       => x_msg_count
16606         ,   p_data                        => x_msg_data
16607         );
16608 
16609         --  Rollback
16610 
16611         ROLLBACK TO Lock_Eco_PVT;
16612 
16613     WHEN OTHERS THEN
16614 
16615         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
16616 
16617         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
16618         THEN
16619             FND_MSG_PUB.Add_Exc_Msg
16620             (   G_PKG_NAME
16621             ,   'Lock_Eco'
16622             );
16623         END IF;
16624 
16625         --  Get message count and data
16626 
16627         FND_MSG_PUB.Count_And_Get
16628         (   p_count                       => x_msg_count
16629         ,   p_data                        => x_msg_data
16630         );
16631 
16632         --  Rollback
16633 
16634         ROLLBACK TO Lock_Eco_PVT;
16635 
16636 ****************************************************************************/
16637 
16638 END Lock_Eco;
16639 
16640 
16641 END ENG_Eco_PVT;
16642