DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_RTG_EXP

Source


1 PACKAGE BODY BOM_RTG_EXP AS
2 /* $Header: BOMREXPB.pls 115.1 2002/12/16 21:13:01 lnarveka noship $ */
3 /***************************************************************************
4 --
5 --  Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      BOMBREXPB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package BOM_RTG_EXP
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  06-OCT-02   M V M P Tilak    Initial Creation
21 ***************************************************************************/
22 
23 G_rtg_header_rec   BOM_RTG_PUB.RTG_HEADER_REC_TYPE;
24 G_rtg_revision_tbl BOM_RTG_PUB.RTG_REVISION_TBL_TYPE;
25 G_operation_tbl    BOM_RTG_PUB.OPERATION_TBL_TYPE;
26 G_op_resource_tbl  BOM_RTG_PUB.OP_RESOURCE_TBL_TYPE;
27 G_sub_resource_tbl BOM_RTG_PUB.SUB_RESOURCE_TBL_TYPE;
28 G_op_network_tbl   BOM_RTG_PUB.OP_NETWORK_TBL_TYPE;
29 
30 PROCEDURE Populate_Header(P_organization_code            IN VARCHAR2,
31                           P_organization_id              IN NUMBER,
32                           P_assembly_item_name           IN VARCHAR2,
33                           P_item_id                      IN NUMBER,
34                           P_alternate_routing_designator IN VARCHAR2,
35                           X_routing_sequence_id          OUT NOCOPY NUMBER)
36 IS
37   CURSOR Routing_Header_CUR IS
38     SELECT   bor.routing_sequence_id,
39              bor.routing_type, -- Eng_Routing_Flag
40              bor.common_assembly_item_id, --Common_Assembly_Item_Name
41              bor.routing_comment,
42              bor.completion_subinventory,
43              bor.completion_locator_id, -- Completion_Location_Name
44 	     wl.line_code,
45 	     bor.cfm_Routing_Flag,
46              bor.mixed_model_map_flag,
47              bor.priority,
48 	     bor.total_product_cycle_time, -- Total_Cycle_Time
49              bor.ctp_flag,
50              bor.attribute_category,
51              bor.attribute1,
52              bor.attribute2,
53              bor.attribute3,
54              bor.attribute4,
55              bor.attribute5,
56              bor.attribute6,
57              bor.attribute7,
58              bor.attribute8,
59              bor.attribute9,
60              bor.attribute10,
61              bor.attribute11,
62              bor.attribute12,
63              bor.attribute13,
64              bor.attribute14,
65              bor.attribute15,
66              bor.original_system_reference
67 	     --, bor.serialization_start_op
68 	   FROM    bom_operational_routings bor,
69              wip_lines wl
70 	   WHERE   bor.organization_id  = P_organization_id
71      AND     bor.assembly_item_id = P_item_id
72      AND     NVL(bor.alternate_routing_designator,'##$$##') = NVL(P_alternate_routing_designator,'##$$##')
73      AND     wl.line_id(+)        = bor.line_id;
74 
75   l_rtg_hdr_rec Routing_Header_CUR%ROWTYPE;
76   l_common_assembly_item_name MTL_SYSTEM_ITEMS_KFV.CONCATENATED_SEGMENTS%TYPE;
77   l_completion_location_name  MTL_ITEM_LOCATIONS_KFV.CONCATENATED_SEGMENTS%TYPE;
78 BEGIN
79   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
80     Error_Handler.Write_Debug('PROCEDURE Populate_Header Entered. ');
81   END IF;
82   OPEN Routing_Header_CUR;
83   FETCH Routing_Header_CUR INTO l_rtg_hdr_rec;
84   IF (Routing_Header_CUR%NOTFOUND) THEN
85     RAISE no_data_found;
86   END IF;
87   l_common_assembly_item_name := BOM_RTG_EXP_UTIL.Get_Item_Name(l_rtg_hdr_rec.common_assembly_item_id);
88   l_completion_location_name  := BOM_RTG_EXP_UTIL.Get_Location_Name(l_rtg_hdr_rec.completion_locator_id,
89                                                                    P_organization_id);
90   G_Rtg_Header_Rec.assembly_item_name        := P_assembly_item_name;
91   G_Rtg_Header_Rec.organization_code         := P_organization_code;
92   G_Rtg_Header_Rec.Alternate_Routing_Code    := P_alternate_routing_designator;
93   G_Rtg_Header_Rec.Eng_Routing_Flag          := l_rtg_hdr_rec.routing_type;
94   G_Rtg_Header_Rec.common_assembly_item_name := l_common_assembly_item_name;
95   G_Rtg_Header_Rec.routing_comment           := l_rtg_hdr_rec.routing_comment;
96   G_Rtg_Header_Rec.completion_subinventory   := l_rtg_hdr_rec.completion_subinventory;
97   G_Rtg_Header_Rec.completion_location_name  := l_completion_location_name;
98   G_Rtg_Header_Rec.line_code                 := l_rtg_hdr_rec.line_code;
99   G_Rtg_Header_Rec.cfm_routing_flag          := l_rtg_hdr_rec.cfm_routing_flag;
100   G_Rtg_Header_Rec.mixed_model_map_flag      := l_rtg_hdr_rec.mixed_model_map_flag;
101   G_Rtg_Header_Rec.priority                  := l_rtg_hdr_rec.priority;
102   G_Rtg_Header_Rec.total_cycle_time          := l_rtg_hdr_rec.total_product_cycle_time;
103   G_Rtg_Header_Rec.ctp_flag                  := l_rtg_hdr_rec.ctp_flag;
104   G_Rtg_Header_Rec.attribute_category        := l_rtg_hdr_rec.attribute_category;
105   G_Rtg_Header_Rec.attribute1                := l_rtg_hdr_rec.attribute1;
106   G_Rtg_Header_Rec.attribute2                := l_rtg_hdr_rec.attribute2;
107   G_Rtg_Header_Rec.attribute3                := l_rtg_hdr_rec.attribute3;
108   G_Rtg_Header_Rec.attribute4                := l_rtg_hdr_rec.attribute4;
109   G_Rtg_Header_Rec.attribute5                := l_rtg_hdr_rec.attribute5;
110   G_Rtg_Header_Rec.attribute6                := l_rtg_hdr_rec.attribute6;
111   G_Rtg_Header_Rec.attribute7                := l_rtg_hdr_rec.attribute7;
112   G_Rtg_Header_Rec.attribute8                := l_rtg_hdr_rec.attribute8;
113   G_Rtg_Header_Rec.attribute9                := l_rtg_hdr_rec.attribute9;
114   G_Rtg_Header_Rec.attribute10               := l_rtg_hdr_rec.attribute10;
115   G_Rtg_Header_Rec.attribute11               := l_rtg_hdr_rec.attribute11;
116   G_Rtg_Header_Rec.attribute12               := l_rtg_hdr_rec.attribute12;
117   G_Rtg_Header_Rec.attribute13               := l_rtg_hdr_rec.attribute13;
118   G_Rtg_Header_Rec.attribute14               := l_rtg_hdr_rec.attribute14;
119   G_Rtg_Header_Rec.attribute15               := l_rtg_hdr_rec.attribute15;
120   G_Rtg_Header_Rec.original_system_reference := l_rtg_hdr_rec.original_system_reference;
121 --  G_Rtg_Header_Rec.Ser_Start_Op_Seq	     := l_rtg_hdr_rec.serialization_start_op;
122   X_routing_sequence_id := l_rtg_hdr_rec.routing_sequence_id;
123 
124   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
125     Error_Handler.Write_Debug('PROCEDURE Populate_Header: One Routing Header record fetched. ');
126   END IF;
127 END Populate_Header;
128 
129 
130 PROCEDURE Populate_Revision(P_organization_code  IN VARCHAR2,
131                             P_organization_id    IN NUMBER,
132                             P_assembly_item_name IN VARCHAR2,
133                             P_item_id            IN NUMBER,
134                             P_alt_rtg_code       IN VARCHAR2) IS
135   CURSOR Routing_Revision_CUR IS
136     SELECT Process_Revision,
137            Effectivity_Date,
138            Attribute_category,
139            Attribute1,
140            Attribute2,
141            Attribute3,
142            Attribute4,
143            Attribute5,
144            Attribute6,
145            Attribute7,
146            Attribute8,
147            Attribute9,
148            Attribute10,
149            Attribute11,
150            Attribute12,
151            Attribute13,
152            Attribute14,
153            Attribute15
154     FROM   mtl_rtg_item_revisions
155     WHERE  inventory_item_id = p_item_id
156     AND    organization_id   = p_organization_id;
157   i NUMBER := 1;
158 BEGIN
159   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
160     Error_Handler.Write_Debug('PROCEDURE Populate_Revision entered.');
161   END IF;
162   FOR revision_rec IN Routing_Revision_CUR LOOP
163     G_rtg_revision_tbl(i).assembly_item_name   := P_assembly_item_name;
164     G_rtg_revision_tbl(i).organization_code    := P_organization_code;
165     G_rtg_revision_tbl(i).alternate_routing_code := P_alt_rtg_code;
166     G_rtg_revision_tbl(i).revision             := revision_rec.process_revision;
167     G_rtg_revision_tbl(i).start_effective_date := revision_rec.effectivity_date;
168     G_rtg_revision_tbl(i).attribute_category   := revision_rec.attribute_category;
169     G_rtg_revision_tbl(i).attribute1           := revision_rec.attribute1;
170     G_rtg_revision_tbl(i).attribute2           := revision_rec.attribute2;
171     G_rtg_revision_tbl(i).attribute3           := revision_rec.attribute3;
172     G_rtg_revision_tbl(i).attribute4           := revision_rec.attribute4;
173     G_rtg_revision_tbl(i).attribute5           := revision_rec.attribute5;
174     G_rtg_revision_tbl(i).attribute6           := revision_rec.attribute6;
175     G_rtg_revision_tbl(i).attribute7           := revision_rec.attribute7;
176     G_rtg_revision_tbl(i).attribute8           := revision_rec.attribute8;
177     G_rtg_revision_tbl(i).attribute9           := revision_rec.attribute9;
178     G_rtg_revision_tbl(i).attribute10          := revision_rec.attribute10;
179     G_rtg_revision_tbl(i).attribute11          := revision_rec.attribute11;
180     G_rtg_revision_tbl(i).attribute12          := revision_rec.attribute12;
181     G_rtg_revision_tbl(i).attribute13          := revision_rec.attribute13;
182     G_rtg_revision_tbl(i).attribute14          := revision_rec.attribute14;
183     G_rtg_revision_tbl(i).attribute15          := revision_rec.attribute15;
184     i := i + 1;
185   END LOOP;
186   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
187     Error_Handler.Write_Debug('PROCEDURE Populate_Revision: '||to_char(G_rtg_revision_tbl.COUNT)||' Routing Revision record(s) fetched.');
188   END IF;
189 END Populate_Revision;
190 
191 
192 PROCEDURE Populate_Sub_Oper_Res(P_organization_code         IN VARCHAR2,
193                                 P_assembly_item_name        IN VARCHAR2,
194                                 P_alt_rtg_code              IN VARCHAR2,
195                                 P_operation_sequence_number IN NUMBER,
196                                 P_operation_type            IN NUMBER,
197                                 P_effectivity_date          IN DATE,
198                                 P_operation_sequence_id     IN NUMBER,
199                                 P_schedule_seq_num          IN NUMBER) IS
200   CURSOR Sub_Oper_Res_CUR IS
201     SELECT  br.Resource_Code, -- Sub_Resource_Code
202             bsor.replacement_group_num, -- Replacement_Group_Number
203             ca.Activity,
204             bsor.Standard_Rate_Flag,
205             bsor.Assigned_Units,
206             bsor.Usage_Rate_Or_Amount,
207             bsor.Usage_Rate_Or_Amount_Inverse,
208             bsor.Basis_Type,
209             bsor.Schedule_Flag,
210             bsor.Resource_Offset_Percent,
211             bsor.Autocharge_Type,
212             bsor.Principle_Flag,
213             bsor.Attribute_category,
214             bsor.Attribute1,
215             bsor.Attribute2,
216             bsor.Attribute3,
217             bsor.Attribute4,
218             bsor.Attribute5,
219             bsor.Attribute6,
220             bsor.Attribute7,
221             bsor.Attribute8,
222             bsor.Attribute9,
223             bsor.Attribute10,
224             bsor.Attribute11,
225             bsor.Attribute12,
226             bsor.Attribute13,
227             bsor.Attribute14,
228             bsor.Attribute15,
229 	    bst.setup_Code  -- Setup_Type
230     FROM    bom_sub_operation_resources bsor,
231             bom_resources br,
232             cst_activities ca,
233             bom_setup_types bst
234     WHERE   bsor.operation_sequence_id = P_operation_sequence_id
235     AND     bsor.schedule_seq_num      = P_schedule_seq_num
236     AND     br.resource_id             = bsor.resource_id
237     AND     ca.activity_id(+)          = bsor.activity_id
238     AND     bst.setup_id(+)            = bsor.setup_id;
239   i NUMBER;
240   j NUMBER := 0;
241 BEGIN
242   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
243     Error_Handler.Write_Debug('PROCEDURE Populate_Sub_Oper_Res entered.');
244     Error_Handler.Write_Debug('Operation Sequence Number: '|| TO_CHAR(P_operation_sequence_number));
245     Error_Handler.Write_Debug('Operation Type           : '|| TO_CHAR(P_operation_type));
246     Error_Handler.Write_Debug('Effectivity Date         : '|| TO_CHAR(P_effectivity_date));
247     Error_Handler.Write_Debug('Schedule Sequence Number : '|| TO_CHAR(P_schedule_seq_num));
248     j := G_Sub_Resource_Tbl.COUNT;
249   END IF;
250   i := G_Sub_Resource_Tbl.LAST + 1;
251   IF (i IS NULL) THEN
252     i := 1;
253   END IF;
254   FOR sub_resource_rec IN sub_oper_res_CUR LOOP
255     G_sub_resource_tbl(i).assembly_item_name           := P_assembly_item_name;
256     G_sub_resource_tbl(i).organization_code            := P_organization_code;
257     G_sub_resource_tbl(i).alternate_routing_code       := P_alt_rtg_code;
258     G_sub_resource_tbl(i).operation_sequence_number    := P_operation_sequence_number;
259     G_sub_resource_tbl(i).operation_type               := P_operation_type;
260     G_sub_resource_tbl(i).op_start_effective_date      := P_effectivity_date;
261     G_sub_resource_tbl(i).schedule_sequence_number     := P_schedule_seq_num;
262     G_sub_resource_tbl(i).sub_resource_code            := sub_resource_rec.resource_code;
263     G_sub_resource_tbl(i).replacement_group_number     := sub_resource_rec.replacement_group_num;
264     G_sub_resource_tbl(i).activity                     := sub_resource_rec.activity;
265     G_sub_resource_tbl(i).standard_rate_flag           := sub_resource_rec.standard_rate_flag;
266     G_sub_resource_tbl(i).assigned_units               := sub_resource_rec.assigned_units;
267     G_sub_resource_tbl(i).usage_rate_or_amount         := sub_resource_rec.usage_rate_or_amount;
268     G_sub_resource_tbl(i).usage_rate_or_amount_inverse := sub_resource_rec.usage_rate_or_amount_inverse;
269     G_sub_resource_tbl(i).basis_type                   := sub_resource_rec.basis_type;
270     G_sub_resource_tbl(i).schedule_flag                := sub_resource_rec.schedule_flag;
271     G_sub_resource_tbl(i).resource_offset_percent      := sub_resource_rec.resource_offset_percent;
272     G_sub_resource_tbl(i).autocharge_type              := sub_resource_rec.autocharge_type;
273     G_sub_resource_tbl(i).principle_flag               := sub_resource_rec.principle_flag;
274     G_sub_resource_tbl(i).attribute_category           := sub_resource_rec.attribute_category;
275     G_sub_resource_tbl(i).attribute1                   := sub_resource_rec.attribute1;
276     G_sub_resource_tbl(i).attribute2                   := sub_resource_rec.attribute2;
277     G_sub_resource_tbl(i).attribute3                   := sub_resource_rec.attribute3;
278     G_sub_resource_tbl(i).attribute4                   := sub_resource_rec.attribute4;
279     G_sub_resource_tbl(i).attribute5                   := sub_resource_rec.attribute5;
280     G_sub_resource_tbl(i).attribute6                   := sub_resource_rec.attribute6;
281     G_sub_resource_tbl(i).attribute7                   := sub_resource_rec.attribute7;
282     G_sub_resource_tbl(i).attribute8                   := sub_resource_rec.attribute8;
283     G_sub_resource_tbl(i).attribute9                   := sub_resource_rec.attribute9;
284     G_sub_resource_tbl(i).attribute10                  := sub_resource_rec.attribute10;
285     G_sub_resource_tbl(i).attribute11                  := sub_resource_rec.attribute11;
286     G_sub_resource_tbl(i).attribute12                  := sub_resource_rec.attribute12;
287     G_sub_resource_tbl(i).attribute13                  := sub_resource_rec.attribute13;
288     G_sub_resource_tbl(i).attribute14                  := sub_resource_rec.attribute14;
289     G_sub_resource_tbl(i).attribute15                  := sub_resource_rec.attribute15;
290     G_sub_resource_tbl(i).setup_type                   := sub_resource_rec.setup_code;
291     i := i + 1;
292   END LOOP;
293   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
294     Error_Handler.Write_Debug('PROCEDURE Populate_Sub_Oper_Res: '||TO_CHAR(G_sub_resource_tbl.COUNT - j)||' record(s) fetched.');
295   END IF;
296 END Populate_Sub_Oper_Res;
297 
298 PROCEDURE Populate_Oper_Resources(P_organization_code     IN VARCHAR2,
299                                   P_assembly_item_name    IN VARCHAR2,
300                                   P_alt_rtg_code          IN VARCHAR2,
301                                   P_operation_sequence_id IN NUMBER,
302                                   P_operation_seq_num     IN NUMBER,
303                                   P_operation_type        IN VARCHAR2,
304                                   P_effectivity_date      IN DATE) IS
305   CURSOR Routing_Oper_Resources_CUR IS
306     SELECT bor.Resource_Seq_Num, -- Resource_Sequence_Number
307            br.Resource_Code,
308            ca.Activity,
309            bor.Standard_Rate_Flag,
310            bor.Assigned_Units,
311            bor.Usage_Rate_Or_amount,
312            bor.Usage_Rate_Or_Amount_Inverse,
313            bor.Basis_Type,
314            bor.Schedule_Flag,
315            bor.Resource_Offset_Percent,
316            bor.Autocharge_Type,
317            bor.Schedule_Seq_Num, -- Schedule_Sequence_Number
318            bor.Principle_Flag,
319            bor.Attribute_category,
320            bor.Attribute1,
321            bor.Attribute2,
322            bor.Attribute3,
323            bor.Attribute4,
324            bor.Attribute5,
325            bor.Attribute6,
326            bor.Attribute7,
327            bor.Attribute8,
328            bor.Attribute9,
329            bor.Attribute10,
330            bor.Attribute11,
331            bor.Attribute12,
332            bor.Attribute13,
333            bor.Attribute14,
334            bor.Attribute15,
335            bst.Setup_Code  --  Setup_Type
336     FROM   bom_operation_resources bor,
337            bom_resources br,
338            cst_activities ca,
339            bom_setup_types bst
340     WHERE  bor.operation_sequence_id = P_operation_sequence_id
341     AND    br.resource_id            = bor.resource_id
342     AND    ca.activity_id(+)         = bor.activity_id
343     AND    bst.setup_id(+)           = bor.setup_id
344     ORDER BY
345            bor.schedule_seq_num;
346   i NUMBER;
347   j NUMBER;
348   l_schedule_seq_num NUMBER;
349 BEGIN
350   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
351     Error_Handler.Write_Debug('PROCEDURE Populate_Oper_Resources entered.');
352     Error_Handler.Write_Debug('Operation Sequence Number: '|| TO_CHAR(P_operation_seq_num));
353     Error_Handler.Write_Debug('Operation Type           : '|| P_operation_type);
354     Error_Handler.Write_Debug('Effectivity Date         : '|| to_char(P_effectivity_date));
355     j := G_op_resource_tbl.COUNT;
356   END IF;
357   i := G_op_resource_tbl.LAST + 1;
358   IF (i IS NULL) THEN
359     i := 1;
360   END IF;
361   FOR oper_res_rec IN Routing_oper_resources_CUR LOOP
362     G_op_resource_tbl(i).assembly_item_name           := P_assembly_item_name;
363     G_op_resource_tbl(i).organization_code            := P_organization_code;
364     G_op_resource_tbl(i).alternate_routing_code       := P_alt_rtg_code;
365     G_op_resource_tbl(i).operation_sequence_number    := P_operation_seq_num;
366     G_op_resource_tbl(i).operation_type               := P_operation_type;
367     G_op_resource_tbl(i).op_start_effective_date      := P_effectivity_date;
368     G_op_resource_tbl(i).resource_sequence_number     := oper_res_rec.resource_seq_num;
369     G_op_resource_tbl(i).resource_code                := oper_res_rec.resource_code;
370     G_op_resource_tbl(i).activity                     := oper_res_rec.activity;
371     G_op_resource_tbl(i).standard_rate_flag           := oper_res_rec.standard_rate_flag;
372     G_op_resource_tbl(i).assigned_units               := oper_res_rec.assigned_units;
373     G_op_resource_tbl(i).usage_rate_or_amount         := oper_res_rec.usage_rate_or_amount;
374     G_op_resource_tbl(i).usage_rate_or_amount_inverse := oper_res_rec.usage_rate_or_amount_inverse;
375     G_op_resource_tbl(i).basis_type                   := oper_res_rec.basis_type;
376     G_op_resource_tbl(i).schedule_flag                := oper_res_rec.schedule_flag;
377     G_op_resource_tbl(i).resource_offset_percent      := oper_res_rec.resource_offset_percent;
378     G_op_resource_tbl(i).autocharge_type              := oper_res_rec.autocharge_type;
379     G_op_resource_tbl(i).schedule_sequence_number     := oper_res_rec.schedule_seq_num;
380     G_op_resource_tbl(i).principle_flag               := oper_res_rec.principle_flag;
381     G_op_resource_tbl(i).attribute_category           := oper_res_rec.attribute_category;
382     G_op_resource_tbl(i).attribute1                   := oper_res_rec.attribute1;
383     G_op_resource_tbl(i).attribute2                   := oper_res_rec.attribute2;
384     G_op_resource_tbl(i).attribute3                   := oper_res_rec.attribute3;
385     G_op_resource_tbl(i).attribute4                   := oper_res_rec.attribute4;
386     G_op_resource_tbl(i).attribute5                   := oper_res_rec.attribute5;
387     G_op_resource_tbl(i).attribute6                   := oper_res_rec.attribute6;
388     G_op_resource_tbl(i).attribute7                   := oper_res_rec.attribute7;
389     G_op_resource_tbl(i).attribute8                   := oper_res_rec.attribute8;
390     G_op_resource_tbl(i).attribute9                   := oper_res_rec.attribute9;
391     G_op_resource_tbl(i).attribute10                  := oper_res_rec.attribute10;
392     G_op_resource_tbl(i).attribute11                  := oper_res_rec.attribute11;
393     G_op_resource_tbl(i).attribute12                  := oper_res_rec.attribute12;
394     G_op_resource_tbl(i).attribute13                  := oper_res_rec.attribute13;
395     G_op_resource_tbl(i).attribute14                  := oper_res_rec.attribute14;
396     G_op_resource_tbl(i).attribute15                  := oper_res_rec.attribute15;
397     G_op_resource_tbl(i).setup_type                   := oper_res_rec.setup_code;
398     IF (l_schedule_seq_num IS NULL OR
399         l_schedule_seq_num <> oper_res_rec.schedule_seq_num) THEN
400       l_schedule_seq_num := oper_res_rec.schedule_seq_num;
401       Populate_Sub_Oper_Res(P_organization_code => P_organization_code,
402                             P_assembly_item_name => P_assembly_item_name,
403                             P_alt_rtg_code => P_alt_rtg_code,
404                             P_operation_sequence_number => P_operation_seq_num,
405                             P_operation_type => P_operation_type,
406                             P_effectivity_date => P_effectivity_date,
407                             P_operation_sequence_id => P_operation_sequence_id,
408                             P_schedule_seq_num => l_schedule_seq_num);
409 /*
410       Populate_Sub_Oper_Res(P_organization_code,
411                             P_assembly_item_name,
412                             P_alt_rtg_code,
413                             P_operation_seq_num,
414                             P_operation_type,
415                             P_effectivity_date,
416                             P_operation_sequence_id,
417                             l_schedule_seq_num);
418 */
419     END IF;
420     i := i + 1;
421   END LOOP;
422   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
423     Error_Handler.Write_Debug('PROCEDURE Populate_Sub_Oper_Res: '||to_char(g_op_resource_tbl.COUNT - j) ||' record(s) fetched. ');
424   END IF;
425 END Populate_Oper_Resources;
426 
427 PROCEDURE Populate_Operations(P_organization_code  IN VARCHAR2,
428                               P_assembly_item_name IN VARCHAR2,
429                               P_routing_seq_id     IN NUMBER,
430                               P_alt_rtg_code       IN VARCHAR2) IS
431   CURSOR Routing_Operation_CUR IS
432     SELECT Operation_Seq_Num,
433            operation_sequence_id,
434            Operation_Type,
435            Effectivity_Date,
436            Standard_Operation_Code,
437            Department_Code,
438            Operation_Lead_Time_Percent,
439            Minimum_Transfer_Quantity,
440            Count_Point_Type,
441            Operation_Description,
442            Disable_Date,
443            Backflush_Flag,
444            Option_Dependent_Flag,
445            Reference_Flag,
446            Process_Seq_Num,
447            Process_Code,
448            Line_Op_Seq_Num,
449            Line_Op_Code,
450            Yield,
451            Cumulative_Yield,
452            Reverse_Cumulative_Yield,
453            Labor_Time_User,
454            Machine_Time_User,
455            Total_Time_User,
456            Net_Planning_Percent,
457            Include_In_Rollup,
458            Operation_Yield_Enabled,
459            Attribute_category,
460            Attribute1,
461            Attribute2,
462            Attribute3,
463            Attribute4,
464            Attribute5,
465            Attribute6,
466            Attribute7,
467            Attribute8,
468            Attribute9,
469            Attribute10,
470            Attribute11,
471            Attribute12,
472            Attribute13,
473            Attribute14,
474            Attribute15,
475            Original_System_Reference
476 	   --,long_description
477    FROM    bom_operation_sequences_v
478    WHERE   routing_sequence_id = P_routing_seq_id;
479   i NUMBER := 1;
480   l_op_seq_id  NUMBER;
481   l_op_seq_num NUMBER;
482   l_op_type    NUMBER;
483   l_eff_date   DATE;
484 BEGIN
485   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
486     Error_Handler.Write_Debug('PROCEDURE Populate_Operations entered.');
487   END IF;
488   FOR routing_oper_rec IN Routing_Operation_CUR LOOP
489     G_operation_tbl(i).assembly_item_name        := P_assembly_item_name;
490     G_operation_tbl(i).organization_code         := P_organization_code;
491     G_operation_tbl(i).alternate_routing_code    := P_alt_rtg_code;
492     G_operation_tbl(i).operation_sequence_number := routing_oper_rec.operation_seq_num;
493     G_operation_tbl(i).operation_type            := routing_oper_rec.operation_type;
494     G_operation_tbl(i).start_effective_date      := routing_oper_rec.effectivity_date;
495     G_operation_tbl(i).standard_operation_code   := routing_oper_rec.standard_operation_code;
496     G_operation_tbl(i).department_code           := routing_oper_rec.department_code;
497     G_operation_tbl(i).op_lead_time_percent      := routing_oper_rec.operation_lead_time_percent;
498     G_operation_tbl(i).minimum_transfer_quantity := routing_oper_rec.minimum_transfer_quantity;
499     G_operation_tbl(i).count_point_type          := routing_oper_rec.count_point_type;
500     G_operation_tbl(i).operation_description     := routing_oper_rec.operation_description;
501     G_operation_tbl(i).disable_date              := routing_oper_rec.disable_date;
502     G_operation_tbl(i).backflush_flag            := routing_oper_rec.backflush_flag;
503     G_operation_tbl(i).option_dependent_flag     := routing_oper_rec.option_dependent_flag;
504     G_operation_tbl(i).reference_flag            := routing_oper_rec.reference_flag;
505     G_operation_tbl(i).process_seq_number        := routing_oper_rec.process_seq_num;
506     G_operation_tbl(i).process_code              := routing_oper_rec.process_code;
507     G_operation_tbl(i).line_op_seq_number        := routing_oper_rec.line_op_seq_num;
508     G_operation_tbl(i).line_op_code              := routing_oper_rec.line_op_code;
509     G_operation_tbl(i).yield                     := routing_oper_rec.yield;
510     G_operation_tbl(i).cumulative_yield          := routing_oper_rec.cumulative_yield;
511     G_operation_tbl(i).reverse_cum_yield         := routing_oper_rec.reverse_cumulative_yield;
512     G_operation_tbl(i).user_labor_time           := routing_oper_rec.labor_time_user;
513     G_operation_tbl(i).user_machine_time         := routing_oper_rec.machine_time_user;
514     G_operation_tbl(i).net_planning_percent      := routing_oper_rec.net_planning_percent;
515     G_operation_tbl(i).Include_In_Rollup         := routing_oper_rec.Include_In_Rollup;
516     G_operation_tbl(i).Op_Yield_Enabled_Flag     := routing_oper_rec.Operation_Yield_Enabled;
517     G_operation_tbl(i).attribute_category        := routing_oper_rec.attribute_category;
518     G_operation_tbl(i).attribute1                := routing_oper_rec.attribute1;
519     G_operation_tbl(i).attribute2                := routing_oper_rec.attribute2;
520     G_operation_tbl(i).attribute3                := routing_oper_rec.attribute3;
521     G_operation_tbl(i).attribute4                := routing_oper_rec.attribute4;
522     G_operation_tbl(i).attribute5                := routing_oper_rec.attribute5;
523     G_operation_tbl(i).attribute6                := routing_oper_rec.attribute6;
524     G_operation_tbl(i).attribute7                := routing_oper_rec.attribute7;
525     G_operation_tbl(i).attribute8                := routing_oper_rec.attribute8;
526     G_operation_tbl(i).attribute9                := routing_oper_rec.attribute9;
527     G_operation_tbl(i).attribute10               := routing_oper_rec.attribute10;
528     G_operation_tbl(i).attribute11               := routing_oper_rec.attribute11;
529     G_operation_tbl(i).attribute12               := routing_oper_rec.attribute12;
530     G_operation_tbl(i).attribute13               := routing_oper_rec.attribute13;
531     G_operation_tbl(i).attribute14               := routing_oper_rec.attribute14;
532     G_operation_tbl(i).attribute15               := routing_oper_rec.attribute15;
533 --    G_operation_tbl(i).long_description		 := routing_oper_rec.long_description;
534 
535     l_op_seq_id  := routing_oper_rec.operation_sequence_id;
536     l_op_seq_num := routing_oper_rec.operation_seq_num;
537     l_op_type    := routing_oper_rec.operation_type;
538     l_eff_date   := routing_oper_rec.effectivity_date;
539 /*
540     Populate_Oper_Resources(P_organization_code,
541                             P_assembly_item_name,
542                             P_alt_rtg_code,
543                             l_op_seq_id,
544                             l_op_seq_num,
545                             l_op_type   ,
546                             l_eff_date  );
547 */
548     Populate_Oper_Resources(P_organization_code => P_organization_code,
549                                   P_assembly_item_name => P_assembly_item_name,
550                                   P_alt_rtg_code => P_alt_rtg_code,
551                                   P_operation_sequence_id => l_op_seq_id,
552                                   P_operation_seq_num => l_op_seq_num,
553                                   P_operation_type => l_op_type,
554                                   P_effectivity_date => l_eff_date);
555     i := i + 1;
556   END LOOP;
557   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
558     Error_Handler.Write_Debug('PROCEDURE Populate_Operations: '||to_char(G_operation_tbl.COUNT)||' record(s) fetched. ');
559   END IF;
560 END Populate_Operations;
561 
562 PROCEDURE Populate_Oper_Networks(P_organization_code IN VARCHAR2,
563                                  P_assembly_item_name IN VARCHAR2,
564                                  P_alternate_routing_code IN VARCHAR2,
565                                  P_routing_seq_id     IN NUMBER) IS
566   CURSOR Oper_Networks_CUR IS
567     SELECT bonv.From_Seq_Num,
568 	   bos1.X_Coordinate From_X_Coordinate,
569 	   bos1.Y_Coordinate From_Y_Coordinate,
570            bonv.From_Effectivity_Date,
571            bonv.To_Seq_Num,
572 	   bos2.X_Coordinate To_X_Coordinate,
573 	   bos2.Y_Coordinate To_Y_Coordinate,
574            bonv.To_Effectivity_Date,
575            bonv.Transition_Type,
576            bonv.Planning_Pct,
577            bonv.Attribute_category,
578            bonv.Attribute1,
579            bonv.Attribute2,
580            bonv.Attribute3,
581            bonv.Attribute4,
582            bonv.Attribute5,
583            bonv.Attribute6,
584            bonv.Attribute7,
585            bonv.Attribute8,
586            bonv.Attribute9,
587            bonv.Attribute10,
588            bonv.Attribute11,
589            bonv.Attribute12,
590            bonv.Attribute13,
591            bonv.Attribute14,
592            bonv.Attribute15,
593            bonv.Original_System_Reference
594     FROM   bom_operation_networks_v bonv,
595            bom_operation_sequences bos1,
596            bom_operation_sequences bos2
597     WHERE  bonv.routing_sequence_id   = P_routing_seq_id
598     AND    bos1.Operation_Sequence_Id = bonv.From_Op_Seq_Id
599     AND    bos2.Operation_Sequence_Id = bonv.To_Op_Seq_Id;
600   i NUMBER := 1;
601 BEGIN
602   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
603     Error_Handler.Write_Debug('PROCEDURE Populate_Oper_Networks entered.');
604   END IF;
605 
606   FOR oper_networks_rec IN Oper_Networks_CUR LOOP
607     G_Op_Network_Tbl(i).assembly_item_name        := P_assembly_item_name;
608     G_op_network_tbl(i).organization_code         := P_organization_code;
609     G_op_network_tbl(i).alternate_routing_code    := P_alternate_routing_code;
610     G_op_network_tbl(i).from_op_seq_number        := oper_networks_rec.from_seq_num;
611     G_op_network_tbl(i).from_x_coordinate         := oper_networks_rec.from_x_coordinate;
612     G_op_network_tbl(i).from_y_coordinate         := oper_networks_rec.from_y_coordinate;
613     G_op_network_tbl(i).from_start_effective_date := oper_networks_rec.from_effectivity_date;
614     G_op_network_tbl(i).to_op_seq_number          := oper_networks_rec.to_seq_num;
615     G_op_network_tbl(i).to_x_coordinate           := oper_networks_rec.to_x_coordinate;
616     G_op_network_tbl(i).to_y_coordinate           := oper_networks_rec.to_y_coordinate;
617     G_op_network_tbl(i).to_start_effective_date   := oper_networks_rec.to_effectivity_date;
618     G_op_network_tbl(i).connection_type           := oper_networks_rec.transition_type;
619     G_op_network_tbl(i).planning_percent          := oper_networks_rec.planning_pct;
620     G_op_network_tbl(i).attribute_category        := oper_networks_rec.attribute_category;
621     G_op_network_tbl(i).attribute1                := oper_networks_rec.attribute1;
622     G_op_network_tbl(i).attribute2                := oper_networks_rec.attribute2;
623     G_op_network_tbl(i).attribute3                := oper_networks_rec.attribute3;
624     G_op_network_tbl(i).attribute4                := oper_networks_rec.attribute4;
625     G_op_network_tbl(i).attribute5                := oper_networks_rec.attribute5;
626     G_op_network_tbl(i).attribute6                := oper_networks_rec.attribute6;
627     G_op_network_tbl(i).attribute7                := oper_networks_rec.attribute7;
628     G_op_network_tbl(i).attribute8                := oper_networks_rec.attribute8;
629     G_op_network_tbl(i).attribute9                := oper_networks_rec.attribute9;
630     G_op_network_tbl(i).attribute10               := oper_networks_rec.attribute10;
631     G_op_network_tbl(i).attribute11               := oper_networks_rec.attribute11;
632     G_op_network_tbl(i).attribute12               := oper_networks_rec.attribute12;
633     G_op_network_tbl(i).attribute13               := oper_networks_rec.attribute13;
634     G_op_network_tbl(i).attribute14               := oper_networks_rec.attribute14;
635     G_op_network_tbl(i).attribute15               := oper_networks_rec.attribute15;
636     G_op_network_tbl(i).original_system_reference := oper_networks_rec.original_system_reference;
637     i := i + 1;
638   END LOOP;
639   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
640     Error_Handler.Write_Debug('PROCEDURE Populate_Oper_Networks: '||to_char(G_op_network_tbl.COUNT)||' record(s) fetched. ');
641   END IF;
642 END Populate_Oper_Networks;
643 
644 /********************************************************************
645 * Procedure	: Export_RTG
646 * Parameters IN	: P_organization_code  : Organization Code
647 *                 P_assembly_item_name : Assembly Item Name
648 *		  P_alternate_routing_designator : Alternate Routing Designator
649 * Parameters OUT: X_rtg_header_rec     : Routing Header Record
650 *                 X_rtg_revision_tbl   : Table of Routing Revision records
651 *                 X_operation_tbl      : Table of Routing Operations
652 *                 X_op_resource_tbl    : Table of Operation Resource Records
653 *                 X_sub_resource_tbl   : Table of Substitute Operation Resource Records
654 *                 X_op_network_tbl     : Table of Operation Networks
655 *********************************************************************/
656 PROCEDURE Export_RTG
657    ( P_init_msg_list                IN  BOOLEAN := FALSE,
658      P_organization_code            IN  VARCHAR2,
659      P_assembly_item_name           IN  VARCHAR2,
660      P_alternate_routing_designator IN  VARCHAR2,
661      P_debug                        IN  VARCHAR2 := 'N',
662      P_output_dir                   IN  VARCHAR2 := NULL,
663      P_debug_filename               IN  VARCHAR2 := 'RTG_EXP_debug.log',
664      X_rtg_header_rec               OUT NOCOPY BOM_RTG_PUB.Rtg_Header_Rec_Type,
665      X_rtg_revision_tbl             OUT NOCOPY BOM_RTG_PUB.Rtg_Revision_Tbl_Type,
666      X_operation_tbl                OUT NOCOPY BOM_RTG_PUB.Operation_Tbl_Type,
667      X_op_resource_tbl              OUT NOCOPY BOM_RTG_PUB.Op_Resource_Tbl_Type,
668      X_sub_resource_tbl             OUT NOCOPY BOM_RTG_PUB.Sub_Resource_Tbl_Type,
669      X_op_network_tbl               OUT NOCOPY BOM_RTG_PUB.Op_Network_Tbl_Type,
670      X_return_status                OUT NOCOPY VARCHAR2,
671      X_msg_count                    OUT NOCOPY NUMBER
672    ) IS
673   l_organization_id NUMBER;
674   l_routing_seq_id  NUMBER;
675   l_Mesg_Token_Tbl  ERROR_HANDLER.Mesg_Token_Tbl_Type;
676   l_other_message   VARCHAR2(50);
677   l_Token_Tbl       ERROR_HANDLER.Token_Tbl_Type;
678   l_Debug_flag      VARCHAR2(1) := p_debug;
679   G_EXC_SEV_QUIT_OBJECT EXCEPTION;
680   G_EXC_UNEXP_SKIP_OBJECT EXCEPTION;
681   l_return_status         VARCHAR2(1);
682   l_err_text              VARCHAR2(2000);
683   l_item_id               NUMBER;
684 BEGIN
685   G_rtg_header_rec := null;
686   G_rtg_revision_tbl.DELETE;
687   G_operation_tbl.DELETE;
688   G_op_resource_tbl.DELETE;
689   G_sub_resource_tbl.DELETE;
690   G_op_network_tbl.DELETE;
691 
692   -- Initialize the message list if the user has set the
693   -- Init Message List parameter
694   --
695   IF (p_init_msg_list) THEN
696     Error_Handler.Initialize;
697   END IF;
698   IF (l_debug_flag = 'Y') THEN
699     IF (trim(p_output_dir) IS NULL OR
700         trim(p_output_dir) = '') THEN
701       -- If debug is Y then out dir must be specified
702       Error_Handler.Add_Error_Token
703         (p_Message_text   => 'Debug is set to Y so an output directory' ||
704                              ' must be specified. Debug will be turned' ||
705                              ' off since no directory is specified',
706          p_Mesg_Token_Tbl => l_mesg_token_tbl,
707          x_Mesg_Token_Tbl => l_mesg_token_tbl,
708          p_Token_Tbl      => l_token_tbl);
709 
710       Bom_Rtg_Error_Handler.Log_Error
711         (p_rtg_header_rec	=> Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC,
712 	 p_rtg_revision_tbl	=> Bom_Rtg_Pub.G_MISS_RTG_REVISION_TBL,
713 	 p_operation_tbl	=> Bom_Rtg_Pub.G_MISS_OPERATION_TBL,
714          p_op_resource_tbl	=> Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL,
715          p_sub_resource_tbl	=> Bom_Rtg_Pub.G_MISS_SUB_RESOURCE_TBL,
716          p_op_network_tbl	=> Bom_Rtg_Pub.G_MISS_OP_NETWORK_TBL,
717 	 p_mesg_token_tbl	=> l_mesg_token_tbl,
718          p_error_status		=> 'W',
719          p_error_scope		=> NULL,
720          p_other_message	=> NULL,
721          p_other_mesg_appid	=> 'BOM',
722          p_other_status		=> NULL,
723          p_other_token_tbl	=> Error_Handler.G_MISS_TOKEN_TBL,
724          p_entity_index		=> 1,
725          p_error_level		=> Error_Handler.G_BO_LEVEL,
726          x_rtg_header_rec	=> x_rtg_header_rec,
727          x_rtg_revision_tbl	=> x_rtg_revision_tbl,
728          x_operation_tbl	=> x_operation_tbl,
729          x_op_resource_tbl	=> x_op_resource_tbl,
730          x_sub_resource_tbl	=> x_sub_resource_tbl,
731          x_op_network_tbl	=> x_op_network_tbl);
732 /*
733       Bom_Rtg_Error_Handler.Log_Error
734         (p_mesg_token_tbl   => l_mesg_token_tbl,
735          p_error_status     => 'W',
736          p_error_level      => Error_Handler.G_BO_LEVEL,
737          x_rtg_header_rec   => x_rtg_header_rec,
738          x_rtg_revision_tbl => x_rtg_revision_tbl,
739          x_operation_tbl    => x_operation_tbl,
740          x_op_resource_tbl  => x_op_resource_tbl,
741          x_sub_resource_tbl => x_sub_resource_tbl,
742          x_op_network_tbl   => x_op_network_tbl);
743 */
744       l_debug_flag := 'N' ;
745     END IF;
746 
747     IF (trim(p_debug_filename) IS NULL OR
748         trim(p_debug_filename) = '') THEN
749       Error_Handler.Add_Error_Token
750         (p_Message_text   =>' Debug is set to Y so an output filename' ||
751                             ' must be specified. Debug will be turned' ||
752                             ' off since no filename is specified',
753          p_Mesg_Token_Tbl => l_mesg_token_tbl,
754          x_Mesg_Token_Tbl => l_mesg_token_tbl,
755          p_Token_Tbl      => l_token_tbl);
756       BOM_RTG_ERROR_HANDLER.Log_Error
757         (p_rtg_header_rec	=> Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC,
758 	 p_rtg_revision_tbl	=> Bom_Rtg_Pub.G_MISS_RTG_REVISION_TBL,
759 	 p_operation_tbl	=> Bom_Rtg_Pub.G_MISS_OPERATION_TBL,
760          p_op_resource_tbl	=> Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL,
761          p_sub_resource_tbl	=> Bom_Rtg_Pub.G_MISS_SUB_RESOURCE_TBL,
762          p_op_network_tbl	=> Bom_Rtg_Pub.G_MISS_OP_NETWORK_TBL,
763 	 p_mesg_token_tbl       => l_mesg_token_tbl,
764          p_error_status         => 'W',
765          p_error_scope		=> NULL,
766          p_other_message	=> NULL,
767          p_other_mesg_appid	=> 'BOM',
768          p_other_status		=> NULL,
769          p_other_token_tbl	=> Error_Handler.G_MISS_TOKEN_TBL,
770          p_entity_index		=> 1,
771          p_error_level          => Error_Handler.G_BO_LEVEL,
772          x_rtg_header_rec       => x_rtg_header_rec,
773          x_rtg_revision_tbl     => x_rtg_revision_tbl,
774          x_operation_tbl        => x_operation_tbl,
775          x_op_resource_tbl      => x_op_resource_tbl,
776          x_sub_resource_tbl     => x_sub_resource_tbl,
777          x_op_network_tbl       => x_op_network_tbl);
778 /*
779       BOM_RTG_ERROR_HANDLER.Log_Error
780         (p_mesg_token_tbl        => l_mesg_token_tbl,
781          p_error_status          => 'W',
782          p_error_level           => Error_Handler.G_BO_LEVEL,
783          x_rtg_header_rec        => x_rtg_header_rec,
784          x_rtg_revision_tbl      => x_rtg_revision_tbl,
785          x_operation_tbl         => x_operation_tbl,
786          x_op_resource_tbl       => x_op_resource_tbl,
787          x_sub_resource_tbl      => x_sub_resource_tbl,
788          x_op_network_tbl        => x_op_network_tbl);
789 */
790       l_debug_flag := 'N';
791     END IF;
792 
793     BOM_Rtg_Globals.Set_Debug(l_debug_flag);
794 
795     IF l_debug_flag = 'Y' THEN
796       Error_Handler.Open_Debug_Session
797         (p_debug_filename     => p_debug_filename,
798          p_output_dir         => p_output_dir,
799          x_return_status      => l_return_status,
800          p_mesg_token_tbl     => l_mesg_token_tbl,
801          x_mesg_token_tbl     => l_mesg_token_tbl);
802       IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
803         BOM_Rtg_Globals.Set_Debug('N');
804       END IF;
805     END IF;
806   END IF;
807 
808   IF ((P_assembly_item_name IS NULL OR
809        P_assembly_item_name = FND_API.G_MISS_CHAR) OR
810       (P_organization_code IS NULL OR
811        P_organization_code = FND_API.G_MISS_CHAR)) THEN
812     l_other_message := 'BOM_ASSY_OR_ORG_MISSING';
813     RAISE G_EXC_SEV_QUIT_OBJECT;
814   END IF;
815 
816   l_organization_id := BOM_RTG_VAL_TO_ID.Organization(p_organization => P_organization_code,
817                                                       x_err_text     => l_err_text);
818   IF (l_organization_id IS NULL) THEN
819     l_other_message := 'BOM_ORG_INVALID';
820     l_token_tbl(1).token_name := 'ORG_CODE';
821     l_token_tbl(1).token_value := P_organization_code;
822     RAISE G_EXC_SEV_QUIT_OBJECT;
823   ELSIF (l_organization_id = FND_API.G_MISS_NUM) THEN
824     l_other_message := 'BOM_UNEXP_ORG_INVALID';
825     RAISE G_EXC_UNEXP_SKIP_OBJECT;
826   END IF;
827   l_item_id := BOM_RTG_EXP_UTIL.Get_Item_Id(P_assembly_item_name);
828   IF (l_item_id IS NULL) THEN
829     l_other_message            := 'BOM_ITEM_INVALID';
830     l_token_tbl(1).token_name  := 'ITEM_NAME';
831     l_token_tbl(1).token_value := P_assembly_item_name;
832     RAISE G_EXC_SEV_QUIT_OBJECT;
833   ELSIF (l_item_id = FND_API.G_MISS_NUM) THEN
834     l_other_message := 'BOM_UNEXP_ITEM_INVALID';
835     RAISE G_EXC_UNEXP_SKIP_OBJECT;
836   END IF;
837 /*
838   Populate_Header(P_organization_code, l_organization_id, P_assembly_item_name, l_item_id,
839                   P_alternate_routing_designator, l_routing_seq_id);
840   Populate_Revision(P_organization_code, l_organization_id, P_assembly_item_name, l_item_id,
841                     P_alternate_routing_designator);
842 */
843   Populate_Header(P_organization_code => P_organization_code,
844                   P_organization_id => l_organization_id,
845                   P_assembly_item_name => P_assembly_item_name,
846                   P_item_id => l_item_id,
847                   P_alternate_routing_designator => P_alternate_routing_designator,
848                   X_routing_sequence_id => l_routing_seq_id);
849 
850   Populate_Revision(P_organization_code => P_organization_code,
851                     P_organization_id => l_organization_id,
852                     P_assembly_item_name => P_assembly_item_name,
853                     P_item_id => l_item_id,
854                     P_alt_rtg_code => P_alternate_routing_designator);
855 
856   IF (l_routing_seq_id IS NOT NULL) THEN
857 /*
858     Populate_Operations(P_organization_code, P_assembly_item_name, l_routing_seq_id,
859                         P_alternate_routing_designator);
860 
861     Populate_Oper_Networks(P_organization_code, P_assembly_item_name, P_alternate_routing_designator,
862                            l_routing_seq_id);
863 */
864     Populate_Operations(P_organization_code => P_organization_code,
865                         P_assembly_item_name => P_assembly_item_name,
866                         P_routing_seq_id => l_routing_seq_id,
867                         P_alt_rtg_code => P_alternate_routing_designator);
868     Populate_Oper_Networks(P_organization_code => P_organization_code,
869                            P_assembly_item_name => P_assembly_item_name,
870                            P_alternate_routing_code => P_alternate_routing_designator,
871                            P_routing_seq_id => l_routing_seq_id);
872   END IF;
873 
874   IF BOM_Rtg_Globals.get_debug = 'Y' THEN
875     Error_Handler.Write_Debug('The Routing Export BO is passed ');
876     Error_Handler.Write_Debug('-----------------------------------------------------') ;
877     Error_Handler.Write_Debug('Header Rec - Assembly Item : ' || G_rtg_header_rec.assembly_item_name);
878     Error_Handler.Write_Debug('Num of Routing Revisions   : ' || G_rtg_revision_tbl.COUNT);
879     Error_Handler.Write_Debug('Num of Operations          : ' || G_operation_tbl.COUNT);
880     Error_Handler.Write_Debug('Num of Resources           : ' || G_op_resource_tbl.COUNT);
881     Error_Handler.Write_Debug('Num of Substitue Resources : ' || G_sub_resource_tbl.COUNT);
882     Error_Handler.Write_Debug('Num of Operation Network   : ' || G_op_network_tbl.COUNT);
883     Error_Handler.Write_Debug('-----------------------------------------------------') ;
884   END IF;
885 
886   X_rtg_header_rec   := G_rtg_header_rec;
887   X_rtg_revision_tbl := G_rtg_revision_tbl;
888   X_operation_tbl    := G_operation_tbl;
889   X_op_resource_tbl  := G_op_resource_tbl;
890   X_sub_resource_tbl := G_sub_resource_tbl;
891   X_op_network_tbl   := G_op_network_tbl;
892   X_return_status    := 'S';
893   EXCEPTION
894     WHEN G_EXC_SEV_QUIT_OBJECT THEN
895       BOM_RTG_ERROR_HANDLER.Log_Error
896         (p_rtg_header_rec	=> Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC,
897 	 p_rtg_revision_tbl	=> Bom_Rtg_Pub.G_MISS_RTG_REVISION_TBL,
898 	 p_operation_tbl	=> Bom_Rtg_Pub.G_MISS_OPERATION_TBL,
899          p_op_resource_tbl	=> Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL,
900          p_sub_resource_tbl	=> Bom_Rtg_Pub.G_MISS_SUB_RESOURCE_TBL,
901          p_op_network_tbl	=> Bom_Rtg_Pub.G_MISS_OP_NETWORK_TBL,
902 	 p_Mesg_Token_Tbl       => l_Mesg_Token_Tbl,
903          p_error_status         => Error_Handler.G_STATUS_ERROR,
904          p_error_level          => Error_Handler.G_BO_LEVEL,
905          p_error_scope          => Error_Handler.G_SCOPE_ALL,
906          p_other_status         => Error_Handler.G_STATUS_NOT_PICKED,
907          p_other_message        => l_other_message,
908          p_other_mesg_appid	=> 'BOM',
909          p_other_token_tbl      => l_token_tbl,
910          p_entity_index		=> 1,
911          x_rtg_header_rec       => x_rtg_header_rec,
912          x_rtg_revision_tbl     => x_rtg_revision_tbl,
913          x_operation_tbl        => x_operation_tbl,
914          x_op_resource_tbl      => x_op_resource_tbl,
915          x_sub_resource_tbl     => x_sub_resource_tbl,
916          x_op_network_tbl       => x_op_network_tbl);
917 /*
918       BOM_RTG_ERROR_HANDLER.Log_Error
919         (p_Mesg_Token_Tbl        => l_Mesg_Token_Tbl,
920          p_error_status          => Error_Handler.G_STATUS_ERROR,
921          p_error_level           => Error_Handler.G_BO_LEVEL,
922          p_error_scope           => Error_Handler.G_SCOPE_ALL,
923          p_other_status          => Error_Handler.G_STATUS_NOT_PICKED,
924          p_other_message         => l_other_message,
925          p_other_token_tbl       => l_token_tbl,
926          x_rtg_header_rec        => x_rtg_header_rec,
927          x_rtg_revision_tbl      => x_rtg_revision_tbl,
928          x_operation_tbl         => x_operation_tbl,
929          x_op_resource_tbl       => x_op_resource_tbl,
930          x_sub_resource_tbl      => x_sub_resource_tbl,
931          x_op_network_tbl        => x_op_network_tbl);
932 */
933          x_return_status := Error_Handler.G_STATUS_ERROR;
934          x_msg_count     := Error_Handler.Get_Message_Count;
935          IF (BOM_RTG_GLOBALS.Get_Debug = 'Y') THEN
936            ERROR_HANDLER.Close_Debug_Session;
937          END IF;
938 
939     WHEN G_EXC_UNEXP_SKIP_OBJECT THEN
940       BOM_RTG_ERROR_HANDLER.Log_Error
941         (p_rtg_header_rec	=> Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC,
942 	 p_rtg_revision_tbl	=> Bom_Rtg_Pub.G_MISS_RTG_REVISION_TBL,
943 	 p_operation_tbl	=> Bom_Rtg_Pub.G_MISS_OPERATION_TBL,
944          p_op_resource_tbl	=> Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL,
945          p_sub_resource_tbl	=> Bom_Rtg_Pub.G_MISS_SUB_RESOURCE_TBL,
946          p_op_network_tbl	=> Bom_Rtg_Pub.G_MISS_OP_NETWORK_TBL,
947          p_Mesg_Token_Tbl       => l_Mesg_Token_Tbl,
948          p_error_status         => Error_Handler.G_STATUS_UNEXPECTED,
949          p_error_scope		=> NULL,
950          p_other_mesg_appid	=> 'BOM',
951          p_entity_index		=> 1,
952          p_error_level          => Error_Handler.G_BO_LEVEL,
953          p_other_status         => Error_Handler.G_STATUS_NOT_PICKED,
954          p_other_message        => l_other_message,
955          p_other_token_tbl      => l_token_tbl,
956          x_rtg_header_rec       => x_rtg_header_rec,
957          x_rtg_revision_tbl     => x_rtg_revision_tbl,
958          x_operation_tbl        => x_operation_tbl,
959          x_op_resource_tbl      => x_op_resource_tbl,
960          x_sub_resource_tbl     => x_sub_resource_tbl,
961          x_op_network_tbl       => x_op_network_tbl);
962 /*
963       BOM_RTG_ERROR_HANDLER.Log_Error
964         (p_Mesg_Token_Tbl        => l_Mesg_Token_Tbl,
965          p_error_status          => Error_Handler.G_STATUS_UNEXPECTED,
966          p_error_level           => Error_Handler.G_BO_LEVEL,
967          p_other_status          => Error_Handler.G_STATUS_NOT_PICKED,
968          p_other_message         => l_other_message,
969          p_other_token_tbl       => l_token_tbl,
970          x_rtg_header_rec        => x_rtg_header_rec,
971          x_rtg_revision_tbl      => x_rtg_revision_tbl,
972          x_operation_tbl         => x_operation_tbl,
973          x_op_resource_tbl       => x_op_resource_tbl,
974          x_sub_resource_tbl      => x_sub_resource_tbl,
975          x_op_network_tbl        => x_op_network_tbl);
976 */
977       x_return_status := Error_Handler.G_STATUS_UNEXPECTED;
978       x_msg_count     := Error_Handler.Get_Message_Count;
979       IF (Bom_Rtg_Globals.Get_Debug = 'Y') THEN
980         ERROR_HANDLER.Close_Debug_Session;
981       END IF;
982     WHEN no_data_found THEN
983       BOM_RTG_ERROR_HANDLER.Log_Error
984         (p_rtg_header_rec	=> Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC,
985 	 p_rtg_revision_tbl	=> Bom_Rtg_Pub.G_MISS_RTG_REVISION_TBL,
986 	 p_operation_tbl	=> Bom_Rtg_Pub.G_MISS_OPERATION_TBL,
987          p_op_resource_tbl	=> Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL,
988          p_sub_resource_tbl	=> Bom_Rtg_Pub.G_MISS_SUB_RESOURCE_TBL,
989          p_op_network_tbl	=> Bom_Rtg_Pub.G_MISS_OP_NETWORK_TBL,
990 	 p_mesg_token_tbl	=> l_mesg_token_tbl,
991          p_error_status         => Error_Handler.G_STATUS_ERROR,
992          p_other_mesg_appid	=> 'BOM',
993          p_other_token_tbl	=> Error_Handler.G_MISS_TOKEN_TBL,
994          p_entity_index		=> 1,
995          p_error_level          => Error_Handler.G_BO_LEVEL,
996          p_error_scope          => Error_Handler.G_SCOPE_ALL,
997          p_other_status         => Error_Handler.G_STATUS_NOT_PICKED,
998          p_other_message        => 'BOM_EXP_NO_RTG',
999          x_rtg_header_rec       => X_rtg_header_rec,
1000          x_rtg_revision_tbl     => X_rtg_revision_tbl,
1001          x_operation_tbl        => X_operation_tbl,
1002          x_op_resource_tbl      => X_op_resource_tbl,
1003          x_sub_resource_tbl     => X_sub_resource_tbl,
1004          x_op_network_tbl       => X_op_network_tbl);
1005 /*
1006       BOM_RTG_ERROR_HANDLER.Log_Error
1007         ( p_error_status          => Error_Handler.G_STATUS_ERROR,
1008           p_error_level           => Error_Handler.G_BO_LEVEL,
1009           p_error_scope           => Error_Handler.G_SCOPE_ALL,
1010           p_other_status          => Error_Handler.G_STATUS_NOT_PICKED,
1011           p_other_message         => 'BOM_EXP_NO_RTG',
1012           x_rtg_header_rec        => X_rtg_header_rec,
1013           x_rtg_revision_tbl      => X_rtg_revision_tbl,
1014           x_operation_tbl         => X_operation_tbl,
1015           x_op_resource_tbl       => X_op_resource_tbl,
1016           x_sub_resource_tbl      => X_sub_resource_tbl,
1017           x_op_network_tbl        => X_op_network_tbl);
1018 */
1019       X_return_status := Error_Handler.G_STATUS_ERROR;
1020       X_msg_count     := Error_Handler.Get_Message_Count;
1021       IF (BOM_RTG_GLOBALS.Get_Debug = 'Y') THEN
1022         ERROR_HANDLER.Close_Debug_Session;
1023       END IF;
1024 END Export_RTG;
1025 END BOM_RTG_EXP;