DBA Data[Home] [Help]

PACKAGE BODY: APPS.ENG_FORM_ECO_PVT

Source


1 PACKAGE BODY ENG_FORM_ECO_PVT AS
2 /* $Header: ENGFPVTB.pls 120.1.12010000.2 2009/11/12 23:14:42 umajumde 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 G_MISS_REV_OP_REC       BOM_RTG_PUB.Rev_Operation_Rec_Type;        --add
16 G_MISS_REV_OP_RES_REC   BOM_RTG_PUB.Rev_Op_Resource_Rec_Type;      --add
17 G_MISS_REV_SUB_RES_REC  BOM_RTG_PUB.Rev_Sub_Resource_Rec_Type;     --add
18 
19 G_CONTROL_REC           BOM_BO_PUB.Control_Rec_Type;
20 
21 
22 -- Added for Bug#1587263
23 -- Set Revised Item's attributes to Global_System_Information
24 -- records, which are used from rev item chidlren entities.
25 -- This modification caused BOs modification for dependency issue.
26 -- In feature, following source I added will be eliminated
27 -- as well as BO's modification for dependency issue.
28 -- This procedure is called from each child entity of Rev Item.
29 -- p_bo_processed is 'RTG' or 'BOM'
30 --
31 --
32 PROCEDURE Set_RevItem_Attributes
33 (  p_revised_item_sequence_id    IN  NUMBER
34  , p_bo_processed                IN  VARCHAR2 := 'RTG'
35 )
36 
37 IS
38         l_lot_number            VARCHAR2(30) ;
39         l_routing_sequence_id   NUMBER ;
40         l_from_wip_entity_id    NUMBER ;
41         l_to_wip_entity_id      NUMBER ;
42         l_from_cum_qty          NUMBER ;
43         l_eco_for_production    NUMBER ;
44         l_cfm_routing_flag      NUMBER ;
45 
46         l_err_text              VARCHAR2(2000);
47         l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
48         l_return_status         VARCHAR2(1);
49 BEGIN
50 
51     l_return_status := FND_API.G_RET_STS_SUCCESS;
52 
53     BEGIN
54         SELECT routing_sequence_id
55              , lot_number
56              , from_wip_entity_id
57              , to_wip_entity_id
58              , from_cum_qty
59              , NVL(eco_for_production,2)
60              , NVL(cfm_routing_flag,2)
61          INTO  l_routing_sequence_id
62              , l_lot_number
63              , l_from_wip_entity_id
64              , l_to_wip_entity_id
65              , l_from_cum_qty
66              , l_eco_for_production
67              , l_cfm_routing_flag
68          FROM eng_revised_items
69          WHERE revised_item_sequence_id = p_revised_item_sequence_id ;
70 
71     EXCEPTION
72         -- Added for Bug1606881
73         WHEN NO_DATA_FOUND THEN
74            NULL ;
75 
76     END  ;
77 
78     IF  p_bo_processed = 'RTG' THEN
79 
80          -- Set Revised Item Attributes to Global System Information.
81          Bom_Rtg_Globals.Set_Lot_Number(l_lot_number) ;
82          Bom_Rtg_Globals.Set_From_Wip_Entity_Id(l_from_wip_entity_id) ;
83          Bom_Rtg_Globals.Set_To_Wip_Entity_Id(l_to_wip_entity_id) ;
84          Bom_Rtg_Globals.Set_From_Cum_Qty(l_from_cum_qty) ;
85          Bom_Rtg_Globals.Set_Eco_For_Production(l_eco_for_production) ;
86          Bom_Rtg_Globals.Set_Routing_Sequence_Id(l_routing_sequence_id) ;
87 
88     ELSIF p_bo_processed = 'BOM' THEN
89 
90          -- Set Revised Item Attributes to Global System Information.
91          Bom_Globals.Set_Lot_Number(l_lot_number) ;
92          Bom_Globals.Set_From_Wip_Entity_Id(l_from_wip_entity_id) ;
93          Bom_Globals.Set_To_Wip_Entity_Id(l_to_wip_entity_id) ;
94          Bom_Globals.Set_From_Cum_Qty(l_from_cum_qty) ;
95          Bom_Globals.Set_Eco_For_Production(l_eco_for_production) ;
96 
97     END IF ;
98 
99 END Set_RevItem_Attributes ;
100 
101 
102 -- Added by Masahiko Mochizuki on 09/13/00
103 -- Rev_Sub_Res
104 
105 PROCEDURE Rev_Sub_Res
106 (   p_unexp_rev_sub_res_rec         IN  BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type
107 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type
108 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type
109 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
110 ,   x_unexp_rev_sub_res_rec         IN OUT NOCOPY BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type
111 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
112 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
113 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
114 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
115 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
116 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type
117 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type
118 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type
119 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
120 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
121 )
122 IS
123 
124 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
125 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
126 l_other_message         VARCHAR2(50);
127 l_err_text              VARCHAR2(2000);
128 l_valid                 BOOLEAN := TRUE;
129 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
130 l_bo_return_status      VARCHAR2(1) := 'S';
131 l_rev_sub_resource_Rec    BOM_RTG_PUB.Rev_Sub_Resource_Rec_Type;
132 l_rev_sub_res_unexp_Rec   BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type := p_unexp_Rev_Sub_Res_rec;
133 l_old_rev_sub_resource_Rec   BOM_RTG_PUB.Rev_Sub_Resource_Rec_Type := NULL;
134 l_old_rev_sub_res_unexp_Rec  BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type := NULL;
135 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
136 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
137 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
138 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
139 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type;
140 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type;
141 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type;
142 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type := p_rev_op_resource_tbl;
143 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;
144 l_return_value          NUMBER;
145 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
146 
147 EXC_SEV_QUIT_RECORD     EXCEPTION;
148 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
149 
150 BEGIN
151 
152     -- Begin block that processes revised items. This block holds the exception handlers
153     -- for header errors.
154 
155     FOR I IN 1..l_rev_sub_resource_tbl.COUNT LOOP
156     BEGIN
157         --  Load local records.
158 
159         l_rev_sub_resource_rec := l_rev_sub_resource_tbl(I);
160 
161         l_rev_sub_resource_rec.transaction_type :=
162                 UPPER(l_rev_sub_resource_rec.transaction_type);
163 
164         l_return_status := FND_API.G_RET_STS_SUCCESS;
165         l_rev_sub_resource_rec.return_status := FND_API.G_RET_STS_SUCCESS;
166 
167         -- Process Flow step 3: Verify Sub Operation Resource's existence
168         --
169 
170         IF g_control_rec.check_existence
171         THEN
172                 --dbms_output.put_line('Checking Existence');
173                 Bom_Validate_Sub_Op_Res.Check_Existence
174                 (  p_rev_sub_resource_rec          => l_rev_sub_resource_rec
175                 ,  p_rev_sub_res_unexp_rec         => l_rev_sub_res_unexp_rec
176                 ,  x_old_rev_sub_resource_rec      => l_old_rev_sub_resource_rec
177                 ,  x_old_rev_sub_res_unexp_rec     => l_old_rev_sub_res_unexp_rec
178                 ,  x_Mesg_Token_Tbl                => x_Mesg_Token_Tbl
179                 ,  x_return_status                 => x_Return_Status
180                 );
181 
182                 --dbms_output.put_line('return_status: ' || l_return_status);
183 
184                 IF l_return_status = Error_Handler.G_STATUS_ERROR
185                 THEN
186                         RAISE EXC_SEV_QUIT_RECORD;
187                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
188                 THEN
189                         RAISE EXC_UNEXP_SKIP_OBJECT;
190                 END IF;
191         END IF;
192 
193         -- Set parent revised item attributes
194         Set_RevItem_Attributes
195         (  p_revised_item_sequence_id    => l_rev_sub_res_unexp_rec.revised_item_sequence_id
196          , p_bo_processed                => 'RTG'
197         ) ;
198 
199 
200 
201      -- Process Flow step 12 - Entity Level Validation
202 
203         IF g_control_rec.entity_validation
204         THEN
205                 --dbms_output.put_line('Entity validation');
206                 IF l_rev_sub_resource_rec.transaction_type = 'DELETE'
207                 THEN
208                         NULL;
209                         /*Eng_Validate_Revised_Item.Check_Entity_Delete
210                         (  p_rev_sub_resource_rec    => l_rev_sub_resource_rec
211                         ,  p_rev_operation_unexp_rec => l_rev_operation_unexp_rec
212                         ,  x_Mesg_Token_Tbl          => l_Mesg_Token_Tbl
213                         ,  x_return_status           => l_Return_Status
214                         );*/
215                 ELSE
216                         Bom_Validate_Sub_Op_Res.Check_Entity
217                         (  p_rev_sub_resource_rec      => l_rev_sub_resource_rec
218                         ,  p_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
219                         ,  p_old_rev_sub_resource_rec  => l_old_rev_sub_resource_rec
220                         ,  p_old_rev_sub_res_unexp_rec => l_old_rev_sub_res_unexp_rec
221                         ,  p_control_rec               => Bom_Rtg_Pub.G_Default_Control_Rec
222                         ,  x_rev_sub_resource_rec      => l_rev_sub_resource_rec
223                         ,  x_rev_sub_res_unexp_rec     => l_rev_sub_res_unexp_rec
224                         ,  x_return_status             => l_return_status
225                         ,  x_mesg_token_tbl            => l_mesg_token_tbl
226                         );
227 
228                 END IF;
229 
230                 --dbms_output.put_line('return_status: ' || l_return_status);
231 
232                 IF l_return_status = Error_Handler.G_STATUS_ERROR
233                 THEN
234                         RAISE EXC_SEV_QUIT_RECORD;
235                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
236                 THEN
237                         RAISE EXC_UNEXP_SKIP_OBJECT;
238                 ELSIF l_return_status ='S' AND
239                       l_Mesg_Token_Tbl.COUNT <>0
240                 THEN
241                         Eco_Error_Handler.Log_Error
242                         (  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
243                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
244                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
245                         ,  p_error_status         => 'W'
246                         ,  p_error_level          => Error_Handler.G_SR_LEVEL
247                         ,  p_entity_index         => I
248                         ,  x_eco_rec              => l_eco_rec
249                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
250                         ,  x_revised_item_tbl     => l_revised_item_tbl
251                         ,  x_rev_component_tbl    => l_rev_component_tbl
252                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
253                         ,  x_sub_component_tbl    => l_sub_component_tbl
254                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
255                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
256                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
257                         );
258                 END IF;
259         END IF;
260 
261         -- Process Flow step 13 : Database Writes
262 --dbms_output.put_line('checking if to write to db');
263         IF g_control_rec.write_to_db
264         THEN
265                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
266                 bom_rtg_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
267                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
268                 bom_rtg_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
269 
270                 --dbms_output.put_line('Writing to the database');
271                 Bom_Sub_Op_Res_Util.Perform_Writes
272                 (   p_rev_sub_resource_rec   => l_rev_sub_resource_rec
273                 ,   p_rev_sub_res_unexp_rec  => l_rev_sub_res_unexp_rec
274                 ,   p_control_rec            => Bom_Rtg_Pub.G_Default_Control_Rec
275                 ,   x_mesg_token_tbl         => x_mesg_token_tbl
276                 ,   x_return_status          => x_return_status
277                 );
278 
279                 --dbms_output.put_line('return_status: ' || l_return_status);
280 
281                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
282                 THEN
283                         RAISE EXC_UNEXP_SKIP_OBJECT;
284                 ELSIF l_return_status ='S' AND
285                       l_Mesg_Token_Tbl.COUNT <>0
286                 THEN
287                         Eco_Error_Handler.Log_Error
288                         (  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
289                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
290                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
291                         ,  p_error_status         => 'W'
292                         ,  p_error_level          => Error_Handler.G_SR_LEVEL
293                         ,  p_entity_index         => I
294                         ,  x_eco_rec              => l_eco_rec
295                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
296                         ,  x_revised_item_tbl     => l_revised_item_tbl
297                         ,  x_rev_component_tbl    => l_rev_component_tbl
298                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
299                         ,  x_sub_component_tbl    => l_sub_component_tbl
300                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
301                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
302                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
303                         );
304                 END IF;
305         END IF;
306 
307         l_rev_sub_resource_tbl(I) := l_rev_sub_resource_rec;
308 
309   EXCEPTION
310 
311     WHEN EXC_SEV_QUIT_RECORD THEN
312 
313         --dbms_output.put_line('Expected error generated');
314         l_rev_sub_resource_tbl(I) := l_rev_sub_resource_rec;
315         Eco_Error_Handler.Log_Error
316                 (  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
317                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
318                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
319                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
320                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
321                 ,  p_error_level          => Error_Handler.G_SR_LEVEL
322                 ,  p_entity_index         => I
323                 ,  x_eco_rec              => l_eco_rec
324                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
325                 ,  x_revised_item_tbl     => l_revised_item_tbl
326                 ,  x_rev_component_tbl    => l_rev_component_tbl
327                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
328                 ,  x_sub_component_tbl    => l_sub_component_tbl
329                 ,  x_rev_operation_tbl    => l_rev_operation_tbl
330                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
331                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
332                 );
333 
334         x_return_status                := l_return_status;
335         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
336         x_ECO_rec                      := l_ECO_rec;
337         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;
338         x_unexp_rev_sub_res_rec        := l_rev_sub_res_unexp_rec;
339         x_eco_revision_tbl             := l_eco_revision_tbl;
340         x_revised_item_tbl             := l_revised_item_tbl;
341         x_sub_component_tbl            := l_sub_component_tbl;
342         x_ref_designator_tbl           := l_ref_designator_tbl;
343         x_rev_component_tbl            := l_rev_component_tbl;
344         x_rev_operation_tbl            := l_rev_operation_tbl;
345         x_rev_op_resource_tbl         := l_rev_op_resource_tbl;
346 
347         RETURN;
348 
349     WHEN EXC_UNEXP_SKIP_OBJECT THEN
350 
351         --dbms_output.put_line('Unexpected error generated');
352         Eco_Error_Handler.Log_Error
353                 (  p_rev_sub_resource_tbl  => l_rev_sub_resource_tbl
354                 ,  p_mesg_token_tbl        => l_mesg_token_tbl
355                 ,  p_error_status          => Error_Handler.G_STATUS_UNEXPECTED
356                 ,  p_other_status          => Error_Handler.G_STATUS_NOT_PICKED
357                 ,  p_other_message         => l_other_message
358                 ,  p_other_token_tbl       => l_other_token_tbl
359                 ,  p_error_level           => Error_Handler.G_SR_LEVEL
360                 ,  p_entity_index          => I
361                 ,  x_ECO_rec               => l_ECO_rec
362                 ,  x_eco_revision_tbl      => l_eco_revision_tbl
363                 ,  x_revised_item_tbl      => l_revised_item_tbl
364                 ,  x_rev_component_tbl     => l_rev_component_tbl
365                 ,  x_ref_designator_tbl    => l_ref_designator_tbl
366                 ,  x_sub_component_tbl     => l_sub_component_tbl
367                 ,  x_rev_operation_tbl     => l_rev_operation_tbl
368                 ,  x_rev_op_resource_tbl   => l_rev_op_resource_tbl
369                 ,  x_rev_sub_resource_tbl  => l_rev_sub_resource_tbl
370                 );
371 
372         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
373         x_ECO_rec                      := l_ECO_rec;
374         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;
375         x_unexp_rev_sub_res_rec        := l_rev_sub_res_unexp_rec;
376         x_eco_revision_tbl             := l_eco_revision_tbl;
377         x_revised_item_tbl             := l_revised_item_tbl;
378         x_ref_designator_tbl           := l_ref_designator_tbl;
379         x_rev_component_tbl            := l_rev_component_tbl;
380         x_sub_component_tbl            := l_sub_component_tbl;
381         x_rev_operation_tbl            := l_rev_operation_tbl;
382         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;
383 
384         l_return_status := 'U';
385 
386   END;
387   END LOOP; -- END revised items processing block
388 
389     IF l_return_status in ('Q', 'U')
390     THEN
391         x_return_status := l_return_status;
392         RETURN;
393     END IF;
394 
395     l_bo_return_status := l_return_status;
396 
397      x_return_status            := l_bo_return_status;
398      x_ECO_rec                  := l_ECO_rec;
399      x_unexp_rev_sub_res_rec    := l_rev_sub_res_unexp_Rec;
400      x_eco_revision_tbl         := l_eco_revision_tbl;
401      x_revised_item_tbl         := l_revised_item_tbl;
402      x_rev_component_tbl        := l_rev_component_tbl;
403      x_ref_designator_tbl       := l_ref_designator_tbl;
404      x_sub_component_tbl        := l_sub_component_tbl;
405      x_rev_operation_tbl        := l_rev_operation_tbl;
406      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;
407      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;
408      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
409 
410 END Rev_Sub_Res;
411 
412 -- Added by Masahiko Mochizuki on 09/12/00
413 --  Rev_Op_Res
414 
415 PROCEDURE Rev_Op_Res
416 (   p_unexp_rev_op_res_rec          IN  BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type
417 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type
418 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type
419 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
420 ,   x_unexp_rev_op_res_rec          IN OUT NOCOPY BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type
421 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
422 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
423 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
424 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
425 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
426 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type
427 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type
428 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type
429 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
430 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
431 )
432 IS
433 
434 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
435 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
436 l_other_message         VARCHAR2(50);
437 l_err_text              VARCHAR2(2000);
438 l_valid                 BOOLEAN := TRUE;
439 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
440 l_bo_return_status      VARCHAR2(1) := 'S';
441 l_rev_op_resource_Rec       BOM_RTG_PUB.Rev_Op_Resource_Rec_Type;
442 l_rev_op_res_unexp_Rec      BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type := p_unexp_rev_op_res_rec;
443 l_old_rev_op_resource_Rec   BOM_RTG_PUB.Rev_Op_Resource_Rec_Type := NULL;
444 l_old_rev_op_res_unexp_Rec  BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type := NULL;
445 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
446 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
447 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
448 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
449 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type;
450 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type;
451 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type;
452 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type := p_rev_op_resource_tbl;
453 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;
454 l_return_value          NUMBER;
455 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
456 
457 EXC_SEV_QUIT_RECORD     EXCEPTION;
458 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
459 
460 BEGIN
461 
462     -- Begin block that processes revised items. This block holds the exception handlers
463     -- for header errors.
464 
465     FOR I IN 1..l_rev_op_resource_tbl.COUNT LOOP
466     BEGIN
467         --  Load local records.
468 
469         l_rev_op_resource_rec := l_rev_op_resource_tbl(I);
470 
471         l_rev_op_resource_rec.transaction_type :=
472                 UPPER(l_rev_op_resource_rec.transaction_type);
473 
474         l_return_status := FND_API.G_RET_STS_SUCCESS;
475         l_rev_op_resource_rec.return_status := FND_API.G_RET_STS_SUCCESS;
476 
477         -- Process Flow step 3: Verify Operation Resource's existence
478         --
479 
480         IF g_control_rec.check_existence
481         THEN
482                 --dbms_output.put_line('Checking Existence');
483                 Bom_Validate_Op_Res.Check_Existence
484                 (  p_rev_op_resource_rec        => l_rev_op_resource_rec
485                 ,  p_rev_op_res_unexp_rec       => l_rev_op_res_unexp_rec
486                 ,  x_old_rev_op_resource_rec    => l_old_rev_op_resource_rec
487                 ,  x_old_rev_op_res_unexp_rec   => l_old_rev_op_res_unexp_rec
488                 ,  x_Mesg_Token_Tbl             => x_Mesg_Token_Tbl
489                 ,  x_return_status              => x_Return_Status
490                 );
491 
492                 --dbms_output.put_line('return_status: ' || l_return_status);
493 
494                 IF l_return_status = Error_Handler.G_STATUS_ERROR
495                 THEN
496                         RAISE EXC_SEV_QUIT_RECORD;
497                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
498                 THEN
499                         RAISE EXC_UNEXP_SKIP_OBJECT;
500                 END IF;
501         END IF;
502 
503         -- Set parent revised item attributes
504         Set_RevItem_Attributes
505         (  p_revised_item_sequence_id    => l_rev_op_res_unexp_rec.revised_item_sequence_id
506          , p_bo_processed                => 'RTG'
507         ) ;
508 
509 
510      -- Process Flow step 12 - Entity Level Validation
511 
512         IF g_control_rec.entity_validation
513         THEN
514                 --dbms_output.put_line('Entity validation');
515                 IF l_rev_op_resource_rec.transaction_type = 'DELETE'
516                 THEN
517                         NULL;
518                         /*Eng_Validate_Revised_Item.Check_Entity_Delete
519                         (  p_rev_op_resource_rec     => l_rev_op_resource_rec
520                         ,  p_rev_operation_unexp_rec => l_rev_operation_unexp_rec
521                         ,  x_Mesg_Token_Tbl          => l_Mesg_Token_Tbl
522                         ,  x_return_status           => l_Return_Status
523                         );*/
524                 ELSE
525                         Bom_Validate_Op_Res.Check_Entity
526                         (  p_rev_op_resource_rec      => l_rev_op_resource_rec
527                         ,  p_rev_op_res_unexp_rec     => l_rev_op_res_unexp_rec
528                         ,  p_old_rev_op_resource_rec  => l_old_rev_op_resource_rec
529                         ,  p_old_rev_op_res_unexp_rec => l_old_rev_op_res_unexp_rec
530                         ,  p_control_rec              => Bom_Rtg_Pub.G_Default_Control_Rec
531                         ,  x_rev_op_resource_rec      => l_rev_op_resource_rec
532                         ,  x_rev_op_res_unexp_rec     => l_rev_op_res_unexp_rec
533                         ,  x_return_status            => l_return_status
534                         ,  x_mesg_token_tbl           => l_mesg_token_tbl
535                         );
536                 END IF;
537 
538                 --dbms_output.put_line('return_status: ' || l_return_status);
539 
540                 IF l_return_status = Error_Handler.G_STATUS_ERROR
541                 THEN
542                         RAISE EXC_SEV_QUIT_RECORD;
543                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
544                 THEN
545                         RAISE EXC_UNEXP_SKIP_OBJECT;
546                 ELSIF l_return_status ='S' AND
547                       l_Mesg_Token_Tbl.COUNT <>0
548                 THEN
549                         Eco_Error_Handler.Log_Error
550                         (  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
551                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
552                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
553                         ,  p_error_status         => 'W'
554                         ,  p_error_level          => Error_Handler.G_RES_LEVEL
555                         ,  p_entity_index         => I
556                         ,  x_eco_rec              => l_eco_rec
557                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
558                         ,  x_revised_item_tbl     => l_revised_item_tbl
559                         ,  x_rev_component_tbl    => l_rev_component_tbl
560                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
561                         ,  x_sub_component_tbl    => l_sub_component_tbl
562                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
563                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
564                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
565                         );
566                 END IF;
567         END IF;
568 
569         -- Process Flow step 13 : Database Writes
570 --dbms_output.put_line('checking if to write to db');
571         IF g_control_rec.write_to_db
572         THEN
573                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
574                 bom_rtg_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
575                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
576                 bom_rtg_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
577 
578                 --dbms_output.put_line('Writing to the database');
579                 Bom_Op_Res_Util.Perform_Writes
580                 (   p_rev_op_resource_rec       => l_rev_op_resource_rec
581                 ,   p_rev_op_res_unexp_rec      => l_rev_op_res_unexp_rec
582                 ,   p_control_rec               => Bom_Rtg_Pub.G_Default_Control_Rec
583                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
584                 ,   x_return_status             => l_return_status
585                 );
586 
587                 --dbms_output.put_line('return_status: ' || l_return_status);
588 
589                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
590                 THEN
591                         RAISE EXC_UNEXP_SKIP_OBJECT;
592                 ELSIF l_return_status ='S' AND
593                       l_Mesg_Token_Tbl.COUNT <>0
594                 THEN
595                         Eco_Error_Handler.Log_Error
596                         (  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
597                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
598                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
599                         ,  p_error_status         => 'W'
600                         ,  p_error_level          => Error_Handler.G_RES_LEVEL
601                         ,  p_entity_index         => I
602                         ,  x_eco_rec              => l_eco_rec
603                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
604                         ,  x_revised_item_tbl     => l_revised_item_tbl
605                         ,  x_rev_component_tbl    => l_rev_component_tbl
606                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
607                         ,  x_sub_component_tbl    => l_sub_component_tbl
608                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
609                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
610                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
611                         );
612                 END IF;
613         END IF;
614 
615         l_rev_op_resource_tbl(I) := l_rev_op_resource_rec;
616 
617   EXCEPTION
618 
619     WHEN EXC_SEV_QUIT_RECORD THEN
620 
621         --dbms_output.put_line('Expected error generated');
622         l_rev_op_resource_tbl(I) := l_rev_op_resource_rec;
623         Eco_Error_Handler.Log_Error
624                 (  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
625                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
626                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
627                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
628                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
629                 ,  p_error_level          => Error_Handler.G_RES_LEVEL
630                 ,  p_entity_index         => I
631                 ,  x_eco_rec              => l_eco_rec
632                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
633                 ,  x_revised_item_tbl     => l_revised_item_tbl
634                 ,  x_rev_component_tbl    => l_rev_component_tbl
635                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
636                 ,  x_sub_component_tbl    => l_sub_component_tbl
637                 ,  x_rev_operation_tbl    => l_rev_operation_tbl
638                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
639                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
640                 );
641 
642         x_return_status                := l_return_status;
643         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
644         x_ECO_rec                      := l_ECO_rec;
645         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;
646         x_unexp_rev_op_res_rec         := l_rev_op_res_unexp_rec;
647         x_eco_revision_tbl             := l_eco_revision_tbl;
648         x_revised_item_tbl             := l_revised_item_tbl;
649         x_ref_designator_tbl           := l_ref_designator_tbl;
650         x_sub_component_tbl            := l_sub_component_tbl;
651         x_rev_component_tbl            := l_rev_component_tbl;
652         x_rev_operation_tbl            := l_rev_operation_tbl;
653         x_rev_sub_resource_tbl        := l_rev_sub_resource_tbl;
654 
655         RETURN;
656 
657     WHEN EXC_UNEXP_SKIP_OBJECT THEN
658 
659         --dbms_output.put_line('Unexpected error generated');
660         Eco_Error_Handler.Log_Error
661                 (  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
662                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
663                 ,  p_error_status         => Error_Handler.G_STATUS_UNEXPECTED
664                 ,  p_other_status         => Error_Handler.G_STATUS_NOT_PICKED
665                 ,  p_other_message        => l_other_message
666                 ,  p_other_token_tbl      => l_other_token_tbl
667                 ,  p_error_level          => Error_Handler.G_RES_LEVEL
668                 ,  p_entity_index         => I
669                 ,  x_ECO_rec              => l_ECO_rec
670                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
671                 ,  x_revised_item_tbl     => l_revised_item_tbl
672                 ,  x_rev_component_tbl    => l_rev_component_tbl
673                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
674                 ,  x_sub_component_tbl    => l_sub_component_tbl
675                 ,  x_rev_operation_tbl    => l_rev_operation_tbl
676                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
677                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
678                 );
679 
680         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
681         x_ECO_rec                      := l_ECO_rec;
682         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;
683         x_unexp_rev_op_res_rec         := l_rev_op_res_unexp_rec;
684         x_eco_revision_tbl             := l_eco_revision_tbl;
685         x_revised_item_tbl             := l_revised_item_tbl;
686         x_ref_designator_tbl           := l_ref_designator_tbl;
687         x_rev_component_tbl            := l_rev_component_tbl;
688         x_sub_component_tbl            := l_sub_component_tbl;
689         x_rev_operation_tbl            := l_rev_operation_tbl;
690         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;
691 
692         l_return_status := 'U';
693 
694   END;
695   END LOOP; -- END revised items processing block
696 
697     IF l_return_status in ('Q', 'U')
698     THEN
699         x_return_status := l_return_status;
700         RETURN;
701     END IF;
702 
703     l_bo_return_status := l_return_status;
704 
705      x_return_status            := l_bo_return_status;
706      x_ECO_rec                  := l_ECO_rec;
707      x_unexp_rev_op_res_rec     := l_rev_op_res_unexp_Rec;
708      x_eco_revision_tbl         := l_eco_revision_tbl;
709      x_revised_item_tbl         := l_revised_item_tbl;
710      x_rev_component_tbl        := l_rev_component_tbl;
711      x_ref_designator_tbl       := l_ref_designator_tbl;
712      x_sub_component_tbl        := l_sub_component_tbl;
713      x_rev_operation_tbl        := l_rev_operation_tbl;
714      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;
715      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;
716      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
717 
718 END Rev_Op_Res;
719 
720 -- Added by Masahiko Mochizuki on 09/12/00
721 --  Rev_Ops
722 
723 PROCEDURE Rev_Ops
724 (   p_rev_operation_tbl             IN  BOM_RTG_PUB.Rev_operation_Tbl_Type
725 ,   p_unexp_rev_op_rec              IN  BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type
726 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_op_resource_Tbl_Type
727 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_sub_resource_Tbl_Type
728 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
729 ,   x_unexp_rev_op_rec              IN OUT NOCOPY BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type
730 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
731 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
732 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
733 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
734 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
735 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type
736 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type
737 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type
738 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
739 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
740 )
741 IS
742 
743 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
744 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
745 l_other_message         VARCHAR2(50);
746 l_err_text              VARCHAR2(2000);
747 l_valid                 BOOLEAN := TRUE;
748 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
749 l_bo_return_status      VARCHAR2(1) := 'S';
750 l_rev_operation_Rec     BOM_RTG_PUB.Rev_Operation_Rec_Type;
751 l_rev_op_unexp_Rec      BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type := p_unexp_rev_op_rec;
752 l_old_rev_operation_Rec BOM_RTG_PUB.Rev_Operation_Rec_Type := NULL;
753 l_old_rev_op_unexp_Rec  BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type := NULL;
754 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
755 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
756 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
757 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
758 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type;
759 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type;
760 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type := p_rev_operation_tbl;
761 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type := p_rev_op_resource_tbl;
762 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;
763 l_return_value          NUMBER;
764 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
765 l_query_op_seq_num      NUMBER := NULL;
766 -- Bug no:2770096
767 l_routing_sequence_id   NUMBER := NULL;
768 l_query_effective_date  DATE := NULL;
769 
770 EXC_SEV_QUIT_RECORD     EXCEPTION;
771 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
772 
773 BEGIN
774 
775     -- Begin block that processes revised items. This block holds the exception handlers
776     -- for header errors.
777 
778 IF BOM_Globals.get_debug = 'Y'
779 THEN
780      error_handler.write_debug('At the beginning of Rev_Op, the rec count is');
781      error_handler.write_debug( l_rev_operation_tbl.COUNT);
782 END IF;
783  FOR I IN 1..l_rev_operation_tbl.COUNT LOOP
784     BEGIN
785         --  Load local records.
786 
787         l_rev_operation_rec := l_rev_operation_tbl(I);
788 
789         l_rev_operation_rec.transaction_type :=
790                 UPPER(l_rev_operation_rec.transaction_type);
791 
792         l_return_status := FND_API.G_RET_STS_SUCCESS;
793         l_rev_operation_rec.return_status := FND_API.G_RET_STS_SUCCESS;
794 
795         -- Process Flow step 3: Verify Revised Operation's existence
796         --
797 IF BOM_Globals.get_debug = 'Y'
798 THEN
799      error_handler.write_debug('At the beginning of check existence');
800 END IF;
801         IF g_control_rec.check_existence
802         THEN
803                 --dbms_output.put_line('Checking Existence');
804                 Bom_Validate_Op_Seq.Check_Existence
805                 (  p_rev_operation_rec     => l_rev_operation_rec
806                 ,  p_rev_op_unexp_rec      => l_rev_op_unexp_rec
807                 ,  x_old_rev_operation_rec => l_old_rev_operation_rec
808                 ,  x_old_rev_op_unexp_rec  => l_old_rev_op_unexp_rec
809                 ,  x_return_status         => l_return_status
810                 ,  x_mesg_token_tbl        => l_mesg_token_tbl
811                 );
812 
813 IF BOM_Globals.get_debug = 'Y'
814 THEN
815      error_handler.write_debug('After check existence, the return status is');
816      error_handler.write_debug( l_Return_Status);
817 END IF;
818 
819 
820                 IF l_return_status = Error_Handler.G_STATUS_ERROR
821                 THEN
822                         RAISE EXC_SEV_QUIT_RECORD;
823                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
824                 THEN
825                         RAISE EXC_UNEXP_SKIP_OBJECT;
826                 END IF;
827         END IF;
828 
829         -- Set parent revised item attributes
830         Set_RevItem_Attributes
831         (  p_revised_item_sequence_id    => l_rev_op_unexp_rec.revised_item_sequence_id
832          , p_bo_processed                => 'RTG'
833         ) ;
834 
835 
836         IF g_control_rec.attribute_defaulting AND
837            l_rev_operation_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE
838         THEN
839 
840                 -- Process Flow step 9: Default missing values for Operation CREATE
841 IF BOM_Globals.get_debug = 'Y'
842 THEN
843      error_handler.write_debug('before op_seq attribute , the return status is');
844      error_handler.write_debug( l_Return_Status);
845 END IF;
846                 Bom_Default_Op_Seq.Attribute_Defaulting
847                 (  p_rev_operation_rec     => l_rev_operation_rec
848                 ,  p_rev_op_unexp_rec      => l_rev_op_unexp_rec
849                 ,  p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
850                 ,  x_rev_operation_rec     => l_rev_operation_rec
851                 ,  x_rev_op_unexp_rec      => l_rev_op_unexp_rec
852                 ,  x_return_status         => l_return_status
853                 ,  x_mesg_token_tbl        => l_mesg_token_tbl
854                 );
855 
856                 --dbms_output.put_line('pvt item num: ' || to_char(l_rev_operation_rec.item_sequence_number));
857 
858                 --dbms_output.put_line('return_status: ' || l_return_status);
859 
860                 IF l_return_status = Error_Handler.G_STATUS_ERROR
861                 THEN
862                         RAISE EXC_SEV_QUIT_RECORD;
863                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
864                 THEN
865                         RAISE EXC_UNEXP_SKIP_OBJECT;
866                 ELSIF l_return_status ='S' AND                     l_Mesg_Token_Tbl.COUNT <>0
867                 THEN
868                         Eco_Error_Handler.Log_Error
869                         (  p_rev_operation_tbl    => l_rev_operation_tbl
870                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
871                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
872                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
873                         ,  p_error_status         => 'W'
874                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
875                         ,  p_entity_index         => I
876                         ,  x_eco_rec              => l_eco_rec
877                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
878                         ,  x_revised_item_tbl     => l_revised_item_tbl
879                         ,  x_rev_component_tbl    => l_rev_component_tbl
880                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
881                         ,  x_sub_component_tbl    => l_sub_component_tbl
882                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
883                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
884                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
885                         );
886                 END IF;
887         END IF;
888 
889 
890         IF ((g_control_rec.entity_defaulting AND
891              NOT g_control_rec.attribute_defaulting)
892             OR
893             g_control_rec.entity_validation)
894            AND
895            (l_rev_operation_rec.transaction_type='UPDATE'
896             OR
897            (l_rev_operation_rec.transaction_type = 'CREATE'
898             AND l_rev_operation_rec.acd_type = 2)
899             )
900         THEN
901                 IF l_rev_operation_rec.transaction_type='UPDATE'
902                 THEN
903 
904                      -- Bug #1614911
905                      -- Form does not have new operatin seq num.
906                      -- and Form always passes the new operation seq num value
907                      -- to operation_sequence_number and new_operation_sequence_number
908                      -- in l_rev_operation_rec.
909                      --
910                      -- Hence theis logic get the original op seq num and
911                      -- effective date using operation_sequence_id
912                      -- Bug no:2770096 ,selecting routing_sequence_id also
913                      BEGIN
914 
915                          SELECT operation_seq_num ,
916                                 effectivity_date ,
917 				routing_sequence_id
918                          INTO   l_query_op_seq_num ,
919                                 l_query_effective_date,
920 				l_routing_sequence_id
921                          FROM   BOM_OPERATION_SEQUENCES
922                          WHERE  operation_sequence_id
923                                   =  l_rev_op_unexp_rec.operation_sequence_id  ;
924                      EXCEPTION
925                          WHEN OTHERS THEN
926                               NULL ;
927                      END  ;
928 
929                      /* Comment Out
930                         l_query_op_seq_num := l_rev_operation_rec.new_operation_sequence_number;
931                         l_query_effective_date := l_rev_operation_rec.start_effective_date;
932                      */
933                 ELSE
934                         l_query_op_seq_num := l_rev_operation_rec.old_operation_sequence_number;
935                         l_query_effective_date := l_rev_operation_rec.old_start_effective_date;
936                 END IF;
937 
938                 --dbms_output.put_line('querying row');
939 
940 IF BOM_Globals.get_debug = 'Y'
941 THEN
942      error_handler.write_debug('before query_row, the return status is');
943      error_handler.write_debug( l_Return_Status);
944 END IF;
945 
946 --Bug 2827097
947 
948 if(l_rev_operation_rec.acd_type = 2 )then
949    l_routing_sequence_id :=l_rev_op_unexp_rec.routing_sequence_id;
950 end if;
951 
952 --end of Bug 2827097
953                 Bom_Op_Seq_Util.Query_Row
954                    -- Modified conditions for Bug1609574
955                    ( p_operation_sequence_number => l_query_op_seq_num
956                                                     --  l_rev_operation_rec.old_operation_sequence_number
957                    , p_effectivity_date          => l_query_effective_date
958                                                     --  l_rev_operation_rec.old_start_effective_date
959                    , p_routing_sequence_id       => l_routing_sequence_id --Bug no:2770096
960 		                                   --l_rev_op_unexp_rec.routing_sequence_id
961                    , p_operation_type            => l_rev_operation_rec.operation_type
962                    , p_mesg_token_tbl            => l_mesg_token_tbl
963                    , x_rev_operation_rec         => l_old_rev_operation_rec
964                    , x_rev_op_unexp_rec          => l_old_rev_op_unexp_rec
965                    , x_mesg_token_tbl            => l_mesg_token_tbl
966                    , x_return_status             => l_return_status
967                    );
968 
969                 --dbms_output.put_line('query return_status: ' || l_return_status);
970 
971                 IF l_return_status = 'N'
972                 THEN
973                         -- Added for Bug1609574
974                         l_return_status := Error_Handler.G_STATUS_ERROR ;
975                         l_Token_Tbl(1).token_name := 'OP_SEQ_NUMBER';
976                         l_Token_Tbl(1).token_value :=
977                                  l_rev_operation_rec.operation_sequence_number ;
978 
979                         Error_Handler.Add_Error_Token
980                         ( p_message_name       => 'BOM_OP_CREATE_REC_NOT_FOUND'
981                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
982                         , p_token_tbl          => l_Token_Tbl
983                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
984                         );
985 
986                         RAISE EXC_SEV_QUIT_RECORD;
987                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
988                 THEN
989                         RAISE EXC_UNEXP_SKIP_OBJECT;
990                 ELSIF l_return_status ='S' AND
991                       l_Mesg_Token_Tbl.COUNT <>0
992                 THEN
993                         Eco_Error_Handler.Log_Error
994                         (  p_rev_operation_tbl    => l_rev_operation_tbl
995                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
996                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
997                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
998                         ,  p_error_status         => 'W'
999                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
1000                         ,  p_entity_index         => I
1001                         ,  x_eco_rec              => l_eco_rec
1002                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
1003                         ,  x_revised_item_tbl     => l_revised_item_tbl
1004                         ,  x_rev_component_tbl    => l_rev_component_tbl
1005                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
1006                         ,  x_sub_component_tbl    => l_sub_component_tbl
1007                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
1008                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1009                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1010                         );
1011 
1012                 END IF;
1013 
1014 /*              IF l_return_status = 'F'
1015                 THEN
1016                         dbms_output.put_line('queried old record');
1017                 ELSIF l_return_status = 'N'
1018                 THEN
1019                         dbms_output.put_line('old record not found');
1020                 END IF;*/
1021         END IF;
1022 
1023      -- Process Flow step 11 - Entity Level Defaulting
1024 
1025         IF g_control_rec.entity_defaulting
1026         THEN
1027                 --dbms_output.put_line('Entity Defaulting');
1028 IF BOM_Globals.get_debug = 'Y'
1029 THEN
1030      error_handler.write_debug('before entity_defaulting , the return status is');
1031      error_handler.write_debug( l_Return_Status);
1032 END IF;
1033 
1034                 Bom_Default_Op_Seq.Entity_Defaulting
1035                 (   p_rev_operation_rec     => l_rev_operation_rec
1036                 ,   p_rev_op_unexp_rec      => l_rev_op_unexp_rec
1037                 ,   p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
1038                 ,   x_rev_operation_rec     => l_rev_operation_rec
1039                 ,   x_rev_op_unexp_rec      => l_rev_op_unexp_rec
1040                 ,   x_return_status         => l_return_status
1041                 ,   x_mesg_token_tbl        => l_mesg_token_tbl
1042                 );
1043 
1044                 --dbms_output.put_line('pvt item num: ' || to_char(l_rev_operation_rec.item_sequence_number));
1045 
1046                 --dbms_output.put_line('return_status: ' || l_return_status);
1047 
1048                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1049                 THEN
1050                         RAISE EXC_SEV_QUIT_RECORD;
1051                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1052                 THEN
1053                         RAISE EXC_UNEXP_SKIP_OBJECT;
1054                 ELSIF l_return_status ='S' AND
1055                       l_Mesg_Token_Tbl.COUNT <>0
1056                 THEN
1057                         Eco_Error_Handler.Log_Error
1058                         (  p_rev_operation_tbl    => l_rev_operation_tbl
1059                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
1060                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1061                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
1062                         ,  p_error_status         => 'W'
1063                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
1064                         ,  p_entity_index         => I
1065                         ,  x_eco_rec              => l_eco_rec
1066                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
1067                         ,  x_revised_item_tbl     => l_revised_item_tbl
1068                         ,  x_rev_component_tbl    => l_rev_component_tbl
1069                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
1070                         ,  x_sub_component_tbl    => l_sub_component_tbl
1071                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
1072                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1073                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1074                         );
1075                 END IF;
1076         END IF;
1077 
1078      -- Process Flow step 12 - Entity Level Validation
1079         IF g_control_rec.entity_validation
1080         THEN
1081 
1082 IF BOM_Globals.get_debug = 'Y'
1083 THEN
1084      error_handler.write_debug('before entity validation , the return status is');
1085      error_handler.write_debug( l_Return_Status);
1086 END IF;
1087 
1088                 --dbms_output.put_line('Entity validation');
1089                 IF l_rev_operation_rec.transaction_type = 'DELETE'
1090                 THEN
1091                         NULL;
1092                         /*Eng_Validate_Revised_Item.Check_Entity_Delete
1093                         (  p_rev_operation_rec    => l_rev_operation_rec
1094                         ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
1095                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
1096                         ,  x_return_status        => l_Return_Status
1097                         );*/
1098                 ELSE
1099 IF BOM_Globals.get_debug = 'Y'
1100 THEN
1101      error_handler.write_debug('before calling Bom_Validate_Op_Seq.Check_Entity,the return status is');
1102      error_handler.write_debug( l_Return_Status);
1103      error_handler.write_debug( l_rev_operation_rec.operation_sequence_number);
1104       error_handler.write_debug( l_rev_operation_rec.count_point_type);
1105       error_handler.write_debug( l_rev_operation_rec.backflush_flag);
1106 
1107      error_handler.write_debug(  'then all others:'           );
1108       error_handler.write_debug(  l_rev_operation_rec.eco_name           );
1109       error_handler.write_debug(  l_rev_operation_rec.organization_code  );
1110       error_handler.write_debug(  l_rev_operation_rec.revised_item_name );
1111       error_handler.write_debug(  l_rev_operation_rec.new_revised_item_revision  );
1112       error_handler.write_debug(  l_rev_operation_rec.ACD_Type                );
1113       error_handler.write_debug(  l_rev_operation_rec.Alternate_Routing_Code   );
1114       error_handler.write_debug(  l_rev_operation_rec.Operation_Type        );
1115       error_handler.write_debug(  l_rev_operation_rec.Start_Effective_Date  );
1116       error_handler.write_debug(  l_rev_operation_rec.new_operation_sequence_number);
1117       error_handler.write_debug(  l_rev_operation_rec.Old_Operation_Sequence_Number );
1118       error_handler.write_debug(  l_rev_operation_rec.Old_Start_Effective_Date    );
1119       error_handler.write_debug(  l_rev_operation_rec.Standard_Operation_Code   );
1120       error_handler.write_debug(  l_rev_operation_rec.Department_Code           );
1121       error_handler.write_debug(  l_rev_operation_rec.Op_Lead_Time_Percent     );
1122       error_handler.write_debug(  l_rev_operation_rec.Minimum_Transfer_Quantity);
1123       error_handler.write_debug(  l_rev_operation_rec.Operation_Description    );
1124       error_handler.write_debug(  l_rev_operation_rec.Disable_Date            );
1125       error_handler.write_debug(  l_rev_operation_rec.Option_Dependent_Flag   );
1126       error_handler.write_debug(  l_rev_operation_rec.Reference_Flag         );
1127       error_handler.write_debug(  l_rev_operation_rec.Yield                  );
1128       error_handler.write_debug(  l_rev_operation_rec.Cumulative_Yield       );
1129       error_handler.write_debug(  l_rev_operation_rec.Cancel_Comments       );
1130       error_handler.write_debug(  l_rev_operation_rec.Attribute_category);
1131     error_handler.write_debug( 'After attribute_category');
1132       error_handler.write_debug(  l_rev_operation_rec.Original_System_Reference   );
1133       error_handler.write_debug(  l_rev_operation_rec.Transaction_Type        );
1134       error_handler.write_debug(  l_rev_operation_rec.Return_Status          );
1135 END IF;
1136 
1137 
1138 
1139 
1140                         Bom_Validate_Op_Seq.Check_Entity
1141                         (  p_rev_operation_rec     => l_rev_operation_rec
1142                         ,  p_rev_op_unexp_rec      => l_rev_op_unexp_rec
1143                         ,  p_old_rev_operation_rec => l_old_rev_operation_rec
1144                         ,  p_old_rev_op_unexp_rec  => l_old_rev_op_unexp_rec
1145                         ,  p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
1146                         ,  x_rev_operation_rec     => l_rev_operation_rec
1147                         ,  x_rev_op_unexp_rec      => l_rev_op_unexp_rec
1148                         ,  x_return_status         => l_return_status
1149                         ,  x_mesg_token_tbl        => l_mesg_token_tbl
1150                         );
1151 
1152                 END IF;
1153 
1154                 --dbms_output.put_line('return_status: ' || l_return_status);
1155 
1156                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1157                 THEN
1158                         RAISE EXC_SEV_QUIT_RECORD;
1159                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1160                 THEN
1161                         RAISE EXC_UNEXP_SKIP_OBJECT;
1162                 ELSIF l_return_status ='S' AND
1163                       l_Mesg_Token_Tbl.COUNT <>0
1164                 THEN
1165                         --dbms_output.put_line('logging warnings');
1166                         Eco_Error_Handler.Log_Error
1167                         (  p_rev_operation_tbl    => l_rev_operation_tbl
1168                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
1169                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1170                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
1171                         ,  p_error_status         => 'W'
1172                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
1173                         ,  p_entity_index         => I
1174                         ,  x_eco_rec              => l_eco_rec
1175                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
1176                         ,  x_revised_item_tbl     => l_revised_item_tbl
1177                         ,  x_rev_component_tbl    => l_rev_component_tbl
1178                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
1179                         ,  x_sub_component_tbl    => l_sub_component_tbl
1180                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
1181                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1182                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1183                         );
1184                 END IF;
1185         END IF;
1186 
1187         -- Process Flow step 13 : Database Writes
1188 
1189 
1190         IF g_control_rec.write_to_db
1191         THEN
1192 
1193 IF BOM_Globals.get_debug = 'Y'
1194 THEN
1195      error_handler.write_debug('Before write_to_db, the return status is');
1196      error_handler.write_debug( l_Return_Status);
1197      error_handler.write_debug( l_rev_op_unexp_rec.operation_sequence_id);
1198 END IF;
1199                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
1200                 bom_rtg_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
1201                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
1202                 bom_rtg_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
1203 
1204            --Bug 9088260 changes begin
1205  	           IF(l_rev_operation_rec.alternate_routing_code is NULL)
1206  	           THEN
1207              ENG_Globals.Perform_Writes_For_Primary_Rtg
1208               (   p_rev_operation_rec       => l_rev_operation_rec
1209               ,   p_rev_op_unexp_rec        => l_rev_op_unexp_rec
1210               ,   x_mesg_token_tbl          => l_mesg_token_tbl
1211               ,   x_return_status           => l_return_status
1212               ) ;
1213              ELSE
1214  	              ENG_Globals.Perform_Writes_For_Alt_Rtg
1215  	               (   p_rev_operation_rec       => l_rev_operation_rec
1216  	               ,   p_rev_op_unexp_rec        => l_rev_op_unexp_rec
1217  	               ,   x_mesg_token_tbl          => l_mesg_token_tbl
1218  	               ,   x_return_status           => l_return_status
1219  	               ) ;
1220  	             END IF;
1221  	              --Bug  9088260  changes end
1222            IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1223            THEN
1224                l_other_message := 'BOM_OP_WRITES_UNEXP_SKIP';
1225                l_other_token_tbl(1).token_name := 'OP_SEQ_NUMBER';
1226                l_other_token_tbl(1).token_value :=
1227                           l_rev_operation_rec.operation_sequence_number ;
1228                RAISE EXC_UNEXP_SKIP_OBJECT ;
1229            ELSIF l_return_status ='S' AND
1230                l_mesg_token_tbl .COUNT <>0
1231            THEN
1232                ECO_Error_Handler.Log_Error
1233                (  p_rev_operation_tbl   => l_rev_operation_tbl
1234                ,  p_rev_op_resource_tbl => l_rev_op_resource_tbl
1235                ,  p_rev_sub_resource_tbl=> l_rev_sub_resource_tbl
1236                ,  p_mesg_token_tbl      => l_mesg_token_tbl
1237                ,  p_error_status        => 'W'
1238                ,  p_error_level         => Error_Handler.G_OP_LEVEL
1239                ,  p_entity_index        => I
1240                ,  x_ECO_rec             => l_ECO_rec
1241                ,  x_eco_revision_tbl    => l_eco_revision_tbl
1242                ,  x_revised_item_tbl    => l_revised_item_tbl
1243                ,  x_rev_component_tbl   => l_rev_component_tbl
1244                ,  x_ref_designator_tbl  => l_ref_designator_tbl
1245                ,  x_sub_component_tbl   => l_sub_component_tbl
1246                ,  x_rev_operation_tbl   => l_rev_operation_tbl
1247                ,  x_rev_op_resource_tbl => l_rev_op_resource_tbl
1248                ,  x_rev_sub_resource_tbl=> l_rev_sub_resource_tbl
1249                ) ;
1250            END IF;
1251 
1252                 --dbms_output.put_line('Writing to the database');
1253                 BOM_Op_Seq_Util.Perform_Writes
1254                 (   p_rev_operation_rec     => l_rev_operation_rec
1255                 ,   p_rev_op_unexp_rec      => l_rev_op_unexp_rec
1256                 ,   p_control_rec           => Bom_Rtg_Pub.G_Default_Control_Rec
1257                 ,   x_return_status         => l_return_status
1258                 ,   x_mesg_token_tbl        => l_mesg_token_tbl
1259                 );
1260 
1261                 --dbms_output.put_line('return_status: ' || l_return_status);
1262 
1263                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1264                 THEN
1265                         RAISE EXC_UNEXP_SKIP_OBJECT;
1266                 ELSIF l_return_status ='S' AND
1267                       l_Mesg_Token_Tbl.COUNT <>0
1268                 THEN
1269                         Eco_Error_Handler.Log_Error
1270                         (  p_rev_operation_tbl    => l_rev_operation_tbl
1271                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
1272                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1273                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
1274                         ,  p_error_status         => 'W'
1275                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
1276                         ,  p_entity_index         => I
1277                         ,  x_eco_rec              => l_eco_rec
1278                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
1279                         ,  x_revised_item_tbl     => l_revised_item_tbl
1280                         ,  x_rev_component_tbl    => l_rev_component_tbl
1281                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
1282                         ,  x_sub_component_tbl    => l_sub_component_tbl
1283                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
1284                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1285                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1286                         );
1287                 END IF;
1288         END IF;
1289 
1290         l_rev_operation_tbl(I) := l_rev_operation_rec;
1291 
1292 
1293 IF BOM_Globals.get_debug = 'Y'
1294 THEN
1295     error_handler.write_debug( 'after checck entity ');
1296    error_handler.write_debug( l_rev_operation_tbl(1).operation_sequence_number);
1297       error_handler.write_debug( l_rev_operation_tbl(1).count_point_type);
1298       error_handler.write_debug( l_rev_operation_tbl(1).backflush_flag);
1299 
1300      error_handler.write_debug(  'then all others:'           );
1301       error_handler.write_debug(  l_rev_operation_tbl(1).eco_name           );
1302       error_handler.write_debug(  l_rev_operation_tbl(1).organization_code  );
1303       error_handler.write_debug(  l_rev_operation_tbl(1).revised_item_name );
1304       error_handler.write_debug(  l_rev_operation_tbl(1).new_revised_item_revision  );
1305       error_handler.write_debug(  l_rev_operation_tbl(1).ACD_Type                );
1306       error_handler.write_debug(  l_rev_operation_tbl(1).Alternate_Routing_Code   );
1307       error_handler.write_debug(  l_rev_operation_tbl(1).Operation_Type        );
1308       error_handler.write_debug(  l_rev_operation_tbl(1).Start_Effective_Date  );
1309       error_handler.write_debug(  l_rev_operation_tbl(1).new_operation_sequence_number);
1310       error_handler.write_debug(  l_rev_operation_tbl(1).Old_Operation_Sequence_Number );
1311       error_handler.write_debug(  l_rev_operation_tbl(1).Old_Start_Effective_Date    );
1312       error_handler.write_debug(  l_rev_operation_tbl(1).Standard_Operation_Code   );
1313       error_handler.write_debug(  l_rev_operation_tbl(1).Department_Code           );
1314       error_handler.write_debug(  l_rev_operation_tbl(1).Op_Lead_Time_Percent     );
1315       error_handler.write_debug(  l_rev_operation_tbl(1).Minimum_Transfer_Quantity);
1316       error_handler.write_debug(  l_rev_operation_tbl(1).Operation_Description    );
1317       error_handler.write_debug(  l_rev_operation_tbl(1).Disable_Date            );
1318       error_handler.write_debug(  l_rev_operation_tbl(1).Option_Dependent_Flag   );
1319       error_handler.write_debug(  l_rev_operation_tbl(1).Reference_Flag         );
1320       error_handler.write_debug(  l_rev_operation_tbl(1).Yield                  );
1321       error_handler.write_debug(  l_rev_operation_tbl(1).Cumulative_Yield       );
1322       error_handler.write_debug(  l_rev_operation_tbl(1).Cancel_Comments       );
1323       error_handler.write_debug(  l_rev_operation_tbl(1).Attribute_category);
1324     error_handler.write_debug( 'After attribute_category');
1325       error_handler.write_debug(  l_rev_operation_tbl(1).Original_System_Reference   );
1326       error_handler.write_debug(  l_rev_operation_tbl(1).Transaction_Type        );
1327       error_handler.write_debug(  l_rev_operation_tbl(1).Return_Status          );
1328   --    error_handler.write_debug(     l_rev_operation_tbl(1).Revised_Item_Sequence_Id    );
1329    --   error_handler.write_debug(     l_rev_operation_tbl(1).Operation_Sequence_Id      );
1330    --   error_handler.write_debug(     l_rev_operation_tbl(1).Old_Operation_Sequence_Id  );
1331    --   error_handler.write_debug(     l_rev_operation_tbl(1).Routing_Sequence_Id      );
1332    --   error_handler.write_debug(     l_rev_operation_tbl(1).Revised_Item_Id          );
1333    --   error_handler.write_debug(     l_rev_operation_tbl(1).Organization_Id          );
1334    --   error_handler.write_debug(     l_rev_operation_tbl(1).Standard_Operation_Id    );
1335     --  error_handler.write_debug(     l_rev_operation_tbl(1).Department_Id            );
1336 
1337      error_handler.write_debug('End of Rev_Op, the return status is');
1338      error_handler.write_debug( l_Return_Status);
1339 END IF;
1340 
1341   EXCEPTION
1342 
1343     WHEN EXC_SEV_QUIT_RECORD THEN
1344 
1345         --dbms_output.put_line('Expected error generated');
1346         l_rev_operation_tbl(I) := l_rev_operation_rec;
1347         Eco_Error_Handler.Log_Error
1348                         (  p_rev_operation_tbl    => l_rev_operation_tbl
1349                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
1350                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1351                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
1352                         ,  p_error_status         => FND_API.G_RET_STS_ERROR
1353                         ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
1354                         ,  p_error_level          => Error_Handler.G_OP_LEVEL
1355                         ,  p_entity_index         => I
1356                         ,  x_eco_rec              => l_eco_rec
1357                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
1358                         ,  x_revised_item_tbl     => l_revised_item_tbl
1359                         ,  x_rev_component_tbl    => l_rev_component_tbl
1360                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
1361                         ,  x_sub_component_tbl    => l_sub_component_tbl
1362                         ,  x_rev_operation_tbl    => l_rev_operation_tbl
1363                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1364                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1365                         );
1366 
1367         x_return_status                := l_return_status;
1368         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1369         x_ECO_rec                      := l_ECO_rec;
1370         x_rev_operation_tbl            := l_rev_operation_tbl;
1371         x_unexp_rev_op_rec             := l_rev_op_unexp_rec;
1372         x_eco_revision_tbl             := l_eco_revision_tbl;
1373         x_revised_item_tbl             := l_revised_item_tbl;
1374         x_ref_designator_tbl           := l_ref_designator_tbl;
1375         x_sub_component_tbl            := l_sub_component_tbl;
1376         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;
1377         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;
1378                 --dbms_output.put_line('err pvt item num: ' || to_char(l_rev_operation_rec.item_sequence_number));
1379 
1380         RETURN;
1381 
1382     WHEN EXC_UNEXP_SKIP_OBJECT THEN
1383 
1384         --dbms_output.put_line('Unexpected error generated');
1385         Eco_Error_Handler.Log_Error
1386                 (  p_rev_operation_tbl    => l_rev_operation_tbl
1387                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl
1388                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1389                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
1390                 ,  p_error_status         => Error_Handler.G_STATUS_UNEXPECTED
1391                 ,  p_other_status         => Error_Handler.G_STATUS_NOT_PICKED
1392                 ,  p_other_message        => l_other_message
1393                 ,  p_other_token_tbl      => l_other_token_tbl
1394                 ,  p_error_level          => Error_Handler.G_OP_LEVEL
1395                 ,  p_entity_index         => I
1396                 ,  x_ECO_rec              => l_ECO_rec
1397                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
1398                 ,  x_revised_item_tbl     => l_revised_item_tbl
1399                 ,  x_rev_component_tbl    => l_rev_component_tbl
1400                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
1401                 ,  x_sub_component_tbl    => l_sub_component_tbl
1402                 ,  x_rev_operation_tbl    => l_rev_operation_tbl
1403                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl
1404                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl
1405                 );
1406 
1407         l_return_status := 'U';
1408 --dbms_output.put_line('unexp message' || l_mesg_token_tbl(1).message_text);
1409         x_return_status                := l_return_status;
1410         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1411         x_ECO_rec                      := l_ECO_rec;
1412         x_eco_revision_tbl             := l_eco_revision_tbl;
1413         x_revised_item_tbl             := l_revised_item_tbl;
1414         x_rev_component_tbl            := l_rev_component_tbl;
1415         x_ref_designator_tbl           := l_ref_designator_tbl;
1416         x_sub_component_tbl            := l_sub_component_tbl;
1417         x_rev_operation_tbl            := l_rev_operation_tbl;
1418         x_unexp_rev_op_rec             := l_rev_op_unexp_rec;
1419         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;
1420         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;
1421 
1422   END;
1423   END LOOP; -- END revised items processing block
1424 
1425     IF l_return_status in ('Q', 'U')
1426     THEN
1427         x_return_status := l_return_status;
1428         RETURN;
1429     END IF;
1430 
1431     l_bo_return_status := l_return_status;
1432 
1433      x_return_status            := l_bo_return_status;
1434      x_ECO_rec                  := l_ECO_rec;
1435      x_unexp_rev_op_rec         := l_rev_op_unexp_Rec;
1436      x_eco_revision_tbl         := l_eco_revision_tbl;
1437      x_revised_item_tbl         := l_revised_item_tbl;
1438      x_rev_component_tbl        := l_rev_component_tbl;
1439      x_ref_designator_tbl       := l_ref_designator_tbl;
1440      x_sub_component_tbl        := l_sub_component_tbl;
1441      x_rev_operation_tbl        := l_rev_operation_tbl;
1442      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;
1443      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;
1444      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
1445                 --dbms_output.put_line('end pvt item num: ' || to_char(l_rev_operation_rec.item_sequence_number));
1446 
1447 END Rev_Ops;
1448 
1449 --  Sub_Comps
1450 
1451 PROCEDURE Sub_Comps
1452 (   p_unexp_sub_comp_rec            IN  BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type
1453 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
1454 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
1455 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
1456 ,   x_unexp_sub_comp_rec            IN OUT NOCOPY BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type
1457 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
1458 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
1459 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
1460 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
1461 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
1462 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
1463 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
1464 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
1465 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
1466 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
1467 )
1468 IS
1469 
1470 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
1471 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
1472 l_other_message         VARCHAR2(50);
1473 l_err_text              VARCHAR2(2000);
1474 l_valid                 BOOLEAN := TRUE;
1475 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
1476 l_bo_return_status      VARCHAR2(1) := 'S';
1477 l_sub_component_Rec      BOM_BO_PUB.Sub_Component_Rec_Type;
1478 l_sub_comp_unexp_Rec     BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type := p_unexp_sub_comp_rec;
1479 l_old_sub_component_Rec  BOM_BO_PUB.Sub_Component_Rec_Type := NULL;
1480 l_old_sub_comp_unexp_Rec BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type := NULL;
1481 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
1482 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
1483 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
1484 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
1485 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
1486 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
1487 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type;     --add
1488 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type;   --add
1489 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type;  --add
1490 l_return_value          NUMBER;
1491 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
1492 
1493 EXC_SEV_QUIT_RECORD     EXCEPTION;
1494 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
1495 
1496 BEGIN
1497 
1498     -- Begin block that processes revised items. This block holds the exception handlers
1499     -- for header errors.
1500 
1501     FOR I IN 1..l_sub_component_tbl.COUNT LOOP
1502     BEGIN
1503         --  Load local records.
1504 
1505         l_sub_component_rec := l_sub_component_tbl(I);
1506 
1507         l_sub_component_rec.transaction_type :=
1508                 UPPER(l_sub_component_rec.transaction_type);
1509 
1510         l_return_status := FND_API.G_RET_STS_SUCCESS;
1511         l_sub_component_rec.return_status := FND_API.G_RET_STS_SUCCESS;
1512 
1513         -- Process Flow step 3: Verify Substitute Component's existence
1514         --
1515 
1516         IF g_control_rec.check_existence
1517         THEN
1518                 --dbms_output.put_line('Checking Existence');
1519                 Bom_Validate_Sub_Component.Check_Existence
1520                 (  p_sub_component_rec          => l_sub_component_rec
1521                 ,  p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
1522                 ,  x_old_sub_component_rec      => l_old_sub_component_rec
1523                 ,  x_old_sub_comp_unexp_rec     => l_old_sub_comp_unexp_rec
1524                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
1525                 ,  x_return_status              => l_Return_Status
1526                 );
1527 
1528                 --dbms_output.put_line('return_status: ' || l_return_status);
1529 
1530                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1531                 THEN
1532                         RAISE EXC_SEV_QUIT_RECORD;
1533                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1534                 THEN
1535                         RAISE EXC_UNEXP_SKIP_OBJECT;
1536                 END IF;
1537         END IF;
1538 
1539         -- Set parent revised item attributes
1540         Set_RevItem_Attributes
1541         (  p_revised_item_sequence_id    => l_sub_comp_unexp_rec.revised_item_sequence_id
1542          , p_bo_processed                => 'BOM'
1543         ) ;
1544 
1545 
1546      -- Process Flow step 12 - Entity Level Validation
1547 
1548         IF g_control_rec.entity_validation
1549         THEN
1550                 --dbms_output.put_line('Entity validation');
1551                 IF l_sub_component_rec.transaction_type = 'DELETE'
1552                 THEN
1553                         NULL;
1554                         /*Eng_Validate_Revised_Item.Check_Entity_Delete
1555                         (  p_rev_component_rec     => l_rev_component_rec
1556                         ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
1557                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
1558                         ,  x_return_status        => l_Return_Status
1559                         );*/
1560                 ELSE
1561                         Bom_Validate_Sub_Component.Check_Entity
1562                         (  p_sub_component_rec          => l_sub_component_rec
1563                         ,  p_sub_comp_unexp_rec         => l_sub_comp_unexp_rec
1564                         ,  p_control_rec                => g_control_rec
1565                         ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
1566                         ,  x_return_status              => l_Return_Status
1567                         );
1568                 END IF;
1569 
1570                 --dbms_output.put_line('return_status: ' || l_return_status);
1571 
1572                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1573                 THEN
1574                         RAISE EXC_SEV_QUIT_RECORD;
1575                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1576                 THEN
1577                         RAISE EXC_UNEXP_SKIP_OBJECT;
1578                 ELSIF l_return_status ='S' AND
1579                       l_Mesg_Token_Tbl.COUNT <>0
1580                 THEN
1581                         Eco_Error_Handler.Log_Error
1582                         (  p_ref_designator_tbl => l_ref_designator_tbl
1583                         ,  p_sub_component_tbl  => l_sub_component_tbl
1584                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
1585                         ,  p_error_status       => 'W'
1586                         ,  p_error_level        => 6
1587                         ,  p_entity_index       => I
1588                         ,  x_eco_rec            => l_eco_rec
1589                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
1590                         ,  x_revised_item_tbl   => l_revised_item_tbl
1591                         ,  x_rev_component_tbl  => l_rev_component_tbl
1592                         ,  x_ref_designator_tbl => l_ref_designator_tbl
1593                         ,  x_sub_component_tbl  => l_sub_component_tbl
1594                         ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1595                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1596                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1597                         );
1598                 END IF;
1599         END IF;
1600 
1601         -- Process Flow step 13 : Database Writes
1602 --dbms_output.put_line('checking if to write to db');
1603         IF g_control_rec.write_to_db
1604         THEN
1605                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
1606                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
1607 
1608                 --dbms_output.put_line('Writing to the database');
1609                 Bom_Sub_Component_Util.Perform_Writes
1610                 (   p_sub_component_rec         => l_sub_component_rec
1611                 ,   p_sub_comp_unexp_rec        => l_sub_comp_unexp_rec
1612                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
1613                 ,   x_return_status             => l_return_status
1614                 );
1615 
1616                 --dbms_output.put_line('return_status: ' || l_return_status);
1617 
1618                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1619                 THEN
1620                         RAISE EXC_UNEXP_SKIP_OBJECT;
1621                 ELSIF l_return_status ='S' AND
1622                       l_Mesg_Token_Tbl.COUNT <>0
1623                 THEN
1624                         Eco_Error_Handler.Log_Error
1625                         (  p_ref_designator_tbl => l_ref_designator_tbl
1626                         ,  p_sub_component_tbl  => l_sub_component_tbl
1627                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
1628                         ,  p_error_status       => 'W'
1629                         ,  p_error_level        => 6
1630                         ,  p_entity_index       => I
1631                         ,  x_eco_rec            => l_eco_rec
1632                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
1633                         ,  x_revised_item_tbl   => l_revised_item_tbl
1634                         ,  x_rev_component_tbl  => l_rev_component_tbl
1635                         ,  x_ref_designator_tbl => l_ref_designator_tbl
1636                         ,  x_sub_component_tbl  => l_sub_component_tbl
1637                         ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1638                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1639                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1640                         );
1641                 END IF;
1642         END IF;
1643 
1644         l_sub_component_tbl(I) := l_sub_component_rec;
1645 
1646   EXCEPTION
1647 
1648     WHEN EXC_SEV_QUIT_RECORD THEN
1649 
1650         --dbms_output.put_line('Expected error generated');
1651         l_sub_component_tbl(I) := l_sub_component_rec;
1652         Eco_Error_Handler.Log_Error
1653                 (  p_ref_designator_tbl => l_ref_designator_tbl
1654                 ,  p_sub_component_tbl  => l_sub_component_tbl
1655                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
1656                 ,  p_error_status       => FND_API.G_RET_STS_ERROR
1657                 ,  p_error_scope        => Error_Handler.G_SCOPE_RECORD
1658                 ,  p_error_level        => 6
1659                 ,  p_entity_index       => I
1660                 ,  x_eco_rec            => l_eco_rec
1661                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
1662                 ,  x_revised_item_tbl   => l_revised_item_tbl
1663                 ,  x_rev_component_tbl  => l_rev_component_tbl
1664                 ,  x_ref_designator_tbl => l_ref_designator_tbl
1665                 ,  x_sub_component_tbl  => l_sub_component_tbl
1666                 ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1667                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1668                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1669                 );
1670 
1671         x_return_status                := l_return_status;
1672         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1673         x_ECO_rec                      := l_ECO_rec;
1674         x_sub_component_tbl            := l_sub_component_tbl;
1675         x_unexp_sub_comp_rec           := l_sub_comp_unexp_rec;
1676         x_eco_revision_tbl             := l_eco_revision_tbl;
1677         x_revised_item_tbl             := l_revised_item_tbl;
1678         x_ref_designator_tbl           := l_ref_designator_tbl;
1679         x_rev_component_tbl            := l_rev_component_tbl;
1680         x_rev_operation_tbl            := l_rev_operation_tbl;     --add
1681         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --add
1682         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --add
1683 
1684         RETURN;
1685 
1686     WHEN EXC_UNEXP_SKIP_OBJECT THEN
1687 
1688         --dbms_output.put_line('Unexpected error generated');
1689         Eco_Error_Handler.Log_Error
1690                 (  p_sub_component_tbl  => l_sub_component_tbl
1691                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
1692                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
1693                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
1694                 ,  p_other_message      => l_other_message
1695                 ,  p_other_token_tbl    => l_other_token_tbl
1696                 ,  p_error_level        => 6
1697                 ,  p_entity_index       => I
1698                 ,  x_ECO_rec            => l_ECO_rec
1699                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
1700                 ,  x_revised_item_tbl   => l_revised_item_tbl
1701                 ,  x_rev_component_tbl  => l_rev_component_tbl
1702                 ,  x_ref_designator_tbl => l_ref_designator_tbl
1703                 ,  x_sub_component_tbl  => l_sub_component_tbl
1704                 ,  x_rev_operation_tbl     => l_rev_operation_tbl     --add
1705                 ,  x_rev_op_resource_tbl   => l_rev_op_resource_tbl   --add
1706                 ,  x_rev_sub_resource_tbl  => l_rev_sub_resource_tbl  --add
1707                 );
1708 
1709         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1710         x_ECO_rec                      := l_ECO_rec;
1711         x_sub_component_tbl            := l_sub_component_tbl;
1712         x_unexp_sub_comp_rec           := l_sub_comp_unexp_rec;
1713         x_eco_revision_tbl             := l_eco_revision_tbl;
1714         x_revised_item_tbl             := l_revised_item_tbl;
1715         x_ref_designator_tbl           := l_ref_designator_tbl;
1716         x_rev_component_tbl            := l_rev_component_tbl;
1717         x_rev_operation_tbl            := l_rev_operation_tbl;     --add
1718         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --add
1719         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --add
1720 
1721         l_return_status := 'U';
1722 
1723   END;
1724   END LOOP; -- END revised items processing block
1725 
1726     IF l_return_status in ('Q', 'U')
1727     THEN
1728         x_return_status := l_return_status;
1729         RETURN;
1730     END IF;
1731 
1732     l_bo_return_status := l_return_status;
1733 
1734      x_return_status            := l_bo_return_status;
1735      x_ECO_rec                  := l_ECO_rec;
1736      x_unexp_sub_comp_rec       := l_sub_comp_unexp_Rec;
1737      x_eco_revision_tbl         := l_eco_revision_tbl;
1738      x_revised_item_tbl         := l_revised_item_tbl;
1739      x_rev_component_tbl        := l_rev_component_tbl;
1740      x_ref_designator_tbl       := l_ref_designator_tbl;
1741      x_sub_component_tbl        := l_sub_component_tbl;
1742      x_rev_operation_tbl        := l_rev_operation_tbl;     --add
1743      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --add
1744      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --add
1745      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
1746 
1747 END Sub_Comps;
1748 
1749 --  Ref_Desgs
1750 
1751 PROCEDURE Ref_Desgs
1752 (   p_unexp_ref_desg_rec            IN  BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type
1753 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
1754 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
1755 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
1756 ,   x_unexp_ref_desg_rec            IN OUT NOCOPY BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type
1757 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
1758 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
1759 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
1760 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
1761 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
1762 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type     --add
1763 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type   --add
1764 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type  --add
1765 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
1766 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
1767 )
1768 IS
1769 
1770 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
1771 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
1772 l_other_message         VARCHAR2(50);
1773 l_err_text              VARCHAR2(2000);
1774 l_valid                 BOOLEAN := TRUE;
1775 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
1776 l_bo_return_status      VARCHAR2(1) := 'S';
1777 l_ref_designator_Rec    BOM_BO_PUB.Ref_Designator_Rec_Type;
1778 l_ref_desg_unexp_Rec    BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type := p_unexp_ref_desg_rec;
1779 l_old_ref_designator_Rec BOM_BO_PUB.Ref_Designator_Rec_Type := NULL;
1780 l_old_ref_desg_unexp_Rec BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type := NULL;
1781 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
1782 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
1783 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
1784 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type;
1785 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
1786 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
1787 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type;      --add
1788 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type;    --add
1789 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type;   --add
1790 l_return_value          NUMBER;
1791 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
1792 
1793 EXC_SEV_QUIT_RECORD     EXCEPTION;
1794 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
1795 
1796 BEGIN
1797 
1798     -- Begin block that processes revised items. This block holds the exception handlers
1799     -- for header errors.
1800 
1801     FOR I IN 1..l_ref_designator_tbl.COUNT LOOP
1802     BEGIN
1803         --  Load local records.
1804 
1805         l_ref_designator_rec := l_ref_designator_tbl(I);
1806 
1807         l_ref_designator_rec.transaction_type :=
1808                 UPPER(l_ref_designator_rec.transaction_type);
1809 
1810         l_return_status := FND_API.G_RET_STS_SUCCESS;
1811         l_ref_designator_rec.return_status := FND_API.G_RET_STS_SUCCESS;
1812 
1813         -- Process Flow step 3: Verify Reference Designator's existence
1814         --
1815 
1816         IF g_control_rec.check_existence
1817         THEN
1818                 --dbms_output.put_line('Checking Existence');
1819                 Bom_Validate_Ref_Designator.Check_Existence
1820                 (  p_ref_designator_rec         => l_ref_designator_rec
1821                 ,  p_ref_desg_unexp_rec         => l_ref_desg_unexp_rec
1822                 ,  x_old_ref_designator_rec     => l_old_ref_designator_rec
1823                 ,  x_old_ref_desg_unexp_rec     => l_old_ref_desg_unexp_rec
1824                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
1825                 ,  x_return_status              => l_Return_Status
1826                 );
1827 
1828                 --dbms_output.put_line('return_status: ' || l_return_status);
1829 
1830                 IF l_return_status = Error_Handler.G_STATUS_ERROR
1831                 THEN
1832                         RAISE EXC_SEV_QUIT_RECORD;
1833                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1834                 THEN
1835                         RAISE EXC_UNEXP_SKIP_OBJECT;
1836                 END IF;
1837         END IF;
1838 
1839 
1840         -- Set parent revised item attributes
1841         Set_RevItem_Attributes
1842         (  p_revised_item_sequence_id    => l_ref_desg_unexp_rec.revised_item_sequence_id
1843          , p_bo_processed                => 'BOM'
1844         ) ;
1845 
1846 
1847         -- Process Flow step 13 : Database Writes
1848 
1849         IF g_control_rec.write_to_db
1850         THEN
1851                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
1852                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
1853 
1854                 --dbms_output.put_line('Writing to the database');
1855                 Bom_Ref_Designator_Util.Perform_Writes
1856                 (   p_ref_designator_rec        => l_ref_designator_rec
1857                 ,   p_ref_desg_unexp_rec        => l_ref_desg_unexp_rec
1858                 ,   p_control_rec               => g_control_rec
1859                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
1860                 ,   x_return_status             => l_return_status
1861                 );
1862 
1863                 --dbms_output.put_line('return_status: ' || l_return_status);
1864 
1865                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
1866                 THEN
1867                         RAISE EXC_UNEXP_SKIP_OBJECT;
1868                 ELSIF l_return_status ='S' AND
1869                       l_Mesg_Token_Tbl.COUNT <>0
1870                 THEN
1871                         Eco_Error_Handler.Log_Error
1872                         (  p_ref_designator_tbl => l_ref_designator_tbl
1873                         ,  p_sub_component_tbl  => l_sub_component_tbl
1874                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
1875                         ,  p_error_status       => 'W'
1876                         ,  p_error_level        => 5
1877                         ,  p_entity_index       => I
1878                         ,  x_eco_rec            => l_eco_rec
1879                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
1880                         ,  x_revised_item_tbl   => l_revised_item_tbl
1881                         ,  x_rev_component_tbl  => l_rev_component_tbl
1882                         ,  x_sub_component_tbl  => l_sub_component_tbl
1883                         ,  x_ref_designator_tbl => l_ref_designator_tbl
1884                         ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1885                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1886                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1887                         );
1888                 END IF;
1889         END IF;
1890 
1891         l_ref_designator_tbl(I) := l_ref_designator_rec;
1892 
1893   EXCEPTION
1894 
1895     WHEN EXC_SEV_QUIT_RECORD THEN
1896 
1897         --dbms_output.put_line('Expected error generated');
1898         l_ref_designator_tbl(I) := l_ref_designator_rec;
1899         Eco_Error_Handler.Log_Error
1900                 (  p_ref_designator_tbl   => l_ref_designator_tbl
1901                 ,  p_sub_component_tbl    => l_sub_component_tbl
1902                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
1903                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
1904                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
1905                 ,  p_error_level          => 5
1906                 ,  p_entity_index         => I
1907                 ,  x_eco_rec              => l_eco_rec
1908                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
1909                 ,  x_revised_item_tbl     => l_revised_item_tbl
1910                 ,  x_rev_component_tbl    => l_rev_component_tbl
1911                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
1912                 ,  x_sub_component_tbl    => l_sub_component_tbl
1913                 ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1914                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1915                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1916                 );
1917 
1918         x_return_status                := l_return_status;
1919         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1920         x_ECO_rec                      := l_ECO_rec;
1921         x_sub_component_tbl            := l_sub_component_tbl;
1922         x_unexp_ref_desg_rec           := l_ref_desg_unexp_rec;
1923         x_eco_revision_tbl             := l_eco_revision_tbl;
1924         x_revised_item_tbl             := l_revised_item_tbl;
1925         x_ref_designator_tbl           := l_ref_designator_tbl;
1926         x_rev_component_tbl            := l_rev_component_tbl;
1927         x_rev_operation_tbl            := l_rev_operation_tbl;     --add
1928         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --add
1929         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --add
1930 
1931         RETURN;
1932 
1933     WHEN EXC_UNEXP_SKIP_OBJECT THEN
1934 
1935         --dbms_output.put_line('Unexpected error generated');
1936         Eco_Error_Handler.Log_Error
1937                 (  p_sub_component_tbl  => l_sub_component_tbl
1938                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
1939                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
1940                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
1941                 ,  p_other_message      => l_other_message
1942                 ,  p_other_token_tbl    => l_other_token_tbl
1943                 ,  p_error_level        => 5
1944                 ,  p_entity_index       => I
1945                 ,  x_ECO_rec            => l_ECO_rec
1946                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
1947                 ,  x_revised_item_tbl   => l_revised_item_tbl
1948                 ,  x_rev_component_tbl  => l_rev_component_tbl
1949                 ,  x_ref_designator_tbl => l_ref_designator_tbl
1950                 ,  x_sub_component_tbl  => l_sub_component_tbl
1951                 ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
1952                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
1953                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
1954                 );
1955 
1956         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
1957         x_ECO_rec                      := l_ECO_rec;
1958         x_sub_component_tbl            := l_sub_component_tbl;
1959         x_unexp_ref_desg_rec           := l_ref_desg_unexp_rec;
1960         x_eco_revision_tbl             := l_eco_revision_tbl;
1961         x_revised_item_tbl             := l_revised_item_tbl;
1962         x_ref_designator_tbl           := l_ref_designator_tbl;
1963         x_rev_component_tbl            := l_rev_component_tbl;
1964         x_rev_operation_tbl            := l_rev_operation_tbl;     --add
1965         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;   --add
1966         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;  --add
1967 
1968 
1969         l_return_status := 'U';
1970         IF g_control_rec.write_to_db
1971         THEN
1972                 RAISE;
1973         END IF;
1974 
1975   END;
1976   END LOOP; -- END ref designator processing block
1977 
1978     IF l_return_status in ('Q', 'U')
1979     THEN
1980         x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
1981         x_return_status := l_return_status;
1982         RETURN;
1983     END IF;
1984 
1985     l_bo_return_status := l_return_status;
1986 
1987      x_return_status            := l_bo_return_status;
1988      x_ECO_rec                  := l_ECO_rec;
1989      x_unexp_ref_desg_rec       := l_ref_desg_unexp_Rec;
1990      x_eco_revision_tbl         := l_eco_revision_tbl;
1991      x_revised_item_tbl         := l_revised_item_tbl;
1992      x_rev_component_tbl        := l_rev_component_tbl;
1993      x_ref_designator_tbl       := l_ref_designator_tbl;
1994      x_sub_component_tbl        := l_sub_component_tbl;
1995      x_rev_operation_tbl        := l_rev_operation_tbl;     --add
1996      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;   --add
1997      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl;  --add
1998      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
1999 
2000 END Ref_Desgs;
2001 
2002 --  Rev_Comps
2003 
2004 PROCEDURE Rev_Comps
2005 (   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
2006 ,   p_unexp_rev_comp_rec            IN  BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type
2007 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
2008 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
2009 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
2010 ,   x_unexp_rev_comp_rec            IN OUT NOCOPY BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type
2011 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
2012 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
2013 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
2014 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
2015 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
2016 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type     --add
2017 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type   --add
2018 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type  --add
2019 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
2020 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
2021 )
2022 IS
2023 
2024 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
2025 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
2026 l_other_message         VARCHAR2(50);
2027 l_err_text              VARCHAR2(2000);
2028 l_valid                 BOOLEAN := TRUE;
2029 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
2030 l_bo_return_status      VARCHAR2(1) := 'S';
2031 l_rev_component_Rec     BOM_BO_PUB.Rev_Component_Rec_Type;
2032 l_rev_comp_unexp_Rec    BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type := p_unexp_rev_comp_rec;
2033 l_old_rev_component_Rec BOM_BO_PUB.Rev_Component_Rec_Type := NULL;
2034 l_old_rev_comp_unexp_Rec     BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type := NULL;
2035 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
2036 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
2037 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type;
2038 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type := p_rev_component_tbl;
2039 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type := p_ref_designator_tbl;
2040 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type := p_sub_component_tbl;
2041 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type;     --add
2042 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type;   --add
2043 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type;  --add
2044 l_return_value          NUMBER;
2045 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
2046 l_query_op_seq_num      NUMBER := NULL;
2047 l_query_effective_date  DATE := NULL;
2048 l_query_from_unit_number  VARCHAR2(30) := NULL;
2049 
2050 EXC_SEV_QUIT_RECORD     EXCEPTION;
2051 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
2052 
2053 BEGIN
2054 
2055     -- Begin block that processes revised items. This block holds the exception handlers
2056     -- for header errors.
2057 
2058     FOR I IN 1..l_rev_component_tbl.COUNT LOOP
2059     BEGIN
2060         --  Load local records.
2061 
2062         l_rev_component_rec := l_rev_component_tbl(I);
2063 
2064         l_rev_component_rec.transaction_type :=
2065                 UPPER(l_rev_component_rec.transaction_type);
2066 
2067         l_return_status := FND_API.G_RET_STS_SUCCESS;
2068         l_rev_component_rec.return_status := FND_API.G_RET_STS_SUCCESS;
2069 
2070         -- Process Flow step 3: Verify Revised Component's existence
2071         --
2072 
2073         IF g_control_rec.check_existence
2074         THEN
2075                 --dbms_output.put_line('Checking Existence');
2076                 Bom_Validate_Bom_Component.Check_Existence
2077                 (  p_rev_component_rec          => l_rev_component_rec
2078                 ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
2079                 ,  x_old_rev_component_rec      => l_old_rev_component_rec
2080                 ,  x_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
2081                 ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
2082                 ,  x_return_status              => l_Return_Status
2083                 );
2084 
2085 
2086                 --dbms_output.put_line('return_status: ' || l_return_status);
2087 
2088                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2089                 THEN
2090                         RAISE EXC_SEV_QUIT_RECORD;
2091                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2092                 THEN
2093                         RAISE EXC_UNEXP_SKIP_OBJECT;
2094                 END IF;
2095         END IF;
2096 
2097         -- Set parent revised item attributes
2098         Set_RevItem_Attributes
2099         (  p_revised_item_sequence_id    => l_rev_comp_unexp_rec.revised_item_sequence_id
2100          , p_bo_processed                => 'BOM'
2101         ) ;
2102 
2103 
2104         IF g_control_rec.attribute_defaulting AND
2105            l_rev_component_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE
2106         THEN
2107 
2108                 -- Process Flow step 9: Default missing values for Operation CREATE
2109 
2110                 --dbms_output.put_line('Attribute Defaulting');
2111                 Bom_Default_Bom_Component.Attribute_Defaulting
2112                 (   p_rev_component_rec         => l_rev_component_rec
2113                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
2114                 ,   x_rev_component_rec         => l_rev_component_rec
2115                 ,   x_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
2116                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2117                 ,   x_return_status             => l_return_status
2118                 );
2119 
2120                 --dbms_output.put_line('pvt item num: ' || to_char(l_rev_component_rec.item_sequence_number));
2121 
2122                 --dbms_output.put_line('return_status: ' || l_return_status);
2123 
2124                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2125                 THEN
2126                         RAISE EXC_SEV_QUIT_RECORD;
2127                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2128                 THEN
2129                         RAISE EXC_UNEXP_SKIP_OBJECT;
2130                 ELSIF l_return_status ='S' AND
2131                       l_Mesg_Token_Tbl.COUNT <>0
2132                 THEN
2133                         Eco_Error_Handler.Log_Error
2134                         (  p_rev_component_tbl    => l_rev_component_tbl
2135                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2136                         ,  p_sub_component_tbl    => l_sub_component_tbl
2137                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2138                         ,  p_error_status         => 'W'
2139                         ,  p_error_level          => 4
2140                         ,  p_entity_index         => I
2141                         ,  x_eco_rec              => l_eco_rec
2142                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2143                         ,  x_revised_item_tbl     => l_revised_item_tbl
2144                         ,  x_rev_component_tbl    => l_rev_component_tbl
2145                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2146                         ,  x_sub_component_tbl    => l_sub_component_tbl
2147                         ,  x_rev_operation_tbl    => l_rev_operation_tbl     --add
2148                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl   --add
2149                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl  --add
2150                         );
2151                 END IF;
2152         END IF;
2153 
2154         IF ((g_control_rec.entity_defaulting AND
2155              NOT g_control_rec.attribute_defaulting)
2156             OR
2157             g_control_rec.entity_validation)
2158            AND
2159            (--l_rev_component_rec.transaction_type='UPDATE'
2160             --OR -- commented out validation on update as it not required --Bug 3864772
2161             (l_rev_component_rec.transaction_type = 'CREATE'
2162              AND l_rev_component_rec.acd_type = 2))
2163         THEN
2164                 IF l_rev_component_rec.transaction_type='UPDATE'
2165                 THEN
2166                         l_query_op_seq_num := l_rev_component_rec.new_operation_sequence_number;
2167                         l_query_effective_date := l_rev_component_rec.start_effective_date;
2168                         l_query_from_unit_number := l_rev_component_rec.from_end_item_unit_number;
2169                 ELSE
2170                         l_query_op_seq_num := l_rev_component_rec.old_operation_sequence_number;
2171                         l_query_effective_date := l_rev_component_rec.old_effectivity_date;
2172                         l_query_from_unit_number := l_rev_component_rec.old_from_end_item_unit_number;
2173                 END IF;
2174 
2175                 --dbms_output.put_line('querying row');
2176                 Bom_Bom_Component_Util.Query_Row
2177                    ( p_component_item_id         => l_rev_comp_unexp_rec.component_item_id
2178                    , p_operation_sequence_number => l_query_op_seq_num
2179                    , p_effectivity_date          => l_query_effective_date
2180                    , p_bill_sequence_id          => l_rev_comp_unexp_rec.bill_sequence_id
2181                    , p_from_end_item_number      => l_query_from_unit_number
2182                    , p_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2183                    , x_Rev_Component_Rec         => l_old_rev_component_rec
2184                    , x_Rev_Comp_Unexp_Rec        => l_old_rev_comp_unexp_rec
2185                    , x_return_status             => l_return_status
2186                    , x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2187                    );
2188 
2189                 --dbms_output.put_line('query return_status: ' || l_return_status);
2190 
2191                 IF l_return_status = 'N'
2192                 THEN
2193                         -- Added for Bug1609574
2194                         l_return_status := Error_Handler.G_STATUS_ERROR ;
2195                         l_Token_Tbl(1).token_name := 'REVISED_COMPONENT_NAME';
2196                         l_Token_Tbl(1).token_value := l_rev_component_rec.component_item_name;
2197 
2198                         Error_Handler.Add_Error_Token
2199                         ( p_message_name       => 'BOM_CMP_CREATE_REC_NOT_FOUND'
2200                         , p_mesg_token_tbl     => l_Mesg_Token_Tbl
2201                         , p_token_tbl          => l_Token_Tbl
2202                         , x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
2203                         );
2204 
2205                         RAISE EXC_SEV_QUIT_RECORD;
2206                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2207                 THEN
2208                         RAISE EXC_UNEXP_SKIP_OBJECT;
2209                 ELSIF l_return_status ='S' AND
2210                       l_Mesg_Token_Tbl.COUNT <>0
2211                 THEN
2212                         Eco_Error_Handler.Log_Error
2213                         (  p_rev_component_tbl    => l_rev_component_tbl
2214                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2215                         ,  p_sub_component_tbl    => l_sub_component_tbl
2216                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2217                         ,  p_error_status         => 'W'
2218                         ,  p_error_level          => 4
2219                         ,  p_entity_index         => I
2220                         ,  x_eco_rec              => l_eco_rec
2221                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2222                         ,  x_revised_item_tbl     => l_revised_item_tbl
2223                         ,  x_rev_component_tbl    => l_rev_component_tbl
2224                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2225                         ,  x_sub_component_tbl    => l_sub_component_tbl
2226                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2227                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2228                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2229                         );
2230                 END IF;
2231 
2232 /*              IF l_return_status = 'F'
2233                 THEN
2234                         dbms_output.put_line('queried old record');
2235                 ELSIF l_return_status = 'N'
2236                 THEN
2237                         dbms_output.put_line('old record not found');
2238                 END IF;*/
2239         END IF;
2240 
2241      -- Process Flow step 11 - Entity Level Defaulting
2242 
2243         IF g_control_rec.entity_defaulting
2244         THEN
2245                 --dbms_output.put_line('Entity Defaulting');
2246 
2247                 Bom_Default_Bom_Component.Entity_Defaulting
2248                 (   p_rev_component_rec         => l_rev_component_rec
2249                 ,   p_old_rev_component_rec     => l_old_rev_component_rec
2250                 ,   x_rev_component_rec         => l_rev_component_rec
2251                 );
2252 
2253                 --dbms_output.put_line('pvt item num: ' || to_char(l_rev_component_rec.item_sequence_number));
2254 
2255                 --dbms_output.put_line('return_status: ' || l_return_status);
2256 
2257                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2258                 THEN
2259                         RAISE EXC_SEV_QUIT_RECORD;
2260                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2261                 THEN
2262                         RAISE EXC_UNEXP_SKIP_OBJECT;
2263                 ELSIF l_return_status ='S' AND
2264                       l_Mesg_Token_Tbl.COUNT <>0
2265                 THEN
2266                         Eco_Error_Handler.Log_Error
2267                         (  p_rev_component_tbl    => l_rev_component_tbl
2268                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2269                         ,  p_sub_component_tbl    => l_sub_component_tbl
2270                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2271                         ,  p_error_status         => 'W'
2272                         ,  p_error_level          => 4
2273                         ,  p_entity_index         => I
2274                         ,  x_eco_rec              => l_eco_rec
2275                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2276                         ,  x_revised_item_tbl     => l_revised_item_tbl
2277                         ,  x_rev_component_tbl    => l_rev_component_tbl
2278                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2279                         ,  x_sub_component_tbl    => l_sub_component_tbl
2280                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2281                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2282                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2283                         );
2284                 END IF;
2285         END IF;
2286 
2287      -- Process Flow step 12 - Entity Level Validation
2288 
2289         IF g_control_rec.entity_validation
2290         THEN
2291                 --dbms_output.put_line('Entity validation');
2292                 IF l_rev_component_rec.transaction_type = 'DELETE'
2293                 THEN
2294                         NULL;
2295                         /*Eng_Validate_Revised_Item.Check_Entity_Delete
2296                         (  p_rev_component_rec     => l_rev_component_rec
2297                         ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
2298                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
2299                         ,  x_return_status        => l_Return_Status
2300                         );*/
2301                 ELSE
2302                         Bom_Validate_Bom_Component.Check_Entity
2303                         (  p_rev_component_rec          => l_rev_component_rec
2304                         ,  p_rev_comp_unexp_rec         => l_rev_comp_unexp_rec
2305                         ,  p_old_rev_component_rec      => l_old_rev_component_rec
2306                         ,  p_old_rev_comp_unexp_rec     => l_old_rev_comp_unexp_rec
2307                         ,  p_control_rec                => g_control_rec
2308                         ,  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
2309                         ,  x_return_status              => l_Return_Status
2310                         );
2311                 END IF;
2312 
2313                 --dbms_output.put_line('return_status: ' || l_return_status);
2314 
2315                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2316                 THEN
2317                         RAISE EXC_SEV_QUIT_RECORD;
2318                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2319                 THEN
2320                         RAISE EXC_UNEXP_SKIP_OBJECT;
2321                 ELSIF l_return_status ='S' AND
2322                       l_Mesg_Token_Tbl.COUNT <>0
2323                 THEN
2324                         --dbms_output.put_line('logging warnings');
2325                         Eco_Error_Handler.Log_Error
2326                         (  p_rev_component_tbl    => l_rev_component_tbl
2327                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2328                         ,  p_sub_component_tbl    => l_sub_component_tbl
2329                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2330                         ,  p_error_status         => 'W'
2331                         ,  p_error_level          => 4
2332                         ,  p_entity_index         => I
2333                         ,  x_eco_rec              => l_eco_rec
2334                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2335                         ,  x_revised_item_tbl     => l_revised_item_tbl
2336                         ,  x_rev_component_tbl    => l_rev_component_tbl
2337                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2338                         ,  x_sub_component_tbl    => l_sub_component_tbl
2339                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2340                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2341                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2342                         );
2343                 END IF;
2344         END IF;
2345 
2346         -- Process Flow step 13 : Database Writes
2347 
2348         IF g_control_rec.write_to_db
2349         THEN
2350                 bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
2351                 bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
2352 
2353                 --dbms_output.put_line('Writing to the database');
2354                 BOM_BOM_Component_Util.Perform_Writes
2355                 (   p_rev_component_rec         => l_rev_component_rec
2356                 ,   p_rev_comp_unexp_rec        => l_rev_comp_unexp_rec
2357                 ,   p_control_rec               => g_control_rec
2358                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2359                 ,   x_return_status             => l_return_status
2360                 );
2361 
2362                 --dbms_output.put_line('return_status: ' || l_return_status);
2363 
2364                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2365                 THEN
2366                         RAISE EXC_UNEXP_SKIP_OBJECT;
2367                 ELSIF l_return_status ='S' AND
2368                       l_Mesg_Token_Tbl.COUNT <>0
2369                 THEN
2370                         Eco_Error_Handler.Log_Error
2371                         (  p_rev_component_tbl    => l_rev_component_tbl
2372                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2373                         ,  p_sub_component_tbl    => l_sub_component_tbl
2374                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2375                         ,  p_error_status         => 'W'
2376                         ,  p_error_level          => 4 --reverted fix 2774876-- vani
2377                         ,  p_entity_index         => I
2378                         ,  x_eco_rec              => l_eco_rec
2379                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2380                         ,  x_revised_item_tbl     => l_revised_item_tbl
2381                         ,  x_rev_component_tbl    => l_rev_component_tbl
2382                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2383                         ,  x_sub_component_tbl    => l_sub_component_tbl
2384                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2385                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2386                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2387                         );
2388                 END IF;
2389         END IF;
2390 
2391         l_rev_component_tbl(I) := l_rev_component_rec;
2392 
2393   EXCEPTION
2394 
2395     WHEN EXC_SEV_QUIT_RECORD THEN
2396 
2397         --dbms_output.put_line('Expected error generated');
2398         l_rev_component_tbl(I) := l_rev_component_rec;
2399         Eco_Error_Handler.Log_Error
2400                 (  p_rev_component_tbl    => l_rev_component_tbl
2401                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
2402                 ,  p_sub_component_tbl    => l_sub_component_tbl
2403                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
2404                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
2405                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
2406                 ,  p_error_level          => 4
2407                 ,  p_entity_index         => I
2408                 ,  x_eco_rec              => l_eco_rec
2409                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
2410                 ,  x_revised_item_tbl     => l_revised_item_tbl
2411                 ,  x_rev_component_tbl    => l_rev_component_tbl
2412                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
2413                 ,  x_sub_component_tbl    => l_sub_component_tbl
2414                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2415                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2416                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2417                 );
2418 
2419         x_return_status                := l_return_status;
2420         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
2421         x_ECO_rec                      := l_ECO_rec;
2422         x_rev_component_tbl            := l_rev_component_tbl;
2423         x_unexp_rev_comp_rec           := l_rev_comp_unexp_rec;
2424         x_eco_revision_tbl             := l_eco_revision_tbl;
2425         x_revised_item_tbl             := l_revised_item_tbl;
2426         x_ref_designator_tbl           := l_ref_designator_tbl;
2427         x_sub_component_tbl            := l_sub_component_tbl;
2428         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
2429         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
2430         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
2431                 --dbms_output.put_line('err pvt item num: ' || to_char(l_rev_component_rec.item_sequence_number));
2432 
2433         RETURN;
2434 
2435     WHEN EXC_UNEXP_SKIP_OBJECT THEN
2436 
2437         --dbms_output.put_line('Unexpected error generated');
2438         Eco_Error_Handler.Log_Error
2439                 (  p_rev_component_tbl    => l_rev_component_tbl
2440                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
2441                 ,  p_sub_component_tbl    => l_sub_component_tbl
2442                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
2443                 ,  p_error_status         => Error_Handler.G_STATUS_UNEXPECTED
2444                 ,  p_other_status         => Error_Handler.G_STATUS_NOT_PICKED
2445                 ,  p_other_message        => l_other_message
2446                 ,  p_other_token_tbl      => l_other_token_tbl
2447                 ,  p_error_level          => 4
2448                 ,  p_entity_index         => I
2449                 ,  x_ECO_rec              => l_ECO_rec
2450                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
2451                 ,  x_revised_item_tbl     => l_revised_item_tbl
2452                 ,  x_rev_component_tbl    => l_rev_component_tbl
2453                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
2454                 ,  x_sub_component_tbl    => l_sub_component_tbl
2455                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2456                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2457                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2458                 );
2459 
2460         l_return_status := 'U';
2461 --dbms_output.put_line('unexp message' || l_mesg_token_tbl(1).message_text);
2462         x_return_status                := l_return_status;
2463         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
2464         x_ECO_rec                      := l_ECO_rec;
2465         x_eco_revision_tbl             := l_eco_revision_tbl;
2466         x_revised_item_tbl             := l_revised_item_tbl;
2467         x_rev_component_tbl            := l_rev_component_tbl;
2468         x_unexp_rev_comp_rec           := l_rev_comp_unexp_rec;
2469         x_ref_designator_tbl           := l_ref_designator_tbl;
2470         x_sub_component_tbl            := l_sub_component_tbl;
2471         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
2472         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
2473         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
2474 
2475   END;
2476   END LOOP; -- END revised items processing block
2477 
2478     IF l_return_status in ('Q', 'U')
2479     THEN
2480         x_return_status := l_return_status;
2481         RETURN;
2482     END IF;
2483 
2484     l_bo_return_status := l_return_status;
2485 
2486      x_return_status            := l_bo_return_status;
2487      x_ECO_rec                  := l_ECO_rec;
2488      x_unexp_rev_comp_rec       := l_rev_comp_unexp_Rec;
2489      x_eco_revision_tbl         := l_eco_revision_tbl;
2490      x_revised_item_tbl         := l_revised_item_tbl;
2491      x_rev_component_tbl        := l_rev_component_tbl;
2492      x_ref_designator_tbl       := l_ref_designator_tbl;
2493      x_sub_component_tbl        := l_sub_component_tbl;    --add
2494      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;  --add
2495      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl; --add
2496      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
2497                 --dbms_output.put_line('end pvt item num: ' || to_char(l_rev_component_rec.item_sequence_number));
2498 
2499 END Rev_Comps;
2500 
2501 --  Rev_Items
2502 
2503 PROCEDURE Rev_Items
2504 (   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
2505 ,   p_unexp_rev_item_rec            IN  ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type
2506 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
2507 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
2508 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
2509 ,   p_rev_operation_tbl             IN  BOM_RTG_PUB.Rev_Operation_Tbl_Type    --add
2510 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type  --add
2511 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type --add
2512 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
2513 ,   x_unexp_rev_item_rec            IN OUT NOCOPY ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type
2514 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
2515 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
2516 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
2517 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
2518 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
2519 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
2520 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
2521 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
2522 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
2523 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
2524 ,   x_disable_revision              OUT NOCOPY NUMBER --Bug no:3034642
2525 )
2526 IS
2527 
2528 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
2529 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
2530 l_other_message         VARCHAR2(50);
2531 l_err_text              VARCHAR2(2000);
2532 l_valid                 BOOLEAN := TRUE;
2533 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
2534 l_bo_return_status      VARCHAR2(1) := 'S';
2535 l_revised_item_Rec      Eng_Eco_Pub.Revised_Item_Rec_Type;
2536 l_rev_item_unexp_Rec    Eng_Eco_Pub.Rev_Item_Unexposed_Rec_Type := p_unexp_rev_item_rec;
2537 l_old_rev_item_Rec      Eng_Eco_Pub.Revised_Item_Rec_Type := NULL;
2538 l_old_rev_item_unexp_Rec     Eng_Eco_Pub.Rev_Item_Unexposed_Rec_Type := NULL;
2539 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
2540 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type;
2541 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type    := p_revised_item_tbl;
2542 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type    := p_rev_component_tbl;
2543 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type   := p_ref_designator_tbl;
2544 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type    := p_sub_component_tbl;
2545 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type    := p_rev_operation_tbl;     --add
2546 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type  := p_rev_op_resource_tbl;   --add
2547 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;  --add
2548 l_return_value          NUMBER;
2549 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
2550 
2551 EXC_SEV_QUIT_RECORD     EXCEPTION;
2552 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
2553 
2554 BEGIN
2555 
2556 
2557     IF BOM_Globals.get_debug = 'Y'
2558    Then
2559      error_handler.write_debug('at the beginning of rev_item procedure');
2560      error_handler.write_debug('revised item count is');
2561      error_handler.write_debug(l_revised_item_tbl.COUNT);
2562 
2563    END IF;
2564 
2565     -- Begin block that processes revised items. This block holds the exception handlers
2566     -- for header errors.
2567     FOR I IN 1..l_revised_item_tbl.COUNT LOOP
2568     BEGIN
2569         --  Load local records.
2570 
2571         l_revised_item_rec := l_revised_item_tbl(I);
2572 
2573         l_revised_item_rec.transaction_type :=
2574                 UPPER(l_revised_item_rec.transaction_type);
2575 
2576         l_return_status := FND_API.G_RET_STS_SUCCESS;
2577         l_revised_item_rec.return_status := FND_API.G_RET_STS_SUCCESS;
2578 
2579         -- Process Flow step 3: Verify ECO's existence
2580         --
2581 
2582         IF g_control_rec.check_existence
2583         THEN
2584                 --dbms_output.put_line('Checking Existence');
2585                 ENG_Validate_Revised_Item.Check_Existence
2586                 ( p_revised_item_rec    => l_revised_item_rec
2587                 , p_rev_item_unexp_rec  => l_rev_item_unexp_rec
2588                 , x_old_revised_item_rec=> l_old_rev_item_rec
2589                 , x_old_rev_item_unexp_rec  => l_old_rev_item_unexp_rec
2590                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
2591                 , x_return_status       => l_Return_Status
2592 		,   x_disable_revision    =>   x_disable_revision --Bug no:3034642
2593                 );
2594 IF BOM_Globals.get_debug = 'Y'
2595    Then
2596      error_handler.write_debug('After check existence');
2597  error_handler.write_debug( l_Return_Status);
2598  END IF;
2599                 --dbms_output.put_line('return_status: ' || l_return_status);
2600 
2601                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2602                 THEN
2603                         RAISE EXC_SEV_QUIT_RECORD;
2604                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2605                 THEN
2606                         RAISE EXC_UNEXP_SKIP_OBJECT;
2607                 END IF;
2608         END IF;
2609 
2610         IF g_control_rec.attribute_defaulting AND
2611            l_revised_item_rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE
2612         THEN
2613 
2614                 -- Process Flow step 9: Default missing values for Operation CREATE
2615                 --dbms_output.put_line('Attribute Defaulting');
2616                 Eng_Default_Revised_Item.Attribute_Defaulting
2617                 (   p_revised_item_rec   => l_revised_item_rec
2618                 ,   p_rev_item_unexp_rec => l_rev_item_unexp_rec
2619                 ,   x_revised_item_rec   => l_revised_item_rec
2620                 ,   x_rev_item_unexp_rec => l_rev_item_unexp_rec
2621                 ,   x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
2622                 ,   x_return_status      => l_Return_Status
2623                 );
2624 IF BOM_Globals.get_debug = 'Y'
2625    Then
2626      error_handler.write_debug('After attribute defaulting, the return status is');
2627      error_handler.write_debug( l_Return_Status);
2628    END IF;
2629                 --dbms_output.put_line('return_status: ' || l_return_status);
2630 
2631                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2632                 THEN
2633                         RAISE EXC_SEV_QUIT_RECORD;
2634                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2635                 THEN
2636                         RAISE EXC_UNEXP_SKIP_OBJECT;
2637                 ELSIF l_return_status ='S' AND
2638                       l_Mesg_Token_Tbl.COUNT <>0
2639                 THEN
2640                         Eco_Error_Handler.Log_Error
2641                         (  p_revised_item_tbl     => l_revised_item_tbl
2642                         ,  p_rev_component_tbl    => l_rev_component_tbl
2643                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2644                         ,  p_sub_component_tbl    => l_sub_component_tbl
2645                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2646                         ,  p_error_status         => 'W'
2647                         ,  p_error_level          => 3
2648                         ,  p_entity_index         => I
2649                         ,  x_ECO_rec              => l_ECO_rec
2650                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2651                         ,  x_revised_item_tbl     => l_revised_item_tbl
2652                         ,  x_rev_component_tbl    => l_rev_component_tbl
2653                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2654                         ,  x_sub_component_tbl    => l_sub_component_tbl
2655                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2656                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2657                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2658                         );
2659                 END IF;
2660         END IF;
2661 
2662         IF ((g_control_rec.entity_defaulting AND
2663              NOT g_control_rec.attribute_defaulting)
2664             OR
2665             g_control_rec.entity_validation)
2666            AND
2667            l_revised_item_rec.transaction_type='UPDATE'
2668         THEN
2669                 --dbms_output.put_line('querying row');
2670                 ENG_Revised_Item_Util.Query_Row
2671                 ( p_revised_item_id     => l_rev_item_unexp_rec.revised_item_id
2672                 , p_organization_id     => l_rev_item_unexp_rec.organization_id
2673                 , p_change_notice       => l_revised_item_rec.eco_name
2674                 , p_start_eff_date      => l_revised_item_rec.start_effective_date
2675                 , p_new_item_revision   => l_revised_item_rec.new_revised_item_revision
2676                 , p_new_routing_revision => l_revised_item_rec.new_routing_revision --add
2677                 , p_from_end_item_number=> l_revised_item_rec.from_end_item_unit_number
2678                 , p_alternate_designator => l_revised_item_rec.alternate_bom_code -- To Fix Bug 3760265
2679                 , x_revised_item_rec    => l_old_rev_item_rec
2680                 , x_rev_item_unexp_rec  => l_old_rev_item_unexp_rec
2681                 , x_Return_status       => l_return_status
2682                 );
2683 
2684 IF BOM_Globals.get_debug = 'Y'
2685    Then
2686       error_handler.write_debug('After query row, the return status is');
2687      error_handler.write_debug( l_Return_Status);
2688    END IF;
2689 
2690                 --dbms_output.put_line('return_status: ' || l_return_status);
2691 
2692 /*              IF l_return_status = 'F'
2693                 THEN
2694                         dbms_output.put_line('queried old record');
2695                 ELSIF l_return_status = 'N'
2696                 THEN
2697                         dbms_output.put_line('old record not found');
2698                 END IF;*/
2699         END IF;
2700 
2701      -- Process Flow step 11 - Entity Level Defaulting
2702 
2703         IF g_control_rec.entity_defaulting
2704         THEN
2705                 --dbms_output.put_line('Entity Defaulting');
2706 
2707                 Eng_Default_Revised_Item.Entity_Defaulting
2708                 (   p_revised_item_rec          => l_revised_item_rec
2709                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
2710                 ,   p_old_revised_item_rec      => l_old_rev_item_rec
2711                 ,   p_old_rev_item_unexp_rec    => l_old_rev_item_unexp_rec
2712                 ,   p_control_rec               => g_control_rec
2713                 ,   x_revised_item_rec          => l_revised_item_rec
2714                 ,   x_rev_item_unexp_rec        => l_rev_item_unexp_rec
2715                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2716                 ,   x_return_status             => l_return_status
2717                 );
2718 
2719 IF BOM_Globals.get_debug = 'Y'
2720    Then
2721       error_handler.write_debug('After eitity default, the return status is');
2722      error_handler.write_debug( l_Return_Status);
2723    END IF;
2724                 --dbms_output.put_line('return_status: ' || l_return_status);
2725 
2726                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2727                 THEN
2728                         RAISE EXC_SEV_QUIT_RECORD;
2729                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2730                 THEN
2731                         RAISE EXC_UNEXP_SKIP_OBJECT;
2732                 ELSIF l_return_status ='S' AND
2733                       l_Mesg_Token_Tbl.COUNT <>0
2734                 THEN
2735                         Eco_Error_Handler.Log_Error
2736                         (  p_ECO_rec              => l_ECO_rec
2737                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
2738                         ,  p_revised_item_tbl     => l_revised_item_tbl
2739                         ,  p_rev_component_tbl    => l_rev_component_tbl
2740                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2741                         ,  p_sub_component_tbl    => l_sub_component_tbl
2742                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
2743                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2744                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2745                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2746                         ,  p_error_status         => 'W'
2747                         ,  p_entity_index         => I
2748                         ,  p_error_level          => 3
2749                         ,  x_ECO_rec              => l_ECO_rec
2750                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2751                         ,  x_revised_item_tbl     => l_revised_item_tbl
2752                         ,  x_rev_component_tbl    => l_rev_component_tbl
2753                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2754                         ,  x_sub_component_tbl    => l_sub_component_tbl
2755                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2756                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2757                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2758                         );
2759                 END IF;
2760         END IF;
2761 
2762      -- Process Flow step 12 - Entity Level Validation
2763 
2764         IF g_control_rec.entity_validation
2765         THEN
2766                 --dbms_output.put_line('Entity validation');
2767                 IF l_revised_item_rec.transaction_type = 'DELETE'
2768                 THEN
2769                         Eng_Validate_Revised_Item.Check_Entity_Delete
2770                         (  p_revised_item_rec     => l_revised_item_rec
2771                         ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
2772                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
2773                         ,  x_return_status        => l_Return_Status
2774                         );
2775                 ELSE
2776                         Eng_Validate_Revised_Item.Check_Entity
2777                         (  p_revised_item_rec     => l_revised_item_rec
2778                         ,  p_rev_item_unexp_rec   => l_rev_item_unexp_rec
2779                         ,  p_old_revised_item_rec => l_old_rev_item_rec
2780                         ,  p_old_rev_item_unexp_rec => l_old_rev_item_unexp_rec
2781                         ,  p_control_rec          => g_control_rec
2782                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
2783                         ,  x_return_status        => l_Return_Status
2784                         );
2785                 END IF;
2786 
2787 IF BOM_Globals.get_debug = 'Y'
2788    Then
2789       error_handler.write_debug('After entity validation.');
2790      error_handler.write_debug( l_Return_Status);
2791    END IF;
2792 
2793                 --dbms_output.put_line('return_status: ' || l_return_status);
2794 
2795                 IF l_return_status = Error_Handler.G_STATUS_ERROR
2796                 THEN
2797                         RAISE EXC_SEV_QUIT_RECORD;
2798                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2799                 THEN
2800                         RAISE EXC_UNEXP_SKIP_OBJECT;
2801                 ELSIF l_return_status ='S' AND
2802                       l_Mesg_Token_Tbl.COUNT <>0
2803                 THEN
2804                         Eco_Error_Handler.Log_Error
2805                         (  p_ECO_rec              => l_ECO_rec
2806                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
2807                         ,  p_revised_item_tbl     => l_revised_item_tbl
2808                         ,  p_rev_component_tbl    => l_rev_component_tbl
2809                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2810                         ,  p_sub_component_tbl    => l_sub_component_tbl
2811                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
2812                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2813                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2814                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2815                         ,  p_error_status         => 'W'
2816                         ,  p_error_level          => 3
2817                         ,  p_entity_index         => I
2818                         ,  x_ECO_rec              => l_ECO_rec
2819                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2820                         ,  x_revised_item_tbl     => l_revised_item_tbl
2821                         ,  x_rev_component_tbl    => l_rev_component_tbl
2822                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2823                         ,  x_sub_component_tbl    => l_sub_component_tbl
2824                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2825                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2826                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2827                         );
2828                 END IF;
2829         END IF;
2830 
2831         -- Process Flow step 13 : Database Writes
2832 
2833         IF g_control_rec.write_to_db
2834         THEN
2835                 eng_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
2836                 eng_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
2837 
2838                 --dbms_output.put_line('Writing to the database');
2839                 ENG_Revised_Item_Util.Perform_Writes
2840                 (   p_revised_item_rec          => l_revised_item_rec
2841                 ,   p_rev_item_unexp_rec        => l_rev_item_unexp_rec
2842                 ,   p_control_rec               => g_control_rec
2843                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
2844                 ,   x_return_status             => l_return_status
2845                 );
2846 
2847 IF BOM_Globals.get_debug = 'Y'
2848    Then
2849       error_handler.write_debug('After write to db, the return status is');
2850      error_handler.write_debug( l_Return_Status);
2851    END IF;
2852 
2853                 --dbms_output.put_line('return_status: ' || l_return_status);
2854 
2855                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
2856                 THEN
2857                         RAISE EXC_UNEXP_SKIP_OBJECT;
2858                 ELSIF l_return_status ='S' AND
2859                       l_Mesg_Token_Tbl.COUNT <>0
2860                 THEN
2861                         Eco_Error_Handler.Log_Error
2862                         (  p_ECO_rec              => l_ECO_rec
2863                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
2864                         ,  p_revised_item_tbl     => l_revised_item_tbl
2865                         ,  p_rev_component_tbl    => l_rev_component_tbl
2866                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
2867                         ,  p_sub_component_tbl    => l_sub_component_tbl
2868                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
2869                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2870                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2871                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
2872                         ,  p_error_status         => 'W'
2873                         ,  p_error_level          => 3
2874                         ,  p_entity_index         => I
2875                         ,  x_ECO_rec              => l_ECO_rec
2876                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
2877                         ,  x_revised_item_tbl     => l_revised_item_tbl
2878                         ,  x_rev_component_tbl    => l_rev_component_tbl
2879                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
2880                         ,  x_sub_component_tbl    => l_sub_component_tbl
2881                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2882                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2883                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2884                         );
2885                 END IF;
2886         END IF;
2887 
2888         l_revised_item_tbl(I) := l_revised_item_rec;
2889 
2890   EXCEPTION
2891 
2892     WHEN EXC_SEV_QUIT_RECORD THEN
2893 
2894         --dbms_output.put_line('Expected error generated');
2895         Eco_Error_Handler.Log_Error
2896                 (  p_revised_item_tbl     => l_revised_item_tbl
2897                 ,  p_rev_component_tbl    => l_rev_component_tbl
2898                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
2899                 ,  p_sub_component_tbl    => l_sub_component_tbl
2900                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
2901                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2902                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2903                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
2904                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
2905                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
2906                 ,  p_error_level          => 3
2907                 ,  p_entity_index         => I
2908                 ,  x_ECO_rec              => l_ECO_rec
2909                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
2910                 ,  x_revised_item_tbl     => l_revised_item_tbl
2911                 ,  x_rev_component_tbl    => l_rev_component_tbl
2912                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
2913                 ,  x_sub_component_tbl    => l_sub_component_tbl
2914                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2915                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2916                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2917                 );
2918 --dbms_output.put_line('logged error: ' || l_return_Status);
2919         x_return_status                := l_return_status;
2920         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
2921         x_ECO_rec                      := l_ECO_rec;
2922         x_unexp_rev_item_rec           := l_rev_item_unexp_Rec;
2923         x_eco_revision_tbl             := l_eco_revision_tbl;
2924         x_revised_item_tbl             := l_revised_item_tbl;
2925         x_rev_component_tbl            := l_rev_component_tbl;
2926         x_ref_designator_tbl           := l_ref_designator_tbl;
2927         x_sub_component_tbl            := l_sub_component_tbl;
2928         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
2929         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
2930         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
2931 
2932         RETURN;
2933 
2934     WHEN EXC_UNEXP_SKIP_OBJECT THEN
2935 
2936         --dbms_output.put_line('Unexpected error generated');
2937         Eco_Error_Handler.Log_Error
2938                 (  p_revised_item_tbl     => l_revised_item_tbl
2939                 ,  p_rev_component_tbl    => l_rev_component_tbl
2940                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
2941                 ,  p_sub_component_tbl    => l_sub_component_tbl
2942                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
2943                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2944                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2945                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
2946                 ,  p_error_status         => Error_Handler.G_STATUS_UNEXPECTED
2947                 ,  p_other_status         => Error_Handler.G_STATUS_NOT_PICKED
2948                 ,  p_other_message        => l_other_message
2949                 ,  p_other_token_tbl      => l_other_token_tbl
2950                 ,  p_error_level          => 3
2951                 ,  x_ECO_rec              => l_ECO_rec
2952                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
2953                 ,  x_revised_item_tbl     => l_revised_item_tbl
2954                 ,  x_rev_component_tbl    => l_rev_component_tbl
2955                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
2956                 ,  x_sub_component_tbl    => l_sub_component_tbl
2957                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
2958                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
2959                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
2960                 );
2961 
2962         x_return_status                := l_return_status;
2963         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
2964         x_ECO_rec                      := l_ECO_rec;
2965         x_unexp_rev_item_rec           := l_rev_item_unexp_Rec;
2966         x_eco_revision_tbl             := l_eco_revision_tbl;
2967         x_revised_item_tbl             := l_revised_item_tbl;
2968         x_rev_component_tbl            := l_rev_component_tbl;
2969         x_ref_designator_tbl           := l_ref_designator_tbl;
2970         x_sub_component_tbl            := l_sub_component_tbl;
2971         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
2972         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
2973         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
2974 
2975         l_return_status := 'U';
2976 
2977   END;
2978   END LOOP; -- END revised items processing block
2979 
2980     IF l_return_status in ('Q', 'U')
2981     THEN
2982         x_return_status := l_return_status;
2983         RETURN;
2984     END IF;
2985 
2986     l_bo_return_status := l_return_status;
2987 
2988 
2989      --  Load OUT parameters
2990 
2991      x_return_status            := l_bo_return_status;
2992      x_ECO_rec                  := l_ECO_rec;
2993      x_unexp_rev_item_rec       := l_rev_item_unexp_Rec;
2994      x_eco_revision_tbl         := l_eco_revision_tbl;
2995      x_revised_item_tbl         := l_revised_item_tbl;
2996      x_rev_component_tbl        := l_rev_component_tbl;
2997      x_ref_designator_tbl       := l_ref_designator_tbl;
2998      x_sub_component_tbl        := l_sub_component_tbl;
2999      x_rev_operation_tbl        := l_rev_operation_tbl;    --add
3000      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;  --add
3001      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl; --add
3002      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
3003 
3004 END Rev_Items;
3005 
3006 --  Eco_Rev
3007 
3008 PROCEDURE Eco_Rev
3009 (   p_eco_revision_tbl              IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type
3010 ,   p_unexp_eco_rev_rec             IN  ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type
3011 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
3012 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
3013 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
3014 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
3015 ,   p_rev_operation_tbl             IN  BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
3016 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
3017 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
3018 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
3019 ,   x_unexp_eco_rev_rec             IN OUT NOCOPY ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type
3020 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
3021 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
3022 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
3023 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
3024 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
3025 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
3026 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
3027 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
3028 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
3029 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
3030 )
3031 IS
3032 
3033 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
3034 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
3035 l_other_message         VARCHAR2(50);
3036 l_err_text              VARCHAR2(2000);
3037 l_valid                 BOOLEAN := TRUE;
3038 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
3039 l_bo_return_status      VARCHAR2(1) := 'S';
3040 l_eco_rev_unexp_Rec     Eng_Eco_Pub.Eco_Rev_Unexposed_Rec_Type := p_unexp_eco_rev_rec;
3041 l_eco_rec               ENG_ECO_PUB.ECO_Rec_Type := NULL;
3042 l_eco_revision_rec      ENG_ECO_PUB.Eco_Revision_Rec_Type;
3043 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type    := p_eco_revision_tbl;
3044 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type    := p_revised_item_tbl;
3045 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type    := p_rev_component_tbl;
3046 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type   := p_ref_designator_tbl;
3047 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type    := p_sub_component_tbl;
3048 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type    := p_rev_operation_tbl;    --add
3049 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type  := p_rev_op_resource_tbl;  --add
3050 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl; --add
3051 l_return_value          NUMBER;
3052 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
3053 
3054 EXC_SEV_QUIT_RECORD     EXCEPTION;
3055 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
3056 
3057 BEGIN
3058 
3059     -- Begin block that processes eco revisions. This block holds the exception handlers
3060     -- for header errors.
3061 
3062     FOR I IN 1..l_eco_revision_tbl.COUNT LOOP
3063     BEGIN
3064         --  Load local records.
3065 
3066         --  Load local records.
3067 
3068         l_eco_revision_rec := l_eco_revision_tbl(I);
3069 
3070         l_eco_revision_rec.transaction_type :=
3071                 UPPER(l_eco_revision_rec.transaction_type);
3072 
3073         l_return_status := FND_API.G_RET_STS_SUCCESS;
3074         l_eco_revision_rec.return_status := FND_API.G_RET_STS_SUCCESS;
3075 
3076         IF g_control_rec.attribute_defaulting
3077         THEN
3078 
3079                 --dbms_output.put_line('Attribute Defaulting');
3080                  Eng_Default_ECO_revision.Attribute_Defaulting
3081                         (   p_eco_revision_rec          => l_eco_revision_rec
3082                         ,   p_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
3083                         ,   x_eco_revision_rec          => l_eco_revision_rec
3084                         ,   x_eco_rev_unexp_rec         => l_eco_rev_unexp_Rec
3085                         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
3086                         ,   x_return_status             => l_Return_Status
3087                         );
3088 
3089                 --dbms_output.put_line('return_status: ' || l_return_status);
3090 
3091                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3092                 THEN
3093                         RAISE EXC_UNEXP_SKIP_OBJECT;
3094                 ELSIF l_return_status ='S' AND
3095                       l_Mesg_Token_Tbl.COUNT <>0
3096                 THEN
3097                         Eco_Error_Handler.Log_Error
3098                         (  p_ECO_rec            => l_ECO_rec
3099                         ,  p_eco_revision_tbl   => l_eco_revision_tbl
3100                         ,  p_revised_item_tbl   => l_revised_item_tbl
3101                         ,  p_rev_component_tbl  => l_rev_component_tbl
3102                         ,  p_ref_designator_tbl => l_ref_designator_tbl
3103                         ,  p_sub_component_tbl  => l_sub_component_tbl
3104                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3105                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3106                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3107                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
3108                         ,  p_error_status       => 'W'
3109                         ,  p_error_level        => 3
3110                         ,  p_entity_index       => I
3111                         ,  x_ECO_rec            => l_ECO_rec
3112                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
3113                         ,  x_revised_item_tbl   => l_revised_item_tbl
3114                         ,  x_rev_component_tbl  => l_rev_component_tbl
3115                         ,  x_ref_designator_tbl => l_ref_designator_tbl
3116                         ,  x_sub_component_tbl  => l_sub_component_tbl
3117                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3118                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3119                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3120                         );
3121                 END IF;
3122 
3123         END IF;
3124 
3125         -- Process Flow step 13 : Database Writes
3126 
3127         IF g_control_rec.write_to_db
3128         THEN
3129                 eng_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
3130                 eng_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
3131                 --dbms_output.put_line('Writing to the database');
3132                 ENG_Eco_Revision_Util.Perform_Writes
3133                 (   p_eco_revision_rec          => l_eco_revision_rec
3134                 ,   p_eco_rev_unexp_rec         => l_eco_rev_unexp_rec
3135                 ,   p_control_rec               => g_control_rec
3136                 ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
3137                 ,   x_return_status             => l_return_status
3138                 );
3139 
3140                 --dbms_output.put_line('return_status: ' || l_return_status);
3141 
3142                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3143                 THEN
3144                         RAISE EXC_UNEXP_SKIP_OBJECT;
3145                 ELSIF l_return_status ='S' AND
3146                       l_Mesg_Token_Tbl.COUNT <>0
3147                 THEN
3148                         Eco_Error_Handler.Log_Error
3149                         (  p_ECO_rec              => l_ECO_rec
3150                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
3151                         ,  p_revised_item_tbl     => l_revised_item_tbl
3152                         ,  p_rev_component_tbl    => l_rev_component_tbl
3153                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
3154                         ,  p_sub_component_tbl    => l_sub_component_tbl
3155                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3156                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3157                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3158                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
3159                         ,  p_error_status         => 'W'
3160                         ,  p_error_level          => 3
3161                         ,  p_entity_index         => I
3162                         ,  x_ECO_rec              => l_ECO_rec
3163                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
3164                         ,  x_revised_item_tbl     => l_revised_item_tbl
3165                         ,  x_rev_component_tbl    => l_rev_component_tbl
3166                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
3167                         ,  x_sub_component_tbl    => l_sub_component_tbl
3168                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3169                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3170                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3171                         );
3172                 END IF;
3173         END IF;
3174 
3175         l_eco_revision_tbl(I)          := l_eco_revision_rec;
3176 
3177         --  For loop exception handler.
3178 
3179 
3180      EXCEPTION
3181 
3182        WHEN EXC_SEV_QUIT_RECORD THEN
3183 
3184         Eco_Error_Handler.Log_Error
3185                 (  p_eco_revision_tbl     => l_eco_revision_tbl
3186                 ,  p_revised_item_tbl     => l_revised_item_tbl
3187                 ,  p_rev_component_tbl    => l_rev_component_tbl
3188                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
3189                 ,  p_sub_component_tbl    => l_sub_component_tbl
3190                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3191                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3192                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3193                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
3194                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
3195                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
3196                 ,  p_error_level          => 2
3197                 ,  p_entity_index         => I
3198                 ,  x_eco_rec              => l_eco_rec
3199                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
3200                 ,  x_revised_item_tbl     => l_revised_item_tbl
3201                 ,  x_rev_component_tbl    => l_rev_component_tbl
3202                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
3203                 ,  x_sub_component_tbl    => l_sub_component_tbl
3204                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3205                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3206                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3207                 );
3208 
3209         IF l_bo_return_status = 'S'
3210         THEN
3211                 l_bo_return_status     := l_return_status;
3212         END IF;
3213         x_return_status                := l_bo_return_status;
3214         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
3215         x_eco_revision_tbl             := l_eco_revision_tbl;
3216         x_unexp_eco_rev_rec            := l_eco_rev_unexp_rec;
3217         x_revised_item_tbl             := l_revised_item_tbl;
3218         x_rev_component_tbl            := l_rev_component_tbl;
3219         x_ref_designator_tbl           := l_ref_designator_tbl;
3220         x_sub_component_tbl            := l_sub_component_tbl;
3221 
3222         RETURN;
3223 
3224     WHEN EXC_UNEXP_SKIP_OBJECT THEN
3225 
3226         --dbms_output.put_line('Unexpected error generated');
3227         Eco_Error_Handler.Log_Error
3228                 (  p_eco_revision_tbl     => l_eco_revision_tbl
3229                 ,  p_revised_item_tbl     => l_revised_item_tbl
3230                 ,  p_rev_component_tbl    => l_rev_component_tbl
3231                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
3232                 ,  p_sub_component_tbl    => l_sub_component_tbl
3233                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3234                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3235                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3236                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
3237                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
3238                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
3239                 ,  p_error_level          => 2
3240                 ,  p_entity_index         => I
3241                 ,  x_eco_rec              => l_eco_rec
3242                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
3243                 ,  x_revised_item_tbl     => l_revised_item_tbl
3244                 ,  x_rev_component_tbl    => l_rev_component_tbl
3245                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
3246                 ,  x_sub_component_tbl    => l_sub_component_tbl
3247                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3248                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3249                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3250                 );
3251 
3252         x_return_status                := l_bo_return_status;
3253         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
3254         x_eco_revision_tbl             := l_eco_revision_tbl;
3255         x_unexp_eco_rev_rec            := l_eco_rev_unexp_rec;
3256         x_revised_item_tbl             := l_revised_item_tbl;
3257         x_rev_component_tbl            := l_rev_component_tbl;
3258         x_ref_designator_tbl           := l_ref_designator_tbl;
3259         x_sub_component_tbl            := l_sub_component_tbl;
3260 
3261         l_return_status := 'U';
3262 
3263         IF g_control_rec.write_to_db
3264         THEN
3265                 RAISE;
3266         END IF;
3267 
3268   END;
3269   END LOOP; -- END eco revisions processing block
3270 
3271     IF l_return_status in ('Q', 'U')
3272     THEN
3273         x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
3274         x_return_status := l_return_status;
3275         RETURN;
3276     END IF;
3277 
3278     l_bo_return_status := l_return_status;
3279 
3280 
3281      --  Load OUT parameters
3282 
3283      x_return_status            := l_bo_return_status;
3284      x_ECO_rec                  := l_ECO_rec;
3285      x_unexp_eco_rev_rec        := l_eco_rev_unexp_Rec;
3286      x_eco_revision_tbl         := l_eco_revision_tbl;
3287      x_revised_item_tbl         := l_revised_item_tbl;
3288      x_rev_component_tbl        := l_rev_component_tbl;
3289      x_ref_designator_tbl       := l_ref_designator_tbl;
3290      x_sub_component_tbl        := l_sub_component_tbl;
3291      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
3292 
3293 END Eco_Rev;
3294 
3295 --  Eco_Header
3296 
3297 PROCEDURE Eco_Header
3298 (   p_ECO_rec                       IN  ENG_Eco_PUB.Eco_Rec_Type
3299 ,   p_unexp_ECO_rec                 IN  ENG_Eco_PUB.ECO_Unexposed_Rec_Type
3300 ,   p_eco_revision_tbl              IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type
3301 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type
3302 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type
3303 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type
3304 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type
3305 ,   p_rev_operation_tbl             IN  BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
3306 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
3307 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
3308 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
3309 ,   x_unexp_ECO_rec                 IN OUT NOCOPY ENG_Eco_PUB.ECO_Unexposed_Rec_Type
3310 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
3311 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
3312 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
3313 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
3314 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
3315 ,   x_Mesg_Token_Tbl                IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
3316 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_operation_Tbl_Type    --add
3317 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_op_resource_Tbl_Type  --add
3318 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_sub_resource_Tbl_Type --add
3319 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
3320 )
3321 IS
3322 
3323 l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
3324 l_other_token_tbl       Error_Handler.Token_Tbl_Type;
3325 l_other_message         VARCHAR2(50);
3326 l_err_text              VARCHAR2(2000);
3327 l_valid                 BOOLEAN := TRUE;
3328 l_Return_Status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
3329 l_bo_return_status      VARCHAR2(1) := 'S';
3330 l_ECO_Rec               Eng_Eco_Pub.ECO_Rec_Type;
3331 l_eco_unexp_Rec         Eng_Eco_Pub.ECO_Unexposed_Rec_Type := p_unexp_eco_rec;
3332 l_Old_ECO_Rec           Eng_Eco_Pub.ECO_Rec_Type := NULL;
3333 l_Old_ECO_Unexp_Rec     Eng_Eco_Pub.ECO_Unexposed_Rec_Type   := NULL;
3334 l_eco_revision_tbl      ENG_Eco_PUB.Eco_Revision_Tbl_Type    := p_eco_revision_tbl;
3335 l_revised_item_tbl      ENG_Eco_PUB.Revised_Item_Tbl_Type    := p_revised_item_tbl;
3336 l_rev_component_tbl     BOM_BO_PUB.Rev_Component_Tbl_Type    := p_rev_component_tbl;
3337 l_ref_designator_tbl    BOM_BO_PUB.Ref_Designator_Tbl_Type   := p_ref_designator_tbl;
3338 l_sub_component_tbl     BOM_BO_PUB.Sub_Component_Tbl_Type    := p_sub_component_tbl;
3339 l_rev_operation_tbl     BOM_RTG_PUB.Rev_Operation_Tbl_Type    := p_rev_operation_tbl;
3340 l_rev_op_resource_tbl   BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type  := p_rev_op_resource_tbl;
3341 l_rev_sub_resource_tbl  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type := p_rev_sub_resource_tbl;
3342 l_return_value          NUMBER;
3343 l_Token_Tbl             Error_Handler.Token_Tbl_Type;
3344 
3345 --10dec
3346 l_ECO_Rec_1               Eng_Eco_Pub.ECO_Rec_Type           := p_ECO_rec;
3347 l_eco_unexp_Rec_1         Eng_Eco_Pub.ECO_Unexposed_Rec_Type := p_unexp_eco_rec;
3348 
3349 
3350 EXC_SEV_QUIT_RECORD     EXCEPTION;
3351 EXC_UNEXP_SKIP_OBJECT   EXCEPTION;
3352 
3353 BEGIN
3354 
3355     -- Begin block that processes header. This block holds the exception handlers
3356     -- for header errors.
3357 
3358     BEGIN
3359 
3360 IF BOM_Globals.get_debug = 'Y'
3361    Then
3362      error_handler.write_debug('start of eco_header.');
3363    END IF;
3364 
3365 
3366 
3367         l_ECO_rec := p_ECO_rec;
3368         l_ECO_rec.transaction_type := UPPER(l_eco_rec.transaction_type);
3369 
3370         l_return_status := FND_API.G_RET_STS_SUCCESS;
3371         l_eco_rec.return_status := FND_API.G_RET_STS_SUCCESS;
3372 
3373         -- Process Flow step 3: Verify ECO's existence
3374         --
3375 
3376         IF g_control_rec.check_existence
3377         THEN
3378 /*
3379 IF BOM_Globals.get_debug = 'Y'
3380    Then
3381      error_handler.write_debug('organization id is');
3382      error_handler.write_debug(' l_eco_unexp_rec.organization_idorganization id is');
3383    END IF;
3384 */
3385 
3386                --dbms_output.put_line('Checking Existence');
3387                 ENG_Validate_Eco.Check_Existence
3388                 ( p_change_notice       => l_eco_rec.ECO_Name
3389                 , p_organization_id     => l_eco_unexp_rec.organization_id
3390                 , p_organization_code   => l_eco_rec.organization_code
3391                 , p_calling_entity      => 'ECO'
3392                 , p_transaction_type    => l_eco_rec.transaction_type
3393                 , x_eco_rec             => l_old_eco_rec
3394                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
3395                 , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
3396                 , x_return_status       => l_Return_Status
3397                 );
3398 
3399                 --dbms_output.put_line('return_status: ' || l_return_status);
3400 
3401                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3402                 THEN
3403                         RAISE EXC_SEV_QUIT_RECORD;
3404                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3405                 THEN
3406                         RAISE EXC_UNEXP_SKIP_OBJECT;
3407                 END IF;
3408         END IF;
3409 
3410 IF BOM_Globals.get_debug = 'Y'
3411    Then
3412      error_handler.write_debug('Attribute defaulting.');
3413    END IF;
3414 
3415         IF g_control_rec.attribute_defaulting AND
3416            l_ECO_Rec.Transaction_Type = ENG_GLOBALS.G_OPR_CREATE
3417         THEN
3418 
3419                 -- Process Flow step 9: Default missing values for Operation CREATE
3420 
3421                 --dbms_output.put_line('Attribute Defaulting');
3422                 Eng_Default_ECO.Attribute_Defaulting
3423                 (   p_ECO_rec           => l_ECO_Rec_1
3424                 ,   p_Unexp_ECO_Rec     => l_ECO_Unexp_Rec_1
3425                 ,   x_ECO_rec           => l_ECO_Rec
3426                 ,   x_Unexp_ECO_Rec     => l_ECO_Unexp_Rec
3427                 ,   x_Mesg_Token_Tbl    => l_Mesg_Token_Tbl
3428                 ,   x_return_status     => l_Return_Status
3429                 );
3430 
3431                 --dbms_output.put_line('return_status: ' || l_return_status);
3432 
3433                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3434                 THEN
3435                         RAISE EXC_SEV_QUIT_RECORD;
3436                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3437                 THEN
3438                         RAISE EXC_UNEXP_SKIP_OBJECT;
3439                 ELSIF l_return_status ='S' AND
3440                       l_Mesg_Token_Tbl.COUNT <>0
3441                 THEN
3442                         Eco_Error_Handler.Log_Error
3443                         (  p_ECO_rec              => l_ECO_rec
3444                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
3445                         ,  p_revised_item_tbl     => l_revised_item_tbl
3446                         ,  p_rev_component_tbl    => l_rev_component_tbl
3447                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
3448                         ,  p_sub_component_tbl    => l_sub_component_tbl
3449                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3450                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3451                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3452                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
3453                         ,  p_error_status         => 'W'
3454                         ,  p_error_level          => 1
3455                         ,  x_ECO_rec              => l_ECO_rec
3456                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
3457                         ,  x_revised_item_tbl     => l_revised_item_tbl
3458                         ,  x_rev_component_tbl    => l_rev_component_tbl
3459                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
3460                         ,  x_sub_component_tbl    => l_sub_component_tbl
3461                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3462                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3463                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3464                         );
3465                 END IF;
3466         END IF;
3467 
3468 IF BOM_Globals.get_debug = 'Y'
3469    Then
3470      error_handler.write_debug('end of Attribute defaulting..');
3471    END IF;
3472 
3473 
3474         IF g_control_rec.entity_defaulting OR
3475            g_control_rec.entity_validation
3476         THEN
3477                 --dbms_output.put_line('querying row');
3478                 ENG_ECO_Util.Query_Row
3479                 ( p_change_notice       => l_ECO_rec.eco_name
3480                 , p_organization_id     => l_eco_unexp_rec.organization_id
3481                 , x_eco_rec             => l_old_eco_rec
3482                 , x_eco_unexp_rec       => l_old_eco_unexp_rec
3483                 , x_return_status       => l_return_status
3484                 , x_err_text            => l_err_text
3485                 );
3486 /*              IF l_return_status = 'F'
3487                 THEN
3488                         dbms_output.put_line('queried old record');
3489                 ELSIF l_return_status = 'N'
3490                 THEN
3491                         dbms_output.put_line('old record not found');
3492                 END IF;*/
3493         END IF;
3494 IF BOM_Globals.get_debug = 'Y'
3495    Then
3496      error_handler.write_debug('end of query row..');
3497    END IF;
3498 
3499 
3500      -- Process Flow step 11 - Entity Level Defaulting
3501 
3502         IF g_control_rec.entity_defaulting
3503         THEN
3504                 --dbms_output.put_line('Entity Defaulting');
3505 
3506                 ENG_Default_ECO.Entity_Defaulting
3507                 (   p_ECO_rec            => l_ECO_rec
3508                 ,   p_Unexp_ECO_rec      => l_ECO_unexp_rec
3509                 ,   p_Old_ECO_rec        => l_old_ECO_rec
3510                 ,   p_Old_Unexp_ECO_rec  => l_old_ECO_unexp_rec
3511                 ,   p_control_rec        => g_control_rec
3512                 ,   x_ECO_rec            => l_ECO_rec
3513                 ,   x_Unexp_ECO_rec      => l_ECO_unexp_rec
3514                 ,   x_return_status      => l_return_status
3515                 ,   x_Mesg_Token_Tbl     => l_Mesg_Token_Tbl
3516                 );
3517 
3518                 --dbms_output.put_line('return_status: ' || l_return_status);
3519 
3520                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3521                 THEN
3522                         RAISE EXC_SEV_QUIT_RECORD;
3523                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3524                 THEN                       RAISE EXC_UNEXP_SKIP_OBJECT;
3525                 ELSIF l_return_status ='S' AND
3526                       l_Mesg_Token_Tbl.COUNT <>0
3527                 THEN
3528                         Eco_Error_Handler.Log_Error
3529                         (  p_ECO_rec              => l_ECO_rec
3530                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
3531                         ,  p_revised_item_tbl     => l_revised_item_tbl
3532                         ,  p_rev_component_tbl    => l_rev_component_tbl
3533                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
3534                         ,  p_sub_component_tbl    => l_sub_component_tbl
3535                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3536                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3537                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3538                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
3539                         ,  p_error_status         => 'W'
3540                         ,  p_error_level          => 1
3541                         ,  x_ECO_rec              => l_ECO_rec
3542                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
3543                         ,  x_revised_item_tbl     => l_revised_item_tbl
3544                         ,  x_rev_component_tbl    => l_rev_component_tbl
3545                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
3546                         ,  x_sub_component_tbl    => l_sub_component_tbl
3547                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3548                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3549                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3550                         );
3551                 END IF;
3552         END IF;
3553 
3554      -- Process Flow step 12 - Entity Level Validation
3555 IF BOM_Globals.get_debug = 'Y'
3556    Then
3557      error_handler.write_debug('After Entity default..');
3558    END IF;
3559 
3560       IF g_control_rec.entity_validation
3561         THEN
3562                 --dbms_output.put_line('Entity validation');
3563                 IF l_eco_rec.transaction_type = 'DELETE'
3564                 THEN
3565                         ENG_Validate_ECO.Check_Delete
3566                         ( p_eco_rec             => l_eco_rec
3567                         , p_Unexp_ECO_rec       => l_ECO_Unexp_Rec
3568                         , x_return_status       => l_return_status
3569                         , x_Mesg_Token_Tbl      => l_Mesg_Token_Tbl
3570                         );
3571 
3572                 ELSE
3573    IF BOM_Globals.get_debug = 'Y'
3574    Then
3575      error_handler.write_debug('Before check entiry..');
3576    END IF;
3577                         Eng_Validate_ECO.Check_Entity
3578                         (  x_return_status        => l_Return_Status
3579                         ,  x_err_text             => l_err_text
3580                         ,  x_Mesg_Token_Tbl       => l_Mesg_Token_Tbl
3581                         ,  p_ECO_rec              => l_ECO_Rec
3582                         ,  p_Unexp_ECO_Rec        => l_ECO_Unexp_Rec
3583                         ,  p_old_ECO_rec          => l_old_ECO_rec
3584                         ,  p_old_unexp_ECO_rec    => l_old_ECO_unexp_rec
3585                         ,  p_control_rec          => g_control_rec
3586                         );
3587 IF BOM_Globals.get_debug = 'Y'
3588    Then
3589      error_handler.write_debug('After check entity..');
3590 
3591 
3592    END IF;
3593                 END IF;
3594 
3595                 --dbms_output.put_line('return_status: ' || l_return_status);
3596 
3597                 IF l_return_status = Error_Handler.G_STATUS_ERROR
3598                 THEN
3599                         RAISE EXC_SEV_QUIT_RECORD;
3600                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3601                 THEN
3602                         RAISE EXC_UNEXP_SKIP_OBJECT;
3603                 ELSIF l_return_status ='S' AND
3604                       l_Mesg_Token_Tbl.COUNT <>0
3605                 THEN
3606                         Eco_Error_Handler.Log_Error
3607                         (  p_ECO_rec              => l_ECO_rec
3608                         ,  p_eco_revision_tbl     => l_eco_revision_tbl
3609                         ,  p_revised_item_tbl     => l_revised_item_tbl
3610                         ,  p_rev_component_tbl    => l_rev_component_tbl
3611                         ,  p_ref_designator_tbl   => l_ref_designator_tbl
3612                         ,  p_sub_component_tbl    => l_sub_component_tbl
3613                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3614                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3615                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3616                         ,  p_mesg_token_tbl       => l_mesg_token_tbl
3617                         ,  p_error_status         => 'W'
3618                         ,  p_error_level          => 1
3619                         ,  x_ECO_rec              => l_ECO_rec
3620                         ,  x_eco_revision_tbl     => l_eco_revision_tbl
3621                         ,  x_revised_item_tbl     => l_revised_item_tbl
3622                         ,  x_rev_component_tbl    => l_rev_component_tbl
3623                         ,  x_ref_designator_tbl   => l_ref_designator_tbl
3624                         ,  x_sub_component_tbl    => l_sub_component_tbl
3625                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3626                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3627                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3628                         );
3629                 END IF;
3630         END IF;
3631 IF BOM_Globals.get_debug = 'Y'
3632    Then
3633      error_handler.write_debug('After check entity..');
3634 END IF;
3635 
3636 
3637         -- Process Flow step 13 : Database Writes
3638 IF BOM_Globals.get_debug = 'Y'
3639    Then
3640      error_handler.write_debug('Before write to db..');
3641 END IF;
3642 
3643         IF g_control_rec.write_to_db
3644         THEN
3645                 eng_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
3646                 eng_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
3647 
3648 IF BOM_Globals.get_debug = 'Y'
3649    Then
3650      error_handler.write_debug('write_to db is true');
3651 END IF;
3652 
3653 
3654                 --dbms_output.put_line('Writing to the database');
3655                 ENG_ECO_Util.Perform_Writes
3656                 (   p_ECO_rec          => l_ECO_rec
3657                 ,   p_Unexp_ECO_rec    => l_ECO_unexp_rec
3658                 ,   p_old_ECO_rec      => l_old_ECO_rec
3659                 ,   p_control_rec      => g_control_rec
3660                 ,   x_Mesg_Token_Tbl   => l_Mesg_Token_Tbl
3661                 ,   x_return_status    => l_return_status
3662                 );
3663 IF BOM_Globals.get_debug = 'Y'
3664    Then
3665      error_handler.write_debug('After write to db..');
3666 END IF;
3667 
3668 
3669                 IF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
3670                 THEN
3671                         RAISE EXC_UNEXP_SKIP_OBJECT;
3672                 ELSIF l_return_status ='S' AND
3673                       l_Mesg_Token_Tbl.COUNT <>0
3674                 THEN
3675                         Eco_Error_Handler.Log_Error
3676                         (  p_ECO_rec            => l_ECO_rec
3677                         ,  p_eco_revision_tbl   => l_eco_revision_tbl
3678                         ,  p_revised_item_tbl   => l_revised_item_tbl
3679                         ,  p_rev_component_tbl  => l_rev_component_tbl
3680                         ,  p_ref_designator_tbl => l_ref_designator_tbl
3681                         ,  p_sub_component_tbl  => l_sub_component_tbl
3682                         ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3683                         ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3684                         ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3685                         ,  p_mesg_token_tbl     => l_mesg_token_tbl
3686                         ,  p_error_status       => 'W'
3687                         ,  p_error_level        => 1
3688                         ,  x_ECO_rec            => l_ECO_rec
3689                         ,  x_eco_revision_tbl   => l_eco_revision_tbl
3690                         ,  x_revised_item_tbl   => l_revised_item_tbl
3691                         ,  x_rev_component_tbl  => l_rev_component_tbl
3692                         ,  x_ref_designator_tbl => l_ref_designator_tbl
3693                         ,  x_sub_component_tbl  => l_sub_component_tbl
3694                         ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3695                         ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3696                         ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3697                         );
3698                 END IF;
3699         END IF;
3700 
3701   EXCEPTION
3702 
3703     WHEN EXC_SEV_QUIT_RECORD THEN
3704 
3705         Eco_Error_Handler.Log_Error
3706                 (  p_ECO_rec              => l_ECO_rec
3707                 ,  p_eco_revision_tbl     => l_eco_revision_tbl
3708                 ,  p_revised_item_tbl     => l_revised_item_tbl
3709                 ,  p_rev_component_tbl    => l_rev_component_tbl
3710                 ,  p_ref_designator_tbl   => l_ref_designator_tbl
3711                 ,  p_sub_component_tbl    => l_sub_component_tbl
3712                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3713                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3714                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3715                 ,  p_mesg_token_tbl       => l_mesg_token_tbl
3716                 ,  p_error_status         => FND_API.G_RET_STS_ERROR
3717                 ,  p_error_scope          => Error_Handler.G_SCOPE_RECORD
3718                 ,  p_error_level          => 1
3719                 ,  x_ECO_rec              => l_ECO_rec
3720                 ,  x_eco_revision_tbl     => l_eco_revision_tbl
3721                 ,  x_revised_item_tbl     => l_revised_item_tbl
3722                 ,  x_rev_component_tbl    => l_rev_component_tbl
3723                 ,  x_ref_designator_tbl   => l_ref_designator_tbl
3724                 ,  x_sub_component_tbl    => l_sub_component_tbl
3725                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3726                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3727                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3728                 );
3729 --dbms_output.put_line('logged error: ' || l_return_Status);
3730         x_return_status                := l_return_status;
3731         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
3732         x_ECO_rec                      := l_ECO_rec;
3733         x_unexp_ECO_rec                := l_eco_unexp_Rec;
3734         x_eco_revision_tbl             := l_eco_revision_tbl;
3735         x_revised_item_tbl             := l_revised_item_tbl;
3736         x_rev_component_tbl            := l_rev_component_tbl;
3737         x_ref_designator_tbl           := l_ref_designator_tbl;
3738         x_sub_component_tbl            := l_sub_component_tbl;
3739         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
3740         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
3741         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
3742 
3743         RETURN;
3744 
3745     WHEN EXC_UNEXP_SKIP_OBJECT THEN
3746        Eco_Error_Handler.Log_Error
3747                 (  p_ECO_rec            => l_ECO_rec
3748                 ,  p_eco_revision_tbl   => l_eco_revision_tbl
3749                 ,  p_revised_item_tbl   => l_revised_item_tbl
3750                 ,  p_rev_component_tbl  => l_rev_component_tbl
3751                 ,  p_ref_designator_tbl => l_ref_designator_tbl
3752                 ,  p_sub_component_tbl  => l_sub_component_tbl
3753                 ,  p_rev_operation_tbl    => l_rev_operation_tbl    --add
3754                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3755                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3756                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
3757                 ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
3758                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
3759                 ,  p_other_message      => l_other_message
3760                 ,  p_other_token_tbl    => l_other_token_tbl
3761                 ,  p_error_level        => 1
3762                 ,  x_ECO_rec            => l_ECO_rec
3763                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
3764                 ,  x_revised_item_tbl   => l_revised_item_tbl
3765                 ,  x_rev_component_tbl  => l_rev_component_tbl
3766                 ,  x_ref_designator_tbl => l_ref_designator_tbl
3767                 ,  x_sub_component_tbl  => l_sub_component_tbl
3768                 ,  x_rev_operation_tbl    => l_rev_operation_tbl    --add
3769                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl  --add
3770                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl --add
3771                 );
3772 
3773         x_return_status                := l_return_status;
3774         x_Mesg_Token_Tbl               := l_Mesg_Token_Tbl;
3775         x_ECO_rec                      := l_ECO_rec;
3776         x_unexp_ECO_rec                := l_eco_unexp_Rec;
3777         x_eco_revision_tbl             := l_eco_revision_tbl;
3778         x_revised_item_tbl             := l_revised_item_tbl;
3779         x_rev_component_tbl            := l_rev_component_tbl;
3780         x_ref_designator_tbl           := l_ref_designator_tbl;
3781         x_sub_component_tbl            := l_sub_component_tbl;
3782         x_rev_operation_tbl            := l_rev_operation_tbl;    --add
3783         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;  --add
3784         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl; --add
3785 
3786         l_return_status := 'U';
3787 
3788         IF g_control_rec.write_to_db
3789         THEN
3790                 RAISE;
3791         END IF;
3792 
3793   END; -- END Header processing block
3794 
3795     IF l_return_status in ('Q', 'U')
3796     THEN
3797         x_return_status := l_return_status;
3798         x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
3799         RETURN;
3800     END IF;
3801 
3802     l_bo_return_status := l_return_status;
3803 
3804 
3805      --  Load OUT parameters
3806 
3807      x_return_status            := l_bo_return_status;
3808      x_ECO_rec                  := l_ECO_rec;
3809      x_unexp_ECO_rec            := l_eco_unexp_Rec;
3810      x_eco_revision_tbl         := l_eco_revision_tbl;
3811      x_revised_item_tbl         := l_revised_item_tbl;
3812      x_rev_component_tbl        := l_rev_component_tbl;
3813      x_ref_designator_tbl       := l_ref_designator_tbl;
3814      x_sub_component_tbl        := l_sub_component_tbl;
3815      x_rev_operation_tbl        := l_rev_operation_tbl;    --add
3816      x_rev_op_resource_tbl      := l_rev_op_resource_tbl;  --add
3817      x_rev_sub_resource_tbl     := l_rev_sub_resource_tbl; --add
3818      x_Mesg_Token_Tbl           := l_Mesg_Token_Tbl;
3819 
3820 END Eco_Header;
3821 
3822 
3823 --  Start of Comments
3824 --  API name    Process_Eco
3825 --  Type        Private
3826 --  Function
3827 --
3828 --  Pre-reqs
3829 --
3830 --  Parameters
3831 --
3832 --  Version     Current version = 1.0
3833 --              Initial version = 1.0
3834 --
3835 --  Notes
3836 --        11-SEP-2000 Modified by Masahiko Mochizuki
3837 --  End of Comments
3838 
3839 PROCEDURE Process_Eco
3840 (   x_return_status                 IN OUT NOCOPY VARCHAR2
3841 ,   x_msg_count                     IN OUT NOCOPY NUMBER
3842 ,   p_control_rec                   IN  BOM_BO_PUB.Control_Rec_Type
3843 ,   p_ECO_rec                       IN  ENG_Eco_PUB.Eco_Rec_Type :=
3844                                         ENG_Eco_PUB.G_MISS_ECO_REC
3845 ,   p_unexp_eco_rec                 IN  ENG_Eco_PUB.ECO_Unexposed_Rec_Type := NULL
3846 ,   p_unexp_rev_item_rec            IN  ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type := NULL
3847 ,   p_unexp_rev_comp_rec            IN  BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type := NULL
3848 ,   p_unexp_eco_rev_rec             IN  ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type := NULL
3849 ,   p_unexp_sub_comp_rec            IN  BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type := NULL
3850 ,   p_unexp_ref_desg_rec            IN  BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type := NULL
3851 ,   p_unexp_rev_op_rec              IN  BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type := NULL
3852 ,   p_unexp_rev_op_res_rec          IN  BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type := NULL
3853 ,   p_unexp_rev_sub_res_rec         IN  BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type := NULL
3854 ,   p_eco_revision_tbl              IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type :=
3855                                         ENG_Eco_PUB.G_MISS_ECO_REVISION_TBL
3856 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type :=
3857                                         ENG_Eco_PUB.G_MISS_REVISED_ITEM_TBL
3858 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type :=
3859                                         BOM_BO_PUB.G_MISS_REV_COMPONENT_TBL
3860 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type :=
3861                                         BOM_BO_PUB.G_MISS_REF_DESIGNATOR_TBL
3862 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type :=
3863                                         BOM_BO_PUB.G_MISS_SUB_COMPONENT_TBL
3864 ,   p_rev_operation_tbl             IN  BOM_RTG_PUB.Rev_Operation_Tbl_Type:=
3865                                         BOM_RTG_PUB.G_MISS_REV_OPERATION_TBL
3866 ,   p_rev_op_resource_tbl           IN  BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type :=
3867                                         BOM_RTG_PUB.G_MISS_REV_OP_RESOURCE_TBL
3868 ,   p_rev_sub_resource_tbl          IN  BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type:=
3869                                         BOM_RTG_PUB.G_MISS_REV_SUB_RESOURCE_TBL
3870 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type --ECO 10dec
3871 ,   x_unexp_ECO_rec                 IN OUT NOCOPY ENG_Eco_PUB.ECO_Unexposed_Rec_Type
3872 ,   x_unexp_eco_rev_rec             IN OUT NOCOPY ENG_Eco_PUB.Eco_Rev_Unexposed_Rec_Type
3873 ,   x_unexp_revised_item_rec        IN OUT NOCOPY ENG_Eco_PUB.Rev_Item_Unexposed_Rec_Type
3874 ,   x_unexp_rev_comp_rec            IN OUT NOCOPY BOM_BO_PUB.Rev_Comp_Unexposed_Rec_Type
3875 ,   x_unexp_sub_comp_rec            IN OUT NOCOPY BOM_BO_PUB.Sub_Comp_Unexposed_Rec_Type
3876 ,   x_unexp_ref_desg_rec            IN OUT NOCOPY BOM_BO_PUB.Ref_Desg_Unexposed_Rec_Type
3877 ,   x_unexp_rev_op_rec              IN OUT NOCOPY BOM_RTG_PUB.Rev_Op_Unexposed_Rec_Type
3878 ,   x_unexp_rev_op_res_rec          IN OUT NOCOPY BOM_RTG_PUB.Rev_Op_Res_Unexposed_Rec_Type
3879 ,   x_unexp_rev_sub_res_rec         IN OUT NOCOPY BOM_RTG_PUB.Rev_Sub_Res_Unexposed_Rec_Type
3880 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
3881 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
3882 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
3883 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
3884 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
3885 ,   x_rev_operation_tbl             IN OUT NOCOPY BOM_RTG_PUB.Rev_Operation_Tbl_Type
3886 ,   x_rev_op_resource_tbl           IN OUT NOCOPY BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type
3887 ,   x_rev_sub_resource_tbl          IN OUT NOCOPY BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type
3888 ,   x_disable_revision              OUT NOCOPY NUMBER --Bug no:3034642
3889 )
3890 IS
3891 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Eco';
3892 l_err_text                    VARCHAR2(240);
3893 l_return_status               VARCHAR2(1);
3894 l_bo_return_status            VARCHAR2(1);
3895 
3896 l_control_rec                 BOM_BO_PUB.Control_Rec_Type;
3897 
3898 l_ECO_rec                     ENG_Eco_PUB.Eco_Rec_Type := p_ECO_rec;
3899 l_unexp_eco_rec               ENG_Eco_PUB.ECO_Unexposed_Rec_Type := p_unexp_eco_rec;
3900 l_eco_revision_rec            ENG_Eco_PUB.Eco_Revision_Rec_Type;
3901 l_eco_revision_tbl            ENG_Eco_PUB.Eco_Revision_Tbl_Type;
3902 l_revised_item_rec            ENG_Eco_PUB.Revised_Item_Rec_Type;
3903 l_revised_item_tbl            ENG_Eco_PUB.Revised_Item_Tbl_Type;
3904 l_rev_component_rec           BOM_BO_PUB.Rev_Component_Rec_Type;
3905 l_rev_component_tbl           BOM_BO_PUB.Rev_Component_Tbl_Type;
3906 l_ref_designator_rec          BOM_BO_PUB.Ref_Designator_Rec_Type;
3907 l_ref_designator_tbl          BOM_BO_PUB.Ref_Designator_Tbl_Type;
3908 l_sub_component_rec           BOM_BO_PUB.Sub_Component_Rec_Type;
3909 l_sub_component_tbl           BOM_BO_PUB.Sub_Component_Tbl_Type;
3910 l_rev_operation_tbl           BOM_RTG_PUB.Rev_Operation_Tbl_Type;     --add
3911 l_rev_op_resource_tbl         BOM_RTG_PUB.Rev_Op_Resource_Tbl_Type;   --add
3912 l_rev_sub_resource_tbl        BOM_RTG_PUB.Rev_Sub_Resource_Tbl_Type;  --add
3913 l_rev_operation_rec           BOM_RTG_PUB.Rev_Operation_Rec_Type;     --add
3914 l_rev_op_resource_rec         BOM_RTG_PUB.Rev_Op_Resource_Rec_Type;   --add
3915 l_rev_sub_resource_rec        BOM_RTG_PUB.Rev_Sub_Resource_Rec_Type;  --add
3916 
3917 l_mesg_token_tbl              Error_Handler.Mesg_Token_Tbl_Type;
3918 l_other_message               VARCHAR2(2000);
3919 l_other_token_tbl             Error_Handler.Token_Tbl_Type;
3920 
3921 EXC_ERR_PVT_API_MAIN          EXCEPTION;
3922 
3923 BEGIN
3924 
3925     --dbms_output.enable(1000000);
3926 
3927     --  Standard call to check for call compatibility
3928 
3929    IF BOM_Globals.get_debug = 'Y'
3930    Then
3931      error_handler.write_debug('here, for test purpose, you can write message.');
3932    END IF;
3933 
3934     --dbms_output.put_line('The following objects will be processed as part of the same business object');
3935     --dbms_output.put_line('| ECO : ' || l_ECO_rec.eco_name);
3936     --dbms_output.put_line('| ECO REVISIONS : ' || to_char(p_eco_revision_tbl.COUNT));
3937     --dbms_output.put_line('| REVISED ITEMS : ' || to_char(p_revised_item_tbl.COUNT));
3938     --dbms_output.put_line('| REVISED COMPS : ' || to_char(p_rev_component_tbl.COUNT));
3939     --dbms_output.put_line('| SUBS. COMPS   : ' || to_Char(p_sub_component_tbl.COUNT));
3940     --dbms_output.put_line('| REFD. DESGS         : ' || to_char(p_ref_designator_tbl.COUNT));
3941     --dbms_output.put_line('|----------------------------------------------------');
3942 
3943     --dbms_output.put_line('Assigning control record to global variable');
3944 
3945   -- Init Global variables.
3946     g_control_rec := p_control_rec;
3947 
3948     bom_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
3949     bom_rtg_globals.set_user_id(p_user_id => g_control_rec.last_updated_by);
3950     bom_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
3951     bom_rtg_globals.set_login_id(p_login_id => g_control_rec.last_update_login);
3952 
3953    -- bug 3583789 ,Bo_Identifier needs to be set for all the errors/warnings to be shown in the form --vani
3954     Eng_Globals.Set_Bo_Identifier(p_bo_identifier       => 'ECO');
3955 
3956     --  Init local variables
3957 
3958     l_ECO_rec                      := p_ECO_rec;
3959 
3960     --  Init local table variables.
3961 
3962     l_eco_revision_tbl             := p_eco_revision_tbl;
3963     l_revised_item_tbl             := p_revised_item_tbl;
3964     l_rev_component_tbl            := p_rev_component_tbl;
3965     l_ref_designator_tbl           := p_ref_designator_tbl;
3966     l_sub_component_tbl            := p_sub_component_tbl;
3967     l_rev_operation_tbl                 := p_rev_operation_tbl;         --add
3968     l_rev_op_resource_tbl              := p_rev_op_resource_tbl;        --add
3969     l_rev_sub_resource_tbl            := p_rev_sub_resource_tbl;        --add
3970 
3971     -- Initialize System_Information Unit_Effectivity flag
3972 
3973     IF PJM_UNIT_EFF.ENABLED = 'Y'
3974     THEN
3975         ENG_Globals.Set_Unit_Effectivity (TRUE);
3976     ELSE
3977         ENG_Globals.Set_Unit_Effectivity (FALSE);
3978     END IF;
3979 
3980 --  Added by AS on 03/17/99 to fix bug 852322
3981     l_bo_return_status := 'S';
3982 
3983     --  Eco
3984 
3985 /*   Bom_Globals.Set_Debug('Y');
3986     Error_Handler.Open_Debug_Session
3987 	(p_debug_filename	=> 'form_debug.log'
3988          , p_output_dir		=> '/sqlcom/log/dom1151'
3989          , x_return_status	=> l_return_status
3990          , p_mesg_token_tbl	=> l_mesg_token_tbl
3991          , x_mesg_Token_tbl	=> l_mesg_token_tbl
3992 	);
3993 */
3994 
3995 IF BOM_Globals.get_debug = 'Y'
3996    Then
3997      error_handler.write_debug('here, for test purpose, you can write message.');
3998    END IF;
3999 
4000     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_ECO
4001     THEN
4002         --dbms_output.put_line('PVT API: Calling ECO_Header');
4003 
4004         Eco_Header
4005         (   p_ECO_rec                   => l_ECO_rec
4006         ,   p_unexp_eco_rec             => l_unexp_eco_rec
4007         ,   p_eco_revision_tbl          => l_eco_revision_tbl
4008         ,   p_revised_item_tbl          => l_revised_item_tbl
4009         ,   p_rev_component_tbl         => l_rev_component_tbl
4010         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4011         ,   p_sub_component_tbl         => l_sub_component_tbl
4012         ,   p_rev_operation_tbl         => l_rev_operation_tbl        --add
4013         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl      --add
4014         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl     --add
4015         ,   x_ECO_rec                   => l_ECO_rec
4016         ,   x_unexp_eco_rec             => x_unexp_eco_rec
4017         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4018         ,   x_revised_item_tbl          => l_revised_item_tbl
4019         ,   x_rev_component_tbl         => l_rev_component_tbl
4020         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4021         ,   x_sub_component_tbl         => l_sub_component_tbl
4022         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4023         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4024         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4025         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4026         ,   x_return_status             => l_return_status       );
4027 
4028         --dbms_output.put_line('eco hdr return status: ' || l_eco_rec.return_status);
4029 
4030         -- Added by AS on 03/22/99 to fix bug 853529
4031 
4032         IF NVL(l_return_status, 'S') = 'Q'
4033         THEN
4034                 l_return_status := 'F';
4035                 RAISE G_EXC_QUIT_IMPORT;
4036         ELSIF NVL(l_return_status, 'S') = 'U'
4037         THEN
4038                 RAISE G_EXC_QUIT_IMPORT;
4039 
4040         --  Added by AS on 03/17/99 to fix bug 852322
4041         ELSIF NVL(l_return_status, 'S') <> 'S'
4042         THEN
4043                 l_bo_return_status := l_return_status;
4044         END IF;
4045 
4046    END IF;
4047 
4048 IF BOM_Globals.get_debug = 'Y'
4049    Then
4050      error_handler.write_debug('end of ECO header in Process_ECO..');
4051      error_handler.write_debug('here, the process entity is:');
4052      error_handler.write_debug( g_control_rec.process_entity);
4053      error_handler.write_debug( ENG_GLOBALS.G_ENTITY_ECO);
4054 
4055 
4056 END IF;
4057 
4058 --error_Handler.Close_Debug_Session;
4059 
4060 
4061    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4062 
4063     --  Eco
4064 
4065     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_ECO_REVISION
4066     THEN
4067         --dbms_output.put_line('PVT API: Calling ECO_Header');
4068 
4069         Eco_Rev
4070         (   p_eco_revision_tbl          => l_eco_revision_tbl
4071         ,   p_unexp_eco_rev_rec         => p_unexp_eco_rev_rec
4072         ,   p_revised_item_tbl          => l_revised_item_tbl
4073         ,   p_rev_component_tbl         => l_rev_component_tbl
4074         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4075         ,   p_sub_component_tbl         => l_sub_component_tbl
4076         ,   p_rev_operation_tbl         => l_rev_operation_tbl        --add
4077         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl      --add
4078         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl     --add
4079         ,   x_eco_rec                   => l_eco_rec
4080         ,   x_unexp_eco_rev_rec         => x_unexp_eco_rev_rec
4081         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4082         ,   x_revised_item_tbl          => l_revised_item_tbl
4083         ,   x_rev_component_tbl         => l_rev_component_tbl
4084         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4085         ,   x_sub_component_tbl         => l_sub_component_tbl
4086         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4087         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4088         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4089         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4090         ,   x_return_status             => l_return_status
4091         );
4092 
4093         --dbms_output.put_line('eco revisions return status: ' || l_eco_revision_tbl(1).return_status);
4094 
4095         -- Added by AS on 03/22/99 to fix bug 853529
4096 
4097         IF NVL(l_return_status, 'S') = 'Q'
4098         THEN
4099                 l_return_status := 'F';
4100                 RAISE G_EXC_QUIT_IMPORT;
4101         ELSIF NVL(l_return_status, 'S') = 'U'
4102         THEN
4103                 RAISE G_EXC_QUIT_IMPORT;
4104 
4105         --  Added by AS on 03/17/99 to fix bug 852322
4106         ELSIF NVL(l_return_status, 'S') <> 'S'
4107         THEN
4108                 l_bo_return_status := l_return_status;
4109         END IF;
4110 
4111    END IF;
4112 
4113     --  Revised Items
4114 
4115     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REVISED_ITEM
4116     THEN
4117         --dbms_output.put_line('PVT API: Calling Rev_Items');
4118 
4119         Rev_Items
4120         (   p_revised_item_tbl          => l_revised_item_tbl
4121         ,   p_unexp_rev_item_rec        => p_unexp_rev_item_rec
4122         ,   p_rev_component_tbl         => l_rev_component_tbl
4123         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4124         ,   p_sub_component_tbl         => l_sub_component_tbl
4125         ,   p_rev_operation_tbl         => l_rev_operation_tbl        --add
4126         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl      --add
4127         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl     --add
4128         ,   x_ECO_rec                   => l_ECO_rec
4129         ,   x_unexp_rev_item_rec        => x_unexp_revised_item_rec
4130         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4131         ,   x_revised_item_tbl          => l_revised_item_tbl
4132         ,   x_rev_component_tbl         => l_rev_component_tbl
4133         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4134         ,   x_sub_component_tbl         => l_sub_component_tbl
4135         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4136         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4137         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4138         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4139         ,   x_return_status             => l_return_status
4140 	,   x_disable_revision          =>  x_disable_revision  --Bug no:3034642
4141         ) ;
4142 
4143 IF BOM_Globals.get_debug = 'Y'
4144    Then
4145      error_handler.write_debug('after rev_items, the return status is');
4146      error_handler.write_debug(l_return_status);
4147    END IF;
4148 
4149         --dbms_output.put_line('rev items return status: ' || l_revised_item_tbl(1).return_status);
4150 
4151         -- Added by AS on 03/22/99 to fix bug 853529
4152 
4153         IF NVL(l_return_status, 'S') = 'Q'
4154         THEN
4155                 l_return_status := 'F';
4156                 RAISE G_EXC_QUIT_IMPORT;
4157         ELSIF NVL(l_return_status, 'S') = 'U'
4158         THEN
4159                 RAISE G_EXC_QUIT_IMPORT;
4160 
4161         --  Added by AS on 03/17/99 to fix bug 852322
4162         ELSIF NVL(l_return_status, 'S') <> 'S'
4163         THEN
4164                 l_bo_return_status := l_return_status;
4165         END IF;
4166 
4167    END IF;
4168 
4169    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4170 
4171     --  Revised Components
4172 
4173     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REV_COMPONENT
4174     THEN
4175         --dbms_output.put_line('PVT API: Calling Rev_Comps');
4176 
4177         Rev_Comps
4178         (   p_rev_component_tbl         => l_rev_component_tbl
4179         ,   p_unexp_rev_comp_rec        => p_unexp_rev_comp_rec
4180         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4181         ,   p_sub_component_tbl         => l_sub_component_tbl
4182         ,   x_ECO_rec                   => l_ECO_rec
4183         ,   x_unexp_rev_comp_rec        => x_unexp_rev_comp_rec
4184         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4185         ,   x_revised_item_tbl          => l_revised_item_tbl
4186         ,   x_rev_component_tbl         => l_rev_component_tbl
4187         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4188         ,   x_sub_component_tbl         => l_sub_component_tbl
4189         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4190         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4191         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4192         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4193         ,   x_return_status             => l_return_status
4194         ) ;
4195 
4196         --dbms_output.put_line('rev comps return status: ' || l_return_status);
4197 --dbms_output.put_line('main item num: ' || to_char(l_rev_component_tbl(1).item_sequence_number));
4198         -- Added by AS on 03/22/99 to fix bug 853529
4199 
4200         IF NVL(l_return_status, 'S') = 'Q'
4201         THEN
4202                 l_return_status := 'F';
4203                 RAISE G_EXC_QUIT_IMPORT;
4204         ELSIF NVL(l_return_status, 'S') = 'U'
4205         THEN
4206                 RAISE G_EXC_QUIT_IMPORT;
4207 
4208         --  Added by AS on 03/17/99 to fix bug 852322
4209         ELSIF NVL(l_return_status, 'S') <> 'S'
4210         THEN
4211                 l_bo_return_status := l_return_status;
4212         END IF;
4213 
4214    END IF;
4215 
4216    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4217 
4218     --  Reference Designators
4219 
4220     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REF_DESIGNATOR
4221     THEN
4222         --dbms_output.put_line('PVT API: Calling Sub_Comps');
4223 
4224         Ref_Desgs
4225         (   p_unexp_ref_desg_rec        => p_unexp_ref_desg_rec
4226         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4227         ,   p_sub_component_tbl         => l_sub_component_tbl
4228         ,   x_ECO_rec                   => l_ECO_rec
4229         ,   x_unexp_ref_desg_rec        => x_unexp_ref_desg_rec
4230         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4231         ,   x_revised_item_tbl          => l_revised_item_tbl
4232         ,   x_rev_component_tbl         => l_rev_component_tbl
4233         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4234         ,   x_sub_component_tbl         => l_sub_component_tbl
4235         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4236         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4237         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4238         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4239         ,   x_return_status             => l_return_status
4240         ) ;
4241 
4242         --dbms_output.put_line('ref desgs return status: ' || l_ref_designator_tbl(1).return_status);
4243 
4244         -- Added by AS on 03/22/99 to fix bug 853529
4245 
4246         IF NVL(l_return_status, 'S') = 'Q'
4247         THEN
4248                 l_return_status := 'F';
4249                 RAISE G_EXC_QUIT_IMPORT;
4250         ELSIF NVL(l_return_status, 'S') = 'U'
4251         THEN
4252                 RAISE G_EXC_QUIT_IMPORT;
4253 
4254         --  Added by AS on 03/17/99 to fix bug 852322
4255         ELSIF NVL(l_return_status, 'S') <> 'S'
4256         THEN
4257                 l_bo_return_status := l_return_status;
4258         END IF;
4259 
4260    END IF;
4261 
4262    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4263 
4264     --  Substitute Components
4265 
4266     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_SUB_COMPONENT
4267     THEN
4268         --dbms_output.put_line('PVT API: Calling Sub_Comps');
4269 
4270         Sub_Comps
4271         (   p_unexp_sub_comp_rec        => p_unexp_sub_comp_rec
4272         ,   p_ref_designator_tbl        => l_ref_designator_tbl
4273         ,   p_sub_component_tbl         => l_sub_component_tbl
4274         ,   x_ECO_rec                   => l_ECO_rec
4275         ,   x_unexp_sub_comp_rec        => x_unexp_sub_comp_rec
4276         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4277         ,   x_revised_item_tbl          => l_revised_item_tbl
4278         ,   x_rev_component_tbl         => l_rev_component_tbl
4279         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4280         ,   x_sub_component_tbl         => l_sub_component_tbl
4281         ,   x_rev_operation_tbl         => l_rev_operation_tbl         --add
4282         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl       --add
4283         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl      --add
4284         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4285         ,   x_return_status             => l_return_status
4286         ) ;
4287 
4288         --dbms_output.put_line('sub comps return status: ' || l_sub_component_tbl(1).return_status);
4289 
4290         -- Added by AS on 03/22/99 to fix bug 853529
4291 
4292         IF NVL(l_return_status, 'S') = 'Q'
4293         THEN
4294                 l_return_status := 'F';
4295                 RAISE G_EXC_QUIT_IMPORT;
4296         ELSIF NVL(l_return_status, 'S') = 'U'
4297         THEN
4298                 RAISE G_EXC_QUIT_IMPORT;
4299 
4300         --  Added by AS on 03/17/99 to fix bug 852322
4301         ELSIF NVL(l_return_status, 'S') <> 'S'
4302         THEN
4303                 l_bo_return_status := l_return_status;
4304         END IF;
4305 
4306    END IF;
4307 
4308    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4309 
4310 -- Added by Masahiko Mochizuki on 09/11/00
4311 
4312     --  Revised Operations
4313 
4314     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REV_OPERATION
4315     THEN
4316         --dbms_output.put_line('PVT API: Calling Rev_Ops');
4317 
4318 
4319        Rev_Ops
4320         (   p_rev_operation_tbl         => l_rev_operation_tbl
4321         ,   p_unexp_rev_op_rec          => p_unexp_rev_op_rec
4322         ,   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
4323         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4324         ,   x_ECO_rec                   => l_ECO_rec
4325         ,   x_unexp_rev_op_rec          => x_unexp_rev_op_rec
4326         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4327         ,   x_revised_item_tbl          => l_revised_item_tbl
4328         ,   x_rev_component_tbl         => l_rev_component_tbl
4329         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4330         ,   x_sub_component_tbl         => l_sub_component_tbl
4331         ,   x_rev_operation_tbl         => l_rev_operation_tbl
4332         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
4333         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4334         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4335         ,   x_return_status             => l_return_status
4336         ) ;
4337 
4338         IF NVL(l_return_status, 'S') = 'Q'
4339         THEN
4340                 l_return_status := 'F';
4341                 RAISE G_EXC_QUIT_IMPORT;
4342         ELSIF NVL(l_return_status, 'S') = 'U'
4343         THEN
4344                 RAISE G_EXC_QUIT_IMPORT;
4345 
4346         ELSIF NVL(l_return_status, 'S') <> 'S'
4347         THEN
4348                 l_bo_return_status := l_return_status;
4349         END IF;
4350 
4351    END IF;
4352 
4353    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4354 
4355 
4356 -- Added by Masahiko Mochizuki on 09/11/00
4357 
4358     --  Revised Operation Resources
4359 
4360     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REV_OP_RESOURCE
4361     THEN
4362         --dbms_output.put_line('PVT API: Calling Rev_Op_Res');
4363 
4364 
4365        Rev_Op_Res
4366         (   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
4367         ,   p_unexp_rev_op_res_rec      => p_unexp_rev_op_res_rec
4368         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4369         ,   x_ECO_rec                   => l_ECO_rec
4370         ,   x_unexp_rev_op_res_rec      => x_unexp_rev_op_res_rec
4371         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4372         ,   x_revised_item_tbl          => l_revised_item_tbl
4373         ,   x_rev_component_tbl         => l_rev_component_tbl
4374         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4375         ,   x_sub_component_tbl         => l_sub_component_tbl
4376         ,   x_rev_operation_tbl         => l_rev_operation_tbl
4377         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
4378         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4379         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4380         ,   x_return_status             => l_return_status
4381         ) ;
4382 
4383         IF NVL(l_return_status, 'S') = 'Q'
4384         THEN
4385                 l_return_status := 'F';
4386                 RAISE G_EXC_QUIT_IMPORT;
4387         ELSIF NVL(l_return_status, 'S') = 'U'
4388         THEN
4389                 RAISE G_EXC_QUIT_IMPORT;
4390 
4391         ELSIF NVL(l_return_status, 'S') <> 'S'
4392         THEN
4393                 l_bo_return_status := l_return_status;
4394         END IF;
4395 
4396    END IF;
4397 
4398    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4399 
4400 
4401 -- Added by Masahiko Mochizuki on 09/11/00
4402 
4403     --  Revised Sub Operation Resources
4404 
4405     IF  g_control_rec.process_entity = ENG_GLOBALS.G_ENTITY_REV_SUB_RESOURCE
4406     THEN
4407         --dbms_output.put_line('PVT API: Calling Rev_Sub_Res');
4408 
4409 
4410        Rev_Sub_Res
4411         (   p_rev_op_resource_tbl       => l_rev_op_resource_tbl
4412         ,   p_unexp_rev_sub_res_rec     => p_unexp_rev_sub_res_rec
4413         ,   p_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4414         ,   x_ECO_rec                   => l_ECO_rec
4415         ,   x_unexp_rev_sub_res_rec     => x_unexp_rev_sub_res_rec
4416         ,   x_eco_revision_tbl          => l_eco_revision_tbl
4417         ,   x_revised_item_tbl          => l_revised_item_tbl
4418         ,   x_rev_component_tbl         => l_rev_component_tbl
4419         ,   x_ref_designator_tbl        => l_ref_designator_tbl
4420         ,   x_sub_component_tbl         => l_sub_component_tbl
4421         ,   x_rev_operation_tbl         => l_rev_operation_tbl
4422         ,   x_rev_op_resource_tbl       => l_rev_op_resource_tbl
4423         ,   x_rev_sub_resource_tbl      => l_rev_sub_resource_tbl
4424         ,   x_Mesg_Token_Tbl            => l_Mesg_Token_Tbl
4425         ,   x_return_status             => l_return_status
4426         ) ;
4427 
4428         IF NVL(l_return_status, 'S') = 'Q'
4429         THEN
4430                 l_return_status := 'F';
4431                 RAISE G_EXC_QUIT_IMPORT;
4432         ELSIF NVL(l_return_status, 'S') = 'U'
4433         THEN
4434                 RAISE G_EXC_QUIT_IMPORT;
4435 
4436         ELSIF NVL(l_return_status, 'S') <> 'S'
4437         THEN
4438                 l_bo_return_status := l_return_status;
4439         END IF;
4440 
4441    END IF;
4442 
4443    --dbms_output.put_line('BO error status: ' || l_bo_return_status);
4444 
4445 
4446     --  Done processing, load OUT parameters.
4447    --  Added by AS on 03/17/99 to fix bug 852322
4448     x_return_status                := l_bo_return_status;
4449 
4450     x_ECO_rec                      := l_ECO_rec;
4451     x_eco_revision_tbl             := l_eco_revision_tbl;
4452     x_revised_item_tbl             := l_revised_item_tbl;
4453     x_rev_component_tbl            := l_rev_component_tbl;
4454     x_ref_designator_tbl           := l_ref_designator_tbl;
4455     x_sub_component_tbl            := l_sub_component_tbl;
4456     x_rev_operation_tbl            := l_rev_operation_tbl;         --add
4457     x_rev_op_resource_tbl          := l_rev_op_resource_tbl;       --add
4458     x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;      --add
4459 
4460     -- Reset system_information business object flags
4461 
4462 IF BOM_Globals.get_debug = 'Y'
4463    Then
4464      error_handler.write_debug('before set global variables.');
4465    END IF;
4466 
4467     ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
4468     ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
4469     ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
4470     ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
4471     ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
4472     ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
4473     ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
4474     ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
4475 IF BOM_Globals.get_debug = 'Y'
4476    Then
4477      error_handler.write_debug('end of process_eco');
4478    END IF;
4479 
4480 EXCEPTION
4481 
4482     WHEN EXC_ERR_PVT_API_MAIN THEN
4483 
4484         Eco_Error_Handler.Log_Error
4485                 (  p_ECO_rec            => l_ECO_rec
4486                 ,  p_eco_revision_tbl   => l_eco_revision_tbl
4487                 ,  p_revised_item_tbl   => l_revised_item_tbl
4488                 ,  p_rev_component_tbl  => l_rev_component_tbl
4489                 ,  p_ref_designator_tbl => l_ref_designator_tbl
4490                 ,  p_sub_component_tbl  => l_sub_component_tbl
4491                 ,  p_rev_operation_tbl     => l_rev_operation_tbl       --add
4492                 ,  p_rev_op_resource_tbl   => l_rev_op_resource_tbl     --add
4493                 ,  p_rev_sub_resource_tbl  => l_rev_sub_resource_tbl    --add
4494                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
4495                 ,  p_error_status       => FND_API.G_RET_STS_UNEXP_ERROR
4496                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
4497                 ,  p_other_message      => l_other_message
4498                 ,  p_other_token_tbl    => l_other_token_tbl
4499                 ,  p_error_level        => 0
4500                 ,  x_ECO_rec            => l_ECO_rec
4501                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
4502                 ,  x_revised_item_tbl   => l_revised_item_tbl
4503                 ,  x_rev_component_tbl  => l_rev_component_tbl
4504                 ,  x_ref_designator_tbl => l_ref_designator_tbl
4505                 ,  x_sub_component_tbl  => l_sub_component_tbl
4506                 ,  x_rev_operation_tbl     => l_rev_operation_tbl      --add
4507                 ,  x_rev_op_resource_tbl   => l_rev_op_resource_tbl    --add
4508                 ,  x_rev_sub_resource_tbl  => l_rev_sub_resource_tbl   --add
4509                 );
4510 
4511         x_return_status                := l_return_status;
4512         x_ECO_rec                      := l_ECO_rec;
4513         x_eco_revision_tbl             := l_eco_revision_tbl;
4514         x_revised_item_tbl             := l_revised_item_tbl;
4515         x_rev_component_tbl            := l_rev_component_tbl;
4516         x_ref_designator_tbl           := l_ref_designator_tbl;
4517         x_sub_component_tbl            := l_sub_component_tbl;
4518         x_rev_operation_tbl            := l_rev_operation_tbl;         --add
4519         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;       --add
4520         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;      --add
4521 
4522 
4523         -- Reset system_information business object flags
4524 
4525         ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
4526         ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
4527         ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
4528         ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
4529         ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
4530         ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
4531         ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
4532         ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
4533 
4534     WHEN G_EXC_QUIT_IMPORT THEN
4535 
4536         x_return_status                := l_return_status;
4537         x_ECO_rec                      := l_ECO_rec;
4538         x_eco_revision_tbl             := l_eco_revision_tbl;
4539         x_revised_item_tbl             := l_revised_item_tbl;
4540         x_rev_component_tbl            := l_rev_component_tbl;
4541         x_ref_designator_tbl           := l_ref_designator_tbl;
4542         x_sub_component_tbl            := l_sub_component_tbl;
4543         x_rev_operation_tbl            :=  l_rev_operation_tbl;         --add
4544         x_rev_op_resource_tbl          :=  l_rev_op_resource_tbl;       --add
4545         x_rev_sub_resource_tbl         :=  l_rev_sub_resource_tbl;      --add
4546 
4547         -- Reset system_information business object flags
4548 
4549         ENG_GLOBALS.Set_ECO_Impl( p_eco_impl        => NULL);
4550         ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl      => NULL);
4551         ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process=> NULL);
4552         ENG_GLOBALS.Set_ECO_Access( p_eco_access    => NULL);
4553         ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
4554         ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
4555         ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
4556         ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
4557 
4558     WHEN OTHERS THEN
4559 
4560 
4561 IF BOM_Globals.get_debug = 'Y'
4562    Then
4563      error_handler.write_debug('error in process_eco.');
4564    END IF;
4565    Error_Handler.Close_Debug_Session;
4566 
4567         IF g_control_rec.write_to_db
4568         THEN
4569                 RAISE;
4570         END IF;
4571 
4572         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4573         THEN
4574                 l_err_text := G_PKG_NAME || ' : Process ECO '
4575                         || substrb(SQLERRM,1,200);
4576                 Error_Handler.Add_Error_Token
4577                         ( p_Message_Text => l_err_text
4578                         , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
4579                         , x_Mesg_Token_Tbl => l_Mesg_Token_Tbl
4580                         );
4581         END IF;
4582 
4583         Eco_Error_Handler.Log_Error
4584                 (  p_ECO_rec            => l_ECO_rec
4585                 ,  p_eco_revision_tbl   => l_eco_revision_tbl
4586                 ,  p_revised_item_tbl   => l_revised_item_tbl
4587                 ,  p_rev_component_tbl  => l_rev_component_tbl
4588                 ,  p_ref_designator_tbl => l_ref_designator_tbl
4589                 ,  p_sub_component_tbl  => l_sub_component_tbl
4590                 ,  p_rev_operation_tbl    => l_rev_operation_tbl       --add
4591                 ,  p_rev_op_resource_tbl  => l_rev_op_resource_tbl     --add
4592                 ,  p_rev_sub_resource_tbl => l_rev_sub_resource_tbl    --add
4593                 ,  p_mesg_token_tbl     => l_mesg_token_tbl
4594                 ,  p_error_status       => FND_API.G_RET_STS_UNEXP_ERROR
4595                 ,  p_other_status       => Error_Handler.G_STATUS_NOT_PICKED
4596                 ,  p_other_message      => l_other_message
4597                 ,  p_other_token_tbl    => l_other_token_tbl
4598                 ,  p_error_level        => 0
4599                 ,  x_ECO_rec            => l_ECO_rec
4600                 ,  x_eco_revision_tbl   => l_eco_revision_tbl
4601                 ,  x_revised_item_tbl   => l_revised_item_tbl
4602                 ,  x_rev_component_tbl  => l_rev_component_tbl
4603                 ,  x_ref_designator_tbl => l_ref_designator_tbl
4604                 ,  x_sub_component_tbl  => l_sub_component_tbl
4605                 ,  x_rev_operation_tbl    => l_rev_operation_tbl         --add
4606                 ,  x_rev_op_resource_tbl  => l_rev_op_resource_tbl       --add
4607                 ,  x_rev_sub_resource_tbl => l_rev_sub_resource_tbl      --add
4608                 );
4609 
4610         x_return_status                := l_return_status;
4611         x_ECO_rec                      := l_ECO_rec;
4612         x_eco_revision_tbl             := l_eco_revision_tbl;
4613         x_revised_item_tbl             := l_revised_item_tbl;
4614         x_rev_component_tbl            := l_rev_component_tbl;
4615         x_ref_designator_tbl           := l_ref_designator_tbl;
4616         x_sub_component_tbl            := l_sub_component_tbl;
4617         x_rev_operation_tbl            := l_rev_operation_tbl;         --add
4618         x_rev_op_resource_tbl          := l_rev_op_resource_tbl;       --add
4619         x_rev_sub_resource_tbl         := l_rev_sub_resource_tbl;      --add
4620 
4621         -- Reset system_information business object flags
4622 
4623         ENG_GLOBALS.Set_ECO_Impl( p_eco_impl         => NULL);
4624         ENG_GLOBALS.Set_ECO_Cancl( p_eco_cancl       => NULL);
4625         ENG_GLOBALS.Set_Wkfl_Process( p_wkfl_process => NULL);
4626         ENG_GLOBALS.Set_ECO_Access( p_eco_access     => NULL);
4627         ENG_GLOBALS.Set_STD_Item_Access( p_std_item_access => NULL);
4628         ENG_GLOBALS.Set_MDL_Item_Access( p_mdl_item_access => NULL);
4629         ENG_GLOBALS.Set_PLN_Item_Access( p_pln_item_access => NULL);
4630         ENG_GLOBALS.Set_OC_Item_Access( p_oc_item_access   => NULL);
4631 
4632 END process_Eco;
4633 
4634 --  Start of Comments
4635 --  API name    Lock_Eco
4636 --  Type        Private
4637 --  Function
4638 --
4639 --  Pre-reqs
4640 --
4641 --  Parameters
4642 --
4643 --  Version     Current version = 1.0
4644 --              Initial version = 1.0
4645 --
4646 --  Notes
4647 --
4648 --  End of Comments
4649 
4650 PROCEDURE Lock_Eco
4651 (   p_api_version_number            IN  NUMBER
4652 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
4653 ,   x_return_status                 IN OUT NOCOPY VARCHAR2
4654 ,   x_msg_count                     IN OUT NOCOPY NUMBER
4655 ,   x_msg_data                      IN OUT NOCOPY VARCHAR2
4656 ,   p_ECO_rec                       IN  ENG_Eco_PUB.Eco_Rec_Type :=
4657                                         ENG_Eco_PUB.G_MISS_ECO_REC
4658 ,   p_eco_revision_tbl              IN  ENG_Eco_PUB.Eco_Revision_Tbl_Type :=
4659                                         ENG_Eco_PUB.G_MISS_ECO_REVISION_TBL
4660 ,   p_revised_item_tbl              IN  ENG_Eco_PUB.Revised_Item_Tbl_Type :=
4661                                         ENG_Eco_PUB.G_MISS_REVISED_ITEM_TBL
4662 ,   p_rev_component_tbl             IN  BOM_BO_PUB.Rev_Component_Tbl_Type :=
4663                                         ENG_Eco_PUB.G_MISS_REV_COMPONENT_TBL
4664 ,   p_ref_designator_tbl            IN  BOM_BO_PUB.Ref_Designator_Tbl_Type :=
4665                                         ENG_Eco_PUB.G_MISS_REF_DESIGNATOR_TBL
4666 ,   p_sub_component_tbl             IN  BOM_BO_PUB.Sub_Component_Tbl_Type :=
4667                                         ENG_Eco_PUB.G_MISS_SUB_COMPONENT_TBL
4668 ,   x_ECO_rec                       IN OUT NOCOPY ENG_Eco_PUB.Eco_Rec_Type
4669 ,   x_eco_revision_tbl              IN OUT NOCOPY ENG_Eco_PUB.Eco_Revision_Tbl_Type
4670 ,   x_revised_item_tbl              IN OUT NOCOPY ENG_Eco_PUB.Revised_Item_Tbl_Type
4671 ,   x_rev_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Rev_Component_Tbl_Type
4672 ,   x_ref_designator_tbl            IN OUT NOCOPY BOM_BO_PUB.Ref_Designator_Tbl_Type
4673 ,   x_sub_component_tbl             IN OUT NOCOPY BOM_BO_PUB.Sub_Component_Tbl_Type
4674 ,   x_err_text                      IN OUT NOCOPY VARCHAR2
4675 )
4676 IS
4677 l_api_version_number          CONSTANT NUMBER := 1.0;
4678 l_api_name                    CONSTANT VARCHAR2(30):= 'Lock_Eco';
4679 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
4680 l_eco_revision_rec            ENG_Eco_PUB.Eco_Revision_Rec_Type;
4681 l_revised_item_rec            ENG_Eco_PUB.Revised_Item_Rec_Type;
4682 l_rev_component_rec           BOM_BO_PUB.Rev_Component_Rec_Type;
4683 l_ref_designator_rec          BOM_BO_PUB.Ref_Designator_Rec_Type;
4684 l_sub_component_rec           BOM_BO_PUB.Sub_Component_Rec_Type;
4685 BEGIN
4686 
4687     --  Standard call to check for call compatibility
4688 
4689 NULL;
4690 
4691 /*********************** Temporarily commented *****************************
4692 
4693     IF NOT FND_API.Compatible_API_Call
4694            (   l_api_version_number
4695            ,   p_api_version_number
4696            ,   l_api_name
4697            ,   G_PKG_NAME
4698            )
4699     THEN
4700         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4701     END IF;
4702 
4703     --  Initialize message list.
4704 
4705     IF FND_API.to_Boolean(p_init_msg_list) THEN
4706         FND_MSG_PUB.initialize;
4707     END IF;
4708 
4709     --  Set Savepoint
4710 
4711     SAVEPOINT Lock_Eco_PVT;
4712 
4713     --  Lock ECO
4714 
4715     IF p_ECO_rec.operation = ENG_GLOBALS.G_OPR_LOCK THEN
4716 
4717         ENG_Eco_Util.Lock_Row
4718         (   p_ECO_rec                     => p_ECO_rec
4719         ,   x_ECO_rec                     => x_ECO_rec
4720         ,   x_return_status               => l_return_status
4721         ,   x_err_text                    => x_err_text
4722         );
4723 
4724         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4725             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4726         ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4727             RAISE FND_API.G_EXC_ERROR;
4728         END IF;
4729 
4730 
4731     END IF;
4732 
4733     --  Lock eco_revision
4734 
4735     FOR I IN 1..p_eco_revision_tbl.COUNT LOOP
4736 
4737         IF p_eco_revision_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
4738 
4739             ENG_Eco_Revision_Util.Lock_Row
4740             (   p_eco_revision_rec            => p_eco_revision_tbl(I)
4741             ,   x_eco_revision_rec            => l_eco_revision_rec
4742             ,   x_return_status               => l_return_status
4743             ,   x_err_text                          => x_err_text
4744             );
4745 
4746             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4747                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4748             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4749                 RAISE FND_API.G_EXC_ERROR;
4750             END IF;
4751 
4752             x_eco_revision_tbl(I)          := l_eco_revision_rec;
4753 
4754         END IF;
4755 
4756     END LOOP;
4757 
4758     --  Lock revised_item
4759 
4760     FOR I IN 1..p_revised_item_tbl.COUNT LOOP
4761 
4762         IF p_revised_item_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
4763 
4764             ENG_Revised_Item_Util.Lock_Row
4765             (   p_revised_item_rec            => p_revised_item_tbl(I)
4766             ,   x_revised_item_rec            => l_revised_item_rec
4767             ,   x_return_status               => l_return_status
4768             ,   x_err_text                    => x_err_text
4769             );
4770 
4771             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4772                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4773             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4774                 RAISE FND_API.G_EXC_ERROR;
4775             END IF;
4776 
4777             x_revised_item_tbl(I)          := l_revised_item_rec;
4778 
4779         END IF;
4780 
4781     END LOOP;
4782 
4783     --  Lock rev_component
4784 
4785     FOR I IN 1..p_rev_component_tbl.COUNT LOOP
4786 
4787         IF p_rev_component_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
4788 
4789             ENG_Rev_Component_Util.Lock_Row
4790             (   p_rev_component_rec           => p_rev_component_tbl(I)
4791             ,   x_rev_component_rec           => l_rev_component_rec
4792             ,   x_return_status               => l_return_status
4793                 ,   x_err_text                      => x_err_text
4794             );
4795 
4796             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4797                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4798             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4799                 RAISE FND_API.G_EXC_ERROR;
4800             END IF;
4801 
4802             x_rev_component_tbl(I)         := l_rev_component_rec;
4803 
4804         END IF;
4805 
4806     END LOOP;
4807 
4808     --  Lock ref_designator
4809 
4810     FOR I IN 1..p_ref_designator_tbl.COUNT LOOP
4811 
4812         IF p_ref_designator_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
4813 
4814             ENG_Ref_Designator_Util.Lock_Row
4815             (   p_ref_designator_rec          => p_ref_designator_tbl(I)
4816             ,   x_ref_designator_rec          => l_ref_designator_rec
4817             ,   x_return_status               => l_return_status
4818               ,   x_err_text                        => x_err_text
4819             );
4820 
4821             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4822                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4823             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4824                 RAISE FND_API.G_EXC_ERROR;
4825             END IF;
4826 
4827             x_ref_designator_tbl(I)        := l_ref_designator_rec;
4828 
4829         END IF;
4830 
4831     END LOOP;
4832 
4833     --  Lock sub_component
4834 
4835     FOR I IN 1..p_sub_component_tbl.COUNT LOOP
4836 
4837         IF p_sub_component_tbl(I).operation = ENG_GLOBALS.G_OPR_LOCK THEN
4838 
4839             ENG_Sub_Component_Util.Lock_Row
4840             (   p_sub_component_rec           => p_sub_component_tbl(I)
4841             ,   x_sub_component_rec           => l_sub_component_rec
4842             ,   x_return_status               => l_return_status
4843                 ,   x_err_text                      => x_err_text
4844             );
4845 
4846             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
4847                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4848             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
4849                 RAISE FND_API.G_EXC_ERROR;
4850             END IF;
4851 
4852             x_sub_component_tbl(I)         := l_sub_component_rec;
4853 
4854         END IF;
4855 
4856     END LOOP;
4857 
4858     --  Set return status
4859 
4860     x_return_status := FND_API.G_RET_STS_SUCCESS;
4861 
4862     --  Get message count and data
4863 
4864     FND_MSG_PUB.Count_And_Get
4865     (   p_count                       => x_msg_count
4866     ,   p_data                        => x_msg_data
4867     );
4868 
4869 
4870 EXCEPTION
4871 
4872     WHEN FND_API.G_EXC_ERROR THEN
4873 
4874         x_return_status := FND_API.G_RET_STS_ERROR;
4875 
4876         --  Get message count and data
4877 
4878         FND_MSG_PUB.Count_And_Get
4879         (   p_count                       => x_msg_count
4880         ,   p_data                        => x_msg_data
4881         );
4882 
4883         --  Rollback
4884 
4885         ROLLBACK TO Lock_Eco_PVT;
4886 
4887     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4888 
4889         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4890 
4891         --  Get message count and data
4892 
4893         FND_MSG_PUB.Count_And_Get
4894         (   p_count                       => x_msg_count
4895         ,   p_data                        => x_msg_data
4896         );
4897        --  Rollback
4898 
4899         ROLLBACK TO Lock_Eco_PVT;
4900 
4901     WHEN OTHERS THEN
4902 
4903         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4904 
4905         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4906         THEN
4907             FND_MSG_PUB.Add_Exc_Msg
4908             (   G_PKG_NAME
4909             ,   'Lock_Eco'
4910             );
4911         END IF;
4912 
4913         --  Get message count and data
4914 
4915         FND_MSG_PUB.Count_And_Get
4916         (   p_count                       => x_msg_count
4917         ,   p_data                        => x_msg_data
4918         );
4919 
4920         --  Rollback
4921 
4922         ROLLBACK TO Lock_Eco_PVT;
4923 
4924 ****************************************************************************/
4925 
4926 END Lock_Eco;
4927 
4928 END ENG_Form_Eco_PVT;
4929