DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_BOM_ISETUP_IMP

Source


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