DBA Data[Home] [Help]

PACKAGE BODY: APPS.BOM_BO_PUB

Source


1 PACKAGE BODY Bom_Bo_Pub AS
2 /* $Header: BOMBBOMB.pls 120.1 2005/08/24 05:08:14 vhymavat noship $ */
3 /***************************************************************************
4 --
5 --  Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      BOMBBOMB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package Bom_BO_Pub
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  09-JUL-99   Rahul Chitko    Initial Creation
21 --  11-AUG-99 Rahul Chitko  Added Code for Procedure Process_Bom and
22 --          other local procedures used within it.
23 --  20-AUG-01   Refai Farook    One To Many support changes
24 --
25 --  25-SEP-01   Refai Farook    Mass changes for unit effectivity support changes
26 --                              Affected procs. are conv_ecocomp_to_bomcomp and
27 --                              conv_bomcomp_to_ecocomp
28 --  22-NOV-02  Vani Hymavathi   modified to include the new column Row_Identifier
29 ***************************************************************************/
30 
31   /*****************************************************************
32   * Procedure : Convert_BomComp_To_EcoComp
33   * Parameters IN : Bom Component Exposed Column Record
34   *     Bom_Component Unexposed Column Record
35   * Parameters OUT: Eco Component Exposed Column Record
36   *     Eco Component Unexposed Column Record
37   * Purpose : This procedure will simply take the BOM component
38   *     record and copy its values into the ECO component
39   *     record. Since the record definitions of ECO and BOM
40   *     records is different, this has to done on a field
41   *     by field basis.
42   ******************************************************************/
43         PROCEDURE Convert_BomComp_To_EcoComp
44         (  p_bom_component_rec  IN  Bom_Bo_Pub.Bom_Comps_Rec_Type :=
45           Bom_bo_Pub.G_MISS_BOM_COMPONENT_REC
46          , p_bom_comp_unexp_rec IN  Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type :=
47           Bom_Bo_Pub.G_MISS_BOM_COMP_UNEXP_REC
48          , x_rev_component_rec  IN OUT NOCOPY Bom_Bo_Pub.Rev_Component_Rec_Type
49          , x_rev_comp_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type
50          )
51   IS
52   BEGIN
53                 x_rev_component_rec.eco_name := NULL;
54                 x_rev_component_rec.organization_code :=
55                                 p_bom_component_rec.organization_code;
56                 x_rev_component_rec.revised_item_name :=
57                                 p_bom_component_rec.assembly_item_name;
58                 x_rev_component_rec.new_revised_item_revision := NULL;
59                 x_rev_component_rec.start_effective_date :=
60                                 p_bom_component_rec.start_Effective_date;
61                 x_rev_component_rec.new_effectivity_date :=
62                                 p_bom_component_rec.new_effectivity_date;
63                 x_rev_component_rec.disable_date :=
64                                 p_bom_component_rec.disable_date;
65                 x_rev_component_rec.operation_sequence_number :=
66                                 p_bom_component_rec.operation_sequence_number;
67                 x_rev_component_rec.component_item_name :=
68                                 p_bom_component_rec.component_item_name;
69                 x_rev_component_rec.alternate_bom_code :=
70                                 p_bom_component_rec.alternate_bom_code;
71                 x_rev_component_rec.acd_type := NULL;
72                 x_rev_component_rec.old_effectivity_date := NULL;
73                 x_rev_component_rec.old_operation_sequence_number := NULL;
74                 x_rev_component_rec.new_operation_sequence_number :=
75                         p_bom_component_rec.new_operation_sequence_number;
76                 x_rev_component_rec.item_sequence_number :=
77                                 p_bom_component_rec.item_sequence_number;
78                 x_rev_component_rec.basis_type:=
79                                 p_bom_component_rec.basis_type;
80                 x_rev_component_rec.quantity_per_assembly :=
81                                 p_bom_component_rec.quantity_per_assembly;
82                 x_rev_component_rec.inverse_quantity :=
83                                 p_bom_component_rec.inverse_quantity;
84                 x_rev_component_rec.Planning_Percent :=
85                                 p_bom_component_rec.Planning_Percent;
86                 x_rev_component_rec.projected_yield :=
87                                 p_bom_component_rec.projected_yield;
88                 x_rev_component_rec.include_in_cost_rollup :=
89                                 p_bom_component_rec.include_in_cost_rollup;
90                 x_rev_component_rec.wip_supply_type :=
91                                 p_bom_component_rec.wip_supply_type;
92                 x_rev_component_rec.so_basis :=
93                                 p_bom_component_rec.so_basis;
94                 x_rev_component_rec.optional :=
95                                 p_bom_component_rec.optional;
96                 x_rev_component_rec.mutually_exclusive :=
97                                 p_bom_component_rec.mutually_exclusive;
98                 x_rev_component_rec.check_atp :=
99                                 p_bom_component_rec.check_atp;
100                 x_rev_component_rec.shipping_allowed :=
101                                 p_bom_component_rec.shipping_allowed;
102                 x_rev_component_rec.required_to_ship :=
103                                 p_bom_component_rec.required_to_ship;
104                 x_rev_component_rec.required_for_revenue :=
105                                 p_bom_component_rec.required_for_revenue;
106                 x_rev_component_rec.include_on_ship_docs :=
107                                 p_bom_component_rec.include_on_ship_docs;
108                 x_rev_component_rec.quantity_related :=
109                                 p_bom_component_rec.quantity_related;
110                 x_rev_component_rec.supply_subinventory :=
111                                 p_bom_component_rec.supply_subinventory;
112                 x_rev_component_rec.location_name :=
113                                 p_bom_component_rec.location_name;
114                 x_rev_component_rec.minimum_allowed_quantity :=
115                                 p_bom_component_rec.minimum_allowed_quantity;
116                 x_rev_component_rec.maximum_allowed_quantity :=
117                                 p_bom_component_rec.maximum_allowed_quantity;
118                 x_rev_component_rec.comments :=
119                                 p_bom_component_rec.comments;
120                 x_rev_component_rec.attribute_category :=
121                                 p_bom_component_rec.attribute_category;
122                 x_rev_component_rec.attribute1 :=
123                                 p_bom_component_rec.attribute1;
124                 x_rev_component_rec.attribute2 :=
125                                 p_bom_component_rec.attribute2;
126                 x_rev_component_rec.attribute3 :=
127                                 p_bom_component_rec.attribute3;
128                 x_rev_component_rec.attribute4 :=
129                                 p_bom_component_rec.attribute4;
130                 x_rev_component_rec.attribute5 :=
131                                 p_bom_component_rec.attribute5;
132                 x_rev_component_rec.attribute6 :=
133                                 p_bom_component_rec.attribute6;
134                 x_rev_component_rec.attribute7 :=
135                                 p_bom_component_rec.attribute7;
136                 x_rev_component_rec.attribute8 :=
137                                 p_bom_component_rec.attribute8;
138                 x_rev_component_rec.attribute9 :=
139                                 p_bom_component_rec.attribute9;
140                 x_rev_component_rec.attribute10 :=
141                                 p_bom_component_rec.attribute10;
142                 x_rev_component_rec.attribute11 :=
143                                 p_bom_component_rec.attribute11;
144                 x_rev_component_rec.attribute12 :=
145                                 p_bom_component_rec.attribute12;
146                 x_rev_component_rec.attribute13 :=
147                                 p_bom_component_rec.attribute13;
148                 x_rev_component_rec.attribute14 :=
149                                 p_bom_component_rec.attribute14;
150                 x_rev_component_rec.attribute15 :=
151                                 p_bom_component_rec.attribute15;
152                 x_rev_component_rec.original_system_reference :=
153                                 p_bom_component_Rec.original_system_reference;
154                 x_rev_component_rec.transaction_type :=
155                                 p_bom_component_rec.transaction_type;
156                 x_rev_component_rec.return_status :=
157                                 p_bom_component_rec.return_status;
158 
159     x_rev_component_rec.From_End_Item_Unit_Number := p_bom_component_rec.From_End_Item_Unit_Number;
160                 x_rev_component_rec.To_End_Item_Unit_Number := p_bom_component_rec.To_End_Item_Unit_Number;
161     x_rev_component_rec.New_From_End_Item_Unit_Number := p_bom_component_rec.New_From_End_Item_Unit_Number;
162                 x_rev_component_rec.New_Routing_Revision    := NULL ; -- Added by MK on 11/02/00
163     x_rev_component_rec.Enforce_Int_Requirements := p_bom_component_rec.Enforce_Int_Requirements;
164     x_rev_component_rec.Row_Identifier := p_bom_component_rec.Row_Identifier;    --added by vhymavat
165     x_rev_component_rec.auto_request_material :=
166           p_bom_component_rec.auto_request_material; -- Added in 11.5.9 by ADEY
167 
168                 x_rev_component_rec.Suggested_Vendor_Name :=
169                                 p_bom_component_rec.Suggested_Vendor_Name; --- Deepu
170 /*
171                 x_rev_component_rec.Purchasing_Category :=
172                                 p_bom_component_rec.Purchasing_Category; --- Deepu
173                 x_rev_component_rec.Purchasing_Category_Id :=
174                                 p_bom_component_rec.Purchasing_Category_Id; --- Deepu
175 */
176     x_rev_component_rec.Unit_Price :=
177                                 p_bom_component_rec.Unit_Price; --- Deepu
178 
179                 --
180                 -- Similarly copy the unexposed record values into an ECO BO
181                 -- compatible record
182                 --
183                 x_rev_comp_unexp_rec.organization_id :=
184                                 p_bom_comp_unexp_rec.organization_id;
185                 x_rev_comp_unexp_rec.component_item_id :=
186                                 p_bom_comp_unexp_rec.component_item_id;
187                 x_rev_comp_unexp_rec.component_sequence_id :=
188                                 p_bom_comp_unexp_rec.component_sequence_id;
189                 x_rev_comp_unexp_rec.revised_item_id :=
190                                 p_bom_comp_unexp_rec.assembly_item_id;
191                 x_rev_comp_unexp_rec.bill_sequence_id :=
192                                 p_bom_comp_unexp_rec.bill_sequence_id;
193                 x_rev_comp_unexp_rec.pick_components :=
194                                 p_bom_comp_unexp_rec.pick_components;
195                 x_rev_comp_unexp_rec.supply_locator_id :=
196                                 p_bom_comp_unexp_rec.supply_locator_id;
197                 x_rev_comp_unexp_rec.bom_item_type :=
198                                 p_bom_comp_unexp_rec.bom_item_type;
199     x_rev_comp_unexp_rec.revised_item_sequence_id := NULL;
200 
201                 x_rev_comp_unexp_rec.Delete_Group_Name :=
202                                 p_bom_component_rec.Delete_Group_Name ; -- Added in 1155
203                 x_rev_comp_unexp_rec.DG_Description    :=
204                                 p_bom_component_rec.DG_Description ;    -- Added in 1155
205                 x_rev_comp_unexp_rec.DG_Sequence_Id    :=
206                                 p_bom_comp_unexp_rec.DG_Sequence_Id ;   -- Added in 1155
207     x_rev_comp_unexp_rec.Enforce_Int_Requirements_Code := p_bom_comp_unexp_rec.Enforce_Int_Requirements_Code;
208 
209                 x_rev_comp_unexp_rec.Rowid   :=
210                                 p_bom_comp_unexp_rec.Rowid ;
211 
212                 x_rev_comp_unexp_rec.bom_implementation_date   :=
213                                 p_bom_comp_unexp_rec.bom_implementation_date;
214 
215     x_rev_comp_unexp_rec.Vendor_Id :=
216                                 p_bom_comp_unexp_rec.Vendor_Id; --- Deepu
217                 x_rev_comp_unexp_rec.Common_Component_Sequence_Id   :=
218                                 p_bom_comp_unexp_rec.Common_Component_Sequence_Id;
219 
220 
221   END Convert_BomComp_To_EcoComp;
222 
223         /*****************************************************************
224         * Procedure     : Convert_EcoComp_To_BomComp
225         * Parameters IN : Eco Component Exposed Column Record
226         *                 Eco Component Unexposed Column Record
227         * Parameters IN : Bom Component Exposed Column Record
228         *                 Bom_Component Unexposed Column Record
229         * Purpose       : This procedure will simply take the Eco component
230         *                 record and copy its values into the Bom component
231         *                 record. Since the record definitions of ECO and BOM
232         *                 records is different, this has to done on a field
233         *                 by field basis.
234         ******************************************************************/
235         PROCEDURE Convert_EcoComp_To_BomComp
236         (  p_rev_component_rec  IN  Bom_Bo_Pub.Rev_Component_Rec_Type :=
237             Bom_Bo_Pub.G_MISS_REV_COMPONENT_REC
238          , p_rev_comp_unexp_rec IN  Bom_Bo_Pub.Rev_Comp_Unexposed_Rec_Type :=
239             Bom_Bo_Pub.G_MISS_REV_COMP_UNEXP_REC
240          , x_bom_component_rec  IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Rec_Type
241          , x_bom_comp_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Unexposed_Rec_Type
242          )
243   IS
244   BEGIN
245                 x_bom_component_rec.organization_code :=
246                                 p_rev_component_rec.organization_code;
247                 x_bom_component_rec.assembly_item_name :=
248                                 p_rev_component_rec.revised_item_name;
249                 x_bom_component_rec.start_effective_date :=
250                                 p_rev_component_rec.start_Effective_date;
251                 x_bom_component_rec.new_effectivity_date :=
252                                 p_rev_component_rec.new_effectivity_date;
253                 x_bom_component_rec.disable_date :=
254                                 p_rev_component_rec.disable_date;
255                 x_bom_component_rec.operation_sequence_number :=
256                                 p_rev_component_rec.operation_sequence_number;
257                 x_bom_component_rec.component_item_name :=
258                                 p_rev_component_rec.component_item_name;
259                 x_bom_component_rec.alternate_bom_code :=
260                                 p_rev_component_rec.alternate_bom_code;
261                 x_bom_component_rec.new_operation_sequence_number :=
262                         p_rev_component_rec.new_operation_sequence_number;
263                 x_bom_component_rec.item_sequence_number :=
264                                 p_rev_component_rec.item_sequence_number;
265                 x_bom_component_rec.basis_type:=
266                                 p_rev_component_rec.basis_type;
267                 x_bom_component_rec.quantity_per_assembly :=
268                                 p_rev_component_rec.quantity_per_assembly;
269                 x_bom_component_rec.inverse_quantity :=
270                                 p_rev_component_rec.inverse_quantity;
271                 x_bom_component_rec.Planning_Percent :=
272                                 p_rev_component_rec.Planning_Percent;
273                 x_bom_component_rec.projected_yield :=
274                                 p_rev_component_rec.projected_yield;
275                 x_bom_component_rec.include_in_cost_rollup :=
276                                 p_rev_component_rec.include_in_cost_rollup;
277                 x_bom_component_rec.wip_supply_type :=
278                                 p_rev_component_rec.wip_supply_type;
279                 x_bom_component_rec.so_basis :=
280                                 p_rev_component_rec.so_basis;
281                 x_bom_component_rec.optional :=
282                                 p_rev_component_rec.optional;
283                 x_bom_component_rec.mutually_exclusive :=
284                                 p_rev_component_rec.mutually_exclusive;
285                 x_bom_component_rec.check_atp :=
286                                 p_rev_component_rec.check_atp;
287                 x_bom_component_rec.shipping_allowed :=
288                                 p_rev_component_rec.shipping_allowed;
292                                 p_rev_component_rec.required_for_revenue;
289                 x_bom_component_rec.required_to_ship :=
290                                 p_rev_component_rec.required_to_ship;
291                 x_bom_component_rec.required_for_revenue :=
293                 x_bom_component_rec.include_on_ship_docs :=
294                                 p_rev_component_rec.include_on_ship_docs;
295                 x_bom_component_rec.quantity_related :=
296                                 p_rev_component_rec.quantity_related;
297                 x_bom_component_rec.supply_subinventory :=
298                                 p_rev_component_rec.supply_subinventory;
299                 x_bom_component_rec.location_name :=
300                                 p_rev_component_rec.location_name;
301                 x_bom_component_rec.minimum_allowed_quantity :=
302                                 p_rev_component_rec.minimum_allowed_quantity;
303                 x_bom_component_rec.maximum_allowed_quantity :=
304                                 p_rev_component_rec.maximum_allowed_quantity;
305                 x_bom_component_rec.comments :=
306                                 p_rev_component_rec.comments;
307                 x_bom_component_rec.From_End_Item_Unit_Number := p_rev_component_rec.From_End_Item_Unit_Number;
308                 x_bom_component_rec.To_End_Item_Unit_Number := p_rev_component_rec.To_End_Item_Unit_Number;
309                 x_bom_component_rec.New_From_End_Item_Unit_Number := p_rev_component_rec.New_From_End_Item_Unit_Number;
310                 x_bom_component_rec.Enforce_Int_Requirements := p_rev_component_rec.Enforce_Int_Requirements;
311     x_bom_component_rec.Row_Identifier:= p_rev_component_rec.Row_Identifier;  --added by vhymavat
312 
313                 x_bom_component_rec.attribute_category :=
314                                 p_rev_component_rec.attribute_category;
315                 x_bom_component_rec.attribute1 :=
316                                 p_rev_component_rec.attribute1;
317                 x_bom_component_rec.attribute2 :=
318                                 p_rev_component_rec.attribute2;
319                 x_bom_component_rec.attribute3 :=
320                                 p_rev_component_rec.attribute3;
321                 x_bom_component_rec.attribute4 :=
322                                 p_rev_component_rec.attribute4;
323                 x_bom_component_rec.attribute5 :=
324                                 p_rev_component_rec.attribute5;
325                 x_bom_component_rec.attribute6 :=
326                                 p_rev_component_rec.attribute6;
327                 x_bom_component_rec.attribute7 :=
328                                 p_rev_component_rec.attribute7;
329                 x_bom_component_rec.attribute8 :=
330                                 p_rev_component_rec.attribute8;
331                 x_bom_component_rec.attribute9 :=
332                                 p_rev_component_rec.attribute9;
333                 x_bom_component_rec.attribute10 :=
334                                 p_rev_component_rec.attribute10;
335                 x_bom_component_rec.attribute11 :=
336                                 p_rev_component_rec.attribute11;
337                 x_bom_component_rec.attribute12 :=
338                                 p_rev_component_rec.attribute12;
339                 x_bom_component_rec.attribute13 :=
340                                 p_rev_component_rec.attribute13;
341                 x_bom_component_rec.attribute14 :=
342                                 p_rev_component_rec.attribute14;
343                 x_bom_component_rec.attribute15 :=
344                                 p_rev_component_rec.attribute15;
345                 x_bom_component_rec.original_system_reference :=
346                                 p_rev_component_Rec.original_system_reference;
347                 x_bom_component_rec.transaction_type :=
348                                 p_rev_component_rec.transaction_type;
349                 x_bom_component_rec.return_status :=
350                                 p_rev_component_rec.return_status;
351 
352                 x_bom_component_rec.Delete_Group_Name :=
353                                 p_rev_comp_unexp_rec.Delete_Group_Name ; -- Added in 1155
354                 x_bom_component_rec.DG_Description    :=
355                                 p_rev_comp_unexp_rec.DG_Description ;    -- Added in 1155
356     x_bom_component_rec.auto_request_material    :=
357           p_rev_component_rec.auto_request_material ;    -- Added in 11.5.9 by ADEY
358 
359     x_bom_component_rec.Suggested_Vendor_Name :=
360                                 p_rev_component_rec.Suggested_Vendor_Name; --- Deepu
361 /*
362     x_bom_component_rec.Purchasing_Category :=
363                                 p_rev_component_rec.Purchasing_Category; --- Deepu
364                 x_bom_component_rec.Purchasing_Category_Id :=
365                                 p_rev_component_rec.Purchasing_Category_Id; --- Deepu
366 */
367     x_bom_component_rec.Unit_Price :=
368                                 p_rev_component_rec.Unit_Price; --- Deepu
369 
370 
371                 --
372                 -- Similarly copy the unexposed record values into an ECO BO
373                 -- compatible record
374                 --
375     x_bom_comp_unexp_rec.assembly_item_id :=
376                                 p_rev_comp_unexp_rec.revised_item_id;
377                 x_bom_comp_unexp_rec.organization_id :=
378                                 p_rev_comp_unexp_rec.organization_id;
379                 x_bom_comp_unexp_rec.component_item_id :=
383                 x_bom_comp_unexp_rec.bill_sequence_id :=
380                                 p_rev_comp_unexp_rec.component_item_id;
381                 x_bom_comp_unexp_rec.component_sequence_id :=
382                                 p_rev_comp_unexp_rec.component_sequence_id;
384                                 p_rev_comp_unexp_rec.bill_sequence_id;
385                 x_bom_comp_unexp_rec.pick_components :=
386                                 p_rev_comp_unexp_rec.pick_components;
387                 x_bom_comp_unexp_rec.supply_locator_id :=
388                                 p_rev_comp_unexp_rec.supply_locator_id;
389                 x_bom_comp_unexp_rec.bom_item_type :=
390                                 p_rev_comp_unexp_rec.bom_item_type;
391 
392                 x_bom_comp_unexp_rec.DG_Sequence_Id  :=
393                                 p_rev_comp_unexp_rec.DG_Sequence_Id ;   -- Added in 1155
394                 x_bom_comp_unexp_rec.Enforce_Int_Requirements_Code  := p_rev_comp_unexp_rec.Enforce_Int_Requirements_Code;
395 
396                 x_bom_comp_unexp_rec.Rowid  :=
397                                 p_rev_comp_unexp_rec.Rowid;
398 
399                 x_bom_comp_unexp_rec.bom_implementation_date  :=
400                                 p_rev_comp_unexp_rec.bom_implementation_date;
401 
402     x_bom_comp_unexp_rec.Vendor_Id :=
403                                 p_rev_comp_unexp_rec.Vendor_Id; --- Deepu
404                 x_bom_comp_unexp_rec.Common_Component_Sequence_Id  :=
405                                 p_rev_comp_unexp_rec.Common_Component_Sequence_Id;
406 
407   END Convert_EcoComp_To_BomComp;
408 
409   PROCEDURE Convert_BomDesg_To_EcoDesg
410         (  p_bom_ref_designator_rec IN  Bom_Bo_Pub.Bom_Ref_Designator_Rec_Type
411                                     := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_REC
412          , p_bom_ref_desg_unexp_rec IN  Bom_Bo_Pub.Bom_Ref_Desg_Unexp_Rec_Type
413                                     := Bom_Bo_Pub.G_MISS_BOM_REF_DESG_UNEXP_REC
414          , x_ref_designator_rec     IN OUT NOCOPY Bom_Bo_Pub.Ref_Designator_Rec_Type
415          , x_ref_desg_unexp_rec     IN OUT NOCOPY Bom_Bo_Pub.Ref_Desg_Unexposed_Rec_Type
416          )
417   IS
418   BEGIN
419     x_ref_designator_rec.eco_name := NULL;
420     x_ref_designator_rec.revised_item_name :=
421       p_bom_ref_designator_rec.assembly_item_name;
422     x_ref_designator_rec.start_effective_date :=
423       p_bom_ref_designator_rec.start_effective_date;
424     x_ref_designator_rec.new_revised_item_revision := NULL;
425     x_ref_designator_rec.operation_sequence_number :=
426       p_bom_ref_designator_rec.operation_sequence_number;
427     x_ref_designator_rec.component_item_name :=
428       p_bom_ref_designator_rec.component_item_name;
429     x_ref_designator_rec.Alternate_Bom_Code :=
430       p_bom_ref_designator_rec.Alternate_Bom_Code;
431     x_ref_designator_rec.Reference_Designator_Name :=
432       p_bom_ref_designator_rec.Reference_Designator_Name;
433     x_ref_designator_rec.ACD_Type := NULL;
434     x_ref_designator_rec.Ref_Designator_Comment :=
435       p_bom_ref_designator_rec.Ref_Designator_Comment;
436     x_ref_designator_rec.Attribute_category :=
437       p_bom_ref_designator_rec.Attribute_category;
438     x_ref_designator_rec.Attribute1 :=
439       p_bom_ref_designator_rec.Attribute1;
440     x_ref_designator_rec.Attribute2 :=
441       p_bom_ref_designator_rec.Attribute2;
442     x_ref_designator_rec.Attribute3 :=
443       p_bom_ref_designator_rec.Attribute3;
444     x_ref_designator_rec.Attribute4 :=
445       p_bom_ref_designator_rec.Attribute4;
446     x_ref_designator_rec.Attribute5 :=
447       p_bom_ref_designator_rec.Attribute5;
448     x_ref_designator_rec.Attribute6 :=
449       p_bom_ref_designator_rec.Attribute6;
450     x_ref_designator_rec.Attribute7 :=
451       p_bom_ref_designator_rec.Attribute7;
452     x_ref_designator_rec.Attribute8 :=
453       p_bom_ref_designator_rec.Attribute8;
454     x_ref_designator_rec.Attribute9 :=
455       p_bom_ref_designator_rec.Attribute9;
456     x_ref_designator_rec.Attribute10 :=
457       p_bom_ref_designator_rec.Attribute10;
458     x_ref_designator_rec.Attribute11 :=
459       p_bom_ref_designator_rec.Attribute11;
460     x_ref_designator_rec.Attribute12 :=
461       p_bom_ref_designator_rec.Attribute12;
462     x_ref_designator_rec.Attribute13 :=
463       p_bom_ref_designator_rec.Attribute13;
467       p_bom_ref_designator_rec.Attribute15;
464     x_ref_designator_rec.Attribute14 :=
465       p_bom_ref_designator_rec.Attribute14;
466     x_ref_designator_rec.Attribute15 :=
468     x_ref_designator_rec.Original_System_Reference :=
469       p_bom_ref_designator_rec.Original_System_Reference;
470     x_ref_designator_rec.New_Reference_Designator :=
471       p_bom_ref_designator_rec.New_Reference_Designator;
472     x_ref_designator_rec.Return_Status :=
473       p_bom_ref_designator_rec.Return_Status;
474     x_ref_designator_rec.Transaction_Type  :=
475       p_bom_ref_designator_rec.Transaction_Type;
476                 x_ref_designator_rec.New_Routing_Revision      := NULL ; -- Added by MK on 11/02/00
477                 x_ref_designator_rec.From_End_Item_Unit_Number :=
478         p_bom_ref_designator_rec.From_End_Item_Unit_Number;
479     x_ref_designator_rec.Row_Identifier:=
480                                p_bom_ref_designator_rec.Row_Identifier;--added by vhyavat
481     --
482     -- Convert the unexposed record well.
483     --
484     x_ref_desg_unexp_rec.organization_id :=
485       p_bom_ref_desg_unexp_rec.organization_id;
486     x_ref_desg_unexp_rec.component_item_id :=
487       p_bom_ref_desg_unexp_rec.component_item_id;
488     x_ref_desg_unexp_rec.Component_Sequence_Id :=
489       p_bom_ref_desg_unexp_rec.component_sequence_id;
490     x_ref_desg_unexp_rec.Revised_Item_Id :=
491       p_bom_ref_desg_unexp_rec.assembly_item_id;
492     x_ref_desg_unexp_rec.bill_sequence_id :=
493       p_bom_ref_desg_unexp_rec.bill_sequence_id;
494   END Convert_BomDesg_To_EcoDesg;
495 
496         PROCEDURE Convert_EcoDesg_To_BomDesg
497         (  p_ref_designator_rec     IN  Bom_Bo_Pub.Ref_Designator_Rec_Type
498                                     := Bom_Bo_Pub.G_MISS_REF_DESIGNATOR_REC
499          , p_ref_desg_unexp_rec     IN  Bom_Bo_Pub.Ref_Desg_Unexposed_Rec_Type
500                                     := Bom_Bo_Pub.G_MISS_REF_DESG_UNEXP_REC
501          , x_bom_ref_designator_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Rec_Type
502          , x_bom_ref_desg_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Desg_Unexp_Rec_Type
503          )
504   IS
505   BEGIN
506                 x_bom_ref_designator_rec.assembly_item_name :=
507                         p_ref_designator_rec.revised_item_name;
508                 x_bom_ref_designator_rec.start_effective_date :=
509                         p_ref_designator_rec.start_effective_date;
510                 x_bom_ref_designator_rec.operation_sequence_number :=
511                         p_ref_designator_rec.operation_sequence_number;
512                 x_bom_ref_designator_rec.component_item_name :=
513                         p_ref_designator_rec.component_item_name;
514                 x_bom_ref_designator_rec.Alternate_Bom_Code :=
515                         p_ref_designator_rec.Alternate_Bom_Code;
516                 x_bom_ref_designator_rec.Reference_Designator_Name :=
517                         p_ref_designator_rec.Reference_Designator_Name;
518                 x_bom_ref_designator_rec.Ref_Designator_Comment :=
519                         p_ref_designator_rec.Ref_Designator_Comment;
520                 x_bom_ref_designator_rec.Attribute_category :=
521                         p_ref_designator_rec.Attribute_category;
522                 x_bom_ref_designator_rec.Attribute1 :=
523                         p_ref_designator_rec.Attribute1;
524                 x_bom_ref_designator_rec.Attribute2 :=
525                         p_ref_designator_rec.Attribute2;
526                 x_bom_ref_designator_rec.Attribute3 :=
527                         p_ref_designator_rec.Attribute3;
528                 x_bom_ref_designator_rec.Attribute4 :=
529                         p_ref_designator_rec.Attribute4;
530                 x_bom_ref_designator_rec.Attribute5 :=
531                         p_ref_designator_rec.Attribute5;
535                         p_ref_designator_rec.Attribute7;
532                 x_bom_ref_designator_rec.Attribute6 :=
533                         p_ref_designator_rec.Attribute6;
534                 x_bom_ref_designator_rec.Attribute7 :=
536                 x_bom_ref_designator_rec.Attribute8 :=
537                         p_ref_designator_rec.Attribute8;
538                 x_bom_ref_designator_rec.Attribute9 :=
539                         p_ref_designator_rec.Attribute9;
540                 x_bom_ref_designator_rec.Attribute10 :=
541                         p_ref_designator_rec.Attribute10;
542                 x_bom_ref_designator_rec.Attribute11 :=
543                         p_ref_designator_rec.Attribute11;
544                 x_bom_ref_designator_rec.Attribute12 :=
545                         p_ref_designator_rec.Attribute12;
546                 x_bom_ref_designator_rec.Attribute13 :=
547                         p_ref_designator_rec.Attribute13;
548                 x_bom_ref_designator_rec.Attribute14 :=
549                         p_ref_designator_rec.Attribute14;
550                 x_bom_ref_designator_rec.Attribute15 :=
551                         p_ref_designator_rec.Attribute15;
552     x_bom_ref_designator_rec.From_End_Item_Unit_Number :=
553                                 p_ref_designator_rec.From_End_Item_Unit_Number;
554 
555                 x_bom_ref_designator_rec.Original_System_Reference :=
556                         p_ref_designator_rec.Original_System_Reference;
557                 x_bom_ref_designator_rec.New_Reference_Designator :=
558                         p_ref_designator_rec.New_Reference_Designator;
559                 x_bom_ref_designator_rec.Return_Status :=
560                         p_ref_designator_rec.Return_Status;
561                 x_bom_ref_designator_rec.Transaction_Type  :=
562                         p_ref_designator_rec.Transaction_Type;
563                 x_bom_ref_designator_rec.Row_Identifier:=
564                          p_ref_designator_rec.Row_Identifier;
565 
566                 --
567                 -- Convert the unexposed record well.
568                 --
569                 x_bom_ref_desg_unexp_rec.organization_id :=
570                         p_ref_desg_unexp_rec.organization_id;
571                 x_bom_ref_desg_unexp_rec.component_item_id :=
572                         p_ref_desg_unexp_rec.component_item_id;
573                 x_bom_ref_desg_unexp_rec.Component_Sequence_Id :=
574                         p_ref_desg_unexp_rec.component_sequence_id;
575                 x_bom_ref_desg_unexp_rec.assembly_item_id :=
576                         p_ref_desg_unexp_rec.Revised_Item_Id;
577                 x_bom_ref_desg_unexp_rec.bill_sequence_id :=
578                         p_ref_desg_unexp_rec.bill_sequence_id;
579 
580   END Convert_EcoDesg_To_BomDesg;
581 
582         PROCEDURE Convert_BomSComp_To_EcoSComp
583         (  p_bom_sub_component_rec  IN  Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
584                                     := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_REC
585          , p_bom_sub_comp_unexp_rec IN  Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
589          )
586                                     := Bom_Bo_Pub.G_MISS_BOM_SUB_COMP_UNEXP_REC
587          , x_sub_component_rec      IN OUT NOCOPY Bom_Bo_Pub.Sub_Component_Rec_Type
588          , x_sub_comp_unexp_rec     IN OUT NOCOPY Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
590   IS
591   BEGIN
592     x_sub_component_rec.eco_name := NULL;
593     x_sub_component_rec.organization_code :=
594       p_bom_sub_component_rec.organization_code;
595     x_sub_component_rec.revised_item_name :=
596       p_bom_sub_component_rec.assembly_item_name;
597     x_sub_component_rec.start_effective_date :=
598       p_bom_sub_component_rec.start_effective_date;
599     x_sub_component_rec.new_revised_item_revision := null;
600     x_sub_component_rec.operation_sequence_number :=
601       p_bom_sub_component_rec.operation_sequence_number;
602     x_sub_component_rec.component_item_name :=
603       p_bom_sub_component_rec.component_item_name;
604     x_sub_component_rec.alternate_bom_code :=
605       p_bom_sub_component_rec.alternate_bom_code;
606     x_sub_component_rec.substitute_component_name :=
607       p_bom_sub_component_rec.substitute_component_name;
608     x_sub_component_rec.new_substitute_component_name :=
609       p_bom_sub_component_rec.new_substitute_component_name;
610     x_sub_component_rec.acd_type :=  NULL;
611     x_sub_component_rec.substitute_item_quantity :=
612                         p_bom_sub_component_rec.substitute_item_quantity;
613                 x_sub_component_rec.Attribute_category :=
614                         p_bom_sub_component_rec.Attribute_category;
615                 x_sub_component_rec.Attribute1 :=
616                         p_bom_sub_component_rec.Attribute1;
617                 x_sub_component_rec.Attribute2 :=
618                         p_bom_sub_component_rec.Attribute2;
619                 x_sub_component_rec.Attribute3 :=
620                         p_bom_sub_component_rec.Attribute3;
621                 x_sub_component_rec.Attribute4 :=
622                         p_bom_sub_component_rec.Attribute4;
623                 x_sub_component_rec.Attribute5 :=
624                         p_bom_sub_component_rec.Attribute5;
625                 x_sub_component_rec.Attribute6 :=
626                         p_bom_sub_component_rec.Attribute6;
627                 x_sub_component_rec.Attribute7 :=
628                         p_bom_sub_component_rec.Attribute7;
629                 x_sub_component_rec.Attribute8 :=
630                         p_bom_sub_component_rec.Attribute8;
631                 x_sub_component_rec.Attribute9 :=
632                         p_bom_sub_component_rec.Attribute9;
633                 x_sub_component_rec.Attribute10 :=
634                         p_bom_sub_component_rec.Attribute10;
635                 x_sub_component_rec.Attribute11 :=
636                         p_bom_sub_component_rec.Attribute11;
637                 x_sub_component_rec.Attribute12 :=
638                         p_bom_sub_component_rec.Attribute12;
639                 x_sub_component_rec.Attribute13 :=
640                         p_bom_sub_component_rec.Attribute13;
641                 x_sub_component_rec.Attribute14 :=
642                         p_bom_sub_component_rec.Attribute14;
643                 x_sub_component_rec.Attribute15 :=
644                         p_bom_sub_component_rec.Attribute15;
645                 x_sub_component_rec.Original_System_Reference :=
646                         p_bom_sub_component_rec.Original_System_Reference;
647                 x_sub_component_rec.Return_Status :=
648                         p_bom_sub_component_rec.Return_Status;
649                 x_sub_component_rec.Transaction_Type  :=
650                         p_bom_sub_component_rec.Transaction_Type;
651                 x_sub_component_rec.New_Routing_Revision      := NULL ; -- Added by MK on 11/02/00
655       p_bom_sub_component_rec.Enforce_Int_Requirements;
652                 x_sub_component_rec.From_End_Item_Unit_Number :=
653       p_bom_sub_component_rec.From_End_Item_Unit_Number;
654                 x_sub_component_rec.Enforce_Int_Requirements :=
656                x_sub_component_rec.Row_Identifier:=
657                      p_bom_sub_component_rec.Row_Identifier;
658                x_sub_component_rec.Inverse_Quantity:=
659                      p_bom_sub_component_rec.Inverse_Quantity;
660 
661     --
662     -- Also store the Unexposed record columns
663     --
664     x_sub_comp_unexp_rec.organization_id :=
665       p_bom_sub_comp_unexp_rec.organization_id;
666     x_sub_comp_unexp_rec.component_item_id :=
667       p_bom_sub_comp_unexp_rec.component_item_id;
668     x_sub_comp_unexp_rec.component_sequence_id :=
669       p_bom_sub_comp_unexp_rec.component_sequence_id;
670     x_sub_Comp_unexp_rec.revised_item_id :=
671       p_bom_sub_comp_unexp_rec.assembly_item_id;
672     x_sub_comp_unexp_rec.substitute_component_id :=
673       p_bom_sub_comp_unexp_rec.substitute_component_id;
674     x_sub_comp_unexp_rec.new_substitute_component_id :=
675       p_bom_sub_comp_unexp_rec.new_substitute_component_id;
676     x_sub_comp_unexp_rec.bill_sequence_id :=
677       p_bom_sub_comp_unexp_rec.bill_sequence_id;
678     x_sub_comp_unexp_rec.Enforce_Int_Requirements_Code :=
679       p_bom_sub_comp_unexp_rec.Enforce_Int_Requirements_Code;
680 
681   END Convert_BomSComp_To_EcoSComp;
682 
683         PROCEDURE Convert_EcoSComp_To_BomSComp
684         (  p_sub_component_rec      IN  Bom_Bo_Pub.Sub_Component_Rec_Type
685                                     := Bom_Bo_Pub.G_MISS_SUB_COMPONENT_REC
686          , p_sub_comp_unexp_rec     IN  Bom_Bo_Pub.Sub_Comp_Unexposed_Rec_Type
687                                     := Bom_bo_Pub.G_MISS_SUB_COMP_UNEXP_REC
688          , x_bom_sub_component_rec  IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Rec_Type
689          , x_bom_sub_comp_unexp_rec IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Comp_Unexp_Rec_Type
690         )
691   IS
692   BEGIN
693                 x_bom_sub_component_rec.organization_code :=
694                         p_sub_component_rec.organization_code;
695                 x_bom_sub_component_rec.assembly_item_name :=
696                         p_sub_component_rec.revised_item_name;
697                 x_bom_sub_component_rec.start_effective_date :=
698                         p_sub_component_rec.start_effective_date;
699                 x_bom_sub_component_rec.operation_sequence_number :=
700                         p_sub_component_rec.operation_sequence_number;
701                 x_bom_sub_component_rec.component_item_name :=
702                         p_sub_component_rec.component_item_name;
703                 x_bom_sub_component_rec.alternate_bom_code :=
704                         p_sub_component_rec.alternate_bom_code;
705                 x_bom_sub_component_rec.substitute_component_name :=
706                         p_sub_component_rec.substitute_component_name;
707                 x_bom_sub_component_rec.new_substitute_component_name :=
708                         p_sub_component_rec.new_substitute_component_name;
709     x_bom_sub_component_rec.substitute_item_quantity :=
710       p_sub_component_rec.substitute_item_quantity;
711                 x_bom_sub_component_rec.Attribute_category :=
712                         p_sub_component_rec.Attribute_category;
713                 x_bom_sub_component_rec.Attribute1 :=
714                         p_sub_component_rec.Attribute1;
715                 x_bom_sub_component_rec.Attribute2 :=
716                         p_sub_component_rec.Attribute2;
717                 x_bom_sub_component_rec.Attribute3 :=
718                         p_sub_component_rec.Attribute3;
719                 x_bom_sub_component_rec.Attribute4 :=
720                         p_sub_component_rec.Attribute4;
721                 x_bom_sub_component_rec.Attribute5 :=
722                         p_sub_component_rec.Attribute5;
723                 x_bom_sub_component_rec.Attribute6 :=
724                         p_sub_component_rec.Attribute6;
725                 x_bom_sub_component_rec.Attribute7 :=
726                         p_sub_component_rec.Attribute7;
727                 x_bom_sub_component_rec.Attribute8 :=
728                         p_sub_component_rec.Attribute8;
729                 x_bom_sub_component_rec.Attribute9 :=
730                         p_sub_component_rec.Attribute9;
731                 x_bom_sub_component_rec.Attribute10 :=
732                         p_sub_component_rec.Attribute10;
733                 x_bom_sub_component_rec.Attribute11 :=
734                         p_sub_component_rec.Attribute11;
735                 x_bom_sub_component_rec.Attribute12 :=
736                         p_sub_component_rec.Attribute12;
737                 x_bom_sub_component_rec.Attribute13 :=
738                         p_sub_component_rec.Attribute13;
739                 x_bom_sub_component_rec.Attribute14 :=
740                         p_sub_component_rec.Attribute14;
741                 x_bom_sub_component_rec.Attribute15 :=
742                         p_sub_component_rec.Attribute15;
743                 x_bom_sub_component_rec.From_End_Item_Unit_Number :=
744                         p_sub_component_rec.From_End_Item_Unit_Number;
745                 x_bom_sub_component_rec.Enforce_Int_Requirements :=
746                         p_sub_component_rec.Enforce_Int_Requirements;
747                 x_bom_sub_component_rec.Original_System_Reference :=
748                         p_sub_component_rec.Original_System_Reference;
752                         p_sub_component_rec.Transaction_Type;
749                 x_bom_sub_component_rec.Return_Status :=
750                         p_sub_component_rec.Return_Status;
751                 x_bom_sub_component_rec.Transaction_Type  :=
753                  x_bom_sub_component_rec.Row_Identifier:=
754                        p_sub_component_rec.Row_Identifier;-- added by vhymavat
755                  x_bom_sub_component_rec.Inverse_Quantity:=
756                        p_sub_component_rec.Inverse_Quantity;
757 
758                 --
759                 -- Also store the Unexposed record columns
760                 --
761                 x_bom_sub_comp_unexp_rec.organization_id :=
762                         p_sub_comp_unexp_rec.organization_id;
763                 x_bom_sub_comp_unexp_rec.component_item_id :=
764                         p_sub_comp_unexp_rec.component_item_id;
765                 x_bom_sub_comp_unexp_rec.component_sequence_id :=
766                         p_sub_comp_unexp_rec.component_sequence_id;
767                 x_bom_sub_Comp_unexp_rec.assembly_item_id :=
768                         p_sub_comp_unexp_rec.revised_item_id;
769                 x_bom_sub_comp_unexp_rec.substitute_component_id :=
770                         p_sub_comp_unexp_rec.substitute_component_id;
771                 x_bom_sub_comp_unexp_rec.new_substitute_component_id :=
772                         p_sub_comp_unexp_rec.new_substitute_component_id;
773                 x_bom_sub_comp_unexp_rec.bill_sequence_id :=
774                         p_sub_comp_unexp_rec.bill_sequence_id;
775                 x_bom_sub_comp_unexp_rec.Enforce_Int_Requirements_Code :=
776                         p_sub_comp_unexp_rec.Enforce_Int_Requirements_Code;
777 
778   END Convert_EcoSComp_To_BomSComp;
779 
780 
781   FUNCTION Does_Rev_Have_Same_Bom
782   ( p_bom_revision_tbl        IN Bom_Bo_Pub.Bom_Revision_Tbl_Type
783   , p_assembly_item_name       IN VARCHAR2
784   , p_organization_code       IN VARCHAR2
785   ) RETURN BOOLEAN
786   IS
787     table_index     NUMBER;
788     record_count        NUMBER;
789   BEGIN
790         record_count := p_bom_revision_tbl.COUNT;
791 
792         FOR table_index IN 1..record_count
793         LOOP
794             IF NVL(p_bom_revision_tbl(table_index).assembly_item_name,
795          FND_API.G_MISS_CHAR) <>
796                NVL(p_assembly_item_name, FND_API.G_MISS_CHAR)
797                OR
798                  NVL(p_bom_revision_tbl(table_index).organization_code,
799          FND_API.G_MISS_CHAR) <>
800                NVL(p_organization_code, FND_API.G_MISS_CHAR)
801           THEN
802               RETURN FALSE;
803           END IF;
804         END LOOP;
805 
806         RETURN TRUE;
807   END Does_Rev_Have_Same_Bom;
808 
809 
810   FUNCTION Does_Comp_Have_Same_Bom
811   ( p_bom_component_tbl       IN BOM_BO_PUB.Bom_Comps_Tbl_Type
812   , p_assembly_item_name       IN VARCHAR2
813   , p_organization_code       IN VARCHAR2
814   ) RETURN BOOLEAN
815   IS
816     table_index     NUMBER;
817     record_count        NUMBER;
818   BEGIN
819         record_count := p_bom_component_tbl.COUNT;
820 
821         FOR table_index IN 1..record_count
822         LOOP
823           IF NVL(p_bom_component_tbl(table_index).assembly_item_name, FND_API.G_MISS_CHAR) <>
824             NVL(p_assembly_item_name, FND_API.G_MISS_CHAR)
825             OR
826             NVL(p_bom_component_tbl(table_index).organization_code, FND_API.G_MISS_CHAR) <>
827             NVL(p_organization_code, FND_API.G_MISS_CHAR)
828           THEN
829               RETURN FALSE;
830           END IF;
831         END LOOP;
832 
833         RETURN TRUE;
834   END Does_Comp_Have_Same_Bom;
835 
836 
837   FUNCTION Does_Desg_Have_Same_Bom
838   ( p_bom_ref_designator_tbl   IN BOM_BO_PUB.Bom_Ref_Designator_Tbl_Type
839   , p_assembly_item_name       IN VARCHAR2
840   , p_organization_code       IN VARCHAR2
841   ) RETURN BOOLEAN
842   IS
843     table_index     NUMBER;
844     record_count        NUMBER;
845   BEGIN
846         record_count := p_bom_ref_designator_tbl.COUNT;
847 
848         FOR table_index IN 1..record_count
849         LOOP
850           IF NVL(p_bom_ref_designator_tbl(table_index).assembly_item_name, FND_API.G_MISS_CHAR) <>
851             NVL(p_assembly_item_name, FND_API.G_MISS_CHAR)
852             OR
853             NVL(p_bom_ref_designator_tbl(table_index).organization_code, FND_API.G_MISS_CHAR) <>
854                 NVL(p_organization_code, FND_API.G_MISS_CHAR)
855           THEN
856               RETURN FALSE;
857           END IF;
858         END LOOP;
859 
860         RETURN TRUE;
861   END Does_Desg_Have_Same_Bom;
862 
863 
864   FUNCTION Does_SComp_Have_Same_Bom
865   ( p_bom_sub_component_tbl    IN BOM_BO_PUB.Bom_Sub_Component_Tbl_Type
866   , p_assembly_item_name       IN VARCHAR2
867   , p_organization_code       IN VARCHAR2
868   ) RETURN BOOLEAN
869   IS
870     table_index     NUMBER;
871     record_count        NUMBER;
872   BEGIN
873         record_count := p_bom_sub_component_tbl.COUNT;
874 
875 if Bom_Globals.Get_Debug = 'Y' THEN
876   Error_Handler.write_debug('Substitute comps check for same BOM ' ||
877           p_assembly_item_name ||
878           ' org ' ||
879           p_organization_code  || ' processing records ' || p_bom_sub_component_tbl.COUNT);
880 end if;
884             NVL(p_assembly_item_name, FND_API.G_MISS_CHAR)
881         FOR table_index IN 1..record_count
882         LOOP
883           IF NVL(p_bom_sub_component_tbl(table_index).assembly_item_name, FND_API.G_MISS_CHAR) <>
885             OR
886             NVL(p_bom_sub_component_tbl(table_index).organization_code, FND_API.G_MISS_CHAR) <>
887                 NVL(p_organization_code, FND_API.G_MISS_CHAR)
888           THEN
889               RETURN FALSE;
890           END IF;
891         END LOOP;
892 
893         RETURN TRUE;
894   END Does_SComp_Have_Same_Bom;
895 
896 
897   FUNCTION Does_CmpOps_Have_Same_Bom
898   ( p_bom_comp_ops_tbl    IN BOM_BO_PUB.Bom_Comp_Ops_Tbl_Type
899   , p_assembly_item_name  IN VARCHAR2
900   , p_organization_code   IN VARCHAR2
901   ) RETURN BOOLEAN
902   IS
903     table_index     NUMBER;
904     record_count        NUMBER;
905   BEGIN
906         record_count := p_bom_comp_ops_tbl.COUNT;
907 
908 if Bom_Globals.Get_Debug = 'Y' THEN
909   Error_Handler.write_debug('Component Operations check for same BOM ' ||
910           p_assembly_item_name ||
911           ' org ' ||
912           p_organization_code  || ' processing records ' || record_count);
913 end if;
914         FOR table_index IN 1..record_count
915         LOOP
916           IF NVL(p_bom_comp_ops_tbl(table_index).assembly_item_name, FND_API.G_MISS_CHAR) <>
917             NVL(p_assembly_item_name, FND_API.G_MISS_CHAR)
918             OR
919             NVL(p_bom_comp_ops_tbl(table_index).organization_code, FND_API.G_MISS_CHAR) <>
920                 NVL(p_organization_code, FND_API.G_MISS_CHAR)
921           THEN
922               RETURN FALSE;
923           END IF;
924         END LOOP;
925 
926         RETURN TRUE;
927   END Does_CmpOps_Have_Same_Bom;
928 
929 
930   /******************************************************************
931   * Procedure : Check_Records_In_Same_BOM
932   * Parameters IN :
933   *
934   *
935   *
936   *
937   *******************************************************************/
938   FUNCTION Check_Records_In_Same_BOM
939         (  p_bom_header_rec     IN  Bom_Bo_Pub.Bom_Head_Rec_Type
940          , p_bom_revision_tbl       IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type
941    , p_bom_component_tbl      IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type
942          , p_bom_ref_designator_tbl IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
943          , p_bom_sub_component_tbl  IN  Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
944          , p_bom_comp_ops_tbl       IN  Bom_Bo_Pub.Bom_Comp_ops_Tbl_Type
945          , x_assembly_item_name     IN OUT NOCOPY VARCHAR2
946    , x_organization_code      IN OUT NOCOPY VARCHAR2
947         )
948   RETURN BOOLEAN
949   IS
950     l_organization_code VARCHAR2(3);
951     l_assembly_item_name  VARCHAR2(240);
952     record_count    NUMBER;
953   BEGIN
954     IF (p_bom_header_rec.assembly_item_name IS NOT NULL AND
955               p_bom_header_rec.assembly_item_name <> FND_API.G_MISS_CHAR)
956               OR
957               (p_bom_header_rec.organization_code IS NOT NULL AND
958                p_bom_header_rec.organization_code <> FND_API.G_MISS_CHAR)
959     THEN
960             l_assembly_item_name :=
961           p_bom_header_rec.assembly_item_name;
962             l_organization_code :=
963           p_bom_header_rec.organization_code;
964       x_assembly_item_name :=
965           p_bom_header_rec.assembly_item_name;
966       x_organization_code :=
967           p_bom_header_rec.organization_code;
968 
969       IF NOT Does_Rev_Have_Same_Bom
970                   ( p_bom_revision_tbl => p_bom_revision_tbl
971                   , p_assembly_item_name => l_assembly_item_name
972                   , p_organization_code => l_organization_code
976             END IF;
973                   )
974             THEN
975                 RETURN FALSE;
977 
978             IF NOT Does_Comp_Have_Same_Bom
979                   ( p_bom_component_tbl => p_bom_component_tbl
980                   , p_assembly_item_name => l_assembly_item_name
981                   , p_organization_code => l_organization_code
982                   )
983             THEN
984                 RETURN FALSE;
985             END IF;
986 
987             IF NOT Does_Desg_Have_Same_Bom
988                   ( p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
989                   , p_assembly_item_name => l_assembly_item_name
990                   , p_organization_code => l_organization_code
991                   )
992             THEN
993                 RETURN FALSE;
994             END IF;
995 
996             IF NOT Does_SComp_Have_Same_Bom
997                   ( p_bom_sub_component_tbl => p_bom_sub_component_tbl
998                   , p_assembly_item_name => l_assembly_item_name
999                   , p_organization_code => l_organization_code
1000                   )
1001             THEN
1002                 RETURN FALSE;
1003             END IF;
1004 
1005             IF NOT Does_CmpOps_Have_Same_Bom
1006                   ( p_bom_comp_ops_tbl => p_bom_comp_ops_tbl
1007                   , p_assembly_item_name => l_assembly_item_name
1008                   , p_organization_code => l_organization_code
1009                   )
1010             THEN
1011                 RETURN FALSE;
1012             END IF;
1013 
1014             RETURN TRUE;
1015 
1016         END IF; -- If Bom Header record Exists Ends
1017 
1018         record_count := p_bom_revision_tbl.COUNT;
1019         IF record_count <> 0
1020         THEN
1021             l_assembly_item_name :=
1022         p_bom_revision_tbl(1).assembly_item_name;
1023             l_organization_code :=
1024         p_bom_revision_tbl(1).organization_code;
1025             x_assembly_item_name :=
1026         p_bom_revision_tbl(1).assembly_item_name;
1027             x_organization_code :=
1028         p_bom_revision_tbl(1).organization_code;
1029 
1030             IF record_count > 1
1031             THEN
1032                   IF NOT Does_Rev_Have_Same_Bom
1033                     ( p_bom_revision_tbl => p_bom_revision_tbl
1034                     , p_assembly_item_name => l_assembly_item_name
1035                     , p_organization_code => l_organization_code
1036                     )
1037                   THEN
1038                   RETURN FALSE;
1039                   END IF;
1040             END IF;
1041 
1042             IF NOT Does_Comp_Have_Same_Bom
1043                   ( p_bom_component_tbl => p_bom_component_tbl
1044                   , p_assembly_item_name => l_assembly_item_name
1045                   , p_organization_code => l_organization_code
1046                   )
1047             THEN
1048                 RETURN FALSE;
1049             END IF;
1050 
1051             IF NOT Does_Desg_Have_Same_Bom
1052                   ( p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1053                   , p_assembly_item_name => l_assembly_item_name
1054                   , p_organization_code => l_organization_code
1055                   )
1056             THEN
1057                 RETURN FALSE;
1058             END IF;
1059 
1060             IF NOT Does_SComp_Have_Same_Bom
1061                   ( p_bom_sub_component_tbl => p_bom_sub_component_tbl
1062                   , p_assembly_item_name => l_assembly_item_name
1063                   , p_organization_code => l_organization_code
1064                   )
1065             THEN
1066                 RETURN FALSE;
1067             END IF;
1068 
1069 
1070             IF NOT Does_CmpOps_Have_Same_Bom
1071                   ( p_bom_comp_ops_tbl => p_bom_comp_ops_tbl
1072                   , p_assembly_item_name => l_assembly_item_name
1073                   , p_organization_code => l_organization_code
1074                   )
1075             THEN
1076                 RETURN FALSE;
1077             END IF;
1078 
1079             RETURN TRUE;
1080         END IF; -- If Revision Table is Not Empty Ends
1081 
1082         record_count := p_bom_component_tbl.COUNT;
1083         IF record_count <> 0
1084         THEN
1085             l_assembly_item_name :=
1086         p_bom_component_tbl(1).assembly_item_name;
1087             l_organization_code :=
1088         p_bom_component_tbl(1).organization_code;
1089             x_assembly_item_name :=
1090         p_bom_component_tbl(1).assembly_item_name;
1091             x_organization_code :=
1092         p_bom_component_tbl(1).organization_code;
1093 
1094             IF record_count > 1
1095             THEN
1096               IF NOT Does_Comp_Have_Same_Bom
1097                     ( p_bom_component_tbl => p_bom_component_tbl
1098                     , p_assembly_item_name => l_assembly_item_name
1099                     , p_organization_code => l_organization_code
1100                     )
1101               THEN
1102                   RETURN FALSE;
1103                   END IF;
1104             END IF;
1105 
1106             IF NOT Does_Desg_Have_Same_Bom
1107                   ( p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1108                   , p_assembly_item_name => l_assembly_item_name
1112                 RETURN FALSE;
1109                   , p_organization_code => l_organization_code
1110                   )
1111             THEN
1113             END IF;
1114 
1115             IF NOT Does_SComp_Have_Same_Bom
1116                   ( p_bom_sub_component_tbl => p_bom_sub_component_tbl
1117                   , p_assembly_item_name => l_assembly_item_name
1118                   , p_organization_code => l_organization_code
1119                   )
1120             THEN
1121                 RETURN FALSE;
1122             END IF;
1123 
1124 
1125             IF NOT Does_CmpOps_Have_Same_Bom
1126                   ( p_bom_comp_ops_tbl => p_bom_comp_ops_tbl
1127                   , p_assembly_item_name => l_assembly_item_name
1128                   , p_organization_code => l_organization_code
1129                   )
1130             THEN
1131                 RETURN FALSE;
1132             END IF;
1133 
1134             RETURN TRUE;
1135         END IF; -- If Bom Component Table is not Empty Ends
1136 
1137         record_count := p_bom_ref_designator_tbl.COUNT;
1138         IF record_count <> 0
1139         THEN
1140             l_assembly_item_name :=
1141         p_bom_ref_designator_tbl(1).assembly_item_name;
1142             l_organization_code :=
1143         p_bom_ref_designator_tbl(1).organization_code;
1144             x_assembly_item_name :=
1145         p_bom_ref_designator_tbl(1).assembly_item_name;
1146             x_organization_code :=
1147         p_bom_ref_designator_tbl(1).organization_code;
1148 
1149             IF record_count > 1
1150             THEN
1151                   IF NOT Does_Desg_Have_Same_Bom
1152                     ( p_bom_ref_designator_tbl =>
1153             p_bom_ref_designator_tbl
1154                     , p_assembly_item_name => l_assembly_item_name
1155                     , p_organization_code => l_organization_code
1156                     )
1157                   THEN
1158                   RETURN FALSE;
1159                   END IF;
1160             END IF;
1161 
1162             IF NOT Does_SComp_Have_Same_Bom
1163                   ( p_bom_sub_component_tbl => p_bom_sub_component_tbl
1164                   , p_assembly_item_name => l_assembly_item_name
1165                   , p_organization_code => l_organization_code
1166                   )
1167             THEN
1168                 RETURN FALSE;
1169             END IF;
1170 
1171 
1172             IF NOT Does_CmpOps_Have_Same_Bom
1173                   ( p_bom_comp_ops_tbl => p_bom_comp_ops_tbl
1174                   , p_assembly_item_name => l_assembly_item_name
1175                   , p_organization_code => l_organization_code
1176                   )
1177             THEN
1178                 RETURN FALSE;
1179             END IF;
1180 
1181             RETURN TRUE;
1182         END IF; -- If reference Desingator Table is not Empty Ends
1183 
1184                 record_count := p_bom_sub_component_tbl.COUNT;
1185 
1186         IF record_count <> 0
1187         THEN
1188             l_assembly_item_name :=
1189         p_bom_sub_component_tbl(1).assembly_item_name;
1190             l_organization_code :=
1191         p_bom_sub_component_tbl(1).organization_code;
1192             x_assembly_item_name :=
1193         p_bom_sub_component_tbl(1).assembly_item_name;
1194             x_organization_code :=
1195         p_bom_sub_component_tbl(1).organization_code;
1196 
1197             IF record_count > 1
1198             THEN
1199                   IF NOT Does_SComp_Have_Same_Bom
1200                     ( p_bom_sub_component_tbl =>
1201             p_bom_sub_component_tbl
1202                     , p_assembly_item_name => l_assembly_item_name
1203                     , p_organization_code => l_organization_code
1204                     )
1205                   THEN
1206                   RETURN FALSE;
1207                   END IF;
1208             END IF;
1209 
1210 
1211             IF NOT Does_CmpOps_Have_Same_Bom
1212                   ( p_bom_comp_ops_tbl => p_bom_comp_ops_tbl
1213                   , p_assembly_item_name => l_assembly_item_name
1214                   , p_organization_code => l_organization_code
1215                   )
1216             THEN
1217                 RETURN FALSE;
1218             END IF;
1219 
1220             RETURN TRUE;
1221         END IF;  -- If Substitut Component Table is not Empty Ends
1222 
1223                 record_count := p_bom_comp_ops_tbl.COUNT;
1224 
1225         IF record_count <> 0
1226         THEN
1227             l_assembly_item_name :=
1228         p_bom_comp_ops_tbl(1).assembly_item_name;
1229             l_organization_code :=
1230         p_bom_comp_ops_tbl(1).organization_code;
1231             x_assembly_item_name :=
1232         p_bom_comp_ops_tbl(1).assembly_item_name;
1233             x_organization_code :=
1234         p_bom_comp_ops_tbl(1).organization_code;
1235 
1236             IF record_count > 1
1237             THEN
1238                   IF NOT Does_CmpOps_Have_Same_Bom
1239                     ( p_bom_comp_ops_tbl =>
1240             p_bom_comp_ops_tbl
1241                     , p_assembly_item_name => l_assembly_item_name
1242                     , p_organization_code => l_organization_code
1243                     )
1244                   THEN
1245                   RETURN FALSE;
1246                   END IF;
1247             END IF;
1251 
1248 
1249             RETURN TRUE;
1250         END IF;  -- Component Operations Table
1252         -- If nothing to process then return TRUE.
1253         --
1254         RETURN TRUE;
1255 
1256   END Check_Records_In_Same_BOM;
1257 
1258   /********************************************************************
1259   * Procedure : Process_Bom
1260   * Parameters IN : Bom Header exposed column record
1261   *     Bom Inventorty Component exposed column table
1262   *     Bom Item Revision Exposed Column Table
1263   *     Substitute Component Exposed Column table
1264   *     Reference Designator Exposed column table
1265   *     Component Operations Exposed column table
1266   * Parameters OUT: Bom Header Exposed Column Record
1267   *     Bom Inventory Components exposed column table
1268   *     Bom Item Revision Exposed Column Table
1269         *                 Substitute Component Exposed Column table
1270         *                 Reference Designator Exposed column table
1271   *     Component Operations Exposed column table
1272   * Purpose : This procedure is the driving procedure of the BOM
1273   *     business Obect. It will verify the integrity of the
1274   *     business object and will call the private API which
1275   *     further drive the business object to perform business
1276   *     logic validations.
1277   *********************************************************************/
1278   PROCEDURE Process_Bom
1279   (  p_bo_identifier           IN  VARCHAR2 := 'BOM'
1280    , p_api_version_number      IN  NUMBER := 1.0
1281    , p_init_msg_list       IN  BOOLEAN := FALSE
1282    , p_bom_header_rec      IN  Bom_Bo_Pub.Bom_Head_Rec_Type :=
1283           Bom_Bo_Pub.G_MISS_BOM_HEADER_REC
1284    , p_bom_revision_tbl      IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
1285           Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
1286    , p_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
1287           Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
1288    , p_bom_ref_designator_tbl  IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type
1289             := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
1290    , p_bom_sub_component_tbl   IN Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
1291             := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
1292          , p_bom_comp_ops_tbl        IN Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type :=
1293                                        Bom_Bo_Pub.G_MISS_BOM_COMP_OPS_TBL
1294    , x_bom_header_rec      IN OUT NOCOPY Bom_Bo_Pub.bom_Head_Rec_Type
1295    , x_bom_revision_tbl      IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
1296    , x_bom_component_tbl       IN OUT NOCOPY Bom_Bo_pub.Bom_Comps_Tbl_Type
1297    , x_bom_ref_designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
1298    , x_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
1299          , x_bom_comp_ops_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type
1300    , x_return_status           IN OUT NOCOPY VARCHAR2
1301    , x_msg_count               IN OUT NOCOPY NUMBER
1302          , p_debug                   IN  VARCHAR2 := 'N'
1303          , p_output_dir              IN  VARCHAR2 := NULL
1304          , p_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
1305          , p_write_err_to_inttable   IN  VARCHAR2 := 'N'
1306          , p_write_err_to_conclog    IN  VARCHAR2 := 'N'
1307          , p_write_err_to_debugfile  IN  VARCHAR2 := 'N'
1308    )
1309   IS
1310     G_EXC_SEV_QUIT_OBJECT       EXCEPTION;
1311     G_EXC_UNEXP_SKIP_OBJECT     EXCEPTION;
1312 
1313     l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
1314     l_other_message   VARCHAR2(50);
1315     l_Token_Tbl       Error_Handler.Token_Tbl_Type;
1316     l_err_text            VARCHAR2(2000);
1317     l_return_status   VARCHAR2(1);
1318 
1319     l_assembly_item_name  VARCHAR2(240);
1320     l_organization_code     VARCHAR2(3);
1321     l_organization_id       NUMBER;
1322     l_bom_header_rec        Bom_Bo_Pub.Bom_Head_Rec_Type := p_bom_header_rec;
1323     l_bom_revision_tbl      Bom_Bo_Pub.Bom_Revision_Tbl_Type;
1324     l_bom_component_tbl     Bom_Bo_Pub.Bom_Comps_Tbl_Type;
1325     l_bom_ref_designator_tbl Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type;
1326     l_bom_sub_component_tbl  Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type;
1327     l_bom_comp_ops_tbl      Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type;
1328     l_Debug_flag    VARCHAR2(1) := p_debug;
1329   BEGIN
1330 
1331                 --
1332                 -- Set Business Object Idenfier in the System Information
1333                 -- record.
1334                 --
1335                 Bom_Globals.Set_Bo_Identifier
1336                             (p_bo_identifier    =>  p_bo_identifier);
1337 
1338                 --
1339                 -- Initialize the message list if the user has set the
1340                 -- Init Message List parameter
1341                 --
1342                 IF p_init_msg_list
1343                 THEN
1344                         Error_Handler.Initialize;
1345                 END IF;
1346 
1347 
1348         IF l_debug_flag = 'Y'
1349             THEN
1350 
1351           IF trim(p_output_dir) IS NULL OR
1352              trim(p_output_dir) = ''
1353           THEN
1354         -- If debug is Y then out dir must be
1355         -- specified
1356 
1357               Error_Handler.Add_Error_Token
1358                           (  p_Message_text       =>
1359            'Debug is set to Y so an output directory' ||
1360            ' must be specified. Debug will be turned' ||
1361            ' off since no directory is specified'
1362                           , p_Mesg_Token_Tbl     => l_mesg_token_tbl
1366 
1363                           , x_Mesg_Token_Tbl     => l_mesg_token_tbl
1364                           , p_Token_Tbl          => l_token_tbl
1365                           );
1367                    Error_Handler.Log_Error
1368                          ( p_bom_header_rec      => p_bom_header_rec
1369                                , p_bom_revision_tbl => p_bom_revision_tbl
1370                          , p_bom_component_tbl => p_bom_component_tbl
1371                          , p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1372                          , p_bom_sub_component_tbl => p_bom_sub_component_tbl
1373                          , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1374                          , p_error_status => 'W'
1375                          , p_error_level => Error_Handler.G_BO_LEVEL
1376                          , x_bom_header_rec      => l_bom_header_rec
1377                          , x_bom_revision_tbl    => l_bom_revision_tbl
1378                          , x_bom_component_tbl   => l_bom_component_tbl
1379                          , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
1380                          , x_bom_sub_component_tbl => l_bom_sub_component_tbl
1381                          );
1382             l_debug_flag := 'N';
1383 
1384           END IF;
1385 
1386           IF trim(p_debug_filename) IS NULL OR
1387              trim(p_debug_filename) = ''
1388           THEN
1389 
1390                                 Error_Handler.Add_Error_Token
1391                                 (  p_Message_text       =>
1392                                    'Debug is set to Y so an output filename' ||
1393                                    ' must be specified. Debug will be turned' ||
1394                                    ' off since no filename is specified'
1395                                 , p_Mesg_Token_Tbl     => l_mesg_token_tbl
1396                                 , x_Mesg_Token_Tbl     => l_mesg_token_tbl
1397                                 , p_Token_Tbl          => l_token_tbl
1398                                 );
1399 
1400                                Error_Handler.Log_Error
1401                                ( p_bom_header_rec      => p_bom_header_rec
1402                                , p_bom_revision_tbl => p_bom_revision_tbl
1403                                , p_bom_component_tbl => p_bom_component_tbl
1404                                , p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1405                                , p_bom_sub_component_tbl => p_bom_sub_component_tbl
1406                                , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1407                                , p_error_status => 'W'
1408                                , p_error_level => Error_Handler.G_BO_LEVEL
1409                                , x_bom_header_rec      => l_bom_header_rec
1410                                , x_bom_revision_tbl    => l_bom_revision_tbl
1411                                , x_bom_component_tbl   => l_bom_component_tbl
1412                                , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
1413                                , x_bom_sub_component_tbl => l_bom_sub_component_tbl
1414                                );
1415                               l_debug_flag := 'N';
1416 
1417           END IF;
1418 
1419                 BOM_Globals.Set_Debug(l_debug_flag);
1420 
1421           IF l_debug_flag = 'Y'
1422           THEN
1423                   Error_Handler.Open_Debug_Session
1424                   (  p_debug_filename     => p_debug_filename
1425                    , p_output_dir         => p_output_dir
1426                    , x_return_status      => l_return_status
1427                    , p_mesg_token_tbl     => l_mesg_token_tbl
1428                    , x_mesg_token_tbl     => l_mesg_token_tbl
1429                    );
1430 
1431                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS
1432                   THEN
1433                         BOM_Globals.Set_Debug('N');
1434                   END IF;
1435           END IF;
1436             END IF;
1437 
1438 
1439     IF bom_globals.get_debug = 'Y' THEN error_handler.write_debug('The BO as passed '); end if;
1440     IF bom_globals.get_debug = 'Y' THEN error_handler.write_debug('Header Rec: ' || p_bom_header_rec.assembly_item_name); end if;
1441     IF bom_globals.get_debug = 'Y' THEN error_handler.write_debug('Num of Components: ' || p_bom_component_tbl.COUNT); end if;
1442     IF (p_bom_component_tbl.COUNT > 0)  THEN
1443             IF bom_globals.get_debug = 'Y' then
1444         Error_Handler.Write_Debug('Assembly key in Component: ' || p_bom_component_tbl(1).assembly_item_name);
1445       END IF;
1446     end if;
1447 
1448     IF bom_globals.get_debug = 'Y' then error_handler.write_debug('Num of Substitute: ' || p_bom_sub_component_tbl.COUNT); END IF;
1449     IF bom_globals.get_debug = 'Y' then error_handler.write_debug('Num of Ref. Desgs: ' || p_bom_ref_designator_tbl.COUNT); END IF;
1450 
1451     --
1452     -- Verify if all the entity record(s) belong to the same
1453     -- business object
1454     --
1455 
1456 if p_bom_sub_component_tbl.COUNT <> 0
1457 then
1458   if bom_globals.get_debug = 'Y'
1459   then
1460     for xx in 1..p_bom_sub_component_tbl.COUNT
1461     loop
1462       error_handler.write_debug('Substitute Component: ' || p_bom_sub_component_tbl(xx).substitute_component_name || ' Assembly ' || p_bom_sub_component_tbl(xx).assembly_item_name
1463              || ' Organization ' || p_bom_sub_component_tbl(xx).organization_code);
1464 
1465     end loop;
1466   end if;
1467 end if;
1468     IF NOT Check_Records_In_Same_BOM
1469        (  p_bom_header_rec    => p_bom_header_rec
1473         , p_bom_sub_component_tbl => p_bom_sub_component_tbl
1470         , p_bom_revision_tbl  => p_bom_revision_tbl
1471         , p_bom_component_tbl => p_bom_component_tbl
1472         , p_bom_ref_designator_tbl  => p_bom_ref_designator_tbl
1474         , p_bom_comp_ops_tbl  => p_bom_comp_ops_tbl
1475         , x_assembly_item_name  => l_assembly_item_name
1476         , x_organization_code => l_organization_code
1477         )
1478     THEN
1479             l_other_message := 'BOM_MUST_BE_IN_SAME_BOM';
1480       RAISE G_EXC_SEV_QUIT_OBJECT;
1481         END IF;
1482 
1483         IF (l_assembly_item_name IS NULL OR
1484               l_assembly_item_name = FND_API.G_MISS_CHAR)
1485               OR
1486               (l_organization_code IS NULL OR
1487                l_organization_code = FND_API.G_MISS_CHAR)
1488         THEN
1489             l_other_message := 'BOM_ASSY_OR_ORG_MISSING';
1490             RAISE G_EXC_SEV_QUIT_OBJECT;
1491         END IF;
1492 
1493 
1494     l_organization_id := Bom_Val_To_Id.Organization
1495                    (  p_organization => l_organization_code
1496                     , x_err_text => l_err_text
1497                    );
1498 
1499         IF l_organization_id IS NULL
1500         THEN
1501       l_other_message := 'BOM_ORG_INVALID';
1502       l_token_tbl(1).token_name := 'ORG_CODE';
1503       l_token_tbl(1).token_value := l_organization_code;
1504       RAISE G_EXC_SEV_QUIT_OBJECT;
1505 
1506         ELSIF l_organization_id = FND_API.G_MISS_NUM
1507         THEN
1508       l_other_message := 'BOM_UNEXP_ORG_INVALID';
1509             RAISE G_EXC_UNEXP_SKIP_OBJECT;
1510         END IF;
1511 
1512 
1513     --
1514     -- Set Organization Id in the System Information record.
1515     --
1516         Bom_Globals.Set_Org_Id( p_org_id  => l_organization_id);
1517 
1518     --
1519     -- Set Application Id in the appication context and set the
1520     -- fine-grained security policy on bom_alternate_designators
1521     -- table. This is currently applicable only if the application
1522     -- calling this BO is EAM
1523     --
1524   Bom_Set_Context.set_application_id;
1525 
1526     --
1527     -- Call the Private API for performing further business
1528     -- rules validation
1529     --
1530 
1531     --
1532     -- set the implementation date based on the alternate designator and the
1533     -- create unimplemented structures flag set at the structure type level.
1534     --
1535     BEGIN
1536        IF(l_bom_header_rec.alternate_bom_code IS NULL)
1537        THEN
1538            select decode(enable_unimplemented_boms,'Y',null, sysdate)
1539              into l_bom_header_rec.BOM_Implementation_Date
1540              from bom_structure_types_b stype,
1541                   bom_alternate_designators alt
1542             where alt.alternate_designator_code IS NULL
1543               and stype.structure_type_id = alt.structure_type_id;
1544      ELSE
1545            select decode(enable_unimplemented_boms,'Y',null, sysdate)
1546              into l_bom_header_rec.BOM_Implementation_Date
1547              from bom_structure_types_b stype,
1548                   bom_alternate_designators alt
1549             where alt.alternate_designator_code = l_bom_header_rec.alternate_bom_code
1550               and organization_id = l_organization_id
1551               and stype.structure_type_id = alt.structure_type_id;
1552      END IF;
1553     EXCEPTION -- bug 3481464
1554     WHEN NO_DATA_FOUND THEN
1555 -- The control can come here only when the caller is from a form in EAM responsibility
1556 -- The security policy will be set for EAM and the above queries would throw this
1557 -- exception, which will be handled as below. 'Asset BOM' is a seeded structure type.
1558        IF(l_bom_header_rec.alternate_bom_code IS NULL)
1559        THEN
1560            select decode(enable_unimplemented_boms,'Y',null, sysdate)
1561              into l_bom_header_rec.BOM_Implementation_Date
1562              from bom_structure_types_b stype
1563             where stype.structure_type_name = 'Asset BOM';
1564        ELSE
1565 -- The control should not come here when the alternate is not null. The query above should
1566 -- not throw a no_data_found exception. If it throws, then there is something else which is wrong
1567            l_bom_header_rec.BOM_Implementation_Date := null;
1568        END IF;
1569     END;
1570 
1571     Bom_Bo_Pvt.Process_Bom
1572     (   p_api_version_number     => p_api_version_number
1573     ,   x_return_status          => l_return_status
1574     ,   x_msg_count              => x_msg_count
1575     ,   p_bom_header_rec         => l_bom_header_rec
1576     ,   p_bom_revision_tbl       => p_bom_revision_tbl
1577     ,   p_bom_component_tbl      => p_bom_component_tbl
1578     ,   p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1579     ,   p_bom_sub_component_tbl  => p_bom_sub_component_tbl
1580     ,   p_bom_comp_ops_tbl       => p_bom_comp_ops_tbl
1581     ,   x_bom_header_rec         => x_bom_header_rec
1582     ,   x_bom_revision_tbl       => x_bom_revision_tbl
1583     ,   x_bom_component_tbl      => x_bom_component_tbl
1584     ,   x_bom_ref_designator_tbl => x_bom_ref_designator_tbl
1585     ,   x_bom_sub_component_tbl  => x_bom_sub_component_tbl
1586     ,   x_bom_comp_ops_tbl       => x_bom_comp_ops_tbl
1587     );
1588 
1589     Bom_Globals.Set_Org_Id( p_org_id  => NULL);
1590     Bom_Globals.Set_Eco_Name( p_eco_name  => NULL);
1591 
1592           IF l_return_status <> 'S'
1593     THEN
1594     -- Call Error Handler
1598       l_token_tbl(2).token_name := 'ORGANIZATION_CODE';
1595 
1596       l_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
1597       l_token_tbl(1).token_value := l_assembly_item_name;
1599       l_token_tbl(2).token_value := l_organization_code;
1600 
1601             Error_Handler.Log_Error
1602                 ( p_error_status  => l_return_status
1603                 , p_error_scope   => Error_Handler.G_SCOPE_ALL
1604                 , p_error_level   => Error_Handler.G_BO_LEVEL
1605                 , p_other_message   => 'BOM_ERROR_BUSINESS_OBJECT'
1606                 , p_other_status  => l_return_status
1607                 , p_other_token_tbl   => l_token_tbl
1608                 , x_bom_header_rec  => l_bom_header_rec
1609                 , x_bom_revision_tbl  => l_bom_revision_tbl
1610                 , x_bom_component_tbl   => l_bom_component_tbl
1611                 , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
1612                 , x_bom_sub_component_tbl => l_bom_sub_component_tbl
1613                 );
1614     END IF;
1615 
1616     x_return_status := l_return_status;
1617           x_msg_count := Error_Handler.Get_Message_Count;
1618 
1619     IF p_write_err_to_inttable = 'Y'
1620     THEN
1621       Error_Handler.Write_To_InterfaceTable;
1622     END IF;
1623 
1624     IF p_write_err_to_conclog = 'Y'
1625     THEN
1626       Error_Handler.Write_To_ConcurrentLog;
1627     END IF;
1628 
1629     IF Bom_Globals.Get_Debug = 'Y' AND p_write_err_to_debugfile = 'Y'
1630     THEN
1631                   Error_Handler.Write_To_DebugFile;
1632                   Error_Handler.Close_Debug_Session;
1633           END IF;
1634 
1635 
1636       EXCEPTION
1637         WHEN G_EXC_SEV_QUIT_OBJECT THEN
1638 
1639         -- Call Error Handler
1640 
1641           Error_Handler.Log_Error
1642               ( p_bom_header_rec  => p_bom_header_rec
1643     , p_bom_revision_tbl => p_bom_revision_tbl
1644     , p_bom_component_tbl => p_bom_component_tbl
1645     , p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1646     , p_bom_sub_component_tbl => p_bom_sub_component_tbl
1647     , p_error_status => Error_Handler.G_STATUS_ERROR
1648     , p_error_scope => Error_Handler.G_SCOPE_ALL
1649     , p_error_level => Error_Handler.G_BO_LEVEL
1650                 , p_other_message => l_other_message
1651                 , p_other_status => Error_Handler.G_STATUS_ERROR
1652                 , p_other_token_tbl => l_token_tbl
1653     , x_bom_header_rec      => l_bom_header_rec
1654                 , x_bom_revision_tbl    => l_bom_revision_tbl
1655                 , x_bom_component_tbl   => l_bom_component_tbl
1656                 , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
1657                 , x_bom_sub_component_tbl => l_bom_sub_component_tbl
1658     );
1659 
1660           x_return_status := Error_Handler.G_STATUS_ERROR;
1661           x_msg_count := Error_Handler.Get_Message_Count;
1662                 IF Bom_Globals.Get_Debug = 'Y'
1663                 THEN
1664                   Error_Handler.Dump_Message_List;
1665                         Error_Handler.Close_Debug_Session;
1666                 END IF;
1667 
1668         WHEN G_EXC_UNEXP_SKIP_OBJECT THEN
1669 
1670         -- Call Error Handler
1671 
1672           Error_Handler.Log_Error
1673     ( p_bom_header_rec      => p_bom_header_rec
1674                 , p_bom_revision_tbl => p_bom_revision_tbl
1675                 , p_bom_component_tbl => p_bom_component_tbl
1676                 , p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1677                 , p_bom_sub_component_tbl => p_bom_sub_component_tbl
1678                 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1679                 , p_error_status => Error_Handler.G_STATUS_UNEXPECTED
1680                 , p_error_level => Error_Handler.G_BO_LEVEL
1681                 , p_other_status => Error_Handler.G_STATUS_NOT_PICKED
1682                 , p_other_message => l_other_message
1683                 , p_other_token_tbl => l_token_tbl
1684                 , x_bom_header_rec      => l_bom_header_rec
1685                 , x_bom_revision_tbl    => l_bom_revision_tbl
1686                 , x_bom_component_tbl   => l_bom_component_tbl
1687                 , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
1688                 , x_bom_sub_component_tbl => l_bom_sub_component_tbl
1689                 );
1690 
1691           x_return_status := Error_Handler.G_STATUS_UNEXPECTED;
1692           x_msg_count := Error_Handler.Get_Message_Count;
1693                 IF Bom_Globals.Get_Debug = 'Y'
1694                 THEN
1695                   Error_Handler.Dump_Message_List;
1696                         Error_Handler.Close_Debug_Session;
1697                 END IF;
1698 
1699   END Process_Bom;
1700 
1701   /********************************************************************
1702   * Procedure : Process_Bom
1703   * Parameters IN : Bom Header exposed column record
1704   *     Bom Inventorty Component exposed column table
1705   *     Bom Item Revision Exposed Column Table
1706   *     Substitute Component Exposed Column table
1707   *     Reference Designator Exposed column table
1708   * Parameters OUT: Bom Header Exposed Column Record
1709   *     Bom Inventory Components exposed column table
1710   *     Bom Item Revision Exposed Column Table
1711         *                 Substitute Component Exposed Column table
1712         *                 Reference Designator Exposed column table
1713   * Purpose : This procedure is the driving procedure of the BOM
1717   *     logic validations. (This is an overloaded procedure)
1714   *     business Obect. It will verify the integrity of the
1715   *     business object and will call the private API which
1716   *     further drive the business object to perform business
1718   *********************************************************************/
1719   PROCEDURE Process_Bom
1720   (  p_bo_identifier           IN  VARCHAR2 := 'BOM'
1721    , p_api_version_number      IN  NUMBER := 1.0
1722    , p_init_msg_list       IN  BOOLEAN := FALSE
1723    , p_bom_header_rec      IN  Bom_Bo_Pub.Bom_Head_Rec_Type :=
1724           Bom_Bo_Pub.G_MISS_BOM_HEADER_REC
1725    , p_bom_revision_tbl      IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
1726           Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
1727    , p_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
1728           Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
1729    , p_bom_ref_designator_tbl  IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type
1730             := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
1731    , p_bom_sub_component_tbl   IN Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
1732             := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
1733    , x_bom_header_rec      IN OUT NOCOPY Bom_Bo_Pub.bom_Head_Rec_Type
1734    , x_bom_revision_tbl      IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
1735    , x_bom_component_tbl       IN OUT NOCOPY Bom_Bo_pub.Bom_Comps_Tbl_Type
1736    , x_bom_ref_designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
1737    , x_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
1738    , x_return_status           IN OUT NOCOPY VARCHAR2
1739    , x_msg_count               IN OUT NOCOPY NUMBER
1740          , p_debug                   IN  VARCHAR2 := 'N'
1741          , p_output_dir              IN  VARCHAR2 := NULL
1742          , p_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
1743          , p_write_err_to_inttable   IN  VARCHAR2 := 'N'
1744          , p_write_err_to_conclog    IN  VARCHAR2 := 'N'
1745          , p_write_err_to_debugfile  IN  VARCHAR2 := 'N'
1746    )
1747         IS
1748            x_bom_comp_ops_tbl  Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type;
1749         BEGIN
1750 
1751      Process_Bom
1752      (  p_bo_identifier          => p_bo_identifier
1753       , p_api_version_number     => p_api_version_number
1754       , p_init_msg_list        => p_init_msg_list
1755       , p_bom_header_rec         => p_bom_header_rec
1756       , p_bom_revision_tbl       => p_bom_revision_tbl
1757       , p_bom_component_tbl      => p_bom_component_tbl
1758       , p_bom_ref_designator_tbl => p_bom_ref_designator_tbl
1759       , p_bom_sub_component_tbl  => p_bom_sub_component_tbl
1760             , p_bom_comp_ops_tbl       => Bom_Bo_Pub.G_MISS_BOM_COMP_OPS_TBL
1761       , x_bom_header_rec         => x_bom_header_rec
1762       , x_bom_revision_tbl       => x_bom_revision_tbl
1763       , x_bom_component_tbl      => x_bom_component_tbl
1764       , x_bom_ref_designator_tbl => x_bom_ref_designator_tbl
1765       , x_bom_sub_component_tbl  => x_bom_sub_component_tbl
1766             , x_bom_comp_ops_tbl       => x_bom_comp_ops_tbl
1767       , x_return_status          => x_return_status
1768       , x_msg_count              => x_msg_count
1769             , p_debug                  => p_debug
1770             , p_output_dir             => p_output_dir
1771             , p_debug_filename         => p_debug_filename
1772             , p_write_err_to_inttable  => p_write_err_to_inttable
1773             , p_write_err_to_conclog   => p_write_err_to_conclog
1774             , p_write_err_to_debugfile => p_write_err_to_debugfile
1775      );
1776         END;
1777 
1778 
1779         /********************************************************************
1780         * Procedure     : Process_Bom
1781         * Parameters IN :
1782         * Parameters OUT:
1783         * Purpose       : To process multiple business objects and to interact
1784   *     with the JAVA layer
1785         *********************************************************************/
1786 
1787   /*
1788 
1789         PROCEDURE Process_Bom
1790         (  p_bo_identifier           IN  VARCHAR2 := 'EBOM'
1791          , p_api_version_number      IN  NUMBER := 1.0
1792          , p_init_msg_list           IN  BOOLEAN := FALSE
1793          , p_bomheaders_tbl          IN  BOMHeadersTable
1794          , p_bomrevisions_tbl        IN  BOMRevisionsTable
1795          , p_bomcomponents_tbl       IN  BOMComponentsTable
1796          , p_bomrefdesignators_tbl   IN  BOMRefDesignatorsTable
1797          , p_bomsubcomponents_tbl    IN  BOMSubComponentsTable
1798          , p_bomcompoperations_tbl   IN  BOMCompOperationsTable
1799          , x_bomheaders_tbl          IN OUT NOCOPY BOMHeadersTable
1800          , x_bomrevisions_tbl        IN OUT NOCOPY BOMRevisionsTable
1801          , x_bomcomponents_tbl       IN OUT NOCOPY BOMComponentsTable
1802          , x_bomrefdesignators_tbl   IN OUT NOCOPY BOMRefDesignatorsTable
1803          , x_bomsubcomponents_tbl    IN OUT NOCOPY BOMSubComponentsTable
1804          , x_bomcompoperations_tbl   IN OUT NOCOPY BOMCompOperationsTable
1805          , x_process_return_status   IN OUT NOCOPY VARCHAR2
1806    , x_process_error_msg       IN OUT NOCOPY VARCHAR2
1807          , x_bo_return_status        IN OUT NOCOPY VARCHAR2
1808          , x_bo_msg_count            IN OUT NOCOPY NUMBER
1809          , p_debug                   IN  VARCHAR2 := 'N'
1810          , p_output_dir              IN  VARCHAR2 := NULL
1811          , p_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
1812          , p_write_err_to_inttable   IN  VARCHAR2 := 'N'
1813          , p_write_err_to_conclog    IN  VARCHAR2 := 'N'
1817     l_bomlist_tbl             BOMListTable;
1814          , p_write_err_to_debugfile  IN  VARCHAR2 := 'N'
1815          ) IS
1816 
1818 
1819     -- Local variables for the IN parameters
1820 
1821           l_bomheaders_tbl          BOMHeadersTable        := p_bomheaders_tbl;
1822           l_bomrevisions_tbl        BOMRevisionsTable      := p_bomrevisions_tbl;
1823           l_bomcomponents_tbl       BOMComponentsTable     := p_bomcomponents_tbl;
1824           l_bomrefdesignators_tbl   BOMRefDesignatorsTable := p_bomrefdesignators_tbl;
1825           l_bomsubcomponents_tbl    BOMSubComponentsTable  := p_bomsubcomponents_tbl;
1826           l_bomcompoperations_tbl   BOMCompOperationsTable := p_bomcompoperations_tbl;
1827 
1828 
1829     -- BOM BO input parameters
1830 
1831           l_bom_header_rec         Bom_Bo_Pub.Bom_Head_Rec_Type;
1832           l_bom_revision_tbl       Bom_Bo_Pub.Bom_Revision_Tbl_Type;
1833           l_bom_component_tbl      Bom_Bo_Pub.Bom_Comps_Tbl_Type;
1834           l_bom_ref_designator_tbl Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type;
1835           l_bom_sub_component_tbl  Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type;
1836           l_bom_comp_ops_tbl       Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type;
1837 
1838     -- Input records count
1839 
1840     l_listcount           NUMBER;
1841     l_hdrcount            NUMBER;
1842     l_revcount    NUMBER;
1843     l_compcount   NUMBER;
1844     l_refdescount   NUMBER;
1845     l_subcompcount  NUMBER;
1846     l_compopscount  NUMBER;
1847 
1848 
1849     -- Processed records count
1850 
1851     l_phdrcount   NUMBER;
1852     l_prevcount   NUMBER;
1853     l_pcompcount    NUMBER;
1854     l_prefdescount  NUMBER;
1855     l_psubcompcount NUMBER;
1856     l_pcompopscount NUMBER;
1857 
1858     -- Status and message variables
1859 
1860     l_bo_return_status        VARCHAR2(1);
1861     l_return_status           VARCHAR2(1);
1862     l_msg_count               NUMBER := 0;
1863       l_previous_msg_count      NUMBER := 0;
1864 
1865     i               NUMBER; -- Used as counter variable
1866 
1867     -- Business Object Identifier variables
1868 
1869     l_assembly_item_name VARCHAR2(2000);
1870     l_organization_code  VARCHAR2(3);
1871     l_alternate_bom_code VARCHAR2(10);
1872 
1873     l_more_data        BOOLEAN := TRUE;
1874 
1875   BEGIN
1876 
1877 
1878       -- Business Object process status: If multiple business objects are
1879             -- processed during this call, then the status will be 'S' if all of them
1880             -- are successful or the status will be 'E' or 'U which depends on the status
1881             -- of the last errored out BO
1882 
1883       l_bo_return_status := 'S';
1884 
1885 
1886       -- Calculate the input count
1887 
1888       IF l_bomheaders_tbl IS NOT NULL
1889       THEN
1890         l_hdrcount  := l_bomheaders_tbl.COUNT;
1891       ELSE
1892         l_hdrcount  := 0;
1893       END IF;
1894 
1895       IF l_bomrevisions_tbl IS NOT NULL
1896       THEN
1897         l_revcount    := l_bomrevisions_tbl.COUNT;
1898       ELSE
1899         l_revcount    := 0;
1900       END IF;
1901 
1902       IF l_bomcomponents_tbl IS NOT NULL
1903       THEN
1904         l_compcount   := l_bomcomponents_tbl.COUNT;
1905       ELSE
1906         l_compcount   := 0;
1907       END IF;
1908 
1909       IF l_bomrefdesignators_tbl IS NOT NULL
1910       THEN
1911         l_refdescount   := l_bomrefdesignators_tbl.COUNT;
1912       ELSE
1913         l_refdescount   := 0;
1914       END IF;
1915 
1916       IF l_bomsubcomponents_tbl IS NOT NULL
1917       THEN
1918         l_subcompcount    := l_bomsubcomponents_tbl.COUNT;
1919       ELSE
1920         l_subcompcount    := 0;
1921       END IF;
1922 
1923       IF l_bomcompoperations_tbl IS NOT NULL
1924       THEN
1925         l_compopscount    := l_bomcompoperations_tbl.COUNT;
1926       ELSE
1927         l_compopscount    := 0;
1928       END IF;
1929 
1930       -- Group the data by each business object
1931 
1932 
1933       WHILE (l_more_data)
1934       LOOP
1935 
1936         -- Initialize all the variables for each business object
1937 
1938               l_bom_header_rec         := Bom_Bo_Pub.G_MISS_BOM_HEADER_REC;
1939               l_bom_revision_tbl       := Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL;
1940               l_bom_component_tbl      := Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL;
1941               l_bom_ref_designator_tbl := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL;
1942               l_bom_sub_component_tbl  := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL;
1943               l_bom_comp_ops_tbl       := Bom_Bo_Pub.G_MISS_BOM_COMP_OPS_TBL;
1944 
1945 
1946         l_assembly_item_name := NULL;
1947               l_organization_code  := NULL;
1948         l_alternate_bom_code := NULL;
1949 
1950         l_return_status := 'S';
1951         l_msg_count     := 0;
1952 
1953         -- Header : Convert from OBJECT type to RECORD type
1954 
1955         IF l_hdrcount <> 0 THEN
1956 
1957           FOR hdrRec IN 1..l_hdrcount
1958           LOOP
1959             IF l_bomheaders_tbl(hdrRec).return_status IS NULL OR
1960                l_bomheaders_tbl(hdrRec).return_status = FND_API.G_MISS_CHAR
1964         l_alternate_bom_code := l_bomheaders_tbl(hdrRec).alternate_bom_code;
1961       THEN
1962         l_assembly_item_name := l_bomheaders_tbl(hdrRec).assembly_item_name;
1963                     l_organization_code  := l_bomheaders_tbl(hdrRec).organization_code;
1965 
1966           l_bom_header_rec.Assembly_item_name      :=
1967           l_bomheaders_tbl(hdrRec).Assembly_item_name;
1968           l_bom_header_rec.Organization_Code       :=
1969           l_bomheaders_tbl(hdrRec).Organization_Code;
1970               l_bom_header_rec.Alternate_Bom_Code      :=
1971           l_bomheaders_tbl(hdrRec).Alternate_Bom_Code;
1972               l_bom_header_rec.Common_Assembly_Item_Name :=
1973           l_bomheaders_tbl(hdrRec).Common_Assembly_Item_Name;
1974               l_bom_header_rec.Assembly_Comment     :=
1975           l_bomheaders_tbl(hdrRec).Assembly_Comment;
1976               l_bom_header_rec.Assembly_Type      :=
1977           l_bomheaders_tbl(hdrRec).Assembly_Type;
1978               l_bom_header_rec.Transaction_Type     :=
1979           l_bomheaders_tbl(hdrRec).Transaction_Type;
1980               l_bom_header_rec.Return_Status            :=
1981           l_bomheaders_tbl(hdrRec).Return_Status;
1982               l_bom_header_rec.Attribute_category     :=
1983           l_bomheaders_tbl(hdrRec).Attribute_category;
1984               l_bom_header_rec.Attribute1  :=
1985           l_bomheaders_tbl(hdrRec).Attribute1;
1986                     l_bom_header_rec.Attribute2  :=
1987           l_bomheaders_tbl(hdrRec).Attribute2;
1988                     l_bom_header_rec.Attribute3 :=
1989           l_bomheaders_tbl(hdrRec).Attribute3;
1990                     l_bom_header_rec.Attribute4  :=
1991           l_bomheaders_tbl(hdrRec).Attribute4;
1992               l_bom_header_rec.Attribute5  :=
1993           l_bomheaders_tbl(hdrRec).Attribute5 ;
1994               l_bom_header_rec.Attribute6  :=
1995           l_bomheaders_tbl(hdrRec).Attribute6;
1996               l_bom_header_rec.Attribute7  :=
1997           l_bomheaders_tbl(hdrRec).Attribute7;
1998               l_bom_header_rec.Attribute8  :=
1999           l_bomheaders_tbl(hdrRec).Attribute8;
2000               l_bom_header_rec.Attribute9  :=
2001           l_bomheaders_tbl(hdrRec).Attribute9;
2002               l_bom_header_rec.Attribute10 :=
2003           l_bomheaders_tbl(hdrRec).Attribute10;
2004               l_bom_header_rec.Attribute11 :=
2005           l_bomheaders_tbl(hdrRec).Attribute11;
2006               l_bom_header_rec.Attribute12 :=
2007           l_bomheaders_tbl(hdrRec).Attribute12;
2008               l_bom_header_rec.Attribute13 :=
2009           l_bomheaders_tbl(hdrRec).Attribute13;
2010               l_bom_header_rec.Attribute14 :=
2011           l_bomheaders_tbl(hdrRec).Attribute14;
2012               l_bom_header_rec.Attribute15 :=
2013           l_bomheaders_tbl(hdrRec).Attribute15;
2014               l_bom_header_rec.Original_System_Reference  :=
2015           l_bomheaders_tbl(hdrRec).Original_System_Reference;
2016               l_bom_header_rec.Delete_Group_Name      :=
2017           l_bomheaders_tbl(hdrRec).Delete_Group_Name;
2018               l_bom_header_rec.DG_Description      :=
2019           l_bomheaders_tbl(hdrRec).DG_Description;
2020               l_bom_header_rec.Delete_Group_Name      :=
2021           l_bomheaders_tbl(hdrRec).Delete_Group_Name;
2022 
2023         -- Delete the record that has been already converted
2024 
2025         l_bomheaders_tbl.DELETE(hdrRec);
2026 
2027         -- Assign a not null value to the return status to avoid this record from being
2028         -- processed next time
2029 
2030         l_bomheaders_tbl(hdrRec).return_status := 'P';
2031 
2032         Exit;
2033       END IF;
2034     END LOOP;
2035         END IF; --  Header Record ends
2036 
2037 
2038         -- Item Revisions : Group the business object data from item revisions and
2039         -- convert them from OBJECT type to RECORD type
2040 
2041         IF l_revcount <> 0 THEN
2042 
2043     i := 0;
2044 
2045           FOR revRec IN 1..l_revcount
2046           LOOP
2047 
2048             IF l_bomrevisions_tbl(revRec).return_status IS NULL OR
2049                l_bomrevisions_tbl(revRec).return_status = FND_API.G_MISS_CHAR
2050       THEN
2051 
2052         IF (l_assembly_item_name IS NULL) OR
2053                        (l_assembly_item_name IS NOT NULL AND
2054             l_bomrevisions_tbl(revRec).assembly_item_name = l_assembly_item_name AND
2055                         l_bomrevisions_tbl(revRec).organization_code = l_organization_code AND
2056             l_bomrevisions_tbl(revRec).alternate_bom_code = l_alternate_bom_code)
2057         THEN
2058 
2059           IF l_assembly_item_name IS NULL
2060           THEN
2061             l_assembly_item_name := l_bomrevisions_tbl(revRec).assembly_item_name;
2062                         l_organization_code  := l_bomrevisions_tbl(revRec).organization_code;
2063             l_alternate_bom_code := l_bomrevisions_tbl(revRec).alternate_bom_code;
2064           END IF;
2065 
2066           i := i+ 1;
2067 
2068           l_bom_revision_tbl(i).Organization_Code     :=
2069           l_bomrevisions_tbl(revRec).Organization_Code ;
2070           l_bom_revision_tbl(i).Assembly_Item_Name     :=
2071           l_bomrevisions_tbl(revRec).Assembly_Item_Name ;
2072           l_bom_revision_tbl(i).Alternate_BOM_Code   :=
2073           l_bomrevisions_tbl(revRec).Alternate_BOM_Code;
2074           l_bom_revision_tbl(i).Revision  :=
2075           l_bomrevisions_tbl(revRec).Revision;
2079           l_bomrevisions_tbl(revRec).Description;
2076           l_bom_revision_tbl(i).Start_Effective_Date  :=
2077           l_bomrevisions_tbl(revRec).Start_Effective_Date;
2078           l_bom_revision_tbl(i).Description  :=
2080           l_bom_revision_tbl(i).Attribute_category     :=
2081           l_bomrevisions_tbl(revRec).Attribute_category;
2082           l_bom_revision_tbl(i).Attribute1  :=
2083           l_bomrevisions_tbl(revRec).Attribute1;
2084           l_bom_revision_tbl(i).Attribute2  :=
2085           l_bomrevisions_tbl(revRec).Attribute2;
2086           l_bom_revision_tbl(i).Attribute3  :=
2087           l_bomrevisions_tbl(revRec).Attribute3;
2088           l_bom_revision_tbl(i).Attribute4  :=
2089           l_bomrevisions_tbl(revRec).Attribute4;
2090           l_bom_revision_tbl(i).Attribute5  :=
2091           l_bomrevisions_tbl(revRec).Attribute5;
2092           l_bom_revision_tbl(i).Attribute6  :=
2093           l_bomrevisions_tbl(revRec).Attribute6;
2094           l_bom_revision_tbl(i).Attribute7  :=
2095           l_bomrevisions_tbl(revRec).Attribute7;
2096           l_bom_revision_tbl(i).Attribute8  :=
2097           l_bomrevisions_tbl(revRec).Attribute8;
2098           l_bom_revision_tbl(i).Attribute9  :=
2099           l_bomrevisions_tbl(revRec).Attribute9;
2100           l_bom_revision_tbl(i).Attribute10 :=
2101           l_bomrevisions_tbl(revRec).Attribute10;
2102           l_bom_revision_tbl(i).Attribute11 :=
2103           l_bomrevisions_tbl(revRec).Attribute11;
2104           l_bom_revision_tbl(i).Attribute12 :=
2105           l_bomrevisions_tbl(revRec).Attribute12;
2106           l_bom_revision_tbl(i).Attribute13 :=
2107           l_bomrevisions_tbl(revRec).Attribute13;
2108           l_bom_revision_tbl(i).Attribute14 :=
2109           l_bomrevisions_tbl(revRec).Attribute14;
2110           l_bom_revision_tbl(i).Attribute15 :=
2111           l_bomrevisions_tbl(revRec).Attribute15;
2112           l_bom_revision_tbl(i).Return_Status     :=
2113           l_bomrevisions_tbl(revRec).Return_Status;
2114           l_bom_revision_tbl(i).Transaction_Type     :=
2115           l_bomrevisions_tbl(revRec).Transaction_Type;
2116           l_bom_revision_tbl(i).Original_System_Reference     :=
2117           l_bomrevisions_tbl(revRec).Original_System_Reference;
2118 
2119           -- Delete the record that has been already converted
2120 
2121           l_bomrevisions_tbl.DELETE(revRec);
2122 
2123           -- Assign a not null value to the return status to avoid this record from being
2124           -- processed next time
2125 
2126           l_bomrevisions_tbl(revRec).return_status := 'P';
2127 
2128         END IF;
2129       END IF;
2130           END LOOP;
2131         END IF;  -- Revision Table ends
2132 
2133 
2134         -- Component : Group the business object data from components and
2135         --             convert them from OBJECT type to RECORD type
2136 
2137 
2138         IF l_compcount <> 0 THEN
2139 
2140     i := 0;
2141 
2142           FOR compRec IN 1..l_compcount
2143           LOOP
2144 
2145             IF l_bomcomponents_tbl(compRec).return_status IS NULL OR
2146                l_bomcomponents_tbl(compRec).return_status = FND_API.G_MISS_CHAR
2147       THEN
2148 
2149         IF (l_assembly_item_name IS NULL) OR
2150                        (l_assembly_item_name IS NOT NULL AND
2151             l_bomcomponents_tbl(compRec).assembly_item_name = l_assembly_item_name AND
2152                         l_bomcomponents_tbl(compRec).organization_code = l_organization_code AND
2153             l_bomcomponents_tbl(compRec).alternate_bom_code = l_alternate_bom_code)
2154         THEN
2155 
2156           IF l_assembly_item_name IS NULL
2157           THEN
2158             l_assembly_item_name := l_bomcomponents_tbl(compRec).assembly_item_name;
2159                         l_organization_code  := l_bomcomponents_tbl(compRec).organization_code;
2160             l_alternate_bom_code := l_bomcomponents_tbl(compRec).alternate_bom_code;
2161           END IF;
2162 
2163           i := i+ 1;
2164 
2165           l_bom_component_tbl(i).Organization_Code     :=
2166           l_bomcomponents_tbl(compRec).Organization_Code ;
2167           l_bom_component_tbl(i).Assembly_Item_Name     :=
2168           l_bomcomponents_tbl(compRec).Assembly_Item_Name ;
2169           l_bom_component_tbl(i).Start_Effective_Date  :=
2170           l_bomcomponents_tbl(compRec).Start_Effective_Date;
2171           l_bom_component_tbl(i).Disable_Date     :=
2172           l_bomcomponents_tbl(compRec).Disable_Date;
2173           l_bom_component_tbl(i).Operation_Sequence_Number    :=
2174           l_bomcomponents_tbl(compRec).Operation_Sequence_Number;
2175           l_bom_component_tbl(i).Component_Item_Name   :=
2176           l_bomcomponents_tbl(compRec).Component_Item_Name;
2177           l_bom_component_tbl(i).Alternate_BOM_Code   :=
2178           l_bomcomponents_tbl(compRec).Alternate_BOM_Code;
2179           l_bom_component_tbl(i).New_Effectivity_Date  :=
2180           l_bomcomponents_tbl(compRec).New_Effectivity_Date;
2181           l_bom_component_tbl(i).New_Operation_Sequence_Number   :=
2182           l_bomcomponents_tbl(compRec).New_Operation_Sequence_Number;
2183           l_bom_component_tbl(i).Item_Sequence_Number   :=
2184           l_bomcomponents_tbl(compRec).Item_Sequence_Number;
2185           l_bom_component_tbl(i).Basis_Type:=
2186           l_bomcomponents_tbl(compRec).Basis_Type;
2187           l_bom_component_tbl(i).Quantity_Per_Assembly  :=
2191           l_bom_component_tbl(i).Planning_Percent  :=
2188           l_bomcomponents_tbl(compRec).Quantity_Per_Assembly;
2189           l_bom_component_tbl(i).Inverse_Quantity  :=
2190           l_bomcomponents_tbl(compRec).Inverse_Quantity;
2192           l_bomcomponents_tbl(compRec).Planning_Percent;
2193           l_bom_component_tbl(i).Projected_Yield     :=
2194           l_bomcomponents_tbl(compRec).Projected_Yield;
2195           l_bom_component_tbl(i).Include_In_Cost_Rollup :=
2196           l_bomcomponents_tbl(compRec).Include_In_Cost_Rollup;
2197           l_bom_component_tbl(i).Wip_Supply_Type     :=
2198           l_bomcomponents_tbl(compRec).Wip_Supply_Type;
2199           l_bom_component_tbl(i).So_Basis     :=
2200           l_bomcomponents_tbl(compRec).So_Basis;
2201           l_bom_component_tbl(i).Optional     :=
2202           l_bomcomponents_tbl(compRec).Optional;
2203           l_bom_component_tbl(i).Mutually_Exclusive     :=
2204           l_bomcomponents_tbl(compRec).Mutually_Exclusive;
2205           l_bom_component_tbl(i).Check_Atp     :=
2206           l_bomcomponents_tbl(compRec).Check_Atp;
2207           l_bom_component_tbl(i).Shipping_Allowed     :=
2208           l_bomcomponents_tbl(compRec).Shipping_Allowed;
2209           l_bom_component_tbl(i).Required_To_Ship     :=
2210           l_bomcomponents_tbl(compRec).Required_To_Ship;
2211           l_bom_component_tbl(i).Required_For_Revenue  :=
2212           l_bomcomponents_tbl(compRec).Required_For_Revenue;
2213           l_bom_component_tbl(i).Include_On_Ship_Docs  :=
2214           l_bomcomponents_tbl(compRec).Include_On_Ship_Docs;
2215           l_bom_component_tbl(i).Quantity_Related     :=
2216           l_bomcomponents_tbl(compRec).Quantity_Related;
2217           l_bom_component_tbl(i).Supply_Subinventory   :=
2218           l_bomcomponents_tbl(compRec).Supply_Subinventory;
2219           l_bom_component_tbl(i).Location_Name     :=
2220           l_bomcomponents_tbl(compRec).Location_Name;
2221           l_bom_component_tbl(i).Minimum_Allowed_Quantity :=
2222           l_bomcomponents_tbl(compRec).Minimum_Allowed_Quantity;
2223           l_bom_component_tbl(i).Maximum_Allowed_Quantity     :=
2224           l_bomcomponents_tbl(compRec).Maximum_Allowed_Quantity;
2225           l_bom_component_tbl(i).Comments     :=
2226           l_bomcomponents_tbl(compRec).Comments;
2227           l_bom_component_tbl(i).Attribute_category     :=
2228           l_bomcomponents_tbl(compRec).Attribute_category;
2229           l_bom_component_tbl(i).Attribute1  :=
2230           l_bomcomponents_tbl(compRec).Attribute1;
2231           l_bom_component_tbl(i).Attribute2  :=
2232           l_bomcomponents_tbl(compRec).Attribute2;
2233           l_bom_component_tbl(i).Attribute3  :=
2234           l_bomcomponents_tbl(compRec).Attribute3;
2235           l_bom_component_tbl(i).Attribute4  :=
2236           l_bomcomponents_tbl(compRec).Attribute4;
2237           l_bom_component_tbl(i).Attribute5  :=
2238           l_bomcomponents_tbl(compRec).Attribute5;
2239           l_bom_component_tbl(i).Attribute6  :=
2240           l_bomcomponents_tbl(compRec).Attribute6;
2241           l_bom_component_tbl(i).Attribute7  :=
2242           l_bomcomponents_tbl(compRec).Attribute7;
2243           l_bom_component_tbl(i).Attribute8  :=
2244           l_bomcomponents_tbl(compRec).Attribute8;
2245           l_bom_component_tbl(i).Attribute9  :=
2246           l_bomcomponents_tbl(compRec).Attribute9;
2247           l_bom_component_tbl(i).Attribute10 :=
2248           l_bomcomponents_tbl(compRec).Attribute10;
2249           l_bom_component_tbl(i).Attribute11 :=
2250           l_bomcomponents_tbl(compRec).Attribute11;
2251           l_bom_component_tbl(i).Attribute12 :=
2252           l_bomcomponents_tbl(compRec).Attribute12;
2253           l_bom_component_tbl(i).Attribute13 :=
2254           l_bomcomponents_tbl(compRec).Attribute13;
2255           l_bom_component_tbl(i).Attribute14 :=
2256           l_bomcomponents_tbl(compRec).Attribute14;
2257           l_bom_component_tbl(i).Attribute15 :=
2258           l_bomcomponents_tbl(compRec).Attribute15;
2259           l_bom_component_tbl(i).From_End_Item_Unit_Number    :=
2260           l_bomcomponents_tbl(compRec).From_End_Item_Unit_Number;
2261           l_bom_component_tbl(i).New_From_End_Item_Unit_Number    :=
2262           l_bomcomponents_tbl(compRec).New_From_End_Item_Unit_Number;
2263           l_bom_component_tbl(i).To_End_Item_Unit_Number     :=
2264           l_bomcomponents_tbl(compRec).To_End_Item_Unit_Number;
2265           l_bom_component_tbl(i).Return_Status     :=
2266           l_bomcomponents_tbl(compRec).Return_Status;
2267           l_bom_component_tbl(i).Transaction_Type     :=
2268           l_bomcomponents_tbl(compRec).Transaction_Type;
2269           l_bom_component_tbl(i).Original_System_Reference     :=
2270           l_bomcomponents_tbl(compRec).Original_System_Reference;
2271           l_bom_component_tbl(i).Delete_Group_Name     :=
2272           l_bomcomponents_tbl(compRec).Delete_Group_Name;
2273           l_bom_component_tbl(i).DG_Description     :=
2274           l_bomcomponents_tbl(compRec).DG_Description;
2275           l_bom_component_tbl(i).Enforce_Int_Requirements    :=
2276           l_bomcomponents_tbl(compRec).Enforce_Int_Requirements;
2277 
2278           -- Delete the record that has been already converted
2279 
2280           l_bomcomponents_tbl.DELETE(compRec);
2281 
2282           -- Assign a not null value to the return status to avoid this record from being
2283           -- processed next time
2284 
2285           l_bomcomponents_tbl(compRec).return_status := 'P';
2286 
2290         END IF; -- Component Table ends
2287         END IF;
2288       END IF;
2289           END LOOP;
2291 
2292 
2293         -- Substitute Component : Group the business object data from substitute components and
2294         -- convert them from OBJECT type to RECORD type
2295 
2296 
2297         IF l_subcompcount <> 0 THEN
2298 
2299     i := 0;
2300 
2301           FOR scompRec IN 1..l_subcompcount
2302           LOOP
2303 
2304             IF l_bomsubcomponents_tbl(scompRec).return_status IS NULL OR
2305                l_bomsubcomponents_tbl(scompRec).return_status = FND_API.G_MISS_CHAR
2306       THEN
2307 
2308         IF (l_assembly_item_name IS NULL) OR
2309                        (l_assembly_item_name IS NOT NULL AND
2310             l_bomsubcomponents_tbl(scompRec).assembly_item_name = l_assembly_item_name AND
2311                         l_bomsubcomponents_tbl(scompRec).organization_code = l_organization_code AND
2312             l_bomsubcomponents_tbl(scompRec).alternate_bom_code = l_alternate_bom_code)
2313         THEN
2314 
2315           IF l_assembly_item_name IS NULL
2316           THEN
2317             l_assembly_item_name := l_bomsubcomponents_tbl(scompRec).assembly_item_name;
2318                         l_organization_code  := l_bomsubcomponents_tbl(scompRec).organization_code;
2319             l_alternate_bom_code := l_bomsubcomponents_tbl(scompRec).alternate_bom_code;
2320           END IF;
2321 
2322           i := i+ 1;
2323 
2324           l_bom_sub_component_tbl(i).Organization_Code     :=
2325           l_bomsubcomponents_tbl(scompRec).Organization_Code ;
2326           l_bom_sub_component_tbl(i).Assembly_Item_Name     :=
2327           l_bomsubcomponents_tbl(scompRec).Assembly_Item_Name ;
2328           l_bom_sub_component_tbl(i).Start_Effective_Date  :=
2329           l_bomsubcomponents_tbl(scompRec).Start_Effective_Date;
2330           l_bom_sub_component_tbl(i).Operation_Sequence_Number    :=
2331           l_bomsubcomponents_tbl(scompRec).Operation_Sequence_Number;
2332           l_bom_sub_component_tbl(i).Component_Item_Name   :=
2333           l_bomsubcomponents_tbl(scompRec).Component_Item_Name;
2334           l_bom_sub_component_tbl(i).Alternate_BOM_Code   :=
2335           l_bomsubcomponents_tbl(scompRec).Alternate_BOM_Code;
2336           l_bom_sub_component_tbl(i).Substitute_Component_Name   :=
2337           l_bomsubcomponents_tbl(scompRec).Substitute_Component_Name;
2338           l_bom_sub_component_tbl(i).Substitute_Item_Quantity  :=
2339           l_bomsubcomponents_tbl(scompRec).Substitute_Item_Quantity;
2340           l_bom_sub_component_tbl(i).Attribute_category     :=
2341           l_bomsubcomponents_tbl(scompRec).Attribute_category;
2342           l_bom_sub_component_tbl(i).Attribute1  :=
2343           l_bomsubcomponents_tbl(scompRec).Attribute1;
2344           l_bom_sub_component_tbl(i).Attribute2  :=
2345           l_bomsubcomponents_tbl(scompRec).Attribute2;
2346           l_bom_sub_component_tbl(i).Attribute3  :=
2347           l_bomsubcomponents_tbl(scompRec).Attribute3;
2348           l_bom_sub_component_tbl(i).Attribute4  :=
2349           l_bomsubcomponents_tbl(scompRec).Attribute4;
2350           l_bom_sub_component_tbl(i).Attribute5  :=
2351           l_bomsubcomponents_tbl(scompRec).Attribute5;
2352           l_bom_sub_component_tbl(i).Attribute6  :=
2353           l_bomsubcomponents_tbl(scompRec).Attribute6;
2354           l_bom_sub_component_tbl(i).Attribute7  :=
2355           l_bomsubcomponents_tbl(scompRec).Attribute7;
2356           l_bom_sub_component_tbl(i).Attribute8  :=
2357           l_bomsubcomponents_tbl(scompRec).Attribute8;
2358           l_bom_sub_component_tbl(i).Attribute9  :=
2359           l_bomsubcomponents_tbl(scompRec).Attribute9;
2360           l_bom_sub_component_tbl(i).Attribute10 :=
2361           l_bomsubcomponents_tbl(scompRec).Attribute10;
2362           l_bom_sub_component_tbl(i).Attribute11 :=
2363           l_bomsubcomponents_tbl(scompRec).Attribute11;
2364           l_bom_sub_component_tbl(i).Attribute12 :=
2365           l_bomsubcomponents_tbl(scompRec).Attribute12;
2366           l_bom_sub_component_tbl(i).Attribute13 :=
2367           l_bomsubcomponents_tbl(scompRec).Attribute13;
2368           l_bom_sub_component_tbl(i).Attribute14 :=
2369           l_bomsubcomponents_tbl(scompRec).Attribute14;
2370           l_bom_sub_component_tbl(i).Attribute15 :=
2371           l_bomsubcomponents_tbl(scompRec).Attribute15;
2372           l_bom_sub_component_tbl(i).From_End_Item_Unit_Number    :=
2373           l_bomsubcomponents_tbl(scompRec).From_End_Item_Unit_Number;
2374           l_bom_sub_component_tbl(i).Return_Status     :=
2375           l_bomsubcomponents_tbl(scompRec).Return_Status;
2376           l_bom_sub_component_tbl(i).Transaction_Type     :=
2377           l_bomsubcomponents_tbl(scompRec).Transaction_Type;
2378           l_bom_sub_component_tbl(i).Original_System_Reference     :=
2379           l_bomsubcomponents_tbl(scompRec).Original_System_Reference;
2380           l_bom_sub_component_tbl(i).Enforce_Int_Requirements    :=
2381           l_bomsubcomponents_tbl(scompRec).Enforce_Int_Requirements;
2382 
2383           -- Delete the record that has been already converted
2384 
2385           l_bomsubcomponents_tbl.DELETE(scompRec);
2386 
2387           -- Assign a not null value to the return status to avoid this record from being
2388           -- processed next time
2389 
2390           l_bomsubcomponents_tbl(scompRec).return_status := 'P';
2391 
2392         END IF;
2393       END IF;
2394           END LOOP;
2395         END IF; -- Substitute Component Table ends
2396 
2397 
2401 
2398         -- Reference Designator : Group the business object data from reference designators and
2399         -- convert them from OBJECT type to RECORD type
2400 
2402         IF l_refdescount <> 0 THEN
2403 
2404     i := 0;
2405 
2406           FOR rdesRec IN 1..l_refdescount
2407           LOOP
2408 
2409             IF l_bomrefdesignators_tbl(rdesRec).return_status IS NULL OR
2410                l_bomrefdesignators_tbl(rdesRec).return_status = FND_API.G_MISS_CHAR
2411       THEN
2412 
2413         IF (l_assembly_item_name IS NULL) OR
2414                        (l_assembly_item_name IS NOT NULL AND
2415             l_bomrefdesignators_tbl(rdesRec).assembly_item_name = l_assembly_item_name AND
2416                         l_bomrefdesignators_tbl(rdesRec).organization_code = l_organization_code AND
2417             l_bomrefdesignators_tbl(rdesRec).alternate_bom_code = l_alternate_bom_code)
2418         THEN
2419 
2420           IF l_assembly_item_name IS NULL
2421           THEN
2422             l_assembly_item_name := l_bomrefdesignators_tbl(rdesRec).assembly_item_name;
2423                         l_organization_code  := l_bomrefdesignators_tbl(rdesRec).organization_code;
2424             l_alternate_bom_code := l_bomrefdesignators_tbl(rdesRec).alternate_bom_code;
2425           END IF;
2426 
2427           i := i+ 1;
2428 
2429           l_bom_ref_designator_tbl(i).Organization_Code     :=
2430           l_bomrefdesignators_tbl(rdesRec).Organization_Code ;
2431           l_bom_ref_designator_tbl(i).Assembly_Item_Name     :=
2432           l_bomrefdesignators_tbl(rdesRec).Assembly_Item_Name ;
2433           l_bom_ref_designator_tbl(i).Start_Effective_Date  :=
2434           l_bomrefdesignators_tbl(rdesRec).Start_Effective_Date;
2435           l_bom_ref_designator_tbl(i).Operation_Sequence_Number    :=
2436           l_bomrefdesignators_tbl(rdesRec).Operation_Sequence_Number;
2437           l_bom_ref_designator_tbl(i).Component_Item_Name   :=
2438           l_bomrefdesignators_tbl(rdesRec).Component_Item_Name;
2439           l_bom_ref_designator_tbl(i).Alternate_BOM_Code   :=
2440           l_bomrefdesignators_tbl(rdesRec).Alternate_BOM_Code;
2441           l_bom_ref_designator_tbl(i).Reference_Designator_Name   :=
2442           l_bomrefdesignators_tbl(rdesRec).Reference_Designator_Name;
2443           l_bom_ref_designator_tbl(i).Ref_Designator_Comment  :=
2444           l_bomrefdesignators_tbl(rdesRec).Ref_Designator_Comment;
2445           l_bom_ref_designator_tbl(i).Attribute_category     :=
2446           l_bomrefdesignators_tbl(rdesRec).Attribute_category;
2447           l_bom_ref_designator_tbl(i).Attribute1  :=
2448           l_bomrefdesignators_tbl(rdesRec).Attribute1;
2449           l_bom_ref_designator_tbl(i).Attribute2  :=
2450           l_bomrefdesignators_tbl(rdesRec).Attribute2;
2451           l_bom_ref_designator_tbl(i).Attribute3  :=
2452           l_bomrefdesignators_tbl(rdesRec).Attribute3;
2453           l_bom_ref_designator_tbl(i).Attribute4  :=
2454           l_bomrefdesignators_tbl(rdesRec).Attribute4;
2455           l_bom_ref_designator_tbl(i).Attribute5  :=
2456           l_bomrefdesignators_tbl(rdesRec).Attribute5;
2457           l_bom_ref_designator_tbl(i).Attribute6  :=
2458           l_bomrefdesignators_tbl(rdesRec).Attribute6;
2459           l_bom_ref_designator_tbl(i).Attribute7  :=
2460           l_bomrefdesignators_tbl(rdesRec).Attribute7;
2461           l_bom_ref_designator_tbl(i).Attribute8  :=
2462           l_bomrefdesignators_tbl(rdesRec).Attribute8;
2463           l_bom_ref_designator_tbl(i).Attribute9  :=
2464           l_bomrefdesignators_tbl(rdesRec).Attribute9;
2465           l_bom_ref_designator_tbl(i).Attribute10 :=
2466           l_bomrefdesignators_tbl(rdesRec).Attribute10;
2467           l_bom_ref_designator_tbl(i).Attribute11 :=
2468           l_bomrefdesignators_tbl(rdesRec).Attribute11;
2469           l_bom_ref_designator_tbl(i).Attribute12 :=
2470           l_bomrefdesignators_tbl(rdesRec).Attribute12;
2471           l_bom_ref_designator_tbl(i).Attribute13 :=
2472           l_bomrefdesignators_tbl(rdesRec).Attribute13;
2473           l_bom_ref_designator_tbl(i).Attribute14 :=
2474           l_bomrefdesignators_tbl(rdesRec).Attribute14;
2475           l_bom_ref_designator_tbl(i).Attribute15 :=
2476           l_bomrefdesignators_tbl(rdesRec).Attribute15;
2477           l_bom_ref_designator_tbl(i).From_End_Item_Unit_Number    :=
2478           l_bomrefdesignators_tbl(rdesRec).From_End_Item_Unit_Number;
2479           l_bom_ref_designator_tbl(i).New_Reference_Designator    :=
2480           l_bomrefdesignators_tbl(rdesRec).New_Reference_Designator;
2481           l_bom_ref_designator_tbl(i).Return_Status     :=
2482           l_bomrefdesignators_tbl(rdesRec).Return_Status;
2483           l_bom_ref_designator_tbl(i).Transaction_Type     :=
2484           l_bomrefdesignators_tbl(rdesRec).Transaction_Type;
2485           l_bom_ref_designator_tbl(i).Original_System_Reference     :=
2486           l_bomrefdesignators_tbl(rdesRec).Original_System_Reference;
2487 
2488           -- Delete the record that has been already converted
2489 
2490           l_bomrefdesignators_tbl.DELETE(rdesRec);
2491 
2492           -- Assign a not null value to the return status to avoid this record from being
2493           -- processed next time
2494 
2495           l_bomrefdesignators_tbl(rdesRec).return_status := 'P';
2496 
2497         END IF;
2498       END IF;
2499           END LOOP;
2500         END IF; -- Reference Designator Table ends
2501 
2502 
2503         -- Component Operations : Group the business object data from component operations and
2504         -- convert them from OBJECT type to RECORD type
2508 
2505 
2506 
2507         IF l_compopscount <> 0 THEN
2509     i := 0;
2510 
2511           FOR copsRec IN 1..l_compopscount
2512           LOOP
2513 
2514             IF l_bomcompoperations_tbl(copsRec).return_status IS NULL OR
2515                l_bomcompoperations_tbl(copsRec).return_status = FND_API.G_MISS_CHAR
2516       THEN
2517 
2518         IF (l_assembly_item_name IS NULL) OR
2519                        (l_assembly_item_name IS NOT NULL AND
2520             l_bomcompoperations_tbl(copsRec).assembly_item_name = l_assembly_item_name AND
2521                         l_bomcompoperations_tbl(copsRec).organization_code = l_organization_code AND
2522             l_bomcompoperations_tbl(copsRec).alternate_bom_code = l_alternate_bom_code)
2523         THEN
2524 
2525           IF l_assembly_item_name IS NULL
2526           THEN
2527             l_assembly_item_name := l_bomcompoperations_tbl(copsRec).assembly_item_name;
2528                         l_organization_code  := l_bomcompoperations_tbl(copsRec).organization_code;
2529             l_alternate_bom_code := l_bomcompoperations_tbl(copsRec).alternate_bom_code;
2530           END IF;
2531 
2532           i := i+ 1;
2533 
2534           l_bom_comp_ops_tbl(i).Organization_Code     :=
2535           l_bomcompoperations_tbl(copsRec).Organization_Code ;
2536           l_bom_comp_ops_tbl(i).Assembly_Item_Name     :=
2537           l_bomcompoperations_tbl(copsRec).Assembly_Item_Name ;
2538           l_bom_comp_ops_tbl(i).Start_Effective_Date  :=
2539           l_bomcompoperations_tbl(copsRec).Start_Effective_Date;
2540           l_bom_comp_ops_tbl(i).From_End_Item_Unit_Number    :=
2541           l_bomcompoperations_tbl(copsRec).From_End_Item_Unit_Number;
2542           l_bom_comp_ops_tbl(i).To_End_Item_Unit_Number    :=
2543           l_bomcompoperations_tbl(copsRec).To_End_Item_Unit_Number;
2544           l_bom_comp_ops_tbl(i).Operation_Sequence_Number    :=
2545           l_bomcompoperations_tbl(copsRec).Operation_Sequence_Number;
2546           l_bom_comp_ops_tbl(i).Component_Item_Name   :=
2547           l_bomcompoperations_tbl(copsRec).Component_Item_Name;
2548           l_bom_comp_ops_tbl(i).Additional_Operation_Seq_Num    :=
2549           l_bomcompoperations_tbl(copsRec).Additional_Operation_Seq_Num;
2550           l_bom_comp_ops_tbl(i).Alternate_BOM_Code   :=
2551           l_bomcompoperations_tbl(copsRec).Alternate_BOM_Code;
2552           l_bom_comp_ops_tbl(i).Attribute_category     :=
2553           l_bomcompoperations_tbl(copsRec).Attribute_category;
2554           l_bom_comp_ops_tbl(i).Attribute1  :=
2555           l_bomcompoperations_tbl(copsRec).Attribute1;
2556           l_bom_comp_ops_tbl(i).Attribute2  :=
2557           l_bomcompoperations_tbl(copsRec).Attribute2;
2558           l_bom_comp_ops_tbl(i).Attribute3  :=
2559           l_bomcompoperations_tbl(copsRec).Attribute3;
2560           l_bom_comp_ops_tbl(i).Attribute4  :=
2561           l_bomcompoperations_tbl(copsRec).Attribute4;
2562           l_bom_comp_ops_tbl(i).Attribute5  :=
2563           l_bomcompoperations_tbl(copsRec).Attribute5;
2564           l_bom_comp_ops_tbl(i).Attribute6  :=
2565           l_bomcompoperations_tbl(copsRec).Attribute6;
2566           l_bom_comp_ops_tbl(i).Attribute7  :=
2567           l_bomcompoperations_tbl(copsRec).Attribute7;
2568           l_bom_comp_ops_tbl(i).Attribute8  :=
2569           l_bomcompoperations_tbl(copsRec).Attribute8;
2570           l_bom_comp_ops_tbl(i).Attribute9  :=
2571           l_bomcompoperations_tbl(copsRec).Attribute9;
2572           l_bom_comp_ops_tbl(i).Attribute10 :=
2573           l_bomcompoperations_tbl(copsRec).Attribute10;
2574           l_bom_comp_ops_tbl(i).Attribute11 :=
2575           l_bomcompoperations_tbl(copsRec).Attribute11;
2576           l_bom_comp_ops_tbl(i).Attribute12 :=
2577           l_bomcompoperations_tbl(copsRec).Attribute12;
2578           l_bom_comp_ops_tbl(i).Attribute13 :=
2579           l_bomcompoperations_tbl(copsRec).Attribute13;
2580           l_bom_comp_ops_tbl(i).Attribute14 :=
2581           l_bomcompoperations_tbl(copsRec).Attribute14;
2582           l_bom_comp_ops_tbl(i).Attribute15 :=
2583           l_bomcompoperations_tbl(copsRec).Attribute15;
2584           l_bom_comp_ops_tbl(i).Return_Status     :=
2585           l_bomcompoperations_tbl(copsRec).Return_Status;
2586           l_bom_comp_ops_tbl(i).Transaction_Type     :=
2587           l_bomcompoperations_tbl(copsRec).Transaction_Type;
2588 
2589           -- Delete the record that has been already converted to free up memory space
2590 
2591           l_bomcompoperations_tbl.DELETE(copsRec);
2592 
2593           -- Assign a not null value to the return status to avoid this record from being
2594           -- processed next time
2595 
2596           l_bomcompoperations_tbl(copsRec).return_status := 'P';
2597 
2598         END IF;
2599       END IF;
2600           END LOOP;
2601         END IF;  -- Component Operations Table ends
2602 
2603         -- Complete the process when there is no more data
2604 
2605         IF l_assembly_item_name IS NULL
2606         THEN
2607     l_more_data := FALSE;
2608     Exit; -- Exit from the WHILE Loop
2609         END IF;
2610 
2611         -- Call the Process_BOM procedure
2612 
2613               Process_Bom
2614               (  p_bo_identifier          => p_bo_identifier
2615               , p_api_version_number     => p_api_version_number
2616               , p_init_msg_list          => p_init_msg_list
2620               , p_bom_ref_designator_tbl => l_bom_ref_designator_tbl
2617               , p_bom_header_rec         => l_bom_header_rec
2618               , p_bom_revision_tbl       => l_bom_revision_tbl
2619               , p_bom_component_tbl      => l_bom_component_tbl
2621               , p_bom_sub_component_tbl  => l_bom_sub_component_tbl
2622               , p_bom_comp_ops_tbl       => l_bom_comp_ops_tbl
2623               , x_bom_header_rec         => l_bom_header_rec
2624               , x_bom_revision_tbl       => l_bom_revision_tbl
2625               , x_bom_component_tbl      => l_bom_component_tbl
2626               , x_bom_ref_designator_tbl => l_bom_ref_designator_tbl
2627               , x_bom_sub_component_tbl  => l_bom_sub_component_tbl
2628               , x_bom_comp_ops_tbl       => l_bom_comp_ops_tbl
2629               , x_return_status          => l_return_status
2630               , x_msg_count              => l_msg_count
2631               , p_debug                  => p_debug
2632               , p_output_dir             => p_output_dir
2633               , p_debug_filename         => p_debug_filename
2634               );
2635 
2636 
2637         -- Count of the error messages for the current business object
2638 
2639         l_previous_msg_count := l_msg_count - l_previous_msg_count;
2640 
2641         -- Store the business object details in the internal BOM list
2642 
2643         IF l_bomlist_tbl IS NULL
2644         THEN
2645     l_bomlist_tbl := BOMListTable(null);
2646         END IF;
2647 
2648         l_listcount := l_bomlist_tbl.COUNT + 1;
2649 
2650               l_bomlist_tbl(l_listcount).assembly_item_name  := l_assembly_item_name;
2651               l_bomlist_tbl(l_listcount).organization_code   := l_organization_code;
2652               l_bomlist_tbl(l_listcount).alternate_bom_code  := l_alternate_bom_code;
2653               l_bomlist_tbl(l_listcount).return_status       := l_return_status;
2654               l_bomlist_tbl(l_listcount).mesg_count          := l_previous_msg_count;
2655 
2656         -- Status of the whole process
2657 
2658         IF l_return_status <> 'S' THEN
2659     l_bo_return_status := l_return_status;
2660         END IF;
2661 
2662         -- Header : Convert from REC type to OBJECT type
2663 
2664         -- Initialize the header tbl by calling the constructor
2665 
2666         IF x_bomheaders_tbl IS NULL
2667         THEN
2668           x_bomheaders_tbl := BOMHeadersTable(null);
2669         END IF;
2670 
2671         l_phdrcount := x_bomheaders_tbl.COUNT + 1;
2672 
2673         IF l_bom_header_rec.assembly_item_name IS NOT NULL THEN
2674           x_bomheaders_tbl(l_phdrcount).Assembly_item_name      :=
2675           l_bom_header_rec.Assembly_item_name;
2676           x_bomheaders_tbl(l_phdrcount).Organization_Code      :=
2677           l_bom_header_rec.Organization_Code;
2678               x_bomheaders_tbl(l_phdrcount).Alternate_Bom_Code       :=
2679           l_bom_header_rec.Alternate_Bom_Code;
2680               x_bomheaders_tbl(l_phdrcount).Common_Assembly_Item_Name :=
2681           l_bom_header_rec.Common_Assembly_Item_Name;
2682               x_bomheaders_tbl(l_phdrcount).Assembly_Comment      :=
2683           l_bom_header_rec.Assembly_Comment;
2684               x_bomheaders_tbl(l_phdrcount).Assembly_Type     :=
2685           l_bom_header_rec.Assembly_Type;
2686               x_bomheaders_tbl(l_phdrcount).Transaction_Type      :=
2687           l_bom_header_rec.Transaction_Type;
2688               x_bomheaders_tbl(l_phdrcount).Return_Status            :=
2689           l_bom_header_rec.Return_Status;
2690               x_bomheaders_tbl(l_phdrcount).Attribute_category      :=
2691           l_bom_header_rec.Attribute_category;
2692               x_bomheaders_tbl(l_phdrcount).Attribute1  :=
2693           l_bom_header_rec.Attribute1;
2694                     x_bomheaders_tbl(l_phdrcount).Attribute2  :=
2695           l_bom_header_rec.Attribute2;
2696                     x_bomheaders_tbl(l_phdrcount).Attribute3 :=
2697           l_bom_header_rec.Attribute3;
2698                     x_bomheaders_tbl(l_phdrcount).Attribute4  :=
2699           l_bom_header_rec.Attribute4;
2700               x_bomheaders_tbl(l_phdrcount).Attribute5  :=
2701           l_bom_header_rec.Attribute5 ;
2702               x_bomheaders_tbl(l_phdrcount).Attribute6  :=
2703           l_bom_header_rec.Attribute6;
2704               x_bomheaders_tbl(l_phdrcount).Attribute7  :=
2705           l_bom_header_rec.Attribute7;
2706               x_bomheaders_tbl(l_phdrcount).Attribute8  :=
2707           l_bom_header_rec.Attribute8;
2708               x_bomheaders_tbl(l_phdrcount).Attribute9  :=
2709           l_bom_header_rec.Attribute9;
2710               x_bomheaders_tbl(l_phdrcount).Attribute10 :=
2711           l_bom_header_rec.Attribute10;
2712               x_bomheaders_tbl(l_phdrcount).Attribute11 :=
2713           l_bom_header_rec.Attribute11;
2714               x_bomheaders_tbl(l_phdrcount).Attribute12 :=
2715           l_bom_header_rec.Attribute12;
2716               x_bomheaders_tbl(l_phdrcount).Attribute13 :=
2717           l_bom_header_rec.Attribute13;
2718               x_bomheaders_tbl(l_phdrcount).Attribute14 :=
2719           l_bom_header_rec.Attribute14;
2720               x_bomheaders_tbl(l_phdrcount).Attribute15 :=
2721           l_bom_header_rec.Attribute15;
2722               x_bomheaders_tbl(l_phdrcount).Original_System_Reference  :=
2723           l_bom_header_rec.Original_System_Reference;
2727           l_bom_header_rec.DG_Description;
2724               x_bomheaders_tbl(l_phdrcount).Delete_Group_Name     :=
2725           l_bom_header_rec.Delete_Group_Name;
2726               x_bomheaders_tbl(l_phdrcount).DG_Description       :=
2728               x_bomheaders_tbl(l_phdrcount).Delete_Group_Name     :=
2729           l_bom_header_rec.Delete_Group_Name;
2730         END IF; --  Header Record ends
2731 
2732 
2733               -- Revisions: Convert from RECORD type to OBJECT type
2734 
2735               IF x_bomrevisions_tbl IS NULL
2736               THEN
2737                 x_bomrevisions_tbl := BOMRevisionsTable(null);
2738               END IF;
2739 
2740               l_prevcount := x_bomrevisions_tbl.COUNT;
2741 
2742               IF l_bom_revision_tbl.COUNT <> 0 THEN
2743 
2744                 i := l_prevcount;
2745 
2746                 FOR revRec IN 1..l_bom_revision_tbl.COUNT
2747                 LOOP
2748 
2749                       i := i + 1;
2750 
2751           x_bomrevisions_tbl(i).Organization_Code     :=
2752           l_bom_revision_tbl(revRec).Organization_Code ;
2753           x_bomrevisions_tbl(i).Assembly_Item_Name     :=
2754           l_bom_revision_tbl(revRec).Assembly_Item_Name ;
2755           x_bomrevisions_tbl(i).Alternate_BOM_Code   :=
2756           l_bom_revision_tbl(revRec).Alternate_BOM_Code;
2757           x_bomrevisions_tbl(i).Revision  :=
2758           l_bom_revision_tbl(revRec).Revision;
2759           x_bomrevisions_tbl(i).Start_Effective_Date  :=
2760           l_bom_revision_tbl(revRec).Start_Effective_Date;
2761           x_bomrevisions_tbl(i).Description  :=
2762           l_bom_revision_tbl(revRec).Description;
2763           x_bomrevisions_tbl(i).Attribute_category     :=
2764           l_bom_revision_tbl(revRec).Attribute_category;
2765           x_bomrevisions_tbl(i).Attribute1  :=
2766           l_bom_revision_tbl(revRec).Attribute1;
2767           x_bomrevisions_tbl(i).Attribute2  :=
2768           l_bom_revision_tbl(revRec).Attribute2;
2769           x_bomrevisions_tbl(i).Attribute3  :=
2770           l_bom_revision_tbl(revRec).Attribute3;
2771           x_bomrevisions_tbl(i).Attribute4  :=
2772           l_bom_revision_tbl(revRec).Attribute4;
2773           x_bomrevisions_tbl(i).Attribute5  :=
2774           l_bom_revision_tbl(revRec).Attribute5;
2775           x_bomrevisions_tbl(i).Attribute6  :=
2776           l_bom_revision_tbl(revRec).Attribute6;
2777           x_bomrevisions_tbl(i).Attribute7  :=
2778           l_bom_revision_tbl(revRec).Attribute7;
2779           x_bomrevisions_tbl(i).Attribute8  :=
2780           l_bom_revision_tbl(revRec).Attribute8;
2781           x_bomrevisions_tbl(i).Attribute9  :=
2782           l_bom_revision_tbl(revRec).Attribute9;
2783           x_bomrevisions_tbl(i).Attribute10 :=
2784           l_bom_revision_tbl(revRec).Attribute10;
2785           x_bomrevisions_tbl(i).Attribute11 :=
2786           l_bom_revision_tbl(revRec).Attribute11;
2787           x_bomrevisions_tbl(i).Attribute12 :=
2788           l_bom_revision_tbl(revRec).Attribute12;
2789           x_bomrevisions_tbl(i).Attribute13 :=
2790           l_bom_revision_tbl(revRec).Attribute13;
2791           x_bomrevisions_tbl(i).Attribute14 :=
2792           l_bom_revision_tbl(revRec).Attribute14;
2793           x_bomrevisions_tbl(i).Attribute15 :=
2794           l_bom_revision_tbl(revRec).Attribute15;
2795           x_bomrevisions_tbl(i).Return_Status     :=
2796           l_bom_revision_tbl(revRec).Return_Status;
2797           x_bomrevisions_tbl(i).Transaction_Type     :=
2798           l_bom_revision_tbl(revRec).Transaction_Type;
2799           x_bomrevisions_tbl(i).Original_System_Reference     :=
2800           l_bom_revision_tbl(revRec).Original_System_Reference;
2801 
2802                 END LOOP;
2803         END IF; -- Revision Record ends
2804 
2805 
2806         -- Components: Convert from RECORD type to OBJECT type
2807 
2808 
2809         IF x_bomcomponents_tbl IS NULL
2810         THEN
2811           x_bomcomponents_tbl := BOMComponentsTable(null);
2812         END IF;
2813 
2814 
2815         l_pcompcount := x_bomcomponents_tbl.COUNT;
2816 
2817 
2818         IF l_bom_component_tbl.COUNT <> 0 THEN
2819 
2820     i := l_pcompcount;
2821 
2822           FOR compRec IN 1..l_bom_component_tbl.COUNT
2823           LOOP
2824 
2825           i := i + 1;
2826 
2827           x_bomcomponents_tbl(i).Organization_Code     :=
2828           l_bom_component_tbl(compRec).Organization_Code ;
2829           x_bomcomponents_tbl(i).Assembly_Item_Name     :=
2830           l_bom_component_tbl(compRec).Assembly_Item_Name ;
2831           x_bomcomponents_tbl(i).Start_Effective_Date  :=
2832           l_bom_component_tbl(compRec).Start_Effective_Date;
2833           x_bomcomponents_tbl(i).Disable_Date     :=
2834           l_bom_component_tbl(compRec).Disable_Date;
2835           x_bomcomponents_tbl(i).Operation_Sequence_Number    :=
2836           l_bom_component_tbl(compRec).Operation_Sequence_Number;
2837           x_bomcomponents_tbl(i).Component_Item_Name   :=
2838           l_bom_component_tbl(compRec).Component_Item_Name;
2839           x_bomcomponents_tbl(i).Alternate_BOM_Code   :=
2840           l_bom_component_tbl(compRec).Alternate_BOM_Code;
2841           x_bomcomponents_tbl(i).New_Effectivity_Date  :=
2842           l_bom_component_tbl(compRec).New_Effectivity_Date;
2843           x_bomcomponents_tbl(i).New_Operation_Sequence_Number   :=
2847           x_bomcomponents_tbl(i).Basis_Type:=
2844           l_bom_component_tbl(compRec).New_Operation_Sequence_Number;
2845           x_bomcomponents_tbl(i).Item_Sequence_Number   :=
2846           l_bom_component_tbl(compRec).Item_Sequence_Number;
2848           l_bom_component_tbl(compRec).Basis_Type;
2849           x_bomcomponents_tbl(i).Quantity_Per_Assembly  :=
2850           l_bom_component_tbl(compRec).Quantity_Per_Assembly;
2851           x_bomcomponents_tbl(i).Inverse_Quantity  :=
2852           l_bom_component_tbl(compRec).Inverse_Quantity;
2853           x_bomcomponents_tbl(i).Planning_Percent  :=
2854           l_bom_component_tbl(compRec).Planning_Percent;
2855           x_bomcomponents_tbl(i).Projected_Yield     :=
2856           l_bom_component_tbl(compRec).Projected_Yield;
2857           x_bomcomponents_tbl(i).Include_In_Cost_Rollup :=
2858           l_bom_component_tbl(compRec).Include_In_Cost_Rollup;
2859           x_bomcomponents_tbl(i).Wip_Supply_Type     :=
2860           l_bom_component_tbl(compRec).Wip_Supply_Type;
2861           x_bomcomponents_tbl(i).So_Basis     :=
2862           l_bom_component_tbl(compRec).So_Basis;
2863           x_bomcomponents_tbl(i).Optional     :=
2864           l_bom_component_tbl(compRec).Optional;
2865           x_bomcomponents_tbl(i).Mutually_Exclusive     :=
2866           l_bom_component_tbl(compRec).Mutually_Exclusive;
2867           x_bomcomponents_tbl(i).Check_Atp     :=
2868           l_bom_component_tbl(compRec).Check_Atp;
2869           x_bomcomponents_tbl(i).Shipping_Allowed     :=
2870           l_bom_component_tbl(compRec).Shipping_Allowed;
2871           x_bomcomponents_tbl(i).Required_To_Ship     :=
2872           l_bom_component_tbl(compRec).Required_To_Ship;
2873           x_bomcomponents_tbl(i).Required_For_Revenue  :=
2874           l_bom_component_tbl(compRec).Required_For_Revenue;
2875           x_bomcomponents_tbl(i).Include_On_Ship_Docs  :=
2876           l_bom_component_tbl(compRec).Include_On_Ship_Docs;
2877           x_bomcomponents_tbl(i).Quantity_Related     :=
2878           l_bom_component_tbl(compRec).Quantity_Related;
2879           x_bomcomponents_tbl(i).Supply_Subinventory   :=
2880           l_bom_component_tbl(compRec).Supply_Subinventory;
2881           x_bomcomponents_tbl(i).Location_Name     :=
2882           l_bom_component_tbl(compRec).Location_Name;
2883           x_bomcomponents_tbl(i).Minimum_Allowed_Quantity :=
2884           l_bom_component_tbl(compRec).Minimum_Allowed_Quantity;
2885           x_bomcomponents_tbl(i).Maximum_Allowed_Quantity     :=
2886           l_bom_component_tbl(compRec).Maximum_Allowed_Quantity;
2887           x_bomcomponents_tbl(i).Comments     :=
2888           l_bom_component_tbl(compRec).Comments;
2889           x_bomcomponents_tbl(i).Attribute_category     :=
2890           l_bom_component_tbl(compRec).Attribute_category;
2891           x_bomcomponents_tbl(i).Attribute1  :=
2892           l_bom_component_tbl(compRec).Attribute1;
2893           x_bomcomponents_tbl(i).Attribute2  :=
2894           l_bom_component_tbl(compRec).Attribute2;
2895           x_bomcomponents_tbl(i).Attribute3  :=
2896           l_bom_component_tbl(compRec).Attribute3;
2897           x_bomcomponents_tbl(i).Attribute4  :=
2898           l_bom_component_tbl(compRec).Attribute4;
2899           x_bomcomponents_tbl(i).Attribute5  :=
2900           l_bom_component_tbl(compRec).Attribute5;
2901           x_bomcomponents_tbl(i).Attribute6  :=
2902           l_bom_component_tbl(compRec).Attribute6;
2903           x_bomcomponents_tbl(i).Attribute7  :=
2904           l_bom_component_tbl(compRec).Attribute7;
2905           x_bomcomponents_tbl(i).Attribute8  :=
2906           l_bom_component_tbl(compRec).Attribute8;
2907           x_bomcomponents_tbl(i).Attribute9  :=
2908           l_bom_component_tbl(compRec).Attribute9;
2909           x_bomcomponents_tbl(i).Attribute10 :=
2910           l_bom_component_tbl(compRec).Attribute10;
2911           x_bomcomponents_tbl(i).Attribute11 :=
2912           l_bom_component_tbl(compRec).Attribute11;
2913           x_bomcomponents_tbl(i).Attribute12 :=
2914           l_bom_component_tbl(compRec).Attribute12;
2915           x_bomcomponents_tbl(i).Attribute13 :=
2916           l_bom_component_tbl(compRec).Attribute13;
2917           x_bomcomponents_tbl(i).Attribute14 :=
2918           l_bom_component_tbl(compRec).Attribute14;
2919           x_bomcomponents_tbl(i).Attribute15 :=
2920           l_bom_component_tbl(compRec).Attribute15;
2921           x_bomcomponents_tbl(i).From_End_Item_Unit_Number    :=
2922           l_bom_component_tbl(compRec).From_End_Item_Unit_Number;
2923           x_bomcomponents_tbl(i).New_From_End_Item_Unit_Number    :=
2924           l_bom_component_tbl(compRec).New_From_End_Item_Unit_Number;
2925           x_bomcomponents_tbl(i).To_End_Item_Unit_Number     :=
2926           l_bom_component_tbl(compRec).To_End_Item_Unit_Number;
2927           x_bomcomponents_tbl(i).Return_Status     :=
2928           l_bom_component_tbl(compRec).Return_Status;
2929           x_bomcomponents_tbl(i).Transaction_Type     :=
2930           l_bom_component_tbl(compRec).Transaction_Type;
2931           x_bomcomponents_tbl(i).Original_System_Reference     :=
2932           l_bom_component_tbl(compRec).Original_System_Reference;
2933           x_bomcomponents_tbl(i).Delete_Group_Name     :=
2934           l_bom_component_tbl(compRec).Delete_Group_Name;
2935           x_bomcomponents_tbl(i).DG_Description     :=
2936           l_bom_component_tbl(compRec).DG_Description;
2937           x_bomcomponents_tbl(i).Enforce_Int_Requirements    :=
2938           l_bom_component_tbl(compRec).Enforce_Int_Requirements;
2942         i := 0;
2939           END LOOP;
2940         END IF; -- Components
2941 
2943 
2944               -- Substitute Components: Convert from RECORD type to OBJECT type
2945 
2946               IF x_bomsubcomponents_tbl IS NULL
2947               THEN
2948                 x_bomsubcomponents_tbl := BOMSubComponentsTable(null);
2949               END IF;
2950 
2951 
2952               l_psubcompcount := x_bomsubcomponents_tbl.COUNT;
2953 
2954 
2955               IF l_bom_sub_component_tbl.COUNT <> 0 THEN
2956 
2957                 i := l_psubcompcount;
2958 
2959                 FOR scompRec IN 1..l_bom_sub_component_tbl.COUNT
2960                 LOOP
2961 
2962                       i := i + 1;
2963 
2964           x_bomsubcomponents_tbl(i).Organization_Code     :=
2965           l_bom_sub_component_tbl(scompRec).Organization_Code ;
2966           x_bomsubcomponents_tbl(i).Assembly_Item_Name     :=
2967           l_bom_sub_component_tbl(scompRec).Assembly_Item_Name ;
2968           x_bomsubcomponents_tbl(i).Start_Effective_Date  :=
2969           l_bom_sub_component_tbl(scompRec).Start_Effective_Date;
2970           x_bomsubcomponents_tbl(i).Operation_Sequence_Number    :=
2971           l_bom_sub_component_tbl(scompRec).Operation_Sequence_Number;
2972           x_bomsubcomponents_tbl(i).Component_Item_Name   :=
2973           l_bom_sub_component_tbl(scompRec).Component_Item_Name;
2974           x_bomsubcomponents_tbl(i).Alternate_BOM_Code   :=
2975           l_bom_sub_component_tbl(scompRec).Alternate_BOM_Code;
2976           x_bomsubcomponents_tbl(i).Substitute_Component_Name   :=
2977           l_bom_sub_component_tbl(scompRec).Substitute_Component_Name;
2978           x_bomsubcomponents_tbl(i).Substitute_Item_Quantity  :=
2979           l_bom_sub_component_tbl(scompRec).Substitute_Item_Quantity;
2980           x_bomsubcomponents_tbl(i).Attribute_category     :=
2981           l_bom_sub_component_tbl(scompRec).Attribute_category;
2982           x_bomsubcomponents_tbl(i).Attribute1  :=
2983           l_bom_sub_component_tbl(scompRec).Attribute1;
2984           x_bomsubcomponents_tbl(i).Attribute2  :=
2985           l_bom_sub_component_tbl(scompRec).Attribute2;
2986           x_bomsubcomponents_tbl(i).Attribute3  :=
2987           l_bom_sub_component_tbl(scompRec).Attribute3;
2988           x_bomsubcomponents_tbl(i).Attribute4  :=
2989           l_bom_sub_component_tbl(scompRec).Attribute4;
2990           x_bomsubcomponents_tbl(i).Attribute5  :=
2991           l_bom_sub_component_tbl(scompRec).Attribute5;
2992           x_bomsubcomponents_tbl(i).Attribute6  :=
2993           l_bom_sub_component_tbl(scompRec).Attribute6;
2994           x_bomsubcomponents_tbl(i).Attribute7  :=
2995           l_bom_sub_component_tbl(scompRec).Attribute7;
2996           x_bomsubcomponents_tbl(i).Attribute8  :=
2997           l_bom_sub_component_tbl(scompRec).Attribute8;
2998           x_bomsubcomponents_tbl(i).Attribute9  :=
2999           l_bom_sub_component_tbl(scompRec).Attribute9;
3000           x_bomsubcomponents_tbl(i).Attribute10 :=
3001           l_bom_sub_component_tbl(scompRec).Attribute10;
3002           x_bomsubcomponents_tbl(i).Attribute11 :=
3003           l_bom_sub_component_tbl(scompRec).Attribute11;
3004           x_bomsubcomponents_tbl(i).Attribute12 :=
3005           l_bom_sub_component_tbl(scompRec).Attribute12;
3006           x_bomsubcomponents_tbl(i).Attribute13 :=
3007           l_bom_sub_component_tbl(scompRec).Attribute13;
3008           x_bomsubcomponents_tbl(i).Attribute14 :=
3009           l_bom_sub_component_tbl(scompRec).Attribute14;
3010           x_bomsubcomponents_tbl(i).Attribute15 :=
3011           l_bom_sub_component_tbl(scompRec).Attribute15;
3012           x_bomsubcomponents_tbl(i).From_End_Item_Unit_Number    :=
3013           l_bom_sub_component_tbl(scompRec).From_End_Item_Unit_Number;
3014           x_bomsubcomponents_tbl(i).Return_Status     :=
3015           l_bom_sub_component_tbl(scompRec).Return_Status;
3016           x_bomsubcomponents_tbl(i).Transaction_Type     :=
3017           l_bom_sub_component_tbl(scompRec).Transaction_Type;
3018           x_bomsubcomponents_tbl(i).Original_System_Reference     :=
3019           l_bom_sub_component_tbl(scompRec).Original_System_Reference;
3020           x_bomsubcomponents_tbl(i).Enforce_Int_Requirements    :=
3021           l_bom_sub_component_tbl(scompRec).Enforce_Int_Requirements;
3022                 END LOOP;
3023 
3024               END IF; -- Substitute Components
3025 
3026         i := 0;
3027 
3028               -- Reference Designators: Convert from RECORD type to OBJECT type
3029 
3030               IF x_bomrefdesignators_tbl IS NULL
3031               THEN
3032                 x_bomrefdesignators_tbl := BOMRefDesignatorsTable(null);
3033               END IF;
3034 
3035 
3036               l_prefdescount := x_bomrefdesignators_tbl.COUNT;
3037 
3038 
3039               IF l_bom_ref_designator_tbl.COUNT <> 0 THEN
3040 
3041                 i := l_prefdescount;
3042 
3043                 FOR rdesRec IN 1..l_bom_ref_designator_tbl.COUNT
3044                 LOOP
3045 
3046                       i := i + 1;
3047 
3048           x_bomrefdesignators_tbl(i).Organization_Code     :=
3049           l_bom_ref_designator_tbl(rdesRec).Organization_Code ;
3050           x_bomrefdesignators_tbl(i).Assembly_Item_Name     :=
3051           l_bom_ref_designator_tbl(rdesRec).Assembly_Item_Name ;
3052           x_bomrefdesignators_tbl(i).Start_Effective_Date  :=
3053           l_bom_ref_designator_tbl(rdesRec).Start_Effective_Date;
3054           x_bomrefdesignators_tbl(i).Operation_Sequence_Number    :=
3058           x_bomrefdesignators_tbl(i).Alternate_BOM_Code   :=
3055           l_bom_ref_designator_tbl(rdesRec).Operation_Sequence_Number;
3056           x_bomrefdesignators_tbl(i).Component_Item_Name   :=
3057           l_bom_ref_designator_tbl(rdesRec).Component_Item_Name;
3059           l_bom_ref_designator_tbl(rdesRec).Alternate_BOM_Code;
3060           x_bomrefdesignators_tbl(i).Reference_Designator_Name   :=
3061           l_bom_ref_designator_tbl(rdesRec).Reference_Designator_Name;
3062           x_bomrefdesignators_tbl(i).Ref_Designator_Comment  :=
3063           l_bom_ref_designator_tbl(rdesRec).Ref_Designator_Comment;
3064           x_bomrefdesignators_tbl(i).Attribute_category     :=
3065           l_bom_ref_designator_tbl(rdesRec).Attribute_category;
3066           x_bomrefdesignators_tbl(i).Attribute1  :=
3067           l_bom_ref_designator_tbl(rdesRec).Attribute1;
3068           x_bomrefdesignators_tbl(i).Attribute2  :=
3069           l_bom_ref_designator_tbl(rdesRec).Attribute2;
3070           x_bomrefdesignators_tbl(i).Attribute3  :=
3071           l_bom_ref_designator_tbl(rdesRec).Attribute3;
3072           x_bomrefdesignators_tbl(i).Attribute4  :=
3073           l_bom_ref_designator_tbl(rdesRec).Attribute4;
3074           x_bomrefdesignators_tbl(i).Attribute5  :=
3075           l_bom_ref_designator_tbl(rdesRec).Attribute5;
3076           x_bomrefdesignators_tbl(i).Attribute6  :=
3077           l_bom_ref_designator_tbl(rdesRec).Attribute6;
3078           x_bomrefdesignators_tbl(i).Attribute7  :=
3079           l_bom_ref_designator_tbl(rdesRec).Attribute7;
3080           x_bomrefdesignators_tbl(i).Attribute8  :=
3081           l_bom_ref_designator_tbl(rdesRec).Attribute8;
3082           x_bomrefdesignators_tbl(i).Attribute9  :=
3083           l_bom_ref_designator_tbl(rdesRec).Attribute9;
3084           x_bomrefdesignators_tbl(i).Attribute10 :=
3085           l_bom_ref_designator_tbl(rdesRec).Attribute10;
3086           x_bomrefdesignators_tbl(i).Attribute11 :=
3087           l_bom_ref_designator_tbl(rdesRec).Attribute11;
3088           x_bomrefdesignators_tbl(i).Attribute12 :=
3089           l_bom_ref_designator_tbl(rdesRec).Attribute12;
3090           x_bomrefdesignators_tbl(i).Attribute13 :=
3091           l_bom_ref_designator_tbl(rdesRec).Attribute13;
3092           x_bomrefdesignators_tbl(i).Attribute14 :=
3093           l_bom_ref_designator_tbl(rdesRec).Attribute14;
3094           x_bomrefdesignators_tbl(i).Attribute15 :=
3095           l_bom_ref_designator_tbl(rdesRec).Attribute15;
3096           x_bomrefdesignators_tbl(i).From_End_Item_Unit_Number    :=
3097           l_bom_ref_designator_tbl(rdesRec).From_End_Item_Unit_Number;
3098           x_bomrefdesignators_tbl(i).New_Reference_Designator    :=
3099           l_bom_ref_designator_tbl(rdesRec).New_Reference_Designator;
3100           x_bomrefdesignators_tbl(i).Return_Status     :=
3101           l_bom_ref_designator_tbl(rdesRec).Return_Status;
3102           x_bomrefdesignators_tbl(i).Transaction_Type     :=
3103           l_bom_ref_designator_tbl(rdesRec).Transaction_Type;
3104           x_bomrefdesignators_tbl(i).Original_System_Reference     :=
3105           l_bom_ref_designator_tbl(rdesRec).Original_System_Reference;
3106                 END LOOP;
3107         END IF; -- Ref Designators
3108 
3109               i := 0;
3110 
3111               -- Component Operations: Convert from RECORD type to OBJECT type
3112 
3113               IF x_bomcompoperations_tbl IS NULL
3114               THEN
3115                 x_bomcompoperations_tbl := BOMCompOperationsTable(null);
3116               END IF;
3117 
3118 
3119               l_pcompopscount := x_bomcompoperations_tbl.COUNT;
3120 
3121 
3122               IF l_bom_comp_ops_tbl.COUNT <> 0 THEN
3123 
3124                 i := l_pcompopscount;
3125 
3126                 FOR copsRec IN 1..l_bom_comp_ops_tbl.COUNT
3127                 LOOP
3128 
3129                       i := i + 1;
3130 
3131           x_bomcompoperations_tbl(i).Organization_Code     :=
3132           l_bom_comp_ops_tbl(copsRec).Organization_Code ;
3133           x_bomcompoperations_tbl(i).Assembly_Item_Name     :=
3134           l_bom_comp_ops_tbl(copsRec).Assembly_Item_Name ;
3135           x_bomcompoperations_tbl(i).Start_Effective_Date  :=
3136           l_bom_comp_ops_tbl(copsRec).Start_Effective_Date;
3137           x_bomcompoperations_tbl(i).From_End_Item_Unit_Number    :=
3138           l_bom_comp_ops_tbl(copsRec).From_End_Item_Unit_Number;
3139           x_bomcompoperations_tbl(i).To_End_Item_Unit_Number    :=
3140           l_bom_comp_ops_tbl(copsRec).To_End_Item_Unit_Number;
3141           x_bomcompoperations_tbl(i).Operation_Sequence_Number    :=
3142           l_bom_comp_ops_tbl(copsRec).Operation_Sequence_Number;
3143           x_bomcompoperations_tbl(i).Component_Item_Name   :=
3144           l_bom_comp_ops_tbl(copsRec).Component_Item_Name;
3145           x_bomcompoperations_tbl(i).Additional_Operation_Seq_Num    :=
3146           l_bom_comp_ops_tbl(copsRec).Additional_Operation_Seq_Num;
3147           x_bomcompoperations_tbl(i).Alternate_BOM_Code   :=
3148           l_bom_comp_ops_tbl(copsRec).Alternate_BOM_Code;
3149           x_bomcompoperations_tbl(i).Attribute_category     :=
3150           l_bom_comp_ops_tbl(copsRec).Attribute_category;
3151           x_bomcompoperations_tbl(i).Attribute1  :=
3152           l_bom_comp_ops_tbl(copsRec).Attribute1;
3153           x_bomcompoperations_tbl(i).Attribute2  :=
3154           l_bom_comp_ops_tbl(copsRec).Attribute2;
3155           x_bomcompoperations_tbl(i).Attribute3  :=
3156           l_bom_comp_ops_tbl(copsRec).Attribute3;
3157           x_bomcompoperations_tbl(i).Attribute4  :=
3158           l_bom_comp_ops_tbl(copsRec).Attribute4;
3162           l_bom_comp_ops_tbl(copsRec).Attribute6;
3159           x_bomcompoperations_tbl(i).Attribute5  :=
3160           l_bom_comp_ops_tbl(copsRec).Attribute5;
3161           x_bomcompoperations_tbl(i).Attribute6  :=
3163           x_bomcompoperations_tbl(i).Attribute7  :=
3164           l_bom_comp_ops_tbl(copsRec).Attribute7;
3165           x_bomcompoperations_tbl(i).Attribute8  :=
3166           l_bom_comp_ops_tbl(copsRec).Attribute8;
3167           x_bomcompoperations_tbl(i).Attribute9  :=
3168           l_bom_comp_ops_tbl(copsRec).Attribute9;
3169           x_bomcompoperations_tbl(i).Attribute10 :=
3170           l_bom_comp_ops_tbl(copsRec).Attribute10;
3171           x_bomcompoperations_tbl(i).Attribute11 :=
3172           l_bom_comp_ops_tbl(copsRec).Attribute11;
3173           x_bomcompoperations_tbl(i).Attribute12 :=
3174           l_bom_comp_ops_tbl(copsRec).Attribute12;
3175           x_bomcompoperations_tbl(i).Attribute13 :=
3176           l_bom_comp_ops_tbl(copsRec).Attribute13;
3177           x_bomcompoperations_tbl(i).Attribute14 :=
3178           l_bom_comp_ops_tbl(copsRec).Attribute14;
3179           x_bomcompoperations_tbl(i).Attribute15 :=
3180           l_bom_comp_ops_tbl(copsRec).Attribute15;
3181           x_bomcompoperations_tbl(i).Return_Status     :=
3182           l_bom_comp_ops_tbl(copsRec).Return_Status;
3183           x_bomcompoperations_tbl(i).Transaction_Type     :=
3184           l_bom_comp_ops_tbl(copsRec).Transaction_Type;
3185 
3186                 END LOOP;
3187 
3188         END IF; -- Component Operations
3189 
3190       END LOOP; -- End of WHILE Loop
3191 
3192       -- Assign the OUT variables
3193 
3194       x_bo_return_status        := l_bo_return_status;
3195       x_bo_msg_count            := l_msg_count;
3196 
3197       x_process_return_status   := 'S';
3198       x_process_error_msg       := '';
3199 
3200       EXCEPTION WHEN OTHERS
3201       THEN
3202         x_process_return_status := 'U';
3203               x_process_error_msg := 'Unexpected Error in Process_EBOM : ' ||to_char(SQLCODE)||' / '||SQLERRM;
3204 
3205   END; -- Process BOM for multiple BOMS
3206 
3207   */
3208 
3209 
3210   /********************************************************************
3211   * Procedure : Process_Bom (for iSetup)
3212   * Parameters IN : Bom Header exposed column table
3213   *     Bom Item Revision Exposed Column Table
3214   *     Bom Inventorty Component exposed column table
3215   *     Substitute Component Exposed Column table
3216   *     Reference Designator Exposed column table
3217   *     Component Operations Exposed column table
3218   * Parameters OUT: Bom Header Exposed Column Table
3219   *     Bom Inventory Components exposed column table
3220   *     Bom Item Revision Exposed Column Table
3221         *                 Substitute Component Exposed Column table
3222         *                 Reference Designator Exposed column table
3223   *     Component Operations Exposed column table
3224   * Purpose : This procedure is a wrapper on existing Process_BOM
3225         *                 procedure. This new procedure accepts a table of Bom
3226   *     headers and calls the existing Process_BOM for each
3227   *     record. This is to support the new Export_BOM that
3228         *                 returns a table of Bom Header records.
3229   *********************************************************************/
3230   PROCEDURE Process_Bom
3231   (  P_bo_identifier           IN  VARCHAR2 := 'BOM'
3232    , P_api_version_number      IN  NUMBER := 1.0
3233    , P_init_msg_list           IN  BOOLEAN := FALSE
3234    , P_bom_header_tbl          IN  Bom_Bo_Pub.Bom_Header_tbl_Type :=
3235           Bom_Bo_Pub.G_MISS_BOM_HEADER_TBL
3236    , P_bom_revision_tbl      IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
3237           Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
3238    , P_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
3239           Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
3240    , P_bom_ref_designator_tbl  IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_type
3241             := Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
3242    , P_bom_sub_component_tbl   IN Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
3243             := Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
3244      , P_bom_comp_ops_tbl        IN Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type :=
3245                                        Bom_Bo_Pub.G_MISS_BOM_COMP_OPS_TBL
3246    , X_bom_header_tbl      IN OUT NOCOPY Bom_Bo_Pub.bom_Header_Tbl_Type
3247    , X_bom_revision_tbl      IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
3248    , X_bom_component_tbl       IN OUT NOCOPY Bom_Bo_pub.Bom_Comps_Tbl_Type
3249    , X_bom_ref_designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
3250    , X_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
3251    , X_bom_comp_ops_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type
3252    , X_return_status           IN OUT NOCOPY VARCHAR2
3253    , X_msg_count               IN OUT NOCOPY NUMBER
3254          , P_debug                   IN  VARCHAR2 := 'N'
3255          , P_output_dir              IN  VARCHAR2 := NULL
3256          , P_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
3257    )
3258         IS
3259           l_bom_header_rec             BOM_BO_PUB.Bom_Head_Rec_Type;
3260           l_bom_revision_tbl           BOM_BO_PUB.Bom_Revision_Tbl_Type;
3261           l_bom_component_tbl          BOM_BO_PUB.Bom_Comps_Tbl_Type;
3262           l_bom_ref_designator_tbl     BOM_BO_PUB.Bom_Ref_Designator_Tbl_Type;
3263           l_bom_sub_component_tbl      BOM_BO_PUB.Bom_Sub_Component_Tbl_Type;
3264           l_bom_comp_ops_tbl           BOM_BO_PUB.Bom_Comp_ops_Tbl_Type;
3268           l_bom_ref_designator_tbl_out BOM_BO_PUB.Bom_Ref_Designator_Tbl_Type;
3265           l_bom_header_rec_out         BOM_BO_PUB.Bom_Head_Rec_Type;
3266           l_bom_revision_tbl_out       BOM_BO_PUB.Bom_Revision_Tbl_Type;
3267           l_bom_component_tbl_out      BOM_BO_PUB.Bom_Comps_Tbl_Type;
3269           l_bom_sub_component_tbl_out  BOM_BO_PUB.Bom_Sub_Component_Tbl_Type;
3270           l_bom_comp_ops_tbl_out       BOM_BO_PUB.Bom_Comp_ops_Tbl_Type;
3271           k NUMBER;
3272           l NUMBER;
3273           o NUMBER;
3274           q NUMBER;
3275           r NUMBER;
3276           l_cnt NUMBER;
3277           no_header_record EXCEPTION;
3278           l_other_message  VARCHAR2(50);
3279         BEGIN
3280 /*
3281           IF (P_bom_header_tbl IS NULL) THEN
3282             l_other_message := 'BOM_NO_HEADER_RECORD';
3283             RAISE no_header_record;
3284           END IF;
3285 */
3286         IF (P_bom_header_tbl.COUNT <= 0 AND
3287             P_bom_revision_tbl.COUNT <= 0) THEN
3288             l_other_message := 'BOM_NO_HEADER_RECORD';
3289             RAISE no_header_record;
3290         ELSIF (P_bom_header_tbl.COUNT <= 0) THEN
3291 --Call to existing Process_BOM that accepts only one record of Bom_Headers per call
3292             Process_Bom(P_bo_identifier          => p_bo_identifier,
3293                         P_api_version_number     => p_api_version_number,
3294                         P_init_msg_list          => p_init_msg_list,
3295                         P_bom_header_rec         => l_bom_header_rec,
3296                         P_bom_revision_tbl       => P_bom_revision_tbl,
3297                         P_bom_component_tbl      => l_bom_component_tbl,
3298                         P_bom_ref_designator_tbl => l_bom_ref_designator_tbl,
3299                         P_bom_sub_component_tbl  => l_bom_sub_component_tbl,
3300                         P_bom_comp_ops_tbl       => l_bom_comp_ops_tbl,
3301                         X_bom_header_rec         => l_bom_header_rec_out,
3302                         X_bom_revision_tbl       => l_bom_revision_tbl_out,
3303                         X_bom_component_tbl      => l_bom_component_tbl_out,
3304                         X_bom_ref_designator_tbl => l_bom_ref_designator_tbl_out,
3305                         X_bom_sub_component_tbl  => l_bom_sub_component_tbl_out,
3306                         X_bom_comp_ops_tbl       => l_bom_comp_ops_tbl_out,
3307                         X_return_status          => X_return_status,
3308                         X_msg_count              => X_msg_count,
3309                         P_debug                  => P_debug,
3310                         P_output_dir             => P_output_dir,
3311                         P_debug_filename         => P_debug_filename);
3312         ELSE
3313           FOR i IN P_bom_header_tbl.FIRST..P_bom_header_tbl.LAST LOOP
3314             l_bom_header_rec := P_bom_header_tbl(i);
3315             l_bom_revision_tbl.DELETE;
3316             k := 1;
3317             IF (P_bom_revision_tbl.COUNT > 0) THEN
3318               FOR j IN P_bom_revision_tbl.FIRST..P_bom_revision_tbl.LAST LOOP
3319                 IF (P_bom_revision_tbl(j).organization_code  = P_bom_header_tbl(i).organization_code AND
3320                     P_bom_revision_tbl(j).assembly_item_name = P_bom_header_tbl(i).assembly_item_name AND
3321                     NVL(P_bom_revision_tbl(k).alternate_bom_code, '##$$##') = NVL(P_bom_header_tbl(i).alternate_bom_code,'##$$##')) THEN
3322                   l_bom_revision_tbl(k) := P_bom_revision_tbl(j);
3323                   k := k + 1;
3324                 END IF;
3325               END LOOP;
3326             END IF;
3327             l_bom_component_tbl.DELETE;
3328             l_bom_ref_designator_tbl.DELETE;
3329             l_bom_sub_component_tbl.DELETE;
3330             l_bom_comp_ops_tbl.DELETE;
3331             l := 1;
3332             o := 1;
3333             q := 1;
3334             r := 1;
3335             IF (P_bom_component_tbl.COUNT > 0) THEN
3336               FOR m IN P_bom_component_tbl.FIRST..P_bom_component_tbl.LAST LOOP
3337                 IF (P_bom_component_tbl(m).organization_code = P_bom_header_tbl(i).organization_code AND
3338                     P_bom_component_tbl(m).assembly_item_name = P_bom_header_tbl(i).assembly_item_name AND
3339                     NVL(P_bom_component_tbl(m).alternate_bom_code, '##$$##') = NVL(P_bom_header_tbl(i).alternate_bom_code,'##$$##')) THEN
3340                   l_bom_component_tbl(l) := P_bom_component_tbl(m);
3341                   l := l + 1;
3342                 END IF;
3343               END LOOP;
3344             END IF;
3345             IF (P_bom_ref_designator_tbl.COUNT > 0) THEN
3346               FOR a IN P_bom_ref_designator_tbl.FIRST..P_bom_ref_designator_tbl.LAST LOOP
3347                 IF (P_bom_ref_designator_tbl(a).organization_code         = P_bom_header_tbl(i).organization_code AND
3348                     P_bom_ref_designator_tbl(a).assembly_item_name        = P_bom_header_tbl(i).assembly_item_name AND
3349                     NVL(P_bom_ref_designator_tbl(a).alternate_bom_code, '##$$##') = NVL(P_bom_header_tbl(i).alternate_bom_code,'##$$##'))  THEN
3350                   l_bom_ref_designator_tbl(o) := P_bom_ref_designator_tbl(a);
3351                   o := o + 1;
3352                 END IF;
3353               END LOOP;
3354             END IF;
3355             IF (P_bom_sub_component_tbl.COUNT > 0) THEN
3356               FOR a IN P_bom_sub_component_tbl.FIRST..P_bom_sub_component_tbl.LAST LOOP
3357                 IF (P_bom_sub_component_tbl(a).organization_code         = P_bom_header_tbl(i).organization_code AND
3358                     P_bom_sub_component_tbl(a).assembly_item_name        = P_bom_header_tbl(i).assembly_item_name AND
3362                 END IF;
3359                     NVL(P_bom_sub_component_tbl(a).alternate_bom_code, '##$$##') = NVL(P_bom_header_tbl(i).alternate_bom_code,'##$$##')) THEN
3360                   l_bom_sub_component_tbl(q) := P_bom_sub_component_tbl(a);
3361                   q := q + 1;
3363               END LOOP;
3364             END IF;
3365             IF (P_bom_comp_ops_tbl.COUNT > 0) THEN
3366               FOR a IN P_bom_comp_ops_tbl.FIRST..P_bom_comp_ops_tbl.LAST LOOP
3367                 IF (P_bom_comp_ops_tbl(a).organization_code         = P_bom_header_tbl(i).organization_code AND
3368                     P_bom_comp_ops_tbl(a).assembly_item_name        = P_bom_header_tbl(i).assembly_item_name AND
3369                     NVL(P_bom_comp_ops_tbl(a).alternate_bom_code, '##$$##') = NVL(P_bom_header_tbl(i).alternate_bom_code,'##$$##')) THEN
3370                   l_bom_comp_ops_tbl(r) := P_bom_comp_ops_tbl(a);
3371                   r := r + 1;
3372                 END IF;
3373               END LOOP;
3374             END IF;
3375 --Call to existing Process_BOM that accepts only one record of Bom_Headers per call
3376             Process_Bom(P_bo_identifier          => p_bo_identifier,
3377                         P_api_version_number     => p_api_version_number,
3378                         P_init_msg_list          => p_init_msg_list,
3379                         P_bom_header_rec         => l_bom_header_rec,
3380                         P_bom_revision_tbl       => l_bom_revision_tbl,
3381                         P_bom_component_tbl      => l_bom_component_tbl,
3382                         P_bom_ref_designator_tbl => l_bom_ref_designator_tbl,
3383                         P_bom_sub_component_tbl  => l_bom_sub_component_tbl,
3384                         P_bom_comp_ops_tbl       => l_bom_comp_ops_tbl,
3385                         X_bom_header_rec         => l_bom_header_rec_out,
3386                         X_bom_revision_tbl       => l_bom_revision_tbl_out,
3387                         X_bom_component_tbl      => l_bom_component_tbl_out,
3388                         X_bom_ref_designator_tbl => l_bom_ref_designator_tbl_out,
3389                         X_bom_sub_component_tbl  => l_bom_sub_component_tbl_out,
3390                         X_bom_comp_ops_tbl       => l_bom_comp_ops_tbl_out,
3391                         X_return_status          => X_return_status,
3392                         X_msg_count              => X_msg_count,
3393                         P_debug                  => P_debug,
3394                         P_output_dir             => P_output_dir,
3395                         P_debug_filename         => P_debug_filename);
3396             IF (X_return_status = 'S') THEN
3397               l_cnt := NULL;
3398               l_cnt := X_bom_header_tbl.LAST + 1;
3399               IF (l_cnt IS NULL) THEN
3400                 l_cnt := 1;
3401               END IF;
3402               X_bom_header_tbl(l_cnt) := l_bom_header_rec_out;
3403 
3404               l_cnt := NULL;
3405               l_cnt := X_bom_revision_tbl.LAST + 1;
3406               IF (l_cnt IS NULL) THEN
3407                 l_cnt := 1;
3408               END IF;
3409               IF (l_bom_revision_tbl_out.COUNT > 0) THEN
3410                 FOR a IN l_bom_revision_tbl_out.FIRST..l_bom_revision_tbl_out.LAST LOOP
3411                   X_bom_revision_tbl(l_cnt) := l_bom_revision_tbl_out(a);
3412                   l_cnt := l_cnt + 1;
3413                 END LOOP;
3414               END IF;
3415 
3416               l_cnt := NULL;
3417               l_cnt := X_bom_component_tbl.LAST + 1;
3418               IF (l_cnt IS NULL) THEN
3419                 l_cnt := 1;
3420               END IF;
3421               IF (l_bom_component_tbl_out.COUNT > 0) THEN
3422                 FOR a IN l_bom_component_tbl_out.FIRST..l_bom_component_tbl_out.LAST LOOP
3423                   X_bom_component_tbl(l_cnt) := l_bom_component_tbl_out(a);
3424                   l_cnt := l_cnt + 1;
3425                 END LOOP;
3426               END IF;
3427 
3428               l_cnt := NULL;
3429               l_cnt := X_bom_ref_designator_tbl.LAST + 1;
3430               IF (l_cnt IS NULL) THEN
3431                 l_cnt := 1;
3432               END IF;
3433               IF (l_bom_ref_designator_tbl_out.COUNT > 0) THEN
3434                 FOR a IN l_bom_ref_designator_tbl_out.FIRST..l_bom_ref_designator_tbl_out.LAST LOOP
3435                   X_bom_ref_designator_tbl(l_cnt) := l_bom_ref_designator_tbl_out(a);
3436                   l_cnt := l_cnt + 1;
3437                 END LOOP;
3438               END IF;
3439 
3440               l_cnt := NULL;
3441               l_cnt := X_bom_sub_component_tbl.LAST + 1;
3442               IF (l_cnt IS NULL) THEN
3443                 l_cnt := 1;
3444               END IF;
3445               IF (l_bom_sub_component_tbl_out.COUNT > 0) THEN
3446                 FOR a IN l_bom_sub_component_tbl_out.FIRST..l_bom_sub_component_tbl_out.LAST LOOP
3447                   X_bom_sub_component_tbl(l_cnt) := l_bom_sub_component_tbl_out(a);
3448                   l_cnt := l_cnt + 1;
3449                 END LOOP;
3450               END IF;
3451 
3452               l_cnt := NULL;
3453               l_cnt := X_bom_comp_ops_tbl.LAST + 1;
3454               IF (l_cnt IS NULL) THEN
3455                 l_cnt := 1;
3456               END IF;
3457               IF (l_bom_comp_ops_tbl_out.COUNT > 0) THEN
3458                 FOR a IN l_bom_comp_ops_tbl_out.FIRST..l_bom_comp_ops_tbl_out.LAST LOOP
3459                   X_bom_comp_ops_tbl(l_cnt) := l_bom_comp_ops_tbl_out(a);
3460                   l_cnt := l_cnt + 1;
3461                 END LOOP;
3462               END IF;
3463             END IF;
3464           END LOOP;
3465         END IF;
3469                 (P_error_status           => Error_Handler.G_STATUS_ERROR,
3466           EXCEPTION
3467             WHEN no_header_record THEN
3468               Error_Handler.Log_Error
3470                  P_error_scope            => Error_Handler.G_SCOPE_ALL,
3471                  P_error_level            => Error_Handler.G_BO_LEVEL,
3472                  P_other_message          => l_other_message,
3473                  P_other_status           => Error_Handler.G_STATUS_ERROR,
3474                  X_bom_header_rec         => l_bom_header_rec,
3475                  X_bom_revision_tbl       => l_bom_revision_tbl,
3476                  X_bom_component_tbl      => l_bom_component_tbl,
3477                  X_bom_ref_designator_tbl => l_bom_ref_designator_tbl,
3478                  X_bom_sub_component_tbl  => l_bom_sub_component_tbl);
3479                X_return_status := Error_Handler.G_STATUS_ERROR;
3480                X_msg_count     := Error_Handler.Get_Message_Count;
3481         END;
3482 
3483 
3484   /*****************************************************************
3485   * Procedure : Process_BOM
3486   * Parameters IN : Component Item Name
3487   *                 Organization Code
3488   *                 Assembly Item Name
3489   *                 Alternate BOM Code
3490   *                 Effectivity Start Date
3491   *                 Disable Date
3492   *                 Implementation Date
3493   *                 Debug Flag
3494   *                 Debug File Name
3495   *                 Output Directory for Debug File
3496   * Parameters OUT: Error Message
3497   *     Eco Component Unexposed Column Record
3498   * Purpose : This procedure will simply is a convenient Method
3499   *           that adds a component to a BOM.  This internaly
3500   *           Calls the BOM Business Object API
3501   ******************************************************************/
3502 PROCEDURE Process_BOM
3503         (
3504            p_Component_Item_Name        IN  VARCHAR2
3505          , p_Organization_Code          IN  VARCHAR2
3506          , p_Assembly_Item_Name         IN  VARCHAR2
3507          , p_Alternate_Bom_Code         IN  VARCHAR2
3508          , p_Quantity_Per_Assembly      IN  NUMBER := 1
3509          , p_Start_Effective_Date       IN  DATE := SYSDATE
3510          , p_Disable_Date               IN  DATE := NULL
3511          , p_Implementation_Date        IN  DATE := SYSDATE
3512          , p_Debug      IN  VARCHAR2 := 'N'
3513          , p_Debug_FileName   IN  VARCHAR2 := NULL
3514          , p_Output_Dir     IN  VARCHAR2 := NULL
3515          , x_error_message    OUT NOCOPY VARCHAR2
3516          )
3517    IS
3518     l_bom_header_rec     Bom_Bo_Pub.Bom_Head_Rec_Type :=
3519         Bom_Bo_Pub.G_MISS_BOM_HEADER_REC;
3520     l_bom_component_tbl  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
3521         Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL;
3522     l_bom_revision_tbl        Bom_Bo_Pub.Bom_Revision_Tbl_Type;
3523     l_bom_ref_designator_tbl  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type;
3524     l_bom_sub_component_tbl   Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type;
3525     l_bom_comp_ops_tbl        Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type;
3526     l_return_status   VARCHAR2(1);
3527     l_msg_count   NUMBER;
3528 
3529     l_message_text varchar2(2000);
3530     l_entity_index number;
3531     l_Implementation_Date  date;
3532     l_entity_id varchar2(30);
3533     l_message_type varchar2(1);
3534    BEGIN
3535     /* Create the header row */
3536     l_bom_header_rec.assembly_item_name := p_Assembly_Item_Name;
3537     l_bom_header_rec.organization_code  := p_Organization_Code;
3538     l_bom_header_rec.BOM_Implementation_Date := SYSDATE;
3539     l_bom_header_rec.transaction_type := 'SYNC';
3540 
3541     /* Create the component row with bare minimum attributes */
3542 
3543 --If there is no Primary Create a Primary Bill
3544     if (p_Alternate_Bom_Code is not null) then
3545 
3546       l_bom_header_rec.alternate_bom_code := null;
3547 
3548       select decode(enable_unimplemented_boms,'Y',null, sysdate)
3549       into l_bom_header_rec.BOM_Implementation_Date
3550       from bom_structure_types_b stype,
3551            bom_alternate_designators alt
3552      where alt.alternate_designator_code IS NULL
3553        and stype.structure_type_id = alt.structure_type_id;
3554 
3555 
3556       Bom_Bo_Pub.Process_Bom
3557           (  p_bo_identifier           => 'BOM'
3561            , x_bom_header_rec          => l_bom_header_rec
3558            , p_api_version_number      => 1.0
3559            , p_init_msg_list           => TRUE
3560            , p_bom_header_rec          => l_bom_header_rec
3562            , x_bom_revision_tbl        => l_bom_revision_tbl
3563            , x_bom_component_tbl       => l_bom_component_tbl
3564            , x_bom_ref_designator_tbl  => l_bom_ref_designator_tbl
3565            , x_bom_sub_component_tbl   => l_bom_sub_component_tbl
3566            , x_bom_comp_ops_tbl        => l_bom_comp_ops_tbl
3567            , x_return_status           => l_return_status
3568            , x_msg_count               => l_msg_count
3569            , p_debug                   => p_Debug
3570            , p_output_dir              => p_Output_Dir
3571            , p_debug_filename          => p_Debug_FileName
3572            );
3573     end if;
3574 
3575     error_handler.close_debug_session;
3576 
3577     if (p_Alternate_Bom_Code is NULL) then
3578       select decode(enable_unimplemented_boms,'Y',null, sysdate)
3579         into l_bom_header_rec.BOM_Implementation_Date
3580         from bom_structure_types_b stype,
3581              bom_alternate_designators alt
3582        where
3583              alt.alternate_designator_code is NULL
3584          and alt.organization_id = -1
3585          and stype.structure_type_id = alt.structure_type_id;
3586     else
3587       select decode(enable_unimplemented_boms,'Y',null, sysdate)
3588         into l_bom_header_rec.BOM_Implementation_Date
3589         from bom_structure_types_b stype,
3590              bom_alternate_designators alt,
3591        org_organization_definitions org
3592        where alt.alternate_designator_code = p_Alternate_Bom_Code
3593          and alt.organization_id = org.organization_id
3594          and org.organization_code = p_Organization_Code
3595          and stype.structure_type_id = alt.structure_type_id;
3596      end if;
3597 
3598     l_bom_header_rec.assembly_item_name := p_Assembly_Item_Name;
3599     l_bom_header_rec.organization_code  := p_Organization_Code;
3600     l_bom_header_rec.transaction_type := 'SYNC';
3601     l_bom_header_rec.alternate_bom_code := p_Alternate_Bom_Code;
3602     l_bom_header_rec.return_status := null;
3603 
3604     l_bom_component_tbl(1).component_item_name := p_Component_Item_name;
3605     l_bom_component_tbl(1).assembly_item_name  := p_Assembly_Item_Name;
3606     l_bom_component_tbl(1).Organization_Code   := p_Organization_Code;
3607     l_bom_component_tbl(1).Start_Effective_Date := p_Start_Effective_Date; --SYSDATE;
3608     l_bom_component_tbl(1).Disable_Date    := p_Disable_Date;
3609     l_bom_component_tbl(1).Quantity_Per_Assembly := p_Quantity_Per_Assembly;
3610     l_bom_component_tbl(1).operation_sequence_number := 1;
3611     l_bom_component_tbl(1).transaction_type := 'SYNC';
3612     l_bom_component_tbl(1).alternate_bom_code := p_Alternate_Bom_Code;
3613     l_bom_component_tbl(1).return_status := null;
3614 
3615 
3616     /* Call the Business object with just the header and component entities */
3617     Bom_Bo_Pub.Process_Bom
3621            , p_bom_header_rec          => l_bom_header_rec
3618           (  p_bo_identifier           => 'BOM'
3619            , p_api_version_number      => 1.0
3620            , p_init_msg_list           => TRUE
3622            , p_bom_component_tbl       => l_bom_component_tbl
3623            , x_bom_header_rec          => l_bom_header_rec
3624            , x_bom_revision_tbl        => l_bom_revision_tbl
3625            , x_bom_component_tbl       => l_bom_component_tbl
3626            , x_bom_ref_designator_tbl  => l_bom_ref_designator_tbl
3627            , x_bom_sub_component_tbl   => l_bom_sub_component_tbl
3628            , x_bom_comp_ops_tbl        => l_bom_comp_ops_tbl
3629            , x_return_status           => l_return_status
3630            , x_msg_count               => l_msg_count
3631            , p_debug                   => p_Debug
3632            , p_output_dir              => p_Output_Dir
3633            , p_debug_filename          => p_Alternate_Bom_Code || '-'||p_Debug_FileName
3634            );
3635 
3636 -- Call the Error handler
3637    if (l_msg_count > 0) then
3638      Error_Handler.Get_Message
3639           (  x_message_text        => l_message_text
3640            , x_entity_index        => l_entity_index
3641            , x_entity_id           => l_entity_id
3642            , x_message_type        => l_message_type
3643            );
3644    end if;
3645 
3646 
3647    if (l_message_type = 'E') then
3648      x_error_message := l_message_text;
3649    end if;
3650 
3651 
3652    END Process_BOM;
3653 
3654   /********************************************************************
3655         * Procedure     : Process_Bom
3656         * Parameters IN : Bom Product Header exposed column Record
3657         *                 Bom Inventorty Component exposed column table
3658         * Purpose       : This procedure is a wrapper on existing Process_BOM
3659         *                 procedure. This new procedure accepts a record of Bom
3660         *                 headers for product family Bills and a table for
3661         *                 product family components. It then calls  the existing
3662         *                 Process_BOM Procedure after populating all the
3663         *                 component data with the default values.
3664         *********************************************************************/
3665         PROCEDURE Process_Bom
3666         (  p_bo_identifier           IN  VARCHAR2 := 'BOM'
3667          , p_api_version_number      IN  NUMBER := 1.0
3668          , p_init_msg_list           IN  BOOLEAN := FALSE
3669          , p_bom_header_rec          IN  Bom_Bo_Pub.Bom_Product_Rec_Type
3670          , p_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Product_Mem_Tab_Type
3671    , x_bom_header_rec          OUT NOCOPY Bom_Bo_Pub.bom_Head_Rec_Type
3672    , x_bom_component_tbl       OUT NOCOPY Bom_Bo_pub.Bom_Comps_Tbl_Type
3673          , x_return_status           OUT NOCOPY VARCHAR2
3674          , x_msg_count               OUT NOCOPY NUMBER
3675          , p_debug                   IN  VARCHAR2 := 'N'
3679   IS
3676          , p_output_dir              IN  VARCHAR2 := NULL
3677          , p_debug_filename          IN  VARCHAR2 := 'BOM_BO_debug.log'
3678   )
3680 
3681 
3682         -- Local variables for the IN parameters
3683 
3684           l_input_bomheader_rec          Bom_Bo_Pub.Bom_Product_Rec_Type        := p_bom_header_rec;
3685           l_input_bomcomponents_tbl      Bom_Bo_Pub.Bom_Product_Mem_Tab_Type    := p_bom_component_tbl;
3686 
3687         -- BOM BO input parameters
3688           l_bom_header_rec             BOM_BO_PUB.Bom_Head_Rec_Type;
3689           l_bom_component_tbl          BOM_BO_PUB.Bom_Comps_Tbl_Type;
3690           x_bom_revision_tbl_out       BOM_BO_PUB.Bom_Revision_Tbl_Type;
3691     x_bom_ref_designator_tbl_out BOM_BO_PUB.Bom_Ref_Designator_Tbl_Type;
3692           x_bom_sub_component_tbl_out  BOM_BO_PUB.Bom_Sub_Component_Tbl_Type;
3693           x_bom_comp_ops_tbl_out       BOM_BO_PUB.Bom_Comp_ops_Tbl_Type;
3694 
3695           l_other_message       VARCHAR2(50);
3696           l_compcount           NUMBER;
3697     l_Token_Tbl           Error_Handler.Token_Tbl_Type;
3698           i     NUMBER := 1;
3699 
3700         BEGIN
3701 
3702           IF (l_input_bomheader_rec.assembly_item_name IS NOT NULL AND
3703               l_input_bomheader_rec.assembly_item_name <> FND_API.G_MISS_CHAR)
3704               OR
3705              (l_input_bomheader_rec.organization_code IS NOT NULL AND
3706               l_input_bomheader_rec.organization_code <> FND_API.G_MISS_CHAR)
3707           THEN
3708            l_bom_header_rec.Assembly_item_name := l_input_bomheader_rec.Assembly_item_name ;
3709            l_bom_header_rec.Organization_Code := l_input_bomheader_rec.Organization_Code;
3710            l_bom_header_rec.Alternate_Bom_Code := NULL;
3711            l_bom_header_rec.Common_Assembly_Item_Name := NULL;
3712            l_bom_header_rec.Common_Organization_Code := NULL;
3713            l_bom_header_rec.Assembly_Comment := NULL;
3714            l_bom_header_rec.Assembly_Type:= 1;
3715            l_bom_header_rec.Transaction_Type := l_input_bomheader_rec.Transaction_Type;
3716            l_bom_header_rec.Attribute_category := l_input_bomheader_rec.Attribute_category;
3717            l_bom_header_rec.Attribute1 := l_input_bomheader_rec.Attribute1;
3718            l_bom_header_rec.Attribute2 := l_input_bomheader_rec.Attribute2;
3719            l_bom_header_rec.Attribute3 := l_input_bomheader_rec.Attribute3;
3720            l_bom_header_rec.Attribute4 := l_input_bomheader_rec.Attribute4;
3721            l_bom_header_rec.Attribute5 := l_input_bomheader_rec.Attribute5 ;
3722            l_bom_header_rec.Attribute6 := l_input_bomheader_rec.Attribute6;
3723            l_bom_header_rec.Attribute7 := l_input_bomheader_rec.Attribute7;
3724            l_bom_header_rec.Attribute8 := l_input_bomheader_rec.Attribute8;
3725      l_bom_header_rec.Attribute9 := l_input_bomheader_rec.Attribute9;
3726            l_bom_header_rec.Attribute10 := l_input_bomheader_rec.Attribute10;
3727            l_bom_header_rec.Attribute11 := l_input_bomheader_rec.Attribute11;
3728            l_bom_header_rec.Attribute12 := l_input_bomheader_rec.Attribute12;
3729            l_bom_header_rec.Attribute13 := l_input_bomheader_rec.Attribute13;
3730            l_bom_header_rec.Attribute14 := l_input_bomheader_rec.Attribute14;
3731            l_bom_header_rec.Attribute15 := l_input_bomheader_rec.Attribute15;
3732            l_bom_header_rec.Delete_Group_Name := l_input_bomheader_rec.Delete_Group_Name;
3733            l_bom_header_rec.DG_Description := l_input_bomheader_rec.DG_Description;
3734 
3735           END IF;
3736 
3737   IF (l_bom_header_rec.Transaction_Type = BOM_Globals.G_OPR_UPDATE) Then
3738               l_token_tbl(1).token_name := 'ASSEMBLY_ITEM_NAME';
3739               l_token_tbl(1).token_value := l_bom_header_rec.assembly_item_name;
3740               l_token_tbl(2).token_name := 'ORGANIZATION_CODE';
3741               l_token_tbl(2).token_value := l_bom_header_rec.organization_code ;
3742 
3743               x_return_status := 'E';
3744               Error_Handler.Log_Error
3745               ( p_error_status        => x_return_status
3746               , p_error_scope         => Error_Handler.G_SCOPE_ALL
3747               , p_error_level         => Error_Handler.G_BO_LEVEL
3751               , x_bom_header_rec      => l_bom_header_rec
3748               , p_other_message       => 'BOM_ERROR_BUSINESS_OBJECT'
3749               , p_other_status        => x_return_status
3750               , p_other_token_tbl     => l_token_tbl
3752               , x_bom_revision_tbl    => x_bom_revision_tbl_out
3753               , x_bom_component_tbl   => l_bom_component_tbl
3754               , x_bom_ref_designator_tbl => x_bom_ref_designator_tbl_out
3755               , x_bom_sub_component_tbl => x_bom_sub_component_tbl_out
3756               );
3757                 x_msg_count := Error_Handler.Get_Message_Count;
3758           IF bom_globals.get_debug = 'Y' then
3759       Error_Handler.Write_Debug('Cannot have transaction type of UPDATE for product family Bills');
3760     END IF;
3761          ELSE
3762           IF l_input_bomcomponents_tbl IS NOT NULL THEN
3763               l_compcount         := l_input_bomcomponents_tbl.COUNT;
3764           ELSE
3765               l_compcount         := 0;
3766           END IF;
3767 
3768           IF (l_compcount > 0) THEN
3769                 FOR compRec in 1.. l_compcount
3770                 LOOP
3771                   IF l_input_bomcomponents_tbl(compRec).return_status IS NULL OR
3772                      l_input_bomcomponents_tbl(compRec).return_status = FND_API.G_MISS_CHAR
3773                   THEN
3774                       l_bom_component_tbl(compRec).Organization_Code     :=
3775                                         l_input_bomcomponents_tbl(compRec).Organization_Code ;
3776                       l_bom_component_tbl(compRec).Assembly_Item_Name     :=
3777                                         l_input_bomcomponents_tbl(compRec).Assembly_Item_Name ;
3778                       l_bom_component_tbl(compRec).Start_Effective_Date  :=
3779           l_input_bomcomponents_tbl(compRec).Start_Effective_Date;
3780           l_bom_component_tbl(compRec).Disable_Date     :=
3781                                         l_input_bomcomponents_tbl(compRec).Disable_Date;
3782                       l_bom_component_tbl(compRec).Operation_Sequence_Number    := 1; -- Default
3783                       l_bom_component_tbl(compRec).Component_Item_Name   :=
3784                                         l_input_bomcomponents_tbl(compRec).Component_Item_Name;
3785                       l_bom_component_tbl(compRec).Alternate_BOM_Code   := Null; -- Default
3786                       l_bom_component_tbl(compRec).New_Effectivity_Date  :=
3787                                         l_input_bomcomponents_tbl(compRec).New_Effectivity_Date;
3788                       l_bom_component_tbl(compRec).New_Operation_Sequence_Number   := 1 ; -- Default
3789                       l_bom_component_tbl(compRec).Item_Sequence_Number   := NULL ; -- Default
3790                       l_bom_component_tbl(compRec).Basis_Type := NULL ; -- Default
3791                       l_bom_component_tbl(compRec).Quantity_Per_Assembly  := 1 ; -- Default
3792                       l_bom_component_tbl(compRec).Planning_Percent  :=
3793                                         nvl(l_input_bomcomponents_tbl(compRec).Planning_Percent,100);
3794                       l_bom_component_tbl(compRec).Projected_Yield     := 1 ; -- Default
3795                       l_bom_component_tbl(compRec).Include_In_Cost_Rollup := NULL;
3796                       l_bom_component_tbl(compRec).Wip_Supply_Type     := NULL;
3797                       l_bom_component_tbl(compRec).So_Basis     := 2; --Default
3798                       l_bom_component_tbl(compRec).Optional     := 2; -- Default
3799                       l_bom_component_tbl(compRec).Mutually_Exclusive     := 2; -- Default
3800                       l_bom_component_tbl(compRec).Check_Atp     :=   NULL; -- Default
3801                       l_bom_component_tbl(compRec).Shipping_Allowed     :=    NULL;
3802                       l_bom_component_tbl(compRec).Required_To_Ship     :=    2; -- Default
3803                       l_bom_component_tbl(compRec).Required_For_Revenue  := 2; -- Default
3804                       l_bom_component_tbl(compRec).Include_On_Ship_Docs  := 2; -- Default
3805                       l_bom_component_tbl(compRec).Quantity_Related     := 2; -- Default
3806                       l_bom_component_tbl(compRec).Supply_Subinventory   := NULL;
3807                       l_bom_component_tbl(compRec).Location_Name     := NULL;
3808                       l_bom_component_tbl(compRec).Minimum_Allowed_Quantity := NULL;
3809                       l_bom_component_tbl(compRec).Maximum_Allowed_Quantity     := NULL;
3810                       l_bom_component_tbl(compRec).Comments     :=
3811                                         l_input_bomcomponents_tbl(compRec).Comments;
3812                       l_bom_component_tbl(compRec).Attribute_category     :=
3813                                         l_input_bomcomponents_tbl(compRec).Attribute_category;
3814           l_bom_component_tbl(compRec).Attribute1  :=
3815                                         l_input_bomcomponents_tbl(compRec).Attribute1;
3816                       l_bom_component_tbl(compRec).Attribute2  :=
3817                                         l_input_bomcomponents_tbl(compRec).Attribute2;
3818                       l_bom_component_tbl(compRec).Attribute3  :=
3819                                         l_input_bomcomponents_tbl(compRec).Attribute3;
3820                       l_bom_component_tbl(compRec).Attribute4  :=
3821                                         l_input_bomcomponents_tbl(compRec).Attribute4;
3822                       l_bom_component_tbl(compRec).Attribute5  :=
3823                                         l_input_bomcomponents_tbl(compRec).Attribute5;
3824                       l_bom_component_tbl(compRec).Attribute6  :=
3825                                         l_input_bomcomponents_tbl(compRec).Attribute6;
3826                       l_bom_component_tbl(compRec).Attribute7  :=
3827                                         l_input_bomcomponents_tbl(compRec).Attribute7;
3828                       l_bom_component_tbl(compRec).Attribute8  :=
3829                                         l_input_bomcomponents_tbl(compRec).Attribute8;
3830                       l_bom_component_tbl(compRec).Attribute9  :=
3831                                         l_input_bomcomponents_tbl(compRec).Attribute9;
3835                                         l_input_bomcomponents_tbl(compRec).Attribute11;
3832                       l_bom_component_tbl(compRec).Attribute10 :=
3833                                         l_input_bomcomponents_tbl(compRec).Attribute10;
3834                       l_bom_component_tbl(compRec).Attribute11 :=
3836                       l_bom_component_tbl(compRec).Attribute12 :=
3837                                         l_input_bomcomponents_tbl(compRec).Attribute12;
3838                       l_bom_component_tbl(compRec).Attribute13 :=
3839                                         l_input_bomcomponents_tbl(compRec).Attribute13;
3840                       l_bom_component_tbl(compRec).Attribute14 :=
3841                                         l_input_bomcomponents_tbl(compRec).Attribute14;
3842                       l_bom_component_tbl(compRec).Attribute15 :=
3843                                         l_input_bomcomponents_tbl(compRec).Attribute15;
3844                       l_bom_component_tbl(compRec).From_End_Item_Unit_Number    := NULL;
3845                       l_bom_component_tbl(compRec).New_From_End_Item_Unit_Number    := NULL;
3846                       l_bom_component_tbl(compRec).To_End_Item_Unit_Number     := NULL;
3847                       l_bom_component_tbl(compRec).Return_Status     := '';
3848           l_bom_component_tbl(compRec).Transaction_Type     :=
3849                                         l_input_bomcomponents_tbl(compRec).Transaction_Type;
3850                       l_bom_component_tbl(compRec).Original_System_Reference     := NULL;
3851                       l_bom_component_tbl(compRec).Delete_Group_Name     :=
3852                                         l_input_bomcomponents_tbl(compRec).Delete_Group_Name;
3853                       l_bom_component_tbl(compRec).DG_Description     :=
3854                                         l_input_bomcomponents_tbl(compRec).DG_Description;
3855                       l_bom_component_tbl(compRec).Enforce_Int_Requirements    := NULL;
3856 
3857                   END IF;
3858                 END LOOP;
3862             Process_Bom(P_bo_identifier          => p_bo_identifier,
3859           END IF;
3860 
3861                 --Call to existing Process_BOM
3863                         P_api_version_number     => p_api_version_number,
3864                         P_init_msg_list          => p_init_msg_list,
3865                         P_bom_header_rec         => l_bom_header_rec,
3866                         P_bom_revision_tbl       => G_MISS_BOM_REVISION_TBL,
3867                         P_bom_component_tbl      => l_bom_component_tbl,
3868                         P_bom_ref_designator_tbl => G_MISS_BOM_REF_DESIGNATOR_TBL,
3869                         P_bom_sub_component_tbl  => G_MISS_BOM_SUB_COMPONENT_TBL,
3870                         P_bom_comp_ops_tbl       => G_MISS_BOM_COMP_OPS_TBL,
3871                         X_bom_header_rec         => x_bom_header_rec,
3872                         X_bom_revision_tbl       => x_bom_revision_tbl_out,
3873                         X_bom_component_tbl      => x_bom_component_tbl,
3874                         X_bom_ref_designator_tbl => x_bom_ref_designator_tbl_out,
3875       X_bom_sub_component_tbl  => x_bom_sub_component_tbl_out,
3876                         X_bom_comp_ops_tbl       => x_bom_comp_ops_tbl_out,
3877                         X_return_status          => X_return_status,
3878                         X_msg_count              => X_msg_count,
3879                         P_debug                  => P_debug,
3880                         P_output_dir             => P_output_dir,
3881                         P_debug_filename         => P_debug_filename);
3882    END IF;
3883         END;
3884 END Bom_Bo_Pub;