DBA Data[Home] [Help]

PACKAGE: APPS.BOM_COPY_BILL

Source


1 PACKAGE bom_copy_bill AUTHID CURRENT_USER AS
2 /* $Header: BOMCPYBS.pls 120.14 2011/06/16 10:06:55 gliang ship $ */
3 /*==========================================================================+
4 |   Copyright (c) 1995 Oracle Corporation, California, USA                  |
5 |                          All rights reserved.                             |
6 +===========================================================================+
7 |                                                                           |
8 | File Name    : BOMPCPYBS.pls                                              |
9 | Description  : Bill copy package                                          |
10 | Created By   : Manu Chadha                                                |
11 |                                                                           |
12 |  from_org_id    Copy from org id                                          |
13 |  to_org_id      Copy to org id                                            |
14 |  from_sequence_id  Copy from bill sequence id                             |
15 |  to_sequence_id    Copy to bill sequence id                               |
16 |  display_option    copy option                                            |
17 |           1 - all (not supported from form)                               |
18 |           2 - current                                                     |
19 |           3 - current + future                                            |
20 |  user_id        user id                                                   |
21 |  to_item_id     Copy to item id                                           |
22 |  direction      direction of copy                                         |
23 |           1 - BOM to BOM                                                  |
24 |           2 - BOM to ENG                                                  |
25 |           3 - ENG to ENG                                                  |
26 |           4 - ENG to BOM                                                  |
27 |  to_alternate      Copy to alternate designator                           |
28 |  rev_date    Revision date to copy                                        |
29 |  err_msg        Error message                                             |
30 |  error_code     Error code                                                |
31 |                                                                           |
32 |  15-SEP-2003    Ezhilarasan   Added overloaded copy_bill                  |
33 |                               procedure for specific components,          |
34 |                               reference designators, substitute components|
35 |                               copy etc.,                                  |
36 +==========================================================================*/
37 
38    bom_application_id   CONSTANT NUMBER (3) := 702;
39 
40    PROCEDURE copy_bill (
41       to_sequence_id     IN   NUMBER,
42       from_sequence_id   IN   NUMBER,
43       from_org_id        IN   NUMBER,
44       to_org_id          IN   NUMBER,
45       display_option     IN   NUMBER DEFAULT 2,
46       user_id            IN   NUMBER DEFAULT -1,
47       to_item_id         IN   NUMBER,
48       direction          IN   NUMBER DEFAULT 1,
49       to_alternate       IN   VARCHAR2,
50       rev_date           IN   DATE,
51       e_change_notice    IN   VARCHAR2,
52       rev_item_seq_id    IN   NUMBER,
53       bill_or_eco        IN   NUMBER,
54       eco_eff_date       IN   DATE,
55       eco_unit_number    IN   VARCHAR2 DEFAULT NULL,
56       unit_number        IN   VARCHAR2 DEFAULT NULL,
57       from_item_id       IN   NUMBER
58    );
59 
60 	-- Start of comments
61 	--	API name 	: copy_bill
62 	--	Type		: private
63 	--	Pre-reqs	: Structure shoule have been exploded.
64 	--	Function	: Copies from the source structure (from_sequence_id)
65 	--                to target structure (to_sequence_id).
66 	--	Parameters	:
67 	--	IN		:	to_sequence_id   	IN NUMBER	Required
68 	--				    Target structure's bill sequence id
69 	--              from_sequence_id    IN NUMBER   Required
70 	--                  Source structure's bill sequence id
71 	--              from_org_id         IN NUMBER   Required
72 	--                  Source structure's organization id
73 	--              to_org_id           IN NUMBER   Required
74 	--                  Target structure's organization id
75 	--              display_option      IN NUMBER   Optional
76 	--				    Effectivity Filter criteria for explosion
77 	--              user_id             IN NUMBER   Optional
78 	--                  User Id of the user who launches this process
79 	--              to_item_id          IN NUMBER   Required
80 	--                  Target Structure's Item Id
81 	--              direction           IN NUMBER   Optional
82 	--                  Specifies the type of source and target structure combination
83 	--              to_alternate        IN VARCHAR2 Required
84 	--                  Target Structure's structure name
85 	--              rev_date            IN DATE     Required
86 	--                  Date on which source structure needs to be exploded
87 	--              e_change_notice     IN VARCHANR2  Optional
88 	--                  Change Notice Name
89 	--              rev_item_seq_id     IN NUMBER   Optional
90 	--                  Revised Item Sequence Id of Target Structure's Item
91 	--              bill_or_eco         IN NUMBER   Optional
92 	--                  Copy operation needs to create a structure or eco
93 	--              eco_eff_date        IN DATE     Optional
94 	--                  Effectivity Date for components if copy operation creates eco
95 	--              eco_unit_number     IN VARCHAR2 Optional
96 	--                  Unit number for components if copy operation creates eco
97 	--              unit_number         IN VARCHAR2 Optional
98 	--                  Unit Number of the source structure components
99 	--              from_item_id        IN NUMBER   Required
100 	--                  Source structure's item id
101 	--              specific_copy_falg  IN VARCHAR2 Required
102 	--                  Flag specifies whether copy operation need to copy all or not
103 	--              copy_all_comps_flag  IN VARCHAR2 Optional
104 	--                  Flag specifies whether all components needs to be copied
105 	--              copy_all_rfds_flag  IN VARCHAR2 Optional
106 	--                  Flag specifies whether all reference designators needs to be copied
107 	--              copy_all_subcomps_flag  IN VARCHAR2 Optional
108 	--                  Flag specifies whether all substitute components needs to be copied
109 	--              copy_attach_flag    IN VARCHAR2 Optional
110 	--                  Flag specifies whether attachments needs to be copied
111 	--              p_copy_request_id   IN NUMBER   Required
112 	--                  Request Id of the copy operation.
113 	--              eco_end_item_rev_id IN NUMBER  Optional
114 	--                  End Item Revision Id for revision eff components in created ttm eco
115 	--              contex_eco IN VARCHAR2 Optional
116 	--                  ECO context from which the source structure has been exploded
117     --              trgt_comps_eff_date IN DATE  Optional
118 	--                  Effectivity Date for the target structure's components
119 	--              trgt_comps_unit_number IN VARCHAR2  Required
120 	--                 Unit number for the target structure's components
121 	--              trgt_comps_end_item_rev_id IN NUMBER Optional
122 	--                 End Item Rev Id for the target structure's components
123 	--              p_parent_sort_order  IN VARCHAR2 Required
124 	--                 Sort Order of the current structure which is being processed
125 	-- End of comments
126 
127    PROCEDURE copy_bill (
128       to_sequence_id               IN   NUMBER,
129       from_sequence_id             IN   NUMBER,
130       from_org_id                  IN   NUMBER,
131       to_org_id                    IN   NUMBER,
132       display_option               IN   NUMBER DEFAULT 2,
133       user_id                      IN   NUMBER DEFAULT -1,
134       to_item_id                   IN   NUMBER,
135       direction                    IN   NUMBER DEFAULT 1,
136       to_alternate                 IN   VARCHAR2,
137       rev_date                     IN   DATE,
138       e_change_notice              IN   VARCHAR2,
139       rev_item_seq_id              IN   NUMBER,
140       bill_or_eco                  IN   NUMBER,
141       eco_eff_date                 IN   DATE,
142       eco_unit_number              IN   VARCHAR2 DEFAULT NULL,
143       unit_number                  IN   VARCHAR2 DEFAULT NULL,
144       from_item_id                 IN   NUMBER,
145       -- Flag to identify whether all the components are copied or specific components are copied.
146       specific_copy_flag           IN   VARCHAR2,
147       copy_all_comps_flag          IN   VARCHAR2 DEFAULT 'N',
148       copy_all_rfds_flag           IN   VARCHAR2 DEFAULT 'N',
149       copy_all_subcomps_flag       IN   VARCHAR2 DEFAULT 'N',
150       -- copy_all_compops_flag IN VARCHAR2 DEFAULT 'N',
151       copy_attach_flag             IN   VARCHAR2 DEFAULT 'Y',
152       -- Request Id for this copy operation.  Value from BOM_COPY_STRUCTURE_REQUEST_S
153       p_copy_request_id            IN   NUMBER,
154       -- End Item Rev Id from which the copied components should be effective
155       eco_end_item_rev_id          IN   NUMBER DEFAULT NULL,
156       -- Structure has been exploded in context of this ECO for copying
157       context_eco                  IN   VARCHAR2 DEFAULT NULL,
158 	  -- End Item Revision for which the source structure has been exploded
159 	  p_end_item_rev_id            IN   NUMBER DEFAULT NULL,
160       -- Effectivity Date, End Item Unit Number and End Item Rev Id
161       -- for the components which are getting copied.  Components from effectivity boundary.
162       trgt_comps_eff_date          IN   DATE DEFAULT NULL,
163       trgt_comps_unit_number       IN   VARCHAR2 DEFAULT NULL,
164       trgt_comps_end_item_rev_id   IN   NUMBER DEFAULT NULL,
165       -- Since the JOIN occurs with bom_explosions_v, there could be multiple
166       -- sub-assemblies (items) in the exploded structure at different levels
167       -- but if we copy once that will be suffice
168       p_parent_sort_order          IN   VARCHAR2 DEFAULT NULL,
169       p_cpy_disable_fields         IN   VARCHAR2 DEFAULT 'N',
170 	  p_trgt_str_eff_ctrl          IN   NUMBER DEFAULT 1,
171 	  p_trgt_str_type_id           IN   NUMBER DEFAULT NULL
172    );
173 
174    /* This function is no longer required.  03-Jan-2006 Bug 4916826
175 	-- Start of comments
176 	--	API name 	: get_component_path
177 	--	Type		: private
178 	--	Pre-reqs	: Structure shoule have been exploded.
179 	--	Function	: Gets the component path with '>' delimited item names from top item.
180 	--	Parameters	:
181 	--	IN		:	p_item_id   	IN NUMBER	Required
182 	--				    Component's item id
183 	--              p_org_id        IN NUMBER   Required
184 	--                  Source sructure's organization
185 	--              p_explode_grp_id  IN NUMBER  Required
186 	--                  Explode Groupd Id of the Source Structure
187 	--              p_sort_order      IN VARHCAR2  Required
188 	--                  Component position in the exploded source structure
189 	-- End of comments
190    FUNCTION get_component_path (
191       p_item_id          IN   NUMBER,
192       p_org_id           IN   NUMBER,
193       p_explode_grp_id   IN   NUMBER,
194       p_sort_order       IN   VARCHAR2
195    )
196       RETURN VARCHAR2;*/
197 
198 	-- Start of comments
199 	--	API name 	: get_current_item_rev
200 	--	Type		: private
201 	--	Pre-reqs	: Structure shoule have been exploded.
202 	--	Function	: Gets the current item rev on given date
203 	--	Parameters	:
204 	--	IN		:	p_item_id   	IN NUMBER	Required
205 	--				    Component's item id
206 	--              p_org_id        IN NUMBER   Required
207 	--                  Source sructure's organization
208 	--              p_rev_date      IN DATE     Required
209 	--                  Date for which revision needs to be found
210 	-- End of comments
211    FUNCTION get_current_item_rev (
212       p_item_id    IN   NUMBER,
213       p_org_id     IN   NUMBER,
214       p_rev_date   IN   DATE
215    )
216       RETURN VARCHAR2;
217 
218 	-- Start of comments
219 	--	API name 	: GET_MESSAGE
220 	--	Type		: private
221 	--	Pre-reqs	: None.
222 	--	Function	: Gets message with tokens set
223 	--	Parameters	:
224 	--	IN		:	p_msg_name   	IN VARCHAR2	Required
225 	--				    Name of the message
226 	--              p_comp_item     IN VARCAHR2 Required
227 	--                  Component Item Name For which the error is being thrown
228 	-- End of comments
229    FUNCTION GET_MESSAGE (p_msg_name IN VARCHAR2, p_comp_item IN VARCHAR2)
230       RETURN VARCHAR2;
231 
232 	-- Start of comments
233 	--	API name 	: GET_MESSAGE
234 	--	Type		: private
235 	--	Pre-reqs	: None.
236 	--	Function	: Gets message with tokens set
237 	--	Parameters	:
238 	--	IN		:	p_msg_name   	IN VARCHAR2	Required
239 	--				    Name of the message
240 	--              p_comp_item     IN VARCAHR2 Required
241 	--                  Component Item Name For which the error is being thrown
242 	--              p_assembly_item IN VARCAHR2 Required
243 	--                  Assembly Item Name For which the error is being thrown
244 	-- End of comments
245    FUNCTION GET_MESSAGE (
246       p_msg_name        IN   VARCHAR2,
247       p_comp_item       IN   VARCHAR2,
248       p_assembly_item   IN   VARCHAR2
249    )
250       RETURN VARCHAR2;
251 
252 	-- Start of comments
253 	--	API name 	: get_cnt_message
254 	--	Type		: private
255 	--	Pre-reqs	: None.
256 	--	Function	: Gets message with tokens set
257 	--	Parameters	:
258 	--	IN		:	p_msg_name   	IN VARCHAR2	Required
259 	--				    Name of the message
260 	--              p_assembly_item IN VARCAHR2 Required
261 	--                  Assembly Item Name For which the error is being thrown
262 	--              p_comp_count    IN NUMBER Required
263 	--                  Number of components For which the error is being thrown
264 	-- End of comments
265    FUNCTION get_cnt_message (
266       p_msg_name        IN   VARCHAR2,
267       p_assembly_item   IN   VARCHAR2,
268       p_comp_count      IN   NUMBER
269    )
270       RETURN VARCHAR2;
271 
272 	-- Start of comments
273 	--	API name 	: get_comp_type_rule_message
274 	--	Type		: private
275 	--	Pre-reqs	: None.
276 	--	Function	: Gets message with tokens set
277 	--	Parameters	:
278 	--	IN		:	p_msg_name   	IN VARCHAR2	Required
279 	--				    Name of the message
280 	--              p_assembly_item IN VARCAHR2 Required
281 	--                  Assembly Item Name For which the error is being thrown
282 	--              p_parent_item_type IN VARCAHR2 Required
283 	--                  Assembly Item's Item Type
284 	--              p_component_item IN VARCAHR2 Required
285 	--                  Component Item Name For which the error is being thrown
286 	--              p_component_item_type          IN VARCAHR2 Required
287 	--                  Component Item's Item Type
288 	-- End of comments
289    FUNCTION get_comp_type_rule_message (
290       p_msg_name            IN    VARCHAR2,
291 	  p_assembly_item       IN    VARCHAR2,
292 	  p_parent_item_type    IN    VARCHAR2,
293       p_component_item      IN    VARCHAR2,
294 	  p_component_item_type IN    VARCHAR2
295 	) RETURN VARCHAR2;
296 
297 	-- Start of comments
298 	--	API name 	: GET_MESSAGE
299 	--	Type		: private
300 	--	Pre-reqs	: None.
301 	--	Function	: Gets message with tokens set
305 	--              p_comp_item     IN VARCAHR2 Required
302 	--	Parameters	:
303 	--	IN		:	p_msg_name   	IN VARCHAR2	Required
304 	--				    Name of the message
306 	--                  Component Item Name For which the error is being thrown
307 	--              p_assembly_item IN VARCAHR2 Required
308 	--                  Assembly Item Name For which the error is being thrown
309 	--              p_comp_rev        IN VARCHAR2 Required
310 	--                  Component revision which does not exist in destination organization.
311 	-- End of comments
312    FUNCTION GET_MESSAGE (
313       p_msg_name        IN   VARCHAR2,
314       p_comp_item       IN   VARCHAR2,
315       p_assembly_item   IN   VARCHAR2,
316       p_comp_rev        IN   VARCHAR2
317    )
318       RETURN VARCHAR2;
319 
320 	-- Start of comments
321 	--	API name 	: revision_exists
322 	--	Type		: private
323 	--	Pre-reqs	: Structure shoule have been exploded.
324 	--	Function	: Checks whether revision exists
325 	--	Parameters	:
326 	--	IN		:	p_from_item_id	IN NUMBER Required
327 	--				    Source structure's item id
328 	--              p_from_org_id   IN NUMBER Required
329 	--                  Source structure's organization id
330 	--              p_revision_id   IN NUMBER Required
331 	--                  Revision Id of the assembly item
332 	-- End of comments
333    FUNCTION revision_exists (
334       p_from_item_id   IN   NUMBER,
335       p_from_org_id    IN   NUMBER,
336       p_revision_id    IN   NUMBER
337    )
338       RETURN VARCHAR2;
339 
340 	-- Start of comments
341 	--	API name 	: get_max_minorrev
342 	--	Type		: private
343 	--	Pre-reqs	: Structure shoule have been exploded.
344 	--	Function	: Gets the max minor revision for given item
345 	--	Parameters	:
346 	--	IN		:	p_item_id   	IN NUMBER	Required
347 	--				    Component's item id
348 	--              p_org_id        IN NUMBER   Required
349 	--                  Source sructure's organization
350 	--              p_revision_id   IN NUMBER Required
351 	--                  Revision Id of the item
352 	-- End of comments
353    FUNCTION get_max_minorrev (
354       p_item_id       IN   NUMBER,
355       p_org_id        IN   NUMBER,
356       p_revision_id   IN   NUMBER
357    )
358       RETURN NUMBER;
359 
360 	-- Start of comments
361 	--	API name 	: get_revision
362 	--	Type		: private
363 	--	Pre-reqs	: Structure shoule have been exploded.
364 	--	Function	: Gets the revision for given item
365 	--	Parameters	:
366 	--	IN		:	p_item_id   	IN NUMBER	Required
367 	--				    Component's item id
368 	--              p_org_id        IN NUMBER   Required
369 	--                  Source sructure's organization
370 	--              p_revision_id   IN NUMBER Required
371 	--                  Revision Id of the item
372 	-- End of comments
373    FUNCTION get_revision (
374       p_item_id       IN   NUMBER,
375       p_org_id        IN   NUMBER,
376       p_revision_id   IN   NUMBER
377    )
378       RETURN NUMBER;
379 
380 	-- Start of comments
381 	--	API name 	: get_minor_rev_code
382 	--	Type		: private
383 	--	Pre-reqs	: Structure shoule have been exploded.
384 	--	Function	: Gets the minor rev code for the given minor rev id
385 	--	Parameters	:
386 	--	IN		:	p_end_item_rev_id IN NUMBER	Required
387 	--				    End Item Revision Id
388 	--              p_end_item_minor_rev_id IN NUMBER   Required
389 	--                  End Item Minor Revision Id
390 	-- End of comments
391    FUNCTION get_minor_rev_code (
392       p_end_item_rev_id         IN   NUMBER,
393       p_end_item_minor_rev_id   IN   NUMBER
394    )
395       RETURN VARCHAR2;
396 
397 	-- Start of comments
398 	--	API name 	: assign_items_to_copy_to_org
399 	--	Type		: private
400 	--	Pre-reqs	: None.
401 	--	Function	: Assigns the items to the target organization
402 	--	Parameters	:
403 	--	IN		:	p_cp_request_id IN NUMBER	Required
404 	--				    Concurrent Program Request Id
405 	--              p_copy_request_id IN NUMBER   Required
406 	--				    Copy Request Id
407 	--              p_from_org_id   IN NUMBER Required
408 	--                  Source structure's organization id
409 	--              p_to_org_id     IN NUMBER Required
410 	--                  Target structure's organization id
411 	--              p_to_org_code   IN VARCHAR2 Required
412 	--                  Target structure organization's code
413 	--              p_usr_id        IN NUMBER Required
414 	--                  User who triggered this copy process
415 	--              p_context_eco   IN VARCHAR2 Required
416 	--                  Context ECO for explosion
417 	-- End of comments
418    PROCEDURE assign_items_to_copy_to_org (
419       p_cp_request_id     IN   NUMBER,
420       p_copy_request_id   IN   NUMBER,
421       p_from_org_id       IN   NUMBER,
422       p_to_org_id         IN   NUMBER,
423       p_to_org_code       IN   VARCHAR2,
424       p_usr_id            IN   NUMBER,
425       p_context_eco       IN   VARCHAR2,
426 	  p_to_item_id        IN   NUMBER,
427 	  p_master_org_id     IN   NUMBER
428    );
429 
430 	-- Start of comments
431 	--	API name 	: purge_processed_copy_requests
432 	--	Type		: private
433 	--	Pre-reqs	: None.
437 	--				    Copy Request Status
434 	--	Function	: Purge processed copy requests for the given status
435 	--	Parameters	:
436 	--	IN		:	p_request_status IN VARCHAR2 Required
438 	-- End of comments
439    PROCEDURE purge_processed_copy_requests (p_request_status IN VARCHAR2);
440 
441 	-- Start of comments
442 	--	API name 	: purge_processed_request_errors
443 	--	Type		: private
444 	--	Pre-reqs	: Structure shoule be exploded.
445 	--	Function	: Purge processed copy request errors for the given status
446 	--	Parameters	:
447 	--	IN		:	p_request_status IN VARCHAR2 Required
448 	--				    Copy Request Status
449 	-- End of comments
450    PROCEDURE purge_processed_request_errors (p_request_status IN VARCHAR2);
451 
452 	-- Start of comments
453 	--	API name 	: get_item_exists_in
454 	--	Type		: private
455 	--	Pre-reqs	: Structure shoule have been exploded.
456 	--	Function	: Gets the list of organization in which item exists
457 	--	Parameters	:
458 	--	IN		:	p_item_id   	IN NUMBER	Required
459 	--				    Component's item id
460 	--              p_copy_request_id   IN NUMBER   Required
461 	--                  Request Id of the copy operation.
462 	-- End of comments
463    FUNCTION get_item_exists_in (
464       p_item_id           IN   NUMBER,
465       p_copy_request_id   IN   NUMBER
466    )
467       RETURN VARCHAR2;
468 
469 	-- Start of comments
470 	--	API name 	: get_structure_exists_in
471 	--	Type		: private
472 	--	Pre-reqs	: Structure shoule have been exploded.
473 	--	Function	: Gets the list of organization in which structure exists
474 	--	Parameters	:
475 	--	IN		:	p_item_id   	IN NUMBER	Required
476 	--				    Component's item id
477 	--              p_copy_request_id   IN NUMBER   Required
478 	--                  Request Id of the copy operation.
479 	-- End of comments
480    FUNCTION get_structure_exists_in (
481       p_item_id       IN   NUMBER,
482       p_copy_request_id   IN   NUMBER
483    )
484       RETURN VARCHAR2;
485 
486 	-- Start of comments
487 	--	API name 	: get_common_structure_exists_in
488 	--	Type		: private
489 	--	Pre-reqs	: Structure shoule have been exploded.
490 	--	Function	: Gets the list of organization in which common structure exists
491 	--	Parameters	:
492 	--	IN		:	p_item_id   	IN NUMBER	Required
493 	--				    Component's item id
494 	--              p_copy_request_id   IN NUMBER   Required
495 	--                  Request Id of the copy operation.
496 	-- End of comments
497    FUNCTION get_common_structure_exists_in (
498       p_item_id       IN   NUMBER,
499       p_copy_request_id   IN   NUMBER
500    )
501       RETURN VARCHAR2;
502 
503 	-- Start of comments
504 	--	API name 	: get_assign_items_in
505 	--	Type		: private
506 	--	Pre-reqs	: Structure shoule have been exploded.
507 	--	Function	: Gets the list of organization in which item needs to be assigned
508 	--	Parameters	:
509 	--	IN		:	p_item_id   	IN NUMBER	Required
510 	--				    Component's item id
511 	--              p_copy_request_id   IN NUMBER   Required
512 	--                  Request Id of the copy operation.
513 	-- End of comments
514    FUNCTION get_assign_items_in (
515       p_item_id           IN   NUMBER,
516       p_copy_request_id   IN   NUMBER
517    )
518       RETURN VARCHAR2;
519 
520 	-- Start of comments
521 	--	API name 	: get_copy_structures_in
522 	--	Type		: private
523 	--	Pre-reqs	: Structure shoule have been exploded.
524 	--	Function	: Gets the list of organization in which structure needs to be copied
525 	--	Parameters	:
526 	--	IN		:	p_item_id   	IN NUMBER	Required
527 	--				    Component's item id
528 	--              p_copy_request_id   IN NUMBER   Required
529 	--                  Request Id of the copy operation.
530 	-- End of comments
531    FUNCTION get_copy_structures_in (
532       p_item_id       IN   NUMBER,
533       p_copy_request_id   IN   NUMBER
534    )
535       RETURN VARCHAR2;
536 
537 	-- Start of comments
538 	--	API name 	: get_common_structures_in
539 	--	Type		: private
540 	--	Pre-reqs	: Structure shoule have been exploded.
541 	--	Function	: Gets the list of organization in which common structure needs to be created
542 	--	Parameters	:
543 	--	IN		:	p_item_id   	IN NUMBER	Required
544 	--				    Component's item id
545 	--              p_copy_request_id   IN NUMBER   Required
546 	--                  Request Id of the copy operation.
547 	-- End of comments
548    FUNCTION get_common_structures_in (
549       p_item_id       IN   NUMBER,
550       p_copy_request_id   IN   NUMBER
551    )
552       RETURN VARCHAR2;
553 
554 	-- Start of comments
555 	--	API name 	: get_org_list_for_hierarchy
556 	--	Type		: private
557 	--	Pre-reqs	: None.
558 	--	Function	: Gets the list of organization in the given organization hierarchy name
559 	--	Parameters	:
560 	--	IN		:	p_hierarchy_name IN VARCHAR2	Required
561 	--				    Organization Hierarchy Name
562 	--              p_org_id   IN NUMBER Required
563 	--                  Organization from which the hierarchy needs to be found
564 	--              p_item_id  IN NUMBER Required
565 	--                  Target structure's item
566 	--              p_structure_name IN NUMBER Required
567 	--                  Target structure's structure name
568 	--  OUT     :   x_org_list_tbl OUT NUM_VARRAY
569 	--                  List of organization Ids
570 	--              x_org_code_tbl OUT VARCHAR2_VARRAY
574 	--              x_assembly_type_tbl OUT NUM_VARRAY
571 	--                  List of organization codes
572 	--              x_org_name_tbl OUT VARCHAR2_VARRAY
573 	--                  List of organization names
575 	--                  List of assembly types for corresponding orgs
576 	--              x_item_rev_tbl OUT VARCHAR2_VARRAY
577 	--                  List of item revisions in the corresponding orgs
578 	--              x_item_rev_id_tbl OUT NUM_VARRAY
579 	--                  List of item revision ids in the corresponding orgs
580 	--              x_item_rev_lbl_tbl OUT VARCHAR2_VARRAY
581 	--                  List of item revision labels in the corresponding orgs
582 	--              x_item_exists_tbl OUT VARCHAR2_ARRAY
583 	--                  List of flags which specifies whether p_item_id exists in corresponding orgs
584 	-- End of comments
585     PROCEDURE get_org_list_for_hierarchy (
586        p_hierarchy_name     IN     VARCHAR2,
587 	   p_org_id             IN     NUMBER,
588 	   p_item_id            IN     NUMBER,
589 	   p_structure_name     IN     VARCHAR2,
590 	   p_effectivity_date   IN     DATE,
591        x_org_list_tbl       OUT    NOCOPY num_varray,
592 	   x_org_code_tbl       OUT    NOCOPY varchar2_varray,
593 	   x_org_name_tbl       OUT    NOCOPY varchar2_varray,
594 	   x_org_structure_tbl  OUT    NOCOPY num_varray,
595 	   x_assembly_type_tbl  OUT    NOCOPY num_varray,
596 	   x_item_rev_tbl       OUT    NOCOPY varchar2_varray,
597 	   x_item_rev_id_tbl    OUT    NOCOPY num_varray,
598 	   x_item_rev_lbl_tbl   OUT    NOCOPY varchar2_varray,
599 	   x_item_exists_tbl    OUT    NOCOPY varchar2_varray,
600 	   x_return_status      OUT NOCOPY VARCHAR2,
601 	   x_error_msg          OUT NOCOPY VARCHAR2
602 	  );
603 
604     PROCEDURE update_created_by (
605 	  p_user_id IN NUMBER
606 	  ,p_to_bill_sequence_id IN NUMBER );
607 
608     PROCEDURE copy_bill_for_revised_item
609     (
610       to_sequence_id               IN   NUMBER,
611       from_sequence_id             IN   NUMBER,
612       from_org_id                  IN   NUMBER,
613       to_org_id                    IN   NUMBER,
614       user_id                      IN   NUMBER DEFAULT -1,
615       to_item_id                   IN   NUMBER,
616       direction                    IN   NUMBER DEFAULT 1,
617       to_alternate                 IN   VARCHAR2,
618       rev_date                     IN   DATE,
619       e_change_notice              IN   VARCHAR2,
620       rev_item_seq_id              IN   NUMBER,
621       eco_eff_date                 IN   DATE,
622       eco_unit_number              IN   VARCHAR2 DEFAULT NULL,
623       unit_number                  IN   VARCHAR2 DEFAULT NULL,
624       from_item_id                 IN   NUMBER,
625       -- Request Id for this copy operation.  Value from BOM_COPY_STRUCTURE_REQUEST_S
626       -- To populate the errors in MTL_INTERFACE_ERRORS with this transaction id
627       p_copy_request_id            IN   NUMBER,
628       --  Unit number for copy to item
629       eco_end_item_rev_id          IN   NUMBER DEFAULT NULL,
630       -- Structure has been exploded in context of this ECO for copying
631       context_eco                  IN   VARCHAR2 DEFAULT NULL,
632       p_end_item_rev_id            IN   NUMBER DEFAULT NULL,
633       -- Since the JOIN occurs with bom_explosions_v, there could be multiple
634       -- sub-assemblies (items) in the exploded structure at different levels
635       -- but if we copy once that will be suffice
636       p_parent_sort_order          IN   VARCHAR2 DEFAULT NULL,
637       p_trgt_str_eff_ctrl          IN   NUMBER DEFAULT 1,
638       -- Flag which specifies whether past effective component needs to be copied
639       -- This will be 'Y' only for first revised item created
640       p_cpy_past_eff_comps         IN   VARCHAR2 DEFAULT 'Y',
641 	  p_trgt_str_type_id           IN   NUMBER   DEFAULT NULL
642     );
643 	PROCEDURE copy_attachments(p_from_sequence_id IN NUMBER,
644 	                            p_to_sequence_id   IN NUMBER,
645 								p_user_id          IN NUMBER);
646 
647 
648 	-- Start of comments
649 	--	API name 	: check_component_type_rules
650 	--	Type		: private
651 	--	Pre-reqs	: None.
652 	--	Function	: Checks the component type rules and returns the error msg
653 	--                if the validation fails
654 	--	Parameters	:
655 	--	IN	  	    : p_component_item_id IN NUMBER Required
656 	--				   Component Item Name
657 	--                p_assembly_item_id IN NUMBER Required
658 	--                 Assembly Item Name
659 	--                p_organization_id IN NUMBER Required
660 	--                 Organization Id
661 	-- Returns      : Error Message if validation fails else null
662 	-- Purpose      : To validate the components and insert error messages
663 	--                to errors table if required.
664 	-- End of comments
665 	FUNCTION check_component_type_rules(p_component_item_id IN NUMBER,
666 	                                    p_assembly_item_id IN NUMBER,
667 										p_org_id IN NUMBER
668 									    ) RETURN VARCHAR2;
669 
670 -- Bug 11868441 - sun: issue with bom commoning when any subassembly is on unimplemented eco
671   PROCEDURE ASSIGN_ECO_COMP_TO_ORGS(
672         p_api_version                   IN  NUMBER,
673         p_organization_id               IN  NUMBER,
674         p_bill_sequence_id              IN  NUMBER    DEFAULT NULL,
675         x_return_status                 OUT NOCOPY   VARCHAR2,
676         x_msg_data                      OUT NOCOPY  VARCHAR2);
677 
678 END bom_copy_bill;