DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_BOM_ISETUP_IMP

Source


1 PACKAGE BODY BOM_BOM_ISETUP_IMP AS
2 /* $Header: BOMBMSTB.pls 120.3 2006/05/04 23:18:15 myerrams noship $ */
3 /***************************************************************************
4 --
5 --  Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      BOMBMSTB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package BOM_BOM_ISETUP_IMP
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  18-NOV-02   M V M P Tilak    Initial Creation
21 --  26-MAR-03   M V M P Tilak    Modified for XSU utility work-around
22 --  10-FEB-04   Anupam Jain      Bug# 3349138, avoid redundant migration of
23 --                               Item Revisions data.
24 --  23-DEC-05	MYERRAMS	 Added ImplementationDate to bom_bill_of_materials_temp table
25 --				 Added BasisType to bom_inventory_components_temp table
26 --				 Bug: 4873339
27 --  05-MAY-05	MYERRAMS	 Modified the ImplementationDate conversion.
28 --				 Bug: 5141752
29 ***************************************************************************/
30 
31 PROCEDURE Import_BOM(P_debug             IN VARCHAR2 := 'N',
32                      P_output_dir        IN VARCHAR2 := NULL,
33                      P_debug_filename    IN VARCHAR2 := 'BOM_BO_debug.log',
34                      P_bom_header_XML    IN CLOB,
35 --Bug 3349138                     P_bom_revisions_XML IN CLOB,
36                      P_bom_inv_comps_XML IN CLOB,
37                      P_bom_sub_comps_XML IN CLOB,
38                      P_bom_ref_desgs_XML IN CLOB,
39                      P_bom_comp_oper_XML IN CLOB,
40                      X_return_status     OUT NOCOPY VARCHAR2,
41                      X_msg_count         OUT NOCOPY NUMBER,
42                      X_G_msg_data        OUT NOCOPY LONG) IS
43 
44   l_bom_header_tbl         BOM_BO_PUB.BOM_HEADER_TBL_TYPE
45                                     := BOM_BO_PUB.G_MISS_BOM_HEADER_TBL;
46 --Bug 3349138  l_bom_revisions_tbl       BOM_BO_PUB.BOM_REVISION_TBL_TYPE
47 --                                    := BOM_BO_PUB.G_MISS_BOM_REVISION_TBL;
48   l_bom_comp_tbl           BOM_BO_PUB.BOM_COMPS_TBL_TYPE
49                                     := BOM_BO_PUB.G_MISS_BOM_COMPONENT_TBL;
50   l_bom_ref_desig_tbl      BOM_BO_PUB.BOM_REF_DESIGNATOR_TBL_TYPE
51                                     := BOM_BO_PUB.G_MISS_BOM_REF_DESIGNATOR_TBL;
52   l_bom_sub_comp_tbl       BOM_BO_PUB.BOM_SUB_COMPONENT_TBL_TYPE
53                                     := BOM_BO_PUB.G_MISS_BOM_SUB_COMPONENT_TBL;
54   l_bom_comp_oper_tbl       BOM_BO_PUB.BOM_COMP_OPS_TBL_TYPE
55                                     := BOM_BO_PUB.G_MISS_BOM_COMP_OPS_TBL;
56   X_bom_header_tbl         BOM_BO_PUB.BOM_HEADER_TBL_TYPE
57                                     := BOM_BO_PUB.G_MISS_BOM_HEADER_TBL;
58   X_bom_revisions_tbl       BOM_BO_PUB.BOM_REVISION_TBL_TYPE
59                                     := BOM_BO_PUB.G_MISS_BOM_REVISION_TBL;
60   X_bom_comp_tbl           BOM_BO_PUB.BOM_COMPS_TBL_TYPE
61                                     := BOM_BO_PUB.G_MISS_BOM_COMPONENT_TBL;
62   X_bom_ref_desig_tbl      BOM_BO_PUB.BOM_REF_DESIGNATOR_TBL_TYPE
63                                     := BOM_BO_PUB.G_MISS_BOM_REF_DESIGNATOR_TBL;
64   X_bom_sub_comp_tbl       BOM_BO_PUB.BOM_SUB_COMPONENT_TBL_TYPE
65                                     := BOM_BO_PUB.G_MISS_BOM_SUB_COMPONENT_TBL;
66   X_bom_comp_oper_tbl       BOM_BO_PUB.BOM_COMP_OPS_TBL_TYPE
67                                     := BOM_BO_PUB.G_MISS_BOM_COMP_OPS_TBL;
68 /* 090403
69   CURSOR bom_updates_CUR IS
70     SELECT AssemblyItemName
71          , OrganizationCode
72          , AlternateCode
73          , TableName
74          , ColumnName
75          , ColumnValue
76          , ColumnType
77     FROM   bom_routing_updates_temp;
78 */
79 
80   CURSOR bom_header_temp_CUR IS
81     SELECT tmp.AssemblyItemName        ,
82            tmp.OrganizationCode         ,
83            tmp.AlternateBomCode        ,
84            tmp.CommonAssemblyItemName ,
85            tmp.CommonOrganizationCode  ,
86            tmp.AssemblyComment          ,
87            tmp.AssemblyType             ,
88            'UPDATE' TransactionType    ,
89            NULL     ReturnStatus       ,
90            tmp.AttributeCategory        ,
91            tmp.Attribute1                ,
92            tmp.Attribute2                ,
93            tmp.Attribute3                ,
94            tmp.Attribute4                ,
95            tmp.Attribute5                ,
96            tmp.Attribute6                ,
97            tmp.Attribute7                ,
98            tmp.Attribute8                ,
99            tmp.Attribute9                ,
100            tmp.Attribute10               ,
101            tmp.Attribute11               ,
102            tmp.Attribute12               ,
103            tmp.Attribute13               ,
104            tmp.Attribute14               ,
105            tmp.Attribute15               ,
106            tmp.OriginalSystemReference   ,
107 	   tmp.ImplementationDate	 , --myerrams, bug: 4873339. New Column added for R12.
108            NULL   DeleteGroupName        ,
109            NULL   DGDescription          ,
110            NULL   RowIdentifier
111     FROM   bom_bill_of_materials_temp tmp,
112            mtl_system_items_kfv item,
113            mtl_parameters org
114     WHERE  org.organization_code      = tmp.OrganizationCode
115     AND    item.concatenated_segments = tmp.AssemblyItemName
116     AND    item.organization_id       = org.organization_id
117     AND    EXISTS (SELECT 1
118                    FROM   bom_bill_of_materials bom
119                    WHERE  bom.assembly_item_id         = item.inventory_item_id
120                    AND    bom.organization_id          = org.organization_id
121                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
122                    AND    bom.common_assembly_item_id is null)
123     UNION ALL
124     SELECT tmp.AssemblyItemName        ,
125            tmp.OrganizationCode         ,
126            tmp.AlternateBomCode        ,
127            tmp.CommonAssemblyItemName ,
128            tmp.CommonOrganizationCode  ,
129            tmp.AssemblyComment          ,
130            tmp.AssemblyType             ,
131            'CREATE'  TransactionType    ,
132            NULL      ReturnStatus       ,
133            tmp.Attributecategory        ,
134            tmp.Attribute1                ,
135            tmp.Attribute2                ,
136            tmp.Attribute3                ,
137            tmp.Attribute4                ,
138            tmp.Attribute5                ,
139            tmp.Attribute6                ,
140            tmp.Attribute7                ,
141            tmp.Attribute8                ,
142            tmp.Attribute9                ,
143            tmp.Attribute10               ,
144            tmp.Attribute11               ,
145            tmp.Attribute12               ,
146            tmp.Attribute13               ,
147            tmp.Attribute14               ,
148            tmp.Attribute15               ,
149            tmp.OriginalSystemReference   ,
150 	   tmp.ImplementationDate	 , --myerrams, bug: 4873339. New Column added for R12.
151            NULL   DeleteGroupName        ,
152            NULL   DGDescription          ,
153            NULL   RowIdentifier
154     FROM   bom_bill_of_materials_temp tmp,
155            mtl_system_items_kfv item,
156            mtl_parameters org
157     WHERE  org.organization_code      = tmp.OrganizationCode
158     AND    item.concatenated_segments = tmp.AssemblyItemName
159     AND    item.organization_id       = org.organization_id
160     AND    NOT EXISTS (SELECT 1
161                        FROM   bom_bill_of_materials bom
162                        WHERE  bom.assembly_item_id         = item.inventory_item_id
163                        AND    bom.organization_id          = org.organization_id
164                        AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##'));
165 
166   CURSOR bom_comp_CUR IS
167     SELECT tmp.OrganizationCode             ,
168            tmp.AssemblyItemName            ,
169            tmp.StartEffectiveDate          ,
170            tmp.DisableDate                  ,
171            tmp.OperationSequenceNumber     ,
172            tmp.ComponentItemName           ,
173            tmp.AlternateBOMCode            ,
174            tmp.NewEffectivityDate          ,
175            tmp.NewOperationSequenceNumber ,
176            tmp.ItemSequenceNumber          ,
177            tmp.QuantityPerAssembly         ,
178            tmp.PlanningPercent              ,
179            tmp.ProjectedYield               ,
180            tmp.IncludeInCostRollup        ,
181            tmp.WipSupplyType               ,
182            tmp.SoBasis                      ,
183            tmp.Optional                      ,
184            tmp.MutuallyExclusive            ,
185            tmp.CheckAtp                     ,
186            tmp.ShippingAllowed              ,
187            tmp.RequiredToShip              ,
188            tmp.RequiredForRevenue          ,
189            tmp.IncludeOnShipDocs          ,
190            tmp.QuantityRelated              ,
191            tmp.SupplySubinventory           ,
192            tmp.LocationName                 ,
193            tmp.MinimumAllowedQuantity      ,
194            tmp.MaximumAllowedQuantity      ,
195            tmp.Comments                      ,
196            tmp.AttributeCategory            ,
197            tmp.Attribute1                    ,
198            tmp.Attribute2                    ,
199            tmp.Attribute3                    ,
200            tmp.Attribute4                    ,
201            tmp.Attribute5                    ,
202            tmp.Attribute6                    ,
203            tmp.Attribute7                    ,
204            tmp.Attribute8                    ,
205            tmp.Attribute9                    ,
206            tmp.Attribute10                   ,
207            tmp.Attribute11                   ,
208            tmp.Attribute12                   ,
209            tmp.Attribute13                   ,
210            tmp.Attribute14                   ,
211            tmp.Attribute15                   ,
212            tmp.FromEndItemUnitNumber         ,
213            tmp.NewFromEndItemUnitNumber      ,
214            tmp.ToEndItemUnitNumber	     ,
215 	   tmp.BasisType		     ,	--myerrams, bug: 4873339. New Column added for R12.
216            NULL     ReturnStatus             ,
217            'UPDATE' TransactionType          ,
218            tmp.OriginalSystemReference       ,
219            NULL   DeleteGroupName            ,
220            NULL   DGDescription              ,
221            tmp.EnforceIntRequirements        ,
222            NULL AutoRequestMaterial          ,
223            NULL RowIdentifier                ,
224            tmp.SuggestedVendorName           ,
225            tmp.UnitPrice
226     FROM   bom_inventory_components_temp tmp
227     WHERE  EXISTS (SELECT 1
228                    FROM   bom_inventory_components comp,
229                           bom_bill_of_materials bom,
230                           mtl_system_items_kfv item1,
231                           mtl_system_items_kfv item2,
232                           mtl_parameters org
233                    WHERE  bom.bill_sequence_id        = comp.bill_sequence_id
234                    AND    item1.inventory_item_id     = bom.assembly_item_id
235                    AND    item1.organization_id       = bom.organization_id
236                    AND    org.organization_id         = bom.organization_id
237                    AND    item1.concatenated_segments = tmp.AssemblyItemName
238                    AND    org.organization_code       = tmp.OrganizationCode
239                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
240                    AND    item2.inventory_item_id     = comp.component_item_id
241                    AND    item2.organization_id       = org.organization_id
242                    AND    item2.concatenated_segments = tmp.ComponentItemName
243                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
244                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
245                    AND    bom.common_assembly_item_id is null)
246     UNION ALL
247     SELECT tmp.OrganizationCode             ,
248            tmp.AssemblyItemName            ,
249            tmp.StartEffectiveDate          ,
250            tmp.DisableDate                  ,
251            tmp.OperationSequenceNumber     ,
252            tmp.ComponentItemName           ,
253            tmp.AlternateBOMCode            ,
254            tmp.NewEffectivityDate          ,
255            tmp.NewOperationSequenceNumber ,
256            tmp.ItemSequenceNumber          ,
257            tmp.QuantityPerAssembly         ,
258            tmp.PlanningPercent              ,
259            tmp.ProjectedYield               ,
260            tmp.IncludeInCostRollup        ,
261            tmp.WipSupplyType               ,
262            tmp.SoBasis                      ,
263            tmp.Optional                      ,
264            tmp.MutuallyExclusive            ,
265            tmp.CheckAtp                     ,
266            tmp.ShippingAllowed              ,
267            tmp.RequiredToShip              ,
268            tmp.RequiredForRevenue          ,
269            tmp.IncludeOnShipDocs          ,
270            tmp.QuantityRelated              ,
271            tmp.SupplySubinventory           ,
272            tmp.LocationName                 ,
273            tmp.MinimumAllowedQuantity      ,
274            tmp.MaximumAllowedQuantity      ,
275            tmp.Comments                      ,
276            tmp.AttributeCategory            ,
277            tmp.Attribute1                    ,
278            tmp.Attribute2                    ,
279            tmp.Attribute3                    ,
280            tmp.Attribute4                    ,
281            tmp.Attribute5                    ,
282            tmp.Attribute6                    ,
283            tmp.Attribute7                    ,
284            tmp.Attribute8                    ,
285            tmp.Attribute9                    ,
286            tmp.Attribute10                   ,
287            tmp.Attribute11                   ,
288            tmp.Attribute12                   ,
289            tmp.Attribute13                   ,
290            tmp.Attribute14                   ,
291            tmp.Attribute15                   ,
292            tmp.FromEndItemUnitNumber     ,
293            tmp.NewFromEndItemUnitNumber ,
294            tmp.ToEndItemUnitNumber       ,
295 	   tmp.BasisType		     ,	--myerrams, bug: 4873339. New Column added for R12.
296            NULL        ReturnStatus         ,
297            'CREATE'    TransactionType      ,
298            tmp.OriginalSystemReference     ,
299            NULL        DeleteGroupName     ,
300            NULL        DGDescription        ,
301            tmp.EnforceIntRequirements    ,
302            NULL AutoRequestMaterial,
303            NULL RowIdentifier,
304            tmp.SuggestedVendorName,
305            tmp.UnitPrice
306     FROM   bom_inventory_components_temp tmp
307     WHERE  NOT EXISTS
308                   (SELECT 1
309                    FROM   bom_inventory_components comp,
310                           bom_bill_of_materials bom,
311                           mtl_system_items_kfv item1,
312                           mtl_system_items_kfv item2,
313                           mtl_parameters org
314                    WHERE  bom.bill_sequence_id        = comp.bill_sequence_id
315                    AND    item1.inventory_item_id     = bom.assembly_item_id
316                    AND    item1.organization_id       = bom.organization_id
317                    AND    org.organization_id         = bom.organization_id
318                    AND    item1.concatenated_segments = tmp.AssemblyItemName
319                    AND    org.organization_code       = tmp.OrganizationCode
320                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
321                    AND    item2.inventory_item_id     = comp.component_item_id
322                    AND    item2.organization_id       = org.organization_id
323                    AND    item2.concatenated_segments = tmp.ComponentItemName
324                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
325                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS'));
326 
327   CURSOR bom_sub_comp_CUR IS
328     SELECT tmp.OrganizationCode            ,
329            tmp.AssemblyItemName           ,
330            tmp.StartEffectiveDate         ,
331            tmp.OperationSequenceNumber    ,
332            tmp.ComponentItemName          ,
333            tmp.AlternateBOMCode           ,
334            tmp.SubstituteComponentName    ,
335            NULL NewSubstituteComponentName,
336            tmp.SubstituteItemQuantity     ,
337            tmp.AttributeCategory           ,
338            tmp.Attribute1                   ,
339            tmp.Attribute2                   ,
340            tmp.Attribute3                   ,
341            tmp.Attribute4                   ,
342            tmp.Attribute5                   ,
343            tmp.Attribute6                   ,
344            tmp.Attribute7                   ,
345            tmp.Attribute8                   ,
346            tmp.Attribute9                   ,
347            tmp.Attribute10                  ,
348            tmp.Attribute11                  ,
349            tmp.Attribute12                  ,
350            tmp.Attribute13                  ,
351            tmp.Attribute14                  ,
352            tmp.Attribute15                  ,
353            null ProgramId                  ,
354            tmp.FromEndItemUnitNumber        ,
355            tmp.EnforceIntRequirements       ,
356            tmp.OriginalSystemReference      ,
357            NULL      ReturnStatus      ,
358            'UPDATE'  TransactionType    ,
359            NULL RowIdentifier
360     FROM   bom_substitute_components_temp tmp
361     WHERE  EXISTS (SELECT 1
362                    FROM   bom_substitute_components sub,
363                           bom_inventory_components comp,
364                           bom_bill_of_materials bom,
365                           mtl_parameters org,
366                           mtl_system_items_kfv item1,
367                           mtl_system_items_kfv item2,
368                           mtl_system_items_kfv item3
369                    WHERE  comp.component_sequence_id = sub.component_sequence_id
370                    AND    bom.bill_sequence_id       = comp.bill_sequence_id
371                    AND    item1.inventory_item_id    = bom.assembly_item_id
372                    AND    item1.organization_id      = bom.organization_id
373                    AND    org.organization_id        = bom.organization_Id
374                    AND    item1.concatenated_segments = tmp.AssemblyItemName
375                    AND    org.organization_code       = tmp.OrganizationCode
376                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
377                    AND    item2.inventory_item_id     = comp.component_item_id
378                    AND    item2.organization_id       = org.organization_id
379                    AND    item2.concatenated_segments = tmp.ComponentItemName
380                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
381                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
382                    AND    item3.inventory_item_id     = sub.substitute_component_id
383                    AND    item3.organization_id       = org.organization_id
384                    AND    item3.concatenated_segments = tmp.SubstituteComponentName
385                    AND    bom.common_assembly_item_id is null)
386     UNION ALL
387     SELECT tmp.OrganizationCode            ,
388            tmp.AssemblyItemName           ,
389            tmp.StartEffectiveDate         ,
390            tmp.OperationSequenceNumber    ,
391            tmp.ComponentItemName          ,
392            tmp.AlternateBOMCode           ,
393            tmp.SubstituteComponentName    ,
394            NULL NewSubstituteComponentName,
395            tmp.SubstituteItemQuantity     ,
396            tmp.AttributeCategory           ,
397            tmp.Attribute1                   ,
398            tmp.Attribute2                   ,
399            tmp.Attribute4                   ,
400            tmp.Attribute5                   ,
401            tmp.Attribute6                   ,
402            tmp.Attribute8                   ,
403            tmp.Attribute9                   ,
404            tmp.Attribute10                  ,
405            tmp.Attribute12                  ,
406            tmp.Attribute13                  ,
407            tmp.Attribute14                  ,
408            tmp.Attribute15                  ,
409            tmp.Attribute3                   ,
410            tmp.Attribute7                   ,
411            tmp.Attribute11                  ,
412            null ProgramId                  ,
413            tmp.FromEndItemUnitNumber    ,
414            tmp.EnforceIntRequirements     ,
415            tmp.OriginalSystemReference    ,
416            NULL      ReturnStatus      ,
417            'CREATE'  TransactionType    ,
418            NULL RowIdentifier
419     FROM   bom_substitute_components_temp tmp
420     WHERE  NOT EXISTS (SELECT 1
421                    FROM   bom_substitute_components sub,
422                           bom_inventory_components comp,
423                           bom_bill_of_materials bom,
424                           mtl_parameters org,
425                           mtl_system_items_kfv item1,
426                           mtl_system_items_kfv item2,
427                           mtl_system_items_kfv item3
428                    WHERE  comp.component_sequence_id = sub.component_sequence_id
429                    AND    bom.bill_sequence_id       = comp.bill_sequence_id
430                    AND    item1.inventory_item_id    = bom.assembly_item_id
431                    AND    item1.organization_id      = bom.organization_id
432                    AND    org.organization_id        = bom.organization_Id
433                    AND    item1.concatenated_segments = tmp.AssemblyItemName
434                    AND    org.organization_code       = tmp.OrganizationCode
435                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
436                    AND    item2.inventory_item_id     = comp.component_item_id
437                    AND    item2.organization_id       = org.organization_id
438                    AND    item2.concatenated_segments = tmp.ComponentItemName
439                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
440                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
441                    AND    item3.inventory_item_id     = sub.substitute_component_id
442                    AND    item3.organization_id       = org.organization_id
443                    AND    item3.concatenated_segments = tmp.SubstituteComponentName);
444 
445   CURSOR bom_ref_desig_CUR IS
446     SELECT tmp.OrganizationCode            ,
447            tmp.AssemblyItemName           ,
448            tmp.StartEffectiveDate         ,
449            tmp.OperationSequenceNumber    ,
450            tmp.ComponentItemName          ,
451            tmp.AlternateBomCode           ,
452            tmp.ReferenceDesignatorName    ,
453            tmp.RefDesignatorComment       ,
454            tmp.AttributeCategory           ,
455            tmp.Attribute1                   ,
456 	   tmp.Attribute2                   ,
457 	   tmp.Attribute3                   ,
458 	   tmp.Attribute4                   ,
459 	   tmp.Attribute5                   ,
460 	   tmp.Attribute6                   ,
461 	   tmp.Attribute7                   ,
462 	   tmp.Attribute8                   ,
463 	   tmp.Attribute9                   ,
464 	   tmp.Attribute10                  ,
465 	   tmp.Attribute11                  ,
466 	   tmp.Attribute12                  ,
467 	   tmp.Attribute13                  ,
468 	   tmp.Attribute14                  ,
469 	   tmp.Attribute15                  ,
470 	   tmp.FromEndItemUnitNumber    ,
471 	   tmp.OriginalSystemReference    ,
472 	   tmp.NewReferenceDesignator     ,
473 	   NULL     ReturnStatus           ,
474 	   'CREATE' TransactionType    ,
475            NULL RowIdentifier
476     FROM   bom_reference_designators_temp tmp
477     WHERE  NOT EXISTS (SELECT 1
478                        FROM   bom_reference_designators ref,
479                               bom_inventory_components comp,
480                               bom_bill_of_materials bom,
481                               mtl_parameters org,
482                               mtl_system_items_kfv item1,
483                               mtl_system_items_kfv item2
484                        WHERE  comp.component_sequence_id = ref.component_sequence_id
485                        AND    bom.bill_sequence_id       = comp.bill_sequence_id
486                        AND    item1.inventory_item_id    = bom.assembly_item_id
487                        AND    item1.organization_id      = bom.organization_id
488                        AND    item1.concatenated_segments = tmp.AssemblyItemName
489                        AND    org.organization_id         = bom.organization_id
490                        AND    org.organization_code       = tmp.OrganizationCode
491                        AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
492                        AND    item2.inventory_item_id     = comp.component_item_id
493                        AND    item2.organization_id       = org.organization_id
494                        AND    item2.concatenated_segments = tmp.ComponentItemName
495                        AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
496                        AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
497                        AND    ref.component_reference_designator = tmp.ReferenceDesignatorName)
498     UNION ALL
499     SELECT tmp.OrganizationCode            ,
500            tmp.AssemblyItemName           ,
501            tmp.StartEffectiveDate         ,
502            tmp.OperationSequenceNumber    ,
503            tmp.ComponentItemName          ,
504            tmp.AlternateBomCode           ,
505            tmp.ReferenceDesignatorName    ,
506            tmp.RefDesignatorComment       ,
507            tmp.AttributeCategory           ,
508            tmp.Attribute1                   ,
509 	   tmp.Attribute2                   ,
510 	   tmp.Attribute3                   ,
511 	   tmp.Attribute4                   ,
512 	   tmp.Attribute5                   ,
513 	   tmp.Attribute6                   ,
514 	   tmp.Attribute7                   ,
515 	   tmp.Attribute8                   ,
516 	   tmp.Attribute9                   ,
517 	   tmp.Attribute10                  ,
518 	   tmp.Attribute11                  ,
519 	   tmp.Attribute12                  ,
520 	   tmp.Attribute13                  ,
521 	   tmp.Attribute14                  ,
522 	   tmp.Attribute15                  ,
523 	   tmp.FromEndItemUnitNumber    ,
524 	   tmp.OriginalSystemReference    ,
525 	   tmp.NewReferenceDesignator     ,
526 	   NULL      ReturnStatus          ,
527 	   'UPDATE'  TransactionType    ,
528            NULL RowIdentifier
529     FROM   bom_reference_designators_temp tmp
530     WHERE  EXISTS (SELECT 1
531                    FROM   bom_reference_designators ref,
532                           bom_inventory_components comp,
533                           bom_bill_of_materials bom,
534                           mtl_parameters org,
535                           mtl_system_items_kfv item1,
536                           mtl_system_items_kfv item2
537                    WHERE  comp.component_sequence_id = ref.component_sequence_id
538                    AND    bom.bill_sequence_id       = comp.bill_sequence_id
539                    AND    item1.inventory_item_id    = bom.assembly_item_id
540                    AND    item1.organization_id      = bom.organization_id
541                    AND    item1.concatenated_segments = tmp.AssemblyItemName
542                    AND    org.organization_id         = bom.organization_id
543                    AND    org.organization_code       = tmp.OrganizationCode
544                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode,'##$$##')
545                    AND    item2.inventory_item_id     = comp.component_item_id
546                    AND    item2.organization_id       = org.organization_id
547                    AND    item2.concatenated_segments = tmp.ComponentItemName
548                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
549                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
550                    AND    ref.component_reference_designator = tmp.ReferenceDesignatorName
551                    AND    bom.common_assembly_item_id is null);
552 
553   CURSOR bom_comp_oper_CUR IS
554     SELECT tmp.OrganizationCode		,
555            tmp.AssemblyItemName		,
556            tmp.StartEffectiveDate		,
557            tmp.FromEndItemUnitNumber    ,
558            tmp.ToEndItemUnitNumber      ,
559 	   tmp.OperationSequenceNumber	,
560 	   tmp.AdditionalOperationSeqNum	,
561        NULL NewAdditionalOpSeqNum,
562 	   tmp.ComponentItemName		,
563 	   tmp.AlternateBOMCode		,
564 	   tmp.Attributecategory		,
565 	   tmp.Attribute1        		,
566 	   tmp.Attribute2        		,
567 	   tmp.Attribute3        		,
568 	   tmp.Attribute4        		,
569 	   tmp.Attribute5        		,
570 	   tmp.Attribute6        		,
571 	   tmp.Attribute7        		,
572 	   tmp.Attribute8        		,
573 	   tmp.Attribute9        		,
574 	   tmp.Attribute10       		,
575 	   tmp.Attribute11       		,
576 	   tmp.Attribute12       		,
577 	   tmp.Attribute13       		,
578 	   tmp.Attribute14       		,
579 	   tmp.Attribute15       		,
580 	   NULL     ReturnStatus       ,
581 	   'CREATE' TransactionType    ,
582        NULL RowIdentifier
583     FROM   bom_component_operations_temp tmp
584     WHERE  NOT EXISTS (SELECT 1
585                        FROM   bom_component_operations comp_oper,
586                               bom_inventory_components comp,
587                               bom_bill_of_materials bom,
588                               mtl_parameters org,
589                               mtl_system_items_kfv item1,
590                               mtl_system_items_kfv item2
591                        WHERE  comp.component_sequence_id  = comp_oper.component_sequence_id
592                        AND    bom.bill_sequence_id        = comp.bill_sequence_id
593                        AND    item1.inventory_item_id     = bom.assembly_item_id
594                        AND    item1.organization_id       = bom.organization_id
595                        AND    item1.concatenated_segments = tmp.AssemblyItemName
596                        AND    org.organization_id         = bom.organization_id
597                        AND    org.organization_code       = tmp.OrganizationCode
598                        AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode, '##$$##')
599                        AND    item2.inventory_item_id     = comp.component_item_id
600                        AND    item2.organization_id       = org.organization_id
601                        AND    item2.concatenated_segments = tmp.ComponentItemName
602                        AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
603                        AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
604                        AND    comp_oper.operation_seq_num = tmp.AdditionalOperationSeqNum)
605     UNION ALL
606     SELECT tmp.OrganizationCode		,
607            tmp.AssemblyItemName		,
608            tmp.StartEffectiveDate		,
609            tmp.FromEndItemUnitNumber    ,
610            tmp.ToEndItemUnitNumber      ,
611 	   tmp.OperationSequenceNumber	,
612 	   tmp.AdditionalOperationSeqNum	,
613        NULL NewAdditionalOpSeqNum,
614 	   tmp.ComponentItemName		,
615 	   tmp.AlternateBOMCode		,
616 	   tmp.Attributecategory		,
617 	   tmp.Attribute1        		,
618 	   tmp.Attribute2        		,
619 	   tmp.Attribute3        		,
620 	   tmp.Attribute4        		,
621 	   tmp.Attribute5        		,
622 	   tmp.Attribute6        		,
623 	   tmp.Attribute7        		,
624 	   tmp.Attribute8        		,
625 	   tmp.Attribute9        		,
626 	   tmp.Attribute10       		,
627 	   tmp.Attribute11       		,
628 	   tmp.Attribute12       		,
629 	   tmp.Attribute13       		,
630 	   tmp.Attribute14       		,
631 	   tmp.Attribute15       		,
632 	   NULL        ReturnStatus    ,
633 	   'UPDATE'    TransactionType    ,
634        NULL        RowIdentifier
635     FROM   bom_component_operations_temp tmp
636     WHERE  EXISTS (SELECT 1
637                    FROM   bom_component_operations comp_oper,
638                           bom_inventory_components comp,
639                           bom_bill_of_materials bom,
640                           mtl_parameters org,
641                           mtl_system_items_kfv item1,
642                           mtl_system_items_kfv item2
643                    WHERE  comp.component_sequence_id  = comp_oper.component_sequence_id
644                    AND    bom.bill_sequence_id        = comp.bill_sequence_id
645                    AND    item1.inventory_item_id     = bom.assembly_item_id
646                    AND    item1.organization_id       = bom.organization_id
647                    AND    item1.concatenated_segments = tmp.AssemblyItemName
648                    AND    org.organization_id         = bom.organization_id
649                    AND    org.organization_code       = tmp.OrganizationCode
650                    AND    NVL(bom.alternate_bom_designator,'##$$##') = NVL(tmp.AlternateBomCode, '##$$##')
651                    AND    item2.inventory_item_id     = comp.component_item_id
652                    AND    item2.organization_id       = org.organization_id
653                    AND    item2.concatenated_segments = tmp.ComponentItemName
654                    AND    comp.operation_seq_num      = tmp.OperationSequenceNumber
655                    AND    comp.effectivity_date       = TO_DATE(tmp.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS')
656                    AND    comp_oper.operation_seq_num = tmp.AdditionalOperationSeqNum
657                    AND    bom.common_assembly_item_id is null);
658 
659 /* Bug 3349138
660   CURSOR bom_revisions_CUR IS
661     SELECT tmp.AssemblyItemName   ,
662            tmp.OrganizationCode    ,
663            tmp.Revision	            ,
664            tmp.AlternateBomCode   ,
665            tmp.Description	    ,
666            tmp.StartEffectiveDate ,
667            'CREATE' TransactionType,
668            NULL     ReturnStatus,
669            tmp.AttributeCategory   ,
670            tmp.Attribute1           ,
671            tmp.Attribute2           ,
672            tmp.Attribute3           ,
673            tmp.Attribute4           ,
674            tmp.Attribute5           ,
675            tmp.Attribute6           ,
676            tmp.Attribute7           ,
677            tmp.Attribute8           ,
678            tmp.Attribute9           ,
679            tmp.Attribute10          ,
680            tmp.Attribute11          ,
681            tmp.Attribute12          ,
682            tmp.Attribute13          ,
683            tmp.Attribute14          ,
684            tmp.Attribute15          ,
685            tmp.OriginalSystemReference,
686            NULL RowIdentifier
687     FROM   bom_revisions_temp tmp,
688            mtl_parameters org,
689            mtl_system_items_kfv item
690     WHERE  org.organization_code      = tmp.OrganizationCode
691     AND    item.concatenated_segments = tmp.AssemblyItemName
692     AND    item.organization_id       = org.organization_id
693     AND    tmp.revision              <> org.starting_revision
694     AND    NOT EXISTS (SELECT 1
695                        FROM   mtl_item_revisions rev
696                        WHERE  rev.organization_id   = org.organization_id
697                        AND    rev.inventory_item_id = item.inventory_item_id
698                        AND    rev.revision          = tmp.revision)
699     UNION ALL
700     SELECT tmp.AssemblyItemName   ,
701      	   tmp.OrganizationCode    ,
702 	       tmp.Revision	            ,
703 	       tmp.AlternateBomCode   ,
704 	   tmp.Description	    ,
705 	   tmp.StartEffectiveDate ,
706            'UPDATE' TransactionType,
707            NULL     ReturnStatus   ,
708            tmp.AttributeCategory    ,
709            tmp.Attribute1           ,
710            tmp.Attribute2           ,
711            tmp.Attribute3           ,
712            tmp.Attribute4           ,
713            tmp.Attribute5           ,
714            tmp.Attribute6           ,
715            tmp.Attribute7           ,
716            tmp.Attribute8           ,
717            tmp.Attribute9           ,
718            tmp.Attribute10          ,
719            tmp.Attribute11          ,
720            tmp.Attribute12          ,
721            tmp.Attribute13          ,
722            tmp.Attribute14          ,
723            tmp.Attribute15          ,
724            tmp.OriginalSystemReference,
725            NULL RowIdentifier
726     FROM   bom_revisions_temp tmp,
727            mtl_parameters org,
728            mtl_system_items_kfv item
729     WHERE  org.organization_code      = tmp.OrganizationCode
730     AND    item.concatenated_segments = tmp.AssemblyItemName
731     AND    item.organization_id       = org.organization_id
732     AND    tmp.revision              <> org.starting_revision
733     AND    EXISTS (SELECT 1
734                    FROM   mtl_item_revisions rev
735                    WHERE  rev.organization_id   = org.organization_id
736                    AND    rev.inventory_item_id = item.inventory_item_id
737                    AND    rev.revision          = tmp.revision);
738 */
739   l_bom_header_rec    bom_header_temp_CUR%ROWTYPE;
740 --Bug 3349138  l_bom_revisions_rec bom_revisions_CUR%ROWTYPE;
741   l_bom_comp_rec      bom_comp_CUR%ROWTYPE;
742   l_bom_ref_desig_rec bom_ref_desig_CUR%ROWTYPE;
743   l_bom_sub_comp_rec  bom_sub_comp_CUR%ROWTYPE;
744   l_bom_comp_oper_rec bom_comp_oper_CUR%ROWTYPE;
745 
746   insCtx DBMS_XMLSave.ctxType;
747   rows   NUMBER;
748   i      NUMBER;
749 
750 -- Following variables are used for logging messages
751   l_error_tbl         ERROR_HANDLER.ERROR_TBL_TYPE;
752   l_message           VARCHAR2(2000) := NULL;
753   l_entity            VARCHAR2(3)    := NULL;
754   l_msg_index         NUMBER;
755   l_message_type      VARCHAR2(1);
756 
757 -- Added for XSU workaround  26/03/03 - TMANDA
758   l_assembly_item_name      VARCHAR2(81)   := NULL;
759   l_organization_code       VARCHAR2(3)    := NULL;
760   l_alternate_bom_code      VARCHAR2(10)   := NULL;
761   l_table_name              VARCHAR2(50)   := NULL;
762   l_column_name             VARCHAR2(50)   := NULL;
763   l_column_value            VARCHAR2(200)  := NULL;
764   l_column_type             VARCHAR2(10)   := NULL;
765   l_update_stmt             VARCHAR2(1000) := NULL;
766 
767 BEGIN
768   -- Bom Header Record
769   IF (P_bom_header_XML IS NOT NULL) THEN
770     -- get the context handle
771     insCtx := DBMS_XMLSave.newContext('BOM_BILL_OF_MATERIALS_TEMP');
772     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
773     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
774     DBMS_XMLSave.setRowTag(insCtx , 'BillOfMaterialsVO');
775     -- this inserts the document
776     rows   := DBMS_XMLSave.insertXML(insCtx, P_bom_header_XML);
777     -- this closes the handle
778     DBMS_XMLSave.closeContext(insCtx);
779   END IF;
780   -- Bom Revisions Table
781 /* Bug 3349138  IF (P_bom_revisions_XML IS NOT NULL) THEN
782     -- get the context handle
783     insCtx := DBMS_XMLSave.newContext('BOM_REVISIONS_TEMP');
784     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
785     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
786     DBMS_XMLSave.setRowTag(insCtx , 'BomRevisionsVO');
787     -- this inserts the document
788     rows := DBMS_XMLSave.insertXML(insCtx, P_bom_revisions_XML);
789     -- this closes the handle
790     DBMS_XMLSave.closeContext(insCtx);
791   END IF;
792 */
793   IF (P_bom_inv_comps_XML IS NOT NULL) THEN
794     -- Bom Inventory Components
795     -- get the context handle
796     insCtx := DBMS_XMLSave.newContext('BOM_INVENTORY_COMPONENTS_TEMP');
797     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
798     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
799     DBMS_XMLSave.setRowTag(insCtx , 'InventoryComponentsVO');
800     -- this inserts the document
801     rows := DBMS_XMLSave.insertXML(insCtx, P_bom_inv_comps_XML);
802     -- this closes the handle
803     DBMS_XMLSave.closeContext(insCtx);
804   END IF;
805   IF (P_bom_sub_comps_XML IS NOT NULL) THEN
806     -- Bom Substitute Components Table
807     -- get the context handle
808     insCtx := DBMS_XMLSave.newContext('BOM_SUBSTITUTE_COMPONENTS_TEMP');
809     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
810     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
811     DBMS_XMLSave.setRowTag(insCtx , 'SubstituteComponentsVO');
812     -- this inserts the document
813     rows := DBMS_XMLSave.insertXML(insCtx, P_bom_sub_comps_XML);
814     -- this closes the handle
815     DBMS_XMLSave.closeContext(insCtx);
816   END IF;
817   IF (P_bom_ref_desgs_XML IS NOT NULL) THEN
818     -- Bom Reference Designators Table
819     -- get the context handle
820     insCtx := DBMS_XMLSave.newContext('BOM_REFERENCE_DESIGNATORS_TEMP');
821     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
822     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
823     DBMS_XMLSave.setRowTag(insCtx , 'ReferenceDesignatorsVO');
824     -- this inserts the document
825     rows := DBMS_XMLSave.insertXML(insCtx, P_bom_ref_desgs_XML);
826     -- this closes the handle
827     DBMS_XMLSave.closeContext(insCtx);
828   END IF;
829   IF (P_bom_comp_oper_XML IS NOT NULL) THEN
830     -- Bom Component Operations Table
831     -- get the context handle
832     insCtx := DBMS_XMLSave.newContext('BOM_COMPONENT_OPERATIONS_TEMP');
833     DBMS_XMLSave.setIgnoreCase(insCtx, 1);
834     DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
835     DBMS_XMLSave.setRowTag(insCtx , 'ComponentOperationsVO');
836     -- this inserts the document
837     rows := DBMS_XMLSave.insertXML(insCtx, P_bom_comp_oper_XML);
838     -- this closes the handle
839     DBMS_XMLSave.closeContext(insCtx);
840   END IF;
841 /* 090403
842   -- update the temp tables for the DATE and floating point NUMBER columns
843   OPEN bom_updates_CUR;
844   LOOP
845     FETCH bom_updates_CUR
846     INTO  l_assembly_item_name,
847           l_organization_code,
848           l_alternate_bom_code,
849           l_table_name,
850           l_column_name,
851           l_column_value,
852           l_column_type;
853 
854     IF (bom_updates_CUR%NOTFOUND) THEN
855       EXIT;
856     END IF;
857 
858     l_update_stmt :=  'update ' || l_table_name ||
859                       ' set ' || l_column_name;
860 
861     IF (l_column_type = 'DATE') THEN
862        l_update_stmt := l_update_stmt || ' = TO_DATE(:l_column_value, ''YYYY-MM-DD HH24:MI:SS'') ';
863     ELSIF (l_column_type = 'NUMBER') THEN
864        l_update_stmt := l_update_stmt || ' = TO_NUMBER(:l_column_value) ';
865     ELSE
866        l_update_stmt := l_update_stmt || ' = :l_column_value ';
867     END IF;
868 
869     l_update_stmt := l_update_stmt || ' where AssemblyItemName = :l_assembly_item_name '
870                                    || ' and OrganizationCode = :l_organization_code ';
871 
872     IF (l_alternate_bom_code IS NOT NULL) THEN
873       l_update_stmt := l_update_stmt || ' and AlternateBomCode = :l_alternate_bom_code';
874 
875       EXECUTE IMMEDIATE l_update_stmt
876         USING l_column_value, l_assembly_item_name, l_organization_code, l_alternate_bom_code;
877     ELSE
878       l_update_stmt := l_update_stmt || ' and AlternateBomCode IS NULL';
879 
880       EXECUTE IMMEDIATE l_update_stmt
881         USING l_column_value, l_assembly_item_name, l_organization_code;
882     END IF;
883   END LOOP;
884   CLOSE bom_updates_CUR;
885   DELETE FROM bom_routing_updates_temp;commit;
886  090403
887 */
888   i := 1;
889 /*
890   OPEN bom_header_temp_CUR;
891   LOOP
892     FETCH bom_header_temp_CUR INTO l_bom_header_tbl(i);
893     IF (bom_header_temp_CUR%NOTFOUND) THEN
894       EXIT;
895     END IF;
896     i := i + 1;
897   END LOOP;
898   CLOSE bom_header_temp_CUR;
899 */
900   FOR bom_header_rec IN bom_header_temp_CUR LOOP
901     l_bom_header_tbl(i).assembly_item_name            := bom_header_rec.AssemblyItemName;
902     l_bom_header_tbl(i).organization_code             := bom_header_rec.OrganizationCode;
903     l_bom_header_tbl(i).alternate_bom_code            := bom_header_rec.AlternateBomCode;
904     l_bom_header_tbl(i).common_assembly_item_name     := bom_header_rec.CommonAssemblyItemName;
905     l_bom_header_tbl(i).common_organization_code      := bom_header_rec.CommonOrganizationCode;
906     l_bom_header_tbl(i).assembly_comment              := bom_header_rec.AssemblyComment;
907     l_bom_header_tbl(i).assembly_type                 := bom_header_rec.AssemblyType;
908     l_bom_header_tbl(i).transaction_type              := bom_header_rec.TransactionType;
909     l_bom_header_tbl(i).return_status                 := bom_header_rec.ReturnStatus;
910     l_bom_header_tbl(i).attribute_category            := bom_header_rec.AttributeCategory;
911     l_bom_header_tbl(i).attribute1                    := bom_header_rec.Attribute1;
912     l_bom_header_tbl(i).attribute2                    := bom_header_rec.Attribute2;
913     l_bom_header_tbl(i).attribute3                    := bom_header_rec.Attribute3;
914     l_bom_header_tbl(i).attribute4                    := bom_header_rec.Attribute4;
915     l_bom_header_tbl(i).attribute5                    := bom_header_rec.Attribute5;
916     l_bom_header_tbl(i).attribute6                    := bom_header_rec.Attribute6;
917     l_bom_header_tbl(i).attribute7                    := bom_header_rec.Attribute7;
918     l_bom_header_tbl(i).attribute8                    := bom_header_rec.Attribute8;
919     l_bom_header_tbl(i).attribute9                    := bom_header_rec.Attribute9;
920     l_bom_header_tbl(i).attribute10                   := bom_header_rec.Attribute10;
921     l_bom_header_tbl(i).attribute11                   := bom_header_rec.Attribute11;
922     l_bom_header_tbl(i).attribute12                   := bom_header_rec.Attribute12;
923     l_bom_header_tbl(i).attribute13                   := bom_header_rec.Attribute13;
924     l_bom_header_tbl(i).attribute14                   := bom_header_rec.Attribute14;
925     l_bom_header_tbl(i).attribute15                   := bom_header_rec.Attribute15;
926     l_bom_header_tbl(i).original_system_reference     := bom_header_rec.OriginalSystemReference;
927     --myerrams, bug:4873339
928     IF (bom_header_rec.ImplementationDate IS NOT NULL) THEN
929     --myerrams, bug:5141752; bom_header_rec.ImplementationDate is of type date. We need not convert that date again.
930 --	l_bom_header_tbl(i).Bom_Implementation_Date   := TO_DATE(bom_header_rec.ImplementationDate, 'YYYY-MM-DD HH24:MI:SS');
931 	l_bom_header_tbl(i).Bom_Implementation_Date   := bom_header_rec.ImplementationDate;
932     END IF;
933     l_bom_header_tbl(i).delete_group_name             := bom_header_rec.DeleteGroupName;
934     l_bom_header_tbl(i).dg_description                := bom_header_rec.DGDescription;
935     l_bom_header_tbl(i).row_identifier                := bom_header_rec.RowIdentifier;
936     i := i + 1;
937   END LOOP;
938   IF (i = 1) THEN  -- There are no records to be processed. RETURN with Error Message
939     FND_MESSAGE.SET_NAME('BOM', 'BOM_SETUP_NO_ROWS');
940     FND_MESSAGE.RETRIEVE(X_G_msg_data);
941   ELSE
942  /* Bug 3349138   IF (P_bom_revisions_XML IS NOT NULL) THEN
943 * Moved this code above. -TMANDA 26/03/03
944       -- Bom Revisions Table
945       -- get the context handle
946       insCtx := DBMS_XMLSave.newContext('BOM_REVISIONS_TEMP');
947       DBMS_XMLSave.setIgnoreCase(insCtx, 1);
948       DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
949       DBMS_XMLSave.setRowTag(insCtx , 'BomRevisionsVO');
950       -- this inserts the document
951       rows := DBMS_XMLSave.insertXML(insCtx, P_bom_revisions_XML);
952       -- this closes the handle
953       DBMS_XMLSave.closeContext(insCtx);
954 *
955       i := 1;
956       FOR bom_revisions_rec IN bom_revisions_CUR LOOP
957         l_bom_revisions_tbl(i).assembly_item_name        := bom_revisions_rec.AssemblyItemName;
958         l_bom_revisions_tbl(i).organization_code         := bom_revisions_rec.OrganizationCode;
959         l_bom_revisions_tbl(i).revision                  := bom_revisions_rec.Revision;
960         l_bom_revisions_tbl(i).alternate_bom_code        := bom_revisions_rec.AlternateBomCode;
961         l_bom_revisions_tbl(i).description               := bom_revisions_rec.Description;
962         l_bom_revisions_tbl(i).start_effective_date      := TO_DATE(bom_revisions_rec.StartEffectiveDate, 'YYYY-MM-DD HH24:MI:SS');
963         l_bom_revisions_tbl(i).transaction_type          := bom_revisions_rec.TransactionType;
964         l_bom_revisions_tbl(i).return_status             := bom_revisions_rec.ReturnStatus;
965         l_bom_revisions_tbl(i).attribute_category        := bom_revisions_rec.AttributeCategory;
966         l_bom_revisions_tbl(i).attribute1                := bom_revisions_rec.Attribute1;
967         l_bom_revisions_tbl(i).attribute2                := bom_revisions_rec.Attribute2;
968         l_bom_revisions_tbl(i).attribute3                := bom_revisions_rec.Attribute3;
969         l_bom_revisions_tbl(i).attribute4                := bom_revisions_rec.Attribute4;
970         l_bom_revisions_tbl(i).attribute5                := bom_revisions_rec.Attribute5;
971         l_bom_revisions_tbl(i).attribute6                := bom_revisions_rec.Attribute6;
972         l_bom_revisions_tbl(i).attribute7                := bom_revisions_rec.Attribute7;
973         l_bom_revisions_tbl(i).attribute8                := bom_revisions_rec.Attribute8;
974         l_bom_revisions_tbl(i).attribute9                := bom_revisions_rec.Attribute9;
975         l_bom_revisions_tbl(i).attribute10               := bom_revisions_rec.Attribute10;
976         l_bom_revisions_tbl(i).attribute11               := bom_revisions_rec.Attribute11;
977         l_bom_revisions_tbl(i).attribute12               := bom_revisions_rec.Attribute12;
978         l_bom_revisions_tbl(i).attribute13               := bom_revisions_rec.Attribute13;
979         l_bom_revisions_tbl(i).attribute14               := bom_revisions_rec.Attribute14;
980         l_bom_revisions_tbl(i).attribute15               := bom_revisions_rec.Attribute15;
981         l_bom_revisions_tbl(i).original_system_reference := bom_revisions_rec.OriginalSystemReference;
982         l_bom_revisions_tbl(i).row_identifier            := bom_revisions_rec.RowIdentifier;
983         i := i + 1;
984       END LOOP;
985 */
986 /*
987       OPEN bom_revisions_CUR;
988       LOOP
989         FETCH bom_revisions_CUR INTO l_bom_revisions_tbl(i);
990         IF (bom_revisions_CUR%NOTFOUND) THEN
991           EXIT;
992         END IF;
993         i := i + 1;
994       END LOOP;
995 */
996 --    END IF;
997     IF (P_bom_inv_comps_XML IS NOT NULL) THEN
998 /*Moved this code above - TMANDA 26/03/03
999       -- Bom Inventory Components
1000       -- get the context handle
1001       insCtx := DBMS_XMLSave.newContext('BOM_INVENTORY_COMPONENTS_TEMP');
1002       DBMS_XMLSave.setIgnoreCase(insCtx, 1);
1003       DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
1004       DBMS_XMLSave.setRowTag(insCtx , 'InventoryComponentsVO');
1005       -- this inserts the document
1006       rows := DBMS_XMLSave.insertXML(insCtx, P_bom_inv_comps_XML);
1007       -- this closes the handle
1008       DBMS_XMLSave.closeContext(insCtx);
1009 */
1010       i := 1;
1011 /*
1012       OPEN bom_comp_CUR;
1013       LOOP
1014         FETCH bom_comp_CUR INTO l_bom_comp_tbl(i);
1015         IF (bom_comp_CUR%NOTFOUND) THEN
1016           EXIT;
1017         END IF;
1018         i := i + 1;
1019       END LOOP;
1020 */
1021       FOR bom_comp_rec IN bom_comp_CUR LOOP
1022         l_bom_comp_tbl(i).organization_code             := bom_comp_rec.OrganizationCode;
1023         l_bom_comp_tbl(i).assembly_item_name            := bom_comp_rec.AssemblyItemName;
1024         l_bom_comp_tbl(i).start_effective_date          := TO_DATE(bom_comp_rec.StartEffectiveDate, 'YYYY-MM-DD HH24:MI:SS');
1025         IF (bom_comp_rec.DisableDate IS NOT NULL) THEN
1026           l_bom_comp_tbl(i).disable_date                := TO_DATE(bom_comp_rec.DisableDate, 'YYYY-MM-DD HH24:MI:SS');
1027         END IF;
1028         l_bom_comp_tbl(i).operation_sequence_number     := bom_comp_rec.OperationSequenceNumber;
1029         l_bom_comp_tbl(i).component_item_name           := bom_comp_rec.ComponentItemName;
1030         l_bom_comp_tbl(i).alternate_bom_code            := bom_comp_rec.AlternateBomCode;
1031         IF (bom_comp_rec.NewEffectivityDate IS NOT NULL) THEN
1032           l_bom_comp_tbl(i).new_effectivity_date          := TO_DATE(bom_comp_rec.NewEffectivityDate, 'YYYY-MM-DD HH24:MI:SS');
1033         END IF;
1034         l_bom_comp_tbl(i).new_operation_sequence_number := bom_comp_rec.NewOperationSequenceNumber;
1035         l_bom_comp_tbl(i).item_sequence_number          := bom_comp_rec.ItemSequenceNumber;
1036         l_bom_comp_tbl(i).quantity_per_assembly         := TO_NUMBER(bom_comp_rec.QuantityPerAssembly);
1037         l_bom_comp_tbl(i).planning_percent              := bom_comp_rec.PlanningPercent;
1038         l_bom_comp_tbl(i).projected_yield               := TO_NUMBER(bom_comp_rec.ProjectedYield);
1039         l_bom_comp_tbl(i).include_in_cost_rollup        := bom_comp_rec.IncludeInCostRollup;
1040         l_bom_comp_tbl(i).wip_supply_type               := bom_comp_rec.WipSupplyType;
1041         l_bom_comp_tbl(i).so_basis                      := bom_comp_rec.SoBasis;
1042         l_bom_comp_tbl(i).optional                      := bom_comp_rec.Optional;
1043         l_bom_comp_tbl(i).mutually_exclusive            := bom_comp_rec.MutuallyExclusive;
1044         l_bom_comp_tbl(i).check_atp                     := bom_comp_rec.CheckAtp;
1045         l_bom_comp_tbl(i).shipping_allowed              := bom_comp_rec.ShippingAllowed;
1046         l_bom_comp_tbl(i).required_to_ship              := bom_comp_rec.RequiredToShip;
1047         l_bom_comp_tbl(i).required_for_revenue          := bom_comp_rec.RequiredForRevenue;
1048         l_bom_comp_tbl(i).include_on_ship_docs          := bom_comp_rec.IncludeOnShipDocs;
1049         l_bom_comp_tbl(i).quantity_related              := bom_comp_rec.QuantityRelated;
1050         l_bom_comp_tbl(i).supply_subinventory           := bom_comp_rec.SupplySubinventory;
1051         l_bom_comp_tbl(i).location_name                 := bom_comp_rec.LocationName;
1052         l_bom_comp_tbl(i).minimum_allowed_quantity      := TO_NUMBER(bom_comp_rec.MinimumAllowedQuantity);
1053         l_bom_comp_tbl(i).maximum_allowed_quantity      := TO_NUMBER(bom_comp_rec.MaximumAllowedQuantity);
1054         l_bom_comp_tbl(i).comments                      := bom_comp_rec.Comments;
1055         l_bom_comp_tbl(i).attribute_category            := bom_comp_rec.AttributeCategory;
1056         l_bom_comp_tbl(i).attribute1                    := bom_comp_rec.Attribute1;
1057         l_bom_comp_tbl(i).attribute2                    := bom_comp_rec.Attribute2;
1058         l_bom_comp_tbl(i).attribute3                    := bom_comp_rec.Attribute3;
1059         l_bom_comp_tbl(i).attribute4                    := bom_comp_rec.Attribute4;
1060         l_bom_comp_tbl(i).attribute5                    := bom_comp_rec.Attribute5;
1061         l_bom_comp_tbl(i).attribute6                    := bom_comp_rec.Attribute6;
1062         l_bom_comp_tbl(i).attribute7                    := bom_comp_rec.Attribute7;
1063         l_bom_comp_tbl(i).attribute8                    := bom_comp_rec.Attribute8;
1064         l_bom_comp_tbl(i).attribute9                    := bom_comp_rec.Attribute9;
1065         l_bom_comp_tbl(i).attribute10                   := bom_comp_rec.Attribute10;
1066         l_bom_comp_tbl(i).attribute11                   := bom_comp_rec.Attribute11;
1067         l_bom_comp_tbl(i).attribute12                   := bom_comp_rec.Attribute12;
1068         l_bom_comp_tbl(i).attribute13                   := bom_comp_rec.Attribute13;
1069         l_bom_comp_tbl(i).attribute14                   := bom_comp_rec.Attribute14;
1070         l_bom_comp_tbl(i).attribute15                   := bom_comp_rec.Attribute15;
1071         l_bom_comp_tbl(i).from_end_item_unit_number     := bom_comp_rec.FromEndItemUnitNumber;
1072         l_bom_comp_tbl(i).new_from_end_item_unit_number := bom_comp_rec.NewFromEndItemUnitNumber;
1073         l_bom_comp_tbl(i).to_end_item_unit_number       := bom_comp_rec.ToEndItemUnitNumber;
1074         l_bom_comp_tbl(i).return_status                 := bom_comp_rec.ReturnStatus;
1075         l_bom_comp_tbl(i).transaction_type              := bom_comp_rec.TransactionType;
1076         l_bom_comp_tbl(i).original_system_reference     := bom_comp_rec.OriginalSystemReference;
1077         l_bom_comp_tbl(i).delete_group_name             := bom_comp_rec.DeleteGroupName;
1078         l_bom_comp_tbl(i).dg_description                := bom_comp_rec.DgDescription;
1079         l_bom_comp_tbl(i).enforce_int_requirements      := bom_comp_rec.EnforceIntRequirements;
1080         l_bom_comp_tbl(i).auto_request_material         := bom_comp_rec.AutoRequestMaterial;
1081         l_bom_comp_tbl(i).row_identifier                := bom_comp_rec.RowIdentifier;
1082         l_bom_comp_tbl(i).suggested_vendor_name         := bom_comp_rec.SuggestedVendorName;
1083         l_bom_comp_tbl(i).unit_price                    := bom_comp_rec.UnitPrice;
1084 	l_bom_comp_tbl(i).Basis_type	                := bom_comp_rec.BasisType;	--myerrams, bug:4873339
1085         i := i + 1;
1086       END LOOP;
1087     END IF;
1088     IF (P_bom_sub_comps_XML IS NOT NULL) THEN
1089 /*
1090       -- Bom Substitute Components Table
1091       -- get the context handle
1092       insCtx := DBMS_XMLSave.newContext('BOM_SUBSTITUTE_COMPONENTS_TEMP');
1093       DBMS_XMLSave.setIgnoreCase(insCtx, 1);
1094       DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
1095       DBMS_XMLSave.setRowTag(insCtx , 'SubstituteComponentsVO');
1096       -- this inserts the document
1097       rows := DBMS_XMLSave.insertXML(insCtx, P_bom_sub_comps_XML);
1098       -- this closes the handle
1099       DBMS_XMLSave.closeContext(insCtx);
1100 */
1101       i := 1;
1102 /*
1103       OPEN bom_sub_comp_CUR;
1104       LOOP
1105         FETCH bom_sub_comp_CUR INTO l_bom_sub_comp_tbl(i);
1106         IF (bom_sub_comp_CUR%NOTFOUND) THEN
1107           EXIT;
1108         END IF;
1109         i := i + 1;
1110       END LOOP;
1111 */
1112       FOR bom_sub_rec IN bom_sub_comp_CUR LOOP
1113         l_bom_sub_comp_tbl(i).organization_code      := bom_sub_rec.OrganizationCode;
1114         l_bom_sub_comp_tbl(i).assembly_item_name     := bom_sub_rec.AssemblyItemName;
1115         l_bom_sub_comp_tbl(i).start_effective_date   := TO_DATE(bom_sub_rec.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS');
1116         l_bom_sub_comp_tbl(i).operation_sequence_number := bom_sub_rec.OperationSequenceNumber;
1117         l_bom_sub_comp_tbl(i).component_item_name       := bom_sub_rec.ComponentItemName;
1118         l_bom_sub_comp_tbl(i).alternate_bom_code        := bom_sub_rec.AlternateBomCode;
1119         l_bom_sub_comp_tbl(i).substitute_component_name := bom_sub_rec.SubstituteComponentName;
1120         l_bom_sub_comp_tbl(i).new_substitute_component_name := bom_sub_rec.NewSubstituteComponentName;
1121         l_bom_sub_comp_tbl(i).substitute_item_quantity      := TO_NUMBER(bom_sub_rec.SubstituteItemQuantity);
1122         l_bom_sub_comp_tbl(i).attribute_category        := bom_sub_rec.AttributeCategory;
1123         l_bom_sub_comp_tbl(i).attribute1                := bom_sub_rec.Attribute1;
1124         l_bom_sub_comp_tbl(i).attribute2                := bom_sub_rec.Attribute2;
1125         l_bom_sub_comp_tbl(i).attribute3                := bom_sub_rec.Attribute3;
1126         l_bom_sub_comp_tbl(i).attribute4                := bom_sub_rec.Attribute4;
1127         l_bom_sub_comp_tbl(i).attribute5                := bom_sub_rec.Attribute5;
1128         l_bom_sub_comp_tbl(i).attribute6                := bom_sub_rec.Attribute6;
1129         l_bom_sub_comp_tbl(i).attribute7                := bom_sub_rec.Attribute7;
1130         l_bom_sub_comp_tbl(i).attribute8                := bom_sub_rec.Attribute8;
1131         l_bom_sub_comp_tbl(i).attribute9                := bom_sub_rec.Attribute9;
1132         l_bom_sub_comp_tbl(i).attribute10               := bom_sub_rec.Attribute10;
1133         l_bom_sub_comp_tbl(i).attribute11               := bom_sub_rec.Attribute11;
1134         l_bom_sub_comp_tbl(i).attribute12               := bom_sub_rec.Attribute12;
1135         l_bom_sub_comp_tbl(i).attribute13               := bom_sub_rec.Attribute13;
1136         l_bom_sub_comp_tbl(i).attribute14               := bom_sub_rec.Attribute14;
1137         l_bom_sub_comp_tbl(i).attribute15               := bom_sub_rec.Attribute15;
1138         l_bom_sub_comp_tbl(i).program_id                := bom_sub_rec.ProgramId;
1139         l_bom_sub_comp_tbl(i).from_end_item_unit_number := bom_sub_rec.FromEndItemUnitNumber;
1140         l_bom_sub_comp_tbl(i).enforce_int_requirements  := bom_sub_rec.EnforceIntRequirements;
1141         l_bom_sub_comp_tbl(i).original_system_reference := bom_sub_rec.OriginalSystemReference;
1142         l_bom_sub_comp_tbl(i).return_status             := bom_sub_rec.ReturnStatus;
1143         l_bom_sub_comp_tbl(i).transaction_type          := bom_sub_rec.TransactionType;
1144         l_bom_sub_comp_tbl(i).row_identifier            := bom_sub_rec.RowIdentifier;
1145         i := i + 1;
1146       END LOOP;
1147     END IF;
1148     IF (P_bom_ref_desgs_XML IS NOT NULL) THEN
1149 /*
1150       -- Bom Reference Designators Table
1151       -- get the context handle
1152       insCtx := DBMS_XMLSave.newContext('BOM_REFERENCE_DESIGNATORS_TEMP');
1153       DBMS_XMLSave.setIgnoreCase(insCtx, 1);
1154       DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
1155       DBMS_XMLSave.setRowTag(insCtx , 'ReferenceDesignatorsVO');
1156       -- this inserts the document
1157       rows := DBMS_XMLSave.insertXML(insCtx, P_bom_ref_desgs_XML);
1158       -- this closes the handle
1159       DBMS_XMLSave.closeContext(insCtx);
1160 */
1161 
1162       i := 1;
1163 /*
1164       OPEN bom_ref_desig_CUR;
1165       LOOP
1166         FETCH bom_ref_desig_CUR INTO l_bom_ref_desig_tbl(i);
1167         IF (bom_ref_desig_CUR%NOTFOUND) THEN
1168           EXIT;
1169         END IF;
1170         i := i + 1;
1171       END LOOP;
1172 */
1173       FOR bom_ref_desig_rec IN bom_ref_desig_CUR LOOP
1174         l_bom_ref_desig_tbl(i).organization_code         := bom_ref_desig_rec.OrganizationCode;
1175         l_bom_ref_desig_tbl(i).assembly_item_name        := bom_ref_desig_rec.AssemblyItemName;
1176         l_bom_ref_desig_tbl(i).start_effective_date      := TO_DATE(bom_ref_desig_rec.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS');
1177         l_bom_ref_desig_tbl(i).operation_sequence_number := bom_ref_desig_rec.OperationSequenceNumber;
1178         l_bom_ref_desig_tbl(i).component_item_name       := bom_ref_desig_rec.ComponentItemName;
1179         l_bom_ref_desig_tbl(i).alternate_bom_code        := bom_ref_desig_rec.AlternateBomCode;
1180         l_bom_ref_desig_tbl(i).reference_designator_name := bom_ref_desig_rec.ReferenceDesignatorName;
1181         l_bom_ref_desig_tbl(i).ref_designator_comment    := bom_ref_desig_rec.RefDesignatorComment;
1182         l_bom_ref_desig_tbl(i).attribute_category        := bom_ref_desig_rec.AttributeCategory;
1183         l_bom_ref_desig_tbl(i).attribute1                := bom_ref_desig_rec.Attribute1;
1184         l_bom_ref_desig_tbl(i).attribute2                := bom_ref_desig_rec.Attribute2;
1185         l_bom_ref_desig_tbl(i).attribute3                := bom_ref_desig_rec.Attribute3;
1186         l_bom_ref_desig_tbl(i).attribute4                := bom_ref_desig_rec.Attribute4;
1187         l_bom_ref_desig_tbl(i).attribute5                := bom_ref_desig_rec.Attribute5;
1188         l_bom_ref_desig_tbl(i).attribute6                := bom_ref_desig_rec.Attribute6;
1189         l_bom_ref_desig_tbl(i).attribute7                := bom_ref_desig_rec.Attribute7;
1190         l_bom_ref_desig_tbl(i).attribute8                := bom_ref_desig_rec.Attribute8;
1191         l_bom_ref_desig_tbl(i).attribute9                := bom_ref_desig_rec.Attribute9;
1192         l_bom_ref_desig_tbl(i).attribute10               := bom_ref_desig_rec.Attribute10;
1193         l_bom_ref_desig_tbl(i).attribute11               := bom_ref_desig_rec.Attribute11;
1194         l_bom_ref_desig_tbl(i).attribute12               := bom_ref_desig_rec.Attribute12;
1195         l_bom_ref_desig_tbl(i).attribute13               := bom_ref_desig_rec.Attribute13;
1196         l_bom_ref_desig_tbl(i).attribute14               := bom_ref_desig_rec.Attribute14;
1197         l_bom_ref_desig_tbl(i).attribute15               := bom_ref_desig_rec.Attribute15;
1198         l_bom_ref_desig_tbl(i).from_end_item_unit_number := bom_ref_desig_rec.FromEndItemUnitNumber;
1199         l_bom_ref_desig_tbl(i).original_system_reference := bom_ref_desig_rec.OriginalSystemReference;
1200         l_bom_ref_desig_tbl(i).new_reference_designator  := bom_ref_desig_rec.NewReferenceDesignator;
1201         l_bom_ref_desig_tbl(i).return_status             := bom_ref_desig_rec.ReturnStatus;
1202         l_bom_ref_desig_tbl(i).transaction_type          := bom_ref_desig_rec.TransactionType;
1203         l_bom_ref_desig_tbl(i).row_identifier            := bom_ref_desig_rec.RowIdentifier;
1204         i := i + 1;
1205       END LOOP;
1206     END IF;
1207     IF (P_bom_comp_oper_XML IS NOT NULL) THEN
1208 /*
1209       -- Bom Component Operations Table
1210       -- get the context handle
1211       insCtx := DBMS_XMLSave.newContext('BOM_COMPONENT_OPERATIONS_TEMP');
1212       DBMS_XMLSave.setIgnoreCase(insCtx, 1);
1213       DBMS_XMLSave.setDateFormat(insCtx, 'yyyy-MM-dd HH:mm:ss');
1214       DBMS_XMLSave.setRowTag(insCtx , 'ComponentOperationsVO');
1215       -- this inserts the document
1216       rows := DBMS_XMLSave.insertXML(insCtx, P_bom_comp_oper_XML);
1217       -- this closes the handle
1218       DBMS_XMLSave.closeContext(insCtx);
1219 */
1220       i := 1;
1221 /*
1222       OPEN bom_comp_oper_CUR;
1223       LOOP
1224         FETCH bom_comp_oper_CUR INTO l_bom_comp_oper_tbl(i);
1225         IF (bom_comp_oper_CUR%NOTFOUND) THEN
1226           EXIT;
1227         END IF;
1228         i := i + 1;
1229       END LOOP;
1230 */
1231       FOR bom_comp_oper_rec IN bom_comp_oper_CUR LOOP
1232         l_bom_comp_oper_tbl(i).organization_code             := bom_comp_oper_rec.OrganizationCode;
1233         l_bom_comp_oper_tbl(i).assembly_item_name            := bom_comp_oper_rec.AssemblyItemName;
1234         l_bom_comp_oper_tbl(i).start_effective_date          := TO_DATE(bom_comp_oper_rec.StartEffectiveDate,'YYYY-MM-DD HH24:MI:SS');
1235         l_bom_comp_oper_tbl(i).from_end_item_unit_number     := bom_comp_oper_rec.FromEndItemUnitNumber;
1236         l_bom_comp_oper_tbl(i).to_end_item_unit_number       := bom_comp_oper_rec.ToEndItemUnitNumber;
1237         l_bom_comp_oper_tbl(i).operation_sequence_number     := bom_comp_oper_rec.OperationSequenceNumber;
1238         l_bom_comp_oper_tbl(i).additional_operation_seq_num  := bom_comp_oper_rec.AdditionalOperationSeqNum;
1239         l_bom_comp_oper_tbl(i).new_additional_op_seq_num     := bom_comp_oper_rec.NewAdditionalOpSeqNum;
1240         l_bom_comp_oper_tbl(i).component_item_name           := bom_comp_oper_rec.ComponentItemName;
1241         l_bom_comp_oper_tbl(i).alternate_bom_code            := bom_comp_oper_rec.AlternateBomCode;
1242         l_bom_comp_oper_tbl(i).attribute_category            := bom_comp_oper_rec.AttributeCategory;
1243         l_bom_comp_oper_tbl(i).attribute1                    := bom_comp_oper_rec.Attribute1;
1244         l_bom_comp_oper_tbl(i).attribute2                    := bom_comp_oper_rec.Attribute2;
1245         l_bom_comp_oper_tbl(i).attribute3                    := bom_comp_oper_rec.Attribute3;
1246         l_bom_comp_oper_tbl(i).attribute4                    := bom_comp_oper_rec.Attribute4;
1247         l_bom_comp_oper_tbl(i).attribute5                    := bom_comp_oper_rec.Attribute5;
1248         l_bom_comp_oper_tbl(i).attribute6                    := bom_comp_oper_rec.Attribute6;
1249         l_bom_comp_oper_tbl(i).attribute7                    := bom_comp_oper_rec.Attribute7;
1250         l_bom_comp_oper_tbl(i).attribute8                    := bom_comp_oper_rec.Attribute8;
1251         l_bom_comp_oper_tbl(i).attribute9                    := bom_comp_oper_rec.Attribute9;
1252         l_bom_comp_oper_tbl(i).attribute10                   := bom_comp_oper_rec.Attribute10;
1253         l_bom_comp_oper_tbl(i).attribute11                   := bom_comp_oper_rec.Attribute11;
1254         l_bom_comp_oper_tbl(i).attribute12                   := bom_comp_oper_rec.Attribute12;
1255         l_bom_comp_oper_tbl(i).attribute13                   := bom_comp_oper_rec.Attribute13;
1256         l_bom_comp_oper_tbl(i).attribute14                   := bom_comp_oper_rec.Attribute14;
1257         l_bom_comp_oper_tbl(i).attribute15                   := bom_comp_oper_rec.Attribute15;
1258         l_bom_comp_oper_tbl(i).return_status                 := bom_comp_oper_rec.ReturnStatus;
1259         l_bom_comp_oper_tbl(i).transaction_type              := bom_comp_oper_rec.TransactionType;
1260         l_bom_comp_oper_tbl(i).row_identifier                := bom_comp_oper_rec.RowIdentifier;
1261         i := i + 1;
1262       END LOOP;
1263     END IF;
1264     BOM_GLOBALS.Set_Caller_Type('MIGRATION');
1265     BOM_BO_PUB.Process_Bom(p_bom_header_tbl         => l_bom_header_tbl,
1266 --Bug 3349138                          p_bom_revision_tbl       => l_bom_revisions_tbl,
1267                            p_bom_component_tbl      => l_bom_comp_tbl,
1268                            p_bom_ref_designator_tbl => l_bom_ref_desig_tbl,
1269                            p_bom_sub_component_tbl  => l_bom_sub_comp_tbl,
1270                            p_bom_comp_ops_tbl       => l_bom_comp_oper_tbl,
1271                            x_bom_header_tbl         => X_bom_header_tbl,
1272                            x_bom_revision_tbl       => X_bom_revisions_tbl,
1273                            x_bom_component_tbl      => X_bom_comp_tbl,
1274                            x_bom_ref_designator_tbl => X_bom_ref_desig_tbl,
1275                            x_bom_sub_component_tbl  => X_bom_sub_comp_tbl,
1276                            x_bom_comp_ops_tbl       => X_bom_comp_oper_tbl,
1277                            x_return_status          => X_return_status,
1278                            x_msg_count              => X_msg_count,
1279                            p_debug                  => P_debug,
1280                            p_output_dir             => P_output_dir,
1281                            p_debug_filename         => P_debug_filename);
1282     FOR i IN 1..X_msg_count LOOP
1283     BEGIN
1284       ERROR_HANDLER.Get_Message(x_entity_index => l_msg_index,
1285                                 x_entity_id    => l_entity,
1286                                 x_message_text => l_message,
1287                                 x_message_type => l_message_type);
1288       X_G_msg_data := X_G_msg_data || FND_GLOBAL.NewLine || FND_GLOBAL.NewLine || TO_CHAR(l_msg_index) || ': '||l_entity ||': '|| l_message_type ||': '||l_message;
1289     EXCEPTION
1290       WHEN OTHERS THEN
1291         EXIT;
1292     END;
1293     END LOOP;
1294   END IF;
1295 
1296 END Import_Bom;
1297 
1298 END BOM_BOM_ISETUP_IMP;