1 PACKAGE gme_api_main AS
2 /* $Header: GMEMAPIS.pls 120.11.12010000.1 2008/07/25 10:28:50 appldev ship $ */
3
4 /*================================================================================
5 Procedure
6 create_batch
7 Description
8 This procedure creates batch, then check for Items failing allocation and
9 inventory shortages.
10 Parameters
11 p_batch_header (R) The batch header row to identify the batch
12 Following columns are used from this row.
13 plant_code (R)
14 recipe_validity_rule_id (R)
15 batch_type (R)
16 update_inventory_ind (R)
17 batch_no (R In case of manual document ordering)
18 plan_start_date (O)
19 plan_cmplt_date (O)
20 due_date (O)
21 wip_whse_code (O)
22 p_batch_size (R) Batch Size (Total input, total output or product quantity)
23 p_batch_size_uom (R) UOM for p_batch_size
24 p_ignore_shortages (R) Do not check for the inventory shortages
25 p_use_shop_cal NUMBER(0,1) - to use shop calendar or not.
26 p_contiguity_override NUMBER(0,1) - for contigious period of calendar.
27 p_creation_mode (R) How the batch is created
28 RECIPE
29 PRODUCT
30 TOTAL_OUTPUT
31 TOTAL_INPUT
32 p_recipe_id (O) Recipe_id for which the batch is to be created.
33 p_recipe_no (O) Recipe number along with recipe_version for which the
34 batch is to be created.
35 p_recipe_version (O) Version of the recipe for which the batch is t be created.
36 p_product_no (O) Item number for which the batch is to be created.
37 p_product_id (O) Item ID for which the batch is to be created.
38 p_ignore_qty_below_cap (O)Whether the batch is to be created or not, when resource
39 quantity goes below minimum capacity of the resource.
40 True (Default)
41 False
42 p_use_least_cost_validity_rule VARCHAR2('F','T') - for least cost batch validity rule.
43
44 x_batch_header The batch header that is returned, with all the data
45 x_unallocated_material Table of materials, if auto allocation failed or
46 inventory shortage exists
47 x_return_status outcome of the API call
48 S - Success
49 E - Error
50 U - Unexpected Error
51 N - Items failed auto allocation
52 V - Inventory shortage exists
53 ================================================================================*/
54 PROCEDURE create_batch (
55 p_validation_level IN NUMBER
56 := gme_common_pvt.g_max_errors
57 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
58 ,x_message_count OUT NOCOPY NUMBER
59 ,x_message_list OUT NOCOPY VARCHAR2
60 ,x_return_status OUT NOCOPY VARCHAR2
61 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
62 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
63 ,p_batch_size IN NUMBER
64 ,p_batch_size_uom IN VARCHAR2
65 ,p_creation_mode IN VARCHAR2
66 ,p_recipe_id IN NUMBER := NULL
67 ,p_recipe_no IN VARCHAR2 := NULL
68 ,p_recipe_version IN NUMBER := NULL
69 ,p_product_no IN VARCHAR2 := NULL
70 ,p_product_id IN NUMBER := NULL
71 ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
72 ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
73 ,p_contiguity_override IN VARCHAR2 := fnd_api.g_false
74 ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
75 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab);
76
77 /*================================================================================
78 Procedure
79 create_phantom
80 Description
81 This procedure creates phantom batch based on the validity rule passsed
82
83 Parameters
84 p_material_details (R) The material detail row to identify the material
85 Following columns are used from this row.
86 material_detail_id (R)
87 p_batch_no (O) Batch no, in case of manual document ordering
88 p_validity_rule_id (R) validity rule to use for creating phantom batch
89 p_ignore_shortages (R) Do not check for the inventory shortages
90 p_use_shop_cal NUMBER(0,1) - to use shop calendar or not.
91 p_contiguity_override NUMBER(0,1) - for contigious period of calendar.
92 p_use_least_cost_validity_rule VARCHAR2('F','T') - for least cost batch validity rule.
93 x_material_details The material detail that is returned, with all the data
94 x_unallocated_material Table of materials, if auto allocation failed or
95 inventory shortage exists
96 x_return_status outcome of the API call
97 S - Success
98 E - Error
99 U - Unexpected Error
100 ================================================================================*/
101 PROCEDURE create_phantom (
102 p_validation_level IN NUMBER
103 := gme_common_pvt.g_max_errors
104 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
105 ,x_message_count OUT NOCOPY NUMBER
106 ,x_message_list OUT NOCOPY VARCHAR2
107 ,x_return_status OUT NOCOPY VARCHAR2
108 ,p_material_detail_rec IN gme_material_details%ROWTYPE
109 ,p_batch_header_rec IN gme_batch_header%ROWTYPE --Bug#6738476
110 ,p_batch_no IN VARCHAR2 DEFAULT NULL
111 ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
112 ,p_validity_rule_id IN NUMBER
113 ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
114 ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
115 ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
116 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab);
117
118 /*================================================================================
119 Procedure
120 scale_batch
121 Description
122 This procedure scaless batch up or down and all the phantom batches.
123
124 Parameters
125 p_batch_header (R) The batch header row to identify the batch
126 Following columns are used from this row.
127 batch_id (R)
128 p_scale_factor (R) How much to scale. (scale multiplier;
129 to make the twice as much quantity,
130 scale factor = 2; to reduce quantity to
131 half scale factor = -0.5.
132 p_primaries (R) Scaling based on product or Ingredients
133 INPUT - Ingredients
134 OUTPUT - Products
135 p_qty_type (O) Whether to use formula quantities or batch quantities
136 0 - Formula
137 1 - Batch (Default)
138
139 x_batch_header The batch header that is returned, with all the data
140 x_return_status outcome of the API call
141 S - Success
142 E - Error
143 U - Unexpected Error
144 G - Over allocation exists
145 ================================================================================*/
146 -- Navin Modified this APIas per GME_Scale_Batch_Theoretical_Yield_TD.
147 PROCEDURE scale_batch (
148 p_validation_level IN NUMBER
149 ,p_init_msg_list IN VARCHAR2
150 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
151 ,p_scale_factor IN NUMBER
152 ,p_primaries IN VARCHAR2
153 ,p_qty_type IN NUMBER
154 ,p_recalc_dates IN VARCHAR2 -- Navin
155 ,p_use_workday_cal IN VARCHAR2
156 ,p_contiguity_override IN VARCHAR2
157 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
158 --Navin
159 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
160 ,x_message_count OUT NOCOPY NUMBER
161 ,x_message_list OUT NOCOPY VARCHAR2
162 ,x_return_status OUT NOCOPY VARCHAR2);
163
164 /*================================================================================
165 Procedure
166 theoretical_yield_batch
167 Description
168 This procedure calculates theoretical yield for the batch, and updates the
169 quantities for the product lines.
170
171 Parameters
172 p_batch_header (R) The batch header row to identify the batch
173 Following columns are used from this row.
174 batch_id (R)
175 p_scale_factor (R) Theoretical yield in fractions
176
177 x_batch_header The batch header that is returned, with all the data
178 x_return_status outcome of the API call
179 S - Success
180 E - Error
181 U - Unexpected Error
182 ================================================================================*/
183 PROCEDURE theoretical_yield_batch (
184 p_validation_level IN NUMBER
185 ,p_init_msg_list IN VARCHAR2
186 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
187 ,p_scale_factor IN NUMBER
188 ,x_message_count OUT NOCOPY NUMBER
189 ,x_message_list OUT NOCOPY VARCHAR2
190 ,x_return_status OUT NOCOPY VARCHAR2);
191
192 /*================================================================================
193 Procedure
194 insert_material_line
195 Description
196 This procedure is used to insert a material line to a batch.
197
198 Parameters
199 p_batch_header_rec (R) The batch header record to which the material will be inserted
200 p_material_detail_rec (R) The material detail record to insert the material line.
201 p_batch_step_rec (O) The batch step record to which the material line will be associated.
202 p_trans_id The return from open_actual_qty; should be passed from form; NULL from pub
203
204 x_transacted Indicates whether transactions were created as a result of inserting matl
205 FND_API.g_true - Transactions were created
206 FND_API.g_true - Transactions were not created
207 x_material_detail_rec The material detail record with all the data assigned
208 x_return_status outcome of the API call
209 S - Success
210 E - Error
211 U - Unexpected Error
212 ================================================================================*/
213
214 PROCEDURE insert_material_line (
215 p_validation_level IN NUMBER
216 := gme_common_pvt.g_max_errors
217 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
218 ,x_message_count OUT NOCOPY NUMBER
219 ,x_message_list OUT NOCOPY VARCHAR2
220 ,x_return_status OUT NOCOPY VARCHAR2
221 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
222 ,p_material_detail_rec IN gme_material_details%ROWTYPE
223 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
224 ,p_trans_id IN NUMBER
225 ,x_transacted OUT NOCOPY VARCHAR2
226 ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE);
227
228 -- following called from form... streamlined: step record not required
229 PROCEDURE insert_material_line (
230 p_validation_level IN NUMBER
231 := gme_common_pvt.g_max_errors
232 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
233 ,x_message_count OUT NOCOPY NUMBER
234 ,x_message_list OUT NOCOPY VARCHAR2
235 ,x_return_status OUT NOCOPY VARCHAR2
236 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
237 ,p_material_detail_rec IN gme_material_details%ROWTYPE
238 ,p_batch_step_id IN NUMBER := NULL
239 ,p_trans_id IN NUMBER
240 ,x_transacted OUT NOCOPY VARCHAR2
241 ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE);
242
243 /*================================================================================
244 Procedure
245 update_material_line
246 Description
247 This procedure is used to update a material line in a batch.
248
249 Parameters
250 p_batch_header_rec (R) The batch header record to which this material belongs
251 p_material_detail_rec (R) The material detail record with the values to update.
252 p_stored_material_detail_rec (R) The material detail record as it is in the DB.
253 p_batch_step_rec (O/R) If the material is associated to a step, this is the assoc. step
254 record. If the material is associated to a step,
255 this parm is required.
256 p_scale_phantom (O) If the plan/wip plan quantity has been updated,
257 and the material is a phantom ingredient,
258 this indicates whether the phantom batch should be scaled.
259 p_trans_id The return from open_actual_qty; should be passed from form; NULL from pub
260
261 x_transacted Indicates whether transactions were created as a result of inserting matl
262 FND_API.g_true - Transactions were created
263 FND_API.g_true - Transactions were not created
267 E - Error
264 x_material_detail_rec The updated material detail record.
265 x_return_status outcome of the API call
266 S - Success
268 U - Unexpected Error
269 ================================================================================*/
270
271 PROCEDURE update_material_line (
272 p_validation_level IN NUMBER
273 := gme_common_pvt.g_max_errors
274 ,p_init_msg_list IN VARCHAR2
275 := fnd_api.g_false
276 ,x_message_count OUT NOCOPY NUMBER
277 ,x_message_list OUT NOCOPY VARCHAR2
278 ,x_return_status OUT NOCOPY VARCHAR2
279 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
280 ,p_material_detail_rec IN gme_material_details%ROWTYPE
281 ,p_stored_material_detail_rec IN gme_material_details%ROWTYPE
282 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
283 ,p_scale_phantom IN VARCHAR2
284 := fnd_api.g_false
285 ,p_trans_id IN NUMBER
286 ,x_transacted OUT NOCOPY VARCHAR2
287 ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE);
288
289 -- following called from form... streamlined: step record and stored matl dtl record not required
290 PROCEDURE update_material_line (
291 p_validation_level IN NUMBER
292 := gme_common_pvt.g_max_errors
293 ,p_init_msg_list IN VARCHAR2
294 := fnd_api.g_false
295 ,x_message_count OUT NOCOPY NUMBER
296 ,x_message_list OUT NOCOPY VARCHAR2
297 ,x_return_status OUT NOCOPY VARCHAR2
298 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
299 ,p_material_detail_rec IN gme_material_details%ROWTYPE
300 ,p_batch_step_id IN NUMBER DEFAULT NULL
301 ,p_scale_phantom IN VARCHAR2 := fnd_api.g_false
302 ,p_trans_id IN NUMBER
303 ,x_transacted OUT NOCOPY VARCHAR2
304 ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE);
305
306 /*================================================================================
307 Procedure
308 delete_material_line
309 Description
310 This procedure is used to delete a material line in a batch.
311
312 Parameters
313 p_batch_header_rec (R) The batch header record to which the material belongs.
314 p_material_detail_rec (R) The material detail record to be deleted
315 p_batch_step_rec (O/R) If the material is associated to a step, this is the assoc. step
316 record. If the material is associated to a step, this parm is required.
317 x_transacted Indicates whether transactions were created as a result of inserting matl
318 FND_API.g_true - Transactions were created
319 FND_API.g_true - Transactions were not created
320 x_return_status outcome of the API call
321 S - Success
322 E - Error
323 U - Unexpected Error
324 ================================================================================*/
325
326
327 PROCEDURE delete_material_line (
328 p_validation_level IN NUMBER
329 := gme_common_pvt.g_max_errors
330 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
331 ,x_message_count OUT NOCOPY NUMBER
332 ,x_message_list OUT NOCOPY VARCHAR2
333 ,x_return_status OUT NOCOPY VARCHAR2
334 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
335 ,p_material_detail_rec IN gme_material_details%ROWTYPE
336 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
337 ,x_transacted OUT NOCOPY VARCHAR2);
338
339 -- following called from form... streamlined: step record not required
340 PROCEDURE delete_material_line (
341 p_validation_level IN NUMBER
342 := gme_common_pvt.g_max_errors
343 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
344 ,x_message_count OUT NOCOPY NUMBER
345 ,x_message_list OUT NOCOPY VARCHAR2
346 ,x_return_status OUT NOCOPY VARCHAR2
347 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
348 ,p_material_detail_rec IN gme_material_details%ROWTYPE
349 ,p_batch_step_id IN NUMBER := NULL
350 ,x_transacted OUT NOCOPY VARCHAR2);
351
352 /*================================================================================
353 Procedure
354 reschedule_batch
355 Description
356 This procedure reschedules batch and all the phantom batches.
357 It also reschedules all the steps, if requested so.
358
359 Parameters
360 p_batch_header (R) The batch header row to identify the batch
364 plan_cmplt_date (R)
361 Following columns are used from this row.
362 batch_id (R)
363 plan_start_date (R)
365 p_use_shop_cal NUMBER(0,1) - to use shop calendar or not.
366 p_contiguity_override NUMBER(0,1) - for contigious period of calendar.
367 x_batch_header The batch header that is returned, with all the data
368 x_return_status outcome of the API call
369 S - Success
370 E - Error
371 U - Unexpected Error
372 ================================================================================*/
373 PROCEDURE reschedule_batch (
374 p_validation_level IN NUMBER
375 ,p_init_msg_list IN VARCHAR2
376 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
377 ,p_use_workday_cal IN VARCHAR2
378 ,p_contiguity_override IN VARCHAR2
379 ,x_message_count OUT NOCOPY NUMBER
380 ,x_message_list OUT NOCOPY VARCHAR2
381 ,x_return_status OUT NOCOPY VARCHAR2
382 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
383
384 /*=========================================9======================================
385 Procedure
386 reschedule_step
387 Description
388 This procedure reschedules step and all the subsequent steps, if requested so.
389
390 Parameters
391 p_batch_step (R) The batch step row to identify the step
392 Following columns are used from this row.
393 batchstep_id (R)
394 plan_start_date (R)
395 plan_cmplt_date (R)
396 p_batch_header (R) The batch header row to identify the batch
397 p_reschedule_other (O) Whether to reschedule subsequent steps.
398 p_use_shop_cal NUMBER(0,1) - to use shop calendar or not.
399 p_contiguity_override NUMBER(0,1) - for contigious period of calendar.
400 x_batch_step The batch step that is returned, with all the data
401 x_return_status outcome of the API call
402 S - Success
403 E - Error
404 U - Unexpected Error
405 ================================================================================*/
406 PROCEDURE reschedule_step (
407 p_validation_level IN NUMBER
408 ,p_init_msg_list IN VARCHAR2
409 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
410 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
411 ,p_reschedule_preceding IN VARCHAR2
412 ,p_reschedule_succeeding IN VARCHAR2
413 ,p_use_workday_cal IN VARCHAR2
414 ,p_contiguity_override IN VARCHAR2
415 ,x_message_count OUT NOCOPY NUMBER
416 ,x_message_list OUT NOCOPY VARCHAR2
417 ,x_return_status OUT NOCOPY VARCHAR2
418 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE);
419
420 /*================================================================================
421 Procedure
422 create_batch_reservations
423 Description
424 This procedure creates high level reservations (at organization level) for ingredient
425 lines within a batch.
426 Parameters
427 p_init_msg_list (O) Instructs TRUE or FALSE (T/F) on whether the message stack
428 should be initialized
429 p_batch_header_rec (R) The batch header row to identify the batch
430 against which high level reservations will
431 be created
432 Following columns are used from this row.
433 organization_id (R)
434 batch_id (R)
435 x_message_count Number of messages accumulated on the stack during processing
436 x_message_list Messages accumulated during processing
437 x_return_status outcome of the API call
438 S - Success
439 E - Error
440 U - Unexpected Error
441 N - Items failed auto allocation
442 V - Inventory shortage exists
443 ================================================================================*/
444 PROCEDURE create_batch_reservations (
445 p_init_msg_list IN VARCHAR2 := fnd_api.g_false
446 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
447 ,x_message_count OUT NOCOPY NUMBER
448 ,x_message_list OUT NOCOPY VARCHAR2
449 ,x_return_status OUT NOCOPY VARCHAR2);
450
451 /*================================================================================
452 Procedure
453 create_line_reservations
454 Description
455 This procedure creates high level reservations (at organization level) for the input
456 batch ingredient line.
457 Parameters
461 within a batch against which a high level reservation will
458 p_init_msg_list (O) Instructs TRUE or FALSE (T/F) on whether the message stack
459 should be initialized
460 p_matl_dtl_rec (R) The material detail row identifying the ingredient line
462 be created
463 x_message_count Number of messages accumulated on the stack during processing
464 x_message_list Messages accumulated during processing
465 x_return_status outcome of the API call
466 S - Success
467 E - Error
468 U - Unexpected Error
469 N - Items failed auto allocation
470 V - Inventory shortage exists
471 ================================================================================*/
472 PROCEDURE create_line_reservations (
473 p_init_msg_list IN VARCHAR2 := fnd_api.g_false
474 ,p_matl_dtl_rec IN gme_material_details%ROWTYPE
475 ,x_message_count OUT NOCOPY NUMBER
476 ,x_message_list OUT NOCOPY VARCHAR2
477 ,x_return_status OUT NOCOPY VARCHAR2);
478
479 /*================================================================================
480 Procedure
481 release_batch
482 Description
483 This procedure is used to release a batch.
484
485 Parameters
486 p_batch_header_rec (R) The batch header record to release.
487 x_batch_header_rec The updated batch header record in WIP state.
488 x_exception_material_tbl A table containing all the exception materials found during
489 the release process and an indication of why they are
490 considered an.exception.
491 x_return_status outcome of the API call
492 S - Success
493 E - Error
494 U - Unexpected Error
495 X - Exception
496 ================================================================================*/
497 PROCEDURE release_batch (
498 p_validation_level IN NUMBER
499 := gme_common_pvt.g_max_errors
500 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
501 ,x_message_count OUT NOCOPY NUMBER
502 ,x_message_list OUT NOCOPY VARCHAR2
503 ,x_return_status OUT NOCOPY VARCHAR2
504 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
505 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
506 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
507 ,p_ignore_exception IN VARCHAR2 := NULL); --Bug#5186328
508
509 /*================================================================================
510 Procedure
511 release_step
512 Description
513 This procedure is used to release a step.
514
515 Parameters
516 p_batch_step_rec (R) The batch step record to release.
517 p_batch_header_rec (R) The batch header record the step belongs to.
518 x_batch_step_rec The updated batch step record in WIP state.
519 x_exception_material_tbl A table containing all the exception materials found during
520 the release process and an indication of why they are
521 considered an.exception.
522
523 x_return_status outcome of the API call
524 S - Success
525 E - Error
526 U - Unexpected Error
527 X - Exception
528 ================================================================================*/
529 PROCEDURE release_step (
530 p_validation_level IN NUMBER
531 := gme_common_pvt.g_max_errors
532 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
533 ,x_message_count OUT NOCOPY NUMBER
534 ,x_message_list OUT NOCOPY VARCHAR2
535 ,x_return_status OUT NOCOPY VARCHAR2
536 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
537 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
538 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
539 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
540 ,p_ignore_exception IN VARCHAR2 := NULL); --Bug#5186328
541
542 /*================================================================================
543 Procedure
544 complete_batch
545 Description
546 This procedure is used to complete a batch.
547
548 Parameters
549 p_batch_header_rec (R) The batch header record to complete.
550 x_batch_header_rec The updated batch header record in Complete state.
551 x_exception_material_tbl A table containing all the exception materials found during
552 the complete process and an indication of why they are
553 considered an.exception.
554 x_return_status outcome of the API call
555 S - Success
559 PROCEDURE complete_batch (
556 E - Error
557 U - Unexpected Error
558 ================================================================================*/
560 p_validation_level IN NUMBER
561 := gme_common_pvt.g_max_errors
562 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
563 ,x_message_count OUT NOCOPY NUMBER
564 ,x_message_list OUT NOCOPY VARCHAR2
565 ,x_return_status OUT NOCOPY VARCHAR2
566 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
567 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
568 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
569 ,p_ignore_exception IN VARCHAR2 := NULL); --Bug#5186328
570
571 /*================================================================================
572 Procedure
573 complete_step
574 Description
575 This procedure is used to complete a step.
576
577 Parameters
578 p_batch_step_rec (R) The batch step record to complete.
579 p_batch_header_rec (R) The batch header record the step belongs to.
580 x_batch_step_rec The updated batch step record in complete state.
581 x_exception_material_tbl A table containing all the exception materials found during
582 the complete process and an indication of why they are
583 considered an.exception.
584 x_return_status outcome of the API call
585 S - Success
586 E - Error
587 U - Unexpected Error
588 X - Exception
589
590 ================================================================================*/
591 PROCEDURE complete_step (
592 p_validation_level IN NUMBER
593 := gme_common_pvt.g_max_errors
594 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
595 ,x_message_count OUT NOCOPY NUMBER
596 ,x_message_list OUT NOCOPY VARCHAR2
597 ,x_return_status OUT NOCOPY VARCHAR2
598 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
599 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
600 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
601 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
602 ,p_ignore_exception IN VARCHAR2 := NULL); --Bug#5186328
603
604 /*================================================================================
605 Procedure
606 delete_step
607 Description
608 This procedure deletes the step associated with the batch
609
610 Parameters
611 p_batch_step (R) The batch step row to identify the step
612 Following columns are used from this row.
613 batchstep_id (R)
614 x_return_status outcome of the API call
615 S - Success
616 E - Error
617 U - Unexpected Error
618 ================================================================================*/
619 PROCEDURE delete_step (
620 p_validation_level IN NUMBER
621 := gme_common_pvt.g_max_errors
622 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
623 ,x_message_count OUT NOCOPY NUMBER
624 ,x_message_list OUT NOCOPY VARCHAR2
625 ,x_return_status OUT NOCOPY VARCHAR2
626 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
627 ,p_batch_header_rec IN gme_batch_header%ROWTYPE);
628
629 /*================================================================================
630 Procedure
631 insert_step
632 Description
633 This procedure inserts the new step to the batch
634
635 Parameters
636 p_batch_step (R) The batch step row to insert to the batch.
637 x_batch_step The batch step that is returned, with all the data
638 x_return_status outcome of the API call
639 S - Success
640 E - Error
641 U - Unexpected Error
642 ================================================================================*/
643 PROCEDURE insert_step (
644 p_validation_level IN NUMBER
645 := gme_common_pvt.g_max_errors
646 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
647 ,x_message_count OUT NOCOPY NUMBER
648 ,x_message_list OUT NOCOPY VARCHAR2
649 ,x_return_status OUT NOCOPY VARCHAR2
650 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
651 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
652 ,x_batch_step OUT NOCOPY gme_batch_steps%ROWTYPE);
653 /*================================================================================
654 Procedure
655 revert_to_wip_batch
656 Description
657 This procedure reverts a completed batch to WIP and all the phantom batches.
658
659 Parameters
663 x_return_status outcome of the API call
660 p_batch_header (R) The batch header row to identify the batch
661 Following columns are used from this row.
662 x_batch_header The batch header that is returned, with all the data
664 S - Success
665 E - Error
666 U - Unexpected Error
667 ================================================================================*/
668 PROCEDURE revert_batch (
669 p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
670 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
671 ,x_message_count OUT NOCOPY NUMBER
672 ,x_message_list OUT NOCOPY VARCHAR2
673 ,x_return_status OUT NOCOPY VARCHAR2
674 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
675 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
676
677 /*================================================================================
678 Procedure
679 revert_step
680 Description
681 This procedure reverts a step to WIP.
682
683 Parameters
684 p_batch_step_rec (R) The batch step row to identify the step
685 Following columns are used from this row.
686 batchstep_id (R)
687
688 p_org_code The name of organization to which this batch belongs
689 p_batch_header_rec batch number to which this step belongs
690 x_batch_step_rec The batch step that is returned, with all the data
691 x_return_status outcome of the API call
692 S - Success
693 E - Error
694 U - Unexpected Error
695 ================================================================================*/
696
697 PROCEDURE revert_step (
698 p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
699 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
700 ,x_message_count OUT NOCOPY NUMBER
701 ,x_message_list OUT NOCOPY VARCHAR2
702 ,x_return_status OUT NOCOPY VARCHAR2
703 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
704 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
705 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE);
706
707
708 /*================================================================================
709 Procedure
710 close_batch
711 Description
712 This procedure closes batch and all the phantom batches.
713 It also closes all the steps.
714
715 Parameters
716 p_batch_header (R) The batch header row to identify the batch
717 Following columns are used from this row.
718 batch_id (R)
719 batch_close_date (O)
720
721 x_batch_header The batch header that is returned, with all the data
722 x_return_status outcome of the API call
723 S - Success
724 E - Error
725 U - Unexpected Error
726 ================================================================================*/
727 PROCEDURE close_batch (
728 p_validation_level IN NUMBER
729 ,p_init_msg_list IN VARCHAR2
730 ,x_message_count OUT NOCOPY NUMBER
731 ,x_message_list OUT NOCOPY VARCHAR2
732 ,x_return_status OUT NOCOPY VARCHAR2
733 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
734 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
735
736 /*================================================================================
737 Procedure
738 close_step
739 Description
740 This procedure closes step.
741
742 Parameters
743 p_batch_step (R) The batch step row to identify the step
744 Following columns are used from this row.
745 batchstep_id (R)
746 step_close_date (O)
747 p_delete_pending (R) Delete the pending allocations if any for the
748 material lines associated with the step.
749
750 x_batch_step The batch step that is returned, with all the data
751 x_return_status outcome of the API call
752 S - Success
753 E - Error
754 U - Unexpected Error
755 ================================================================================*/
756 PROCEDURE close_step (
757 p_validation_level IN NUMBER
758 := gme_common_pvt.g_max_errors /* Punit Kumar */
759 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
760 ,x_message_count OUT NOCOPY NUMBER
761 ,x_message_list OUT NOCOPY VARCHAR2
762 ,x_return_status OUT NOCOPY VARCHAR2
763 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
764 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
768 /*================================================================================
765 ,p_delete_pending IN VARCHAR2 := fnd_api.g_false
766 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE);
767
769 Procedure
770 reopen_batch
771 Description
772 This procedure reopens batch and all the phantom batches.
773 It also reopens all the steps, if requested so.
774
775 Parameters
776 p_batch_header (R) The batch header row to identify the batch
777 Following columns are used from this row.
778 batch_id (R)
779 p_reopen_steps (O) Reopen all the steps.
780
781 x_batch_header The batch header that is returned, with all the data
782 x_return_status outcome of the API call
783 S - Success
784 E - Error
785 U - Unexpected Error
786 ================================================================================*/
787 PROCEDURE reopen_batch (
788 p_validation_level IN NUMBER
789 := gme_common_pvt.g_max_errors /* Punit Kumar */
790 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
791 ,x_message_count OUT NOCOPY NUMBER
792 ,x_message_list OUT NOCOPY VARCHAR2
793 ,x_return_status OUT NOCOPY VARCHAR2
794 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
795 ,p_reopen_steps IN VARCHAR2 := fnd_api.g_false
796 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
797
798 /*================================================================================
799 Procedure
800 reopen_step
801 Description
802 This procedure reopens step.
803
804 Parameters
805 p_batch_step (R) The batch header row to identify the batch
806 Following columns are used from this row.
807 batchstep_id (R)
808
809 x_batch_header The batch header that is returned, with all the data
810 x_return_status outcome of the API call
811 S - Success
812 E - Error
813 U - Unexpected Error
814 ================================================================================*/
815 PROCEDURE reopen_step (
816 p_validation_level IN NUMBER
817 := gme_common_pvt.g_max_errors /* Punit Kumar */
818 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
819 ,x_message_count OUT NOCOPY NUMBER
820 ,x_message_list OUT NOCOPY VARCHAR2
821 ,x_return_status OUT NOCOPY VARCHAR2
822 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
823 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
824 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE);
825
826 /*================================================================================
827 Procedure
828 incremental_backflush
829 Description
830 This procedure is used to incrementally backflush the qty to the material line.
831
832 Parameters
833 p_batch_header_rec (R) The batch header record
834 p_material_detail_rec (R) The material detail record
835 p_qty (R) The quantity to apply incrementally as follows:
836 p_qty_type (R) 0 - By increment qty
837 1 - New actual qty
838 2 - % of Plan
839 p_trans_date Transaction date to record for the incremental backflush
840 x_exception_material_tab Table of materials that could not be consumed or yielded
841 for the calculated incremental quantity
842 x_return_status result of the API call
843 S - Success
844 E - Error
845 U - Unexpected Error
846 X - Batch Exception
847
848 HISTORY
849 ================================================================================*/
850 PROCEDURE incremental_backflush (
851 p_validation_level IN NUMBER
852 := gme_common_pvt.g_max_errors
853 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
854 ,x_message_count OUT NOCOPY NUMBER
855 ,x_message_list OUT NOCOPY VARCHAR2
856 ,x_return_status OUT NOCOPY VARCHAR2
857 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
858 ,p_material_detail_rec IN gme_material_details%ROWTYPE
859 ,p_qty IN NUMBER
860 ,p_qty_type IN NUMBER
861 ,p_trans_date IN DATE
862 ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab);
863
864
865 /*================================================================================
866 Procedure
867 reroute_batch
868 Description
869 This procedure reroutes batch (typically changes the routing
870 associated with the batch).
871
872 Parameters
873 p_batch_header_rec (R) The batch header row to identify the batch
877
874 Following columns are used from this row.
875 batch_id (R)
876 p_validity_rule_id (R) Recipe validity rule id for the new recipe.
878 x_batch_header The batch header that is returned, with all the data
879 x_return_status outcome of the API call
880 S - Success
881 E - Error
882 U - Unexpected Error
883 C - No continous periods found
884 ================================================================================*/
885 PROCEDURE reroute_batch (
886 p_validation_level IN NUMBER
887 := gme_common_pvt.g_max_errors
888 ,p_init_msg_list IN VARCHAR2
889 DEFAULT fnd_api.g_false
890 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
891 ,p_validity_rule_id IN NUMBER
892 ,p_use_workday_cal IN VARCHAR2
893 DEFAULT fnd_api.g_false
894 ,p_contiguity_override IN VARCHAR2
895 DEFAULT fnd_api.g_false
896 ,x_message_count OUT NOCOPY NUMBER
897 ,x_message_list OUT NOCOPY VARCHAR2
898 ,x_return_status OUT NOCOPY VARCHAR2
899 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
900
901 /*================================================================================
902 Procedure
903 cancel_batch
904 Description
905 This procedure cancels batch and all the phantom batches.
906 It also cancels all the steps.
907
908 Parameters
909 p_batch_header (R) The batch header row to identify the batch
910 Following columns are used from this row.
911 batch_id (R)
912 x_batch_header The batch header that is returned, with all the data
913 x_return_status outcome of the API call
914 S - Success
915 E - Error
916 U - Unexpected Error
917 ================================================================================*/
918 PROCEDURE cancel_batch (
919 p_validation_level IN NUMBER
920 := gme_common_pvt.g_max_errors
921 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
922 ,x_message_count OUT NOCOPY NUMBER
923 ,x_message_list OUT NOCOPY VARCHAR2
924 ,x_return_status OUT NOCOPY VARCHAR2
925 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
926 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
927
928 /*================================================================================
929 Procedure
930 terminate_batch
931
932 Description
933 This procedure terminates batch and all the phantom batches.
934 It also terminates all the steps.
935
936 Parameters
937 p_batch_header (R) The batch header row to identify the batch
938 Following columns are used from this row.
939 batch_id (R)
940 p_reason_name Reason to terminate the batch
941 x_batch_header The batch header that is returned, with all the data
942 x_return_status outcome of the API call
943 S - Success
944 E - Error
945 U - Unexpected Error
946 ================================================================================*/
947 PROCEDURE terminate_batch (
948 p_validation_level IN NUMBER
949 := gme_common_pvt.g_max_errors
950 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
951 ,x_message_count OUT NOCOPY NUMBER
952 ,x_message_list OUT NOCOPY VARCHAR2
953 ,x_return_status OUT NOCOPY VARCHAR2
954 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
955 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE);
956
957 /*================================================================================
958 Procedure
959 unrelease_batch
960 Description
961 This procedure is used to unrelease a batch, it's phantom batches and any WIP steps.
962
963 Parameters
964 p_batch_header_rec (R) The batch header record to unrelease..
965 p_create_resv_pend_lots Create pending product lots / reservations
966 1 = Yes
967 0 = No
968 x_batch_header_rec The updated batch header record in Pending state.
969 x_return_status outcome of the API call
970 S - Success
971 E - Error
972 U - Unexpected Error
973 ================================================================================*/
974 PROCEDURE unrelease_batch (
975 p_validation_level IN NUMBER
976 := gme_common_pvt.g_max_errors
977 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
978 ,x_message_count OUT NOCOPY NUMBER
979 ,x_message_list OUT NOCOPY VARCHAR2
983 ,p_create_resv_pend_lots IN NUMBER);
980 ,x_return_status OUT NOCOPY VARCHAR2
981 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
982 ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
984
985 /*================================================================================
986 Procedure
987 unrelease_step
988 Description
989 This procedure is used to unrelease a step, and assoc phantom batches.
990
991 Parameters
992 p_batch_step_rec (R) The batch step record to unrelease..
993 p_batch_header_rec (R) The batch header record that the step belongs to.
994 p_create_resv_pend_lots Create pending product lots / reservations
995 1 = Yes
996 0 = No
997 p_update_inventory_ind Update inventory indicator from the batch header
998 x_batch_step_rec The updated batch step record in Pending state.
999 x_return_status outcome of the API call
1000 S - Success
1001 E - Error
1002 U - Unexpected Error
1003 ================================================================================*/
1004 PROCEDURE unrelease_step (
1005 p_validation_level IN NUMBER
1006 := gme_common_pvt.g_max_errors
1007 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1008 ,x_message_count OUT NOCOPY NUMBER
1009 ,x_message_list OUT NOCOPY VARCHAR2
1010 ,x_return_status OUT NOCOPY VARCHAR2
1011 ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
1012 ,p_batch_header_rec IN gme_batch_header%ROWTYPE
1013 ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
1014 ,p_create_resv_pend_lots IN NUMBER);
1015
1016 /*================================================================================
1017 Procedure
1018 auto_detail_line
1019 Description
1020 This procedure automatically generates detailed level reservations for an
1021 ingredient line. The Rules Engine is used to determine the detailing.
1022 Parameters
1023 p_material_detail_rec (R) Ingredient line row
1024 x_return_status outcome of the API call
1025 S - Success
1026 E - Error
1027 U - Unexpected Error
1028 ================================================================================*/
1029 PROCEDURE auto_detail_line (
1030 p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1031 ,x_message_count OUT NOCOPY NUMBER
1032 ,x_message_list OUT NOCOPY VARCHAR2
1033 ,x_return_status OUT NOCOPY VARCHAR2
1034 ,p_material_detail_rec IN gme_material_details%ROWTYPE);
1035
1036 /*================================================================================
1037 Procedure
1038 auto_detail_batch
1039 Description
1040 This procedure automatically generates detailed level reservations for the
1041 ingredient lines of a production batch.
1042 The Rules Engine is used to determine the detailing.
1043
1044 Parameters
1045 p_init_msg_list (O) Specifies whether or not message list should be
1046 initialized (T/F)
1047 x_message_count Number of messages added to the stack
1048 x_message_list Messages generated during processing
1049 x_return_status outcome of the API call
1050 S - Success
1051 E - Error
1052 U - Unexpected Error
1053 p_batch_rec (R) Production Batch Header row
1054 ================================================================================*/
1055
1056 PROCEDURE auto_detail_batch(
1057 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1058 x_message_count OUT NOCOPY NUMBER,
1059 x_message_list OUT NOCOPY VARCHAR2,
1060 x_return_status OUT NOCOPY VARCHAR2,
1061 p_batch_rec IN gme_batch_header%ROWTYPE);
1062
1063 /*================================================================================
1064 Procedure
1065 create_pending_product_lot
1066 Description
1067 This procedure creates a pending product lot record.
1068
1069 Parameters
1070 p_init_msg_list (O) Specifies whether or not message list should be
1071 initialized (T/F)
1072 x_message_count Number of messages added to the stack
1073 x_message_list Messages generated during processing
1074 x_return_status outcome of the API call
1075 S - Success
1076 E - Error
1077 U - Unexpected Error
1078 p_org_id Organization ID
1079 p_pending_product_lots_rec (R) Pending Product Lots record to be created.
1080 x_pending_product_lots_rec Pending Product Lots record that was created.
1081 ================================================================================*/
1082
1083 PROCEDURE create_pending_product_lot (
1084 p_validation_level IN NUMBER
1088 ,x_message_list OUT NOCOPY VARCHAR2
1085 := gme_common_pvt.g_max_errors
1086 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1087 ,x_message_count OUT NOCOPY NUMBER
1089 ,x_return_status OUT NOCOPY VARCHAR2
1090 ,p_org_id IN NUMBER
1091 ,p_pending_product_lots_rec IN gme_pending_product_lots%ROWTYPE
1092 ,x_pending_product_lots_rec OUT NOCOPY gme_pending_product_lots%ROWTYPE);
1093
1094 /*================================================================================
1095 Procedure
1096 update_pending_product_lot
1097 Description
1098 This procedure updates a pending product lot record.
1099
1100 Parameters
1101 p_init_msg_list (O) Specifies whether or not message list should be
1102 initialized (T/F)
1103 x_message_count Number of messages added to the stack
1104 x_message_list Messages generated during processing
1105 x_return_status outcome of the API call
1106 S - Success
1107 E - Error
1108 U - Unexpected Error
1109 p_org_id Organization ID
1110 p_pending_product_lots_rec (R) Pending Product Lots record to be updated.
1111 x_pending_product_lots_rec Pending Product Lots record that was updated.
1112 ================================================================================*/
1113
1114 PROCEDURE update_pending_product_lot (
1115 p_validation_level IN NUMBER
1116 := gme_common_pvt.g_max_errors
1117 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1118 ,x_message_count OUT NOCOPY NUMBER
1119 ,x_message_list OUT NOCOPY VARCHAR2
1120 ,x_return_status OUT NOCOPY VARCHAR2
1121 ,p_org_id IN NUMBER
1122 ,p_pending_product_lots_rec IN gme_pending_product_lots%ROWTYPE
1123 ,x_pending_product_lots_rec IN OUT NOCOPY gme_pending_product_lots%ROWTYPE);
1124
1125 /*================================================================================
1126 Procedure
1127 delete_pending_product_lot
1128 Description
1129 This procedure deletes a pending product lot record.
1130
1131 Parameters
1132 p_init_msg_list (O) Specifies whether or not message list should be
1133 initialized (T/F)
1134 x_message_count Number of messages added to the stack
1135 x_message_list Messages generated during processing
1136 x_return_status outcome of the API call
1137 S - Success
1138 E - Error
1139 U - Unexpected Error
1140 p_org_id Organization ID
1141 p_pending_product_lots_rec (R) Pending Product Lots record to be deleted.
1142 ================================================================================*/
1143
1144 PROCEDURE delete_pending_product_lot (
1145 p_validation_level IN NUMBER
1146 := gme_common_pvt.g_max_errors
1147 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1148 ,x_message_count OUT NOCOPY NUMBER
1149 ,x_message_list OUT NOCOPY VARCHAR2
1150 ,x_return_status OUT NOCOPY VARCHAR2
1151 ,p_org_id IN NUMBER
1152 ,p_pending_product_lots_rec IN gme_pending_product_lots%ROWTYPE);
1153
1154 END gme_api_main;