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