DBA Data[Home] [Help]

PACKAGE: APPS.GME_API_PUB

Source


1 PACKAGE gme_api_pub AUTHID CURRENT_USER AS
2 /* $Header: GMEPAPIS.pls 120.39.12020000.6 2013/02/01 19:38:34 gmurator ship $ */
3 /*#
4 * This file contains the headers for the Process Execution (GME) APIs in
5 * Oracle Process Manufacturing (OPM). Each procedure has a common set of
6 * parameters to which API-specific parameters are appended.
7 * @rep:scope public
8 * @rep:product GME
9 * @rep:displayname Production Management public api's
10 * @rep:lifecycle active
11 * @rep:category BUSINESS_ENTITY GME_BATCH
12 */
13 
14 /*#
15 * Save Batch Procedure
16 * This procedure allows the user to save a batch.
17 * It is used to consolidate all the transactions from the temporary
18 * tables and write them to the main tables.
19 * @param p_header_id NUMBER Optional.
20 * @param p_table NUMBER Optional To indicate which table to be processed by Transaction Manager.
21 * @param p_clear_qty_cache BOOLEAN default to true to clear qty cache
22 * @param x_return_status return status
23 * @param p_commit commit flag - default is 'F'
24 * @rep:scope public
25 * @rep:lifecycle active
26 * @rep:displayname save_batch
27 */
28    /*================================================================================
29      Procedure
30        save_batch
31      Description
32        This procedure is used to consolidate all the transactions from the temporary
33        tables and write them to the main tables.
34      Parameters
35        p_header_id (O)           The header_id used by the inventory transaction manager.
36        p_table     (O)           Table to process by Transaction Manager
37                                  1 - temp table
38                                  2 - interface table
39        x_return_status           outcome of the API call
40                                  S - Success
41                                  E - Error
42                                  U - Unexpected Error
43        p_commit                  Indicates whether to commit.
44                                  'T' (FND_API.G_TRUE) - to commit work
45                                  'F' (FND_API.G_FALSE) - Not to commit work
46                                  This is defaulted 'F'
47    ================================================================================*/
48   /* Bug 5255959 added p_clear_qty_cache parameter */
49    PROCEDURE save_batch (
50       p_header_id       IN              NUMBER DEFAULT NULL
51      ,p_table           IN              NUMBER DEFAULT NULL
52      ,p_commit          IN              VARCHAR2 := fnd_api.g_false
53      ,x_return_status   OUT NOCOPY      VARCHAR2
54      --Bug#5584699 Changed the datatype from boolean to varchar2.
55      ,p_clear_qty_cache    IN              VARCHAR2 := fnd_api.g_true);
56      --,p_clear_qty_cache    IN              BOOLEAN DEFAULT TRUE);
57 
58 /*#
59 * Create Batch Procedure
60 * This procedure creates batch, then check for Items failing allocation and
61 * inventory shortages.
62 * @param p_api_version Version of the api
63 * @param p_validation_level validation level
64 * @param p_init_msg_list message list flag - default is 'F'
65 * @param p_commit commit flag - default is 'F'
66 * @param x_message_count # of messages
67 * @param x_message_list List of messages
68 * @param x_return_status return status
69 * @param p_org_code Inventory Organization (Plant or Lab)
70 * @param p_batch_header_rec gme_batch_header rowtype
71 * @param x_batch_header_rec gme_batch_header rowtype
72 * @param p_batch_size batch size
73 * @param p_batch_size_uom batch size uom
74 * @param p_creation_mode creation mode
75 * @param p_recipe_id recipe id
76 * @param p_recipe_no recipe no
77 * @param p_recipe_version recipe version
78 * @param p_product_no product no
79 * @param p_item_revision item revision of the product, if revision control
80 * @param p_product_id product id
81 * @param p_ignore_qty_below_cap ignore below capacity qty
82 * @param p_use_workday_cal use shop calendar flag
83 * @param p_contiguity_override contiguity override flag
84 * @param p_use_least_cost_validity_rule use least cost validity rule to create batch
85 * @param x_exception_material_tbl table of exception records
86 * @rep:scope public
87 * @rep:lifecycle active
88 * @rep:displayname create_batch
89 */
90 
91    /*================================================================================
92      Procedure
93        create_batch
94      Description
95        This procedure creates batch, then check for inventory shortages.
96      Parameters
97        p_org_code (O)            Organization code of the plant or lab
98        p_batch_header_rec (R)    The batch header row to identify the batch
99                                  Following columns are used from this row.
100                                  organization_id  (R)
101                                  recipe_validity_rule_id (R)
102                                  batch_type (R)
103                                  update_inventory_ind (R)
104                                  batch_no (R In case of manual document ordering)
105                                  plan_start_date (O)
106                                  plan_cmplt_date (O)
107                                  due_date (O)
108                                  wip_whse_code (O)
109        p_batch_size (R)          Batch Size (Total input, total output or product quantity)
110                                  Batch size is NULL for recipe mode of creation.
111        p_batch_size_uom (R)      UOM for p_batch_size
112        p_creation_mode (R)       How the batch is created
113                                  RECIPE
114                                  PRODUCT
115                                  TOTAL_OUTPUT
116                                  TOTAL_INPUT
117        p_recipe_id (O)           Recipe_id for which the batch is to be created.
118        p_recipe_no (O)           Recipe number along with recipe_version for which the
119                                  batch is to be created.
120        p_recipe_version (O)      Version of the recipe for  which the batch is t be created.
121        p_product_no (O)          Item number for which the batch is to be created.
122        p_item_revision (O)       Item revision of the product if it is revision controlled
123        p_product_id (O)          Item ID for which the batch is to be created.
124        p_sum_all_prod_lines      "A" sum all prod lines, "S" Primary prod only.
125                                  Used when creating by 'PRODUCT' (Introduced for APS).
126        p_ignore_qty_below_cap (O)Whether the batch is to be created or not, when resource
127                                  quantity goes below minimum capacity of the resource.
128                                  'T'  (Default)
129                                  'F'
130        p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
131        p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
132        p_use_least_cost_validity_rule    VARCHAR2('F','T') - for least cost batch validity rule.
133        x_batch_header_rec        The batch header that is returned,
134        x_return_status           outcome of the API call
135                                  S - Success
136                                  E - Error
137                                  U - Unexpected Error
138                                  V - Inventory shortage exists
139        x_exception_material_tbl  Table of exception records
140    ================================================================================*/
141    PROCEDURE create_batch (
142       p_api_version              IN              NUMBER
143      ,p_validation_level         IN              NUMBER
144             := gme_common_pvt.g_max_errors
145      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
146      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
147      ,x_message_count            OUT NOCOPY      NUMBER
148      ,x_message_list             OUT NOCOPY      VARCHAR2
149      ,x_return_status            OUT NOCOPY      VARCHAR2
150      ,p_org_code                 IN              VARCHAR2 := NULL
151      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
152      ,x_batch_header_rec         OUT NOCOPY      gme_batch_header%ROWTYPE
153      ,p_batch_size               IN              NUMBER := NULL
154      ,p_batch_size_uom           IN              VARCHAR2 := NULL
155      ,p_creation_mode            IN              VARCHAR2
156      ,p_recipe_id                IN              NUMBER := NULL
157      ,p_recipe_no                IN              VARCHAR2 := NULL
158      ,p_recipe_version           IN              NUMBER := NULL
159      ,p_product_no               IN              VARCHAR2 := NULL
160      ,p_item_revision            IN              VARCHAR2 := NULL
161      ,p_product_id               IN              NUMBER := NULL
162      ,p_sum_all_prod_lines       IN              VARCHAR2 := 'A'
163      ,p_ignore_qty_below_cap     IN              VARCHAR2 := fnd_api.g_true
164      ,p_use_workday_cal          IN              VARCHAR2 := fnd_api.g_true
165      ,p_contiguity_override      IN              VARCHAR2 := fnd_api.g_true
169 /*#
166      ,p_use_least_cost_validity_rule     IN              VARCHAR2 := fnd_api.g_false
167      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
168 
170 * Create Phantom Procedure
171 * This procedure creates batch, then check for Items failing allocation and
172 * inventory shortages.
173 * @param p_api_version Version of the api
174 * @param p_validation_level validation level
175 * @param p_init_msg_list message list flag - default is 'F'
176 * @param p_commit commit flag - default is 'F'
177 * @param x_message_count # of messages
178 * @param x_message_list List of messages
179 * @param x_return_status return status
180 * @param p_material_detail_rec gme_material_details rowtype
181 * @param p_org_code Inventory Organization (Plant or Lab)
182 * @param p_batch_no batch no
183 * @param x_material_detail_rec gme_material_details rowtype
184 * @param p_batch_header_rec gme_batch_header row to pass Flexfields
185 * @param p_validity_rule_id validity rule id
186 * @param p_use_workday_cal use shop calendar flag
187 * @param p_contiguity_override contiguity override flag
188 * @param p_use_least_cost_validity_rule use least cost validity rule
189 * @param x_exception_material_tbl table of exception records
190 * @rep:scope public
191 * @rep:lifecycle active
192 * @rep:displayname create_phantom
193 */
194    /*================================================================================
195     Procedure
196       create_phantom
197     Description
198       This procedure creates phantom batch based on the validity rule passsed
199 
200     Parameters
201       p_material_details (R)    The material detail row to identify the material
202                                 Following columns are used from this row.
203                                 material_detail_id  (R)
204       p_org_code (O)            Organization code of the plant or lab
205       p_batch_no         (O)    Batch no, in case of manual document ordering
206       p_validity_rule_id (R)    validity rule to use for creating phantom batch
207       p_ignore_shortages (R)    Do not check for the inventory shortages
208       p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
209       p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
210       p_use_least_cost_validity_rule    VARCHAR2('F','T') - for least cost batch validity rule.
211       x_material_details_rec    The material detail that is returned, with all the data
212                                 inventory shortage exists
213       x_return_status           outcome of the API call
214                                 S - Success
215                                 E - Error
216                                 U - Unexpected Error
217       x_exception_material_tbl  Table of exception records
218   ================================================================================*/
219    PROCEDURE create_phantom (
220       p_api_version              IN              NUMBER
221      ,p_validation_level         IN              NUMBER
222             := gme_common_pvt.g_max_errors
223      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
224      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
225      ,x_message_count            OUT NOCOPY      NUMBER
226      ,x_message_list             OUT NOCOPY      VARCHAR2
227      ,x_return_status            OUT NOCOPY      VARCHAR2
228      ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
229      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE --Bug#6738476
230      ,p_org_code                 IN              VARCHAR2
231      ,p_batch_no                 IN              VARCHAR2 DEFAULT NULL
232      ,x_material_detail_rec      OUT NOCOPY      gme_material_details%ROWTYPE
233      ,p_validity_rule_id         IN              NUMBER
234      ,p_use_workday_cal          IN              VARCHAR2 := fnd_api.g_true
235      ,p_contiguity_override      IN              VARCHAR2 := fnd_api.g_true
236      ,p_use_least_cost_validity_rule     IN      VARCHAR2 := fnd_api.g_false
237      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
238 
239 /*#
240 * Scale Batch Procedure
241 * This procedure reschedules a batch and all associated phantom batches.
242 * It also reschedules all the steps, if requested so.
243 * @param p_api_version Version of the api
244 * @param p_validation_level validation level
245 * @param p_init_msg_list message list flag - default is 'F'
246 * @param p_commit commit flag - default is 'F'
247 * @param x_message_count # of messages
248 * @param x_message_list List of messages
249 * @param x_return_status return status
250 * @param p_batch_header_rec gme_batch_header rowtype
251 * @param p_org_code Inventory Organization (Plant or Lab)
252 * @param p_ignore_exception Ignore exceptions raised during Scale batch
253 * @param p_use_workday_cal use shop calendar flag
254 * @param p_contiguity_override contiguity override
255 * @param p_recalc_dates recalculate dates vased on new resource usage
256 * @param p_scale_factor factor by which quantities should be scaled
257 * @param p_qty_type 1 - batch quantities, 0 - formula quantities
258 * @param p_primaries INPUT scale based in Ingredients, OUTPUT scale based on Products
259 * @param x_batch_header_rec gme_batch_header rowtype
260 * @param x_exception_material_tbl table of exception records
261 * @rep:scope public
262 * @rep:lifecycle active
263 * @rep:displayname reschedule_batch
264 */
265    /*================================================================================
266      Procedure
267        scale_batch
268      Description
269        This procedure reschedules batch and all the phantom batches.
270         It also reschedules all the steps, if requested so.
271 
272      Parameters
273        p_batch_header_rec (R)    The batch header row to identify the batch
274                                  Following columns are used from this row.
275                                  batch_id  (R)
276                                  plan_start_date (R)
277                                  plan_cmplt_date (R)
278        p_org_code (O)            Organization code of the plant or lab
279        p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
280        p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
281        p_recalc_dates            VARCHAR2('F','T') - recalculate dates or not.
282        p_scale_factor (O)        scale factor for scaling
283        p_primaries (R)           (INPUT, OUTPUT) scale based on Ingredients or Products
284        p_qty_type (O)            (0,1) Use formula quantities or batch quantities
285        x_batch_header_rec        The batch header that is returned, with all the data
286        x_return_status           outcome of the API call
287                                  S - Success
288                                  E - Error
289                                  U - Unexpected Error
290       x_exception_material_tbl  Table of exception records
291    ================================================================================*/
292    PROCEDURE scale_batch (
293       p_api_version              IN              NUMBER
294      ,p_validation_level         IN              NUMBER
295             := gme_common_pvt.g_max_errors
296      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
297      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
298      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
299      ,p_org_code                 IN              VARCHAR2
300      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
301      ,p_scale_factor             IN              NUMBER
302      ,p_primaries                IN              VARCHAR2
303      ,p_qty_type                 IN              NUMBER := 1
304      ,p_recalc_dates             IN              VARCHAR2 := fnd_api.g_false
305      ,p_use_workday_cal          IN              VARCHAR2 := fnd_api.g_false
306      ,p_contiguity_override      IN              VARCHAR2 := fnd_api.g_false
307      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab
308      ,x_message_count            OUT NOCOPY      NUMBER
309      ,x_message_list             OUT NOCOPY      VARCHAR2
310      ,x_return_status            OUT NOCOPY      VARCHAR2
311      ,x_batch_header_rec         OUT NOCOPY      gme_batch_header%ROWTYPE);
312 
313 /*#
314 * Theoretical Yield Batch Procedure
315 * This procedure calculates theoretical yield for the batch, and updates the
316 * quantities for the product lines.
317 * @param p_api_version Version of the api
318 * @param p_validation_level validation level
319 * @param p_init_msg_list message list flag - default is False
320 * @param x_message_count # of messages
321 * @param x_message_list List of messages
322 * @param p_commit commit flag - default is False
323 * @param x_return_status return status
324 * @param p_org_code Inventory Organization (Plant or Lab)
325 * @param p_batch_header_rec gme_batch_header rowtype
326 * @param p_scale_factor scale factor for theoretical yield
327 * @rep:scope public
328 * @rep:lifecycle active
329 * @rep:displayname theoretical_yield_batch
330 */
331 
332    /*================================================================================
333      Procedure
334        theoretical_yield_batch
335      Description
336        This procedure calculates theoretical yield for the batch, and updates the
337         quantities for the product lines.
338 
339      Parameters
340        p_batch_header (R)        The batch header row to identify the batch
341                                  Following columns are used from this row.
342                                  batch_id  (R)
343        p_org_code (O)            Organization code of the plant or lab
344        p_scale_factor (R)        Theoretical yield in fractions
345 
346        x_batch_header            The batch header that is returned, with all the data
347        x_return_status           outcome of the API call
348                                  S - Success
349                                  E - Error
350                                  U - Unexpected Error
351    ================================================================================*/
352    PROCEDURE theoretical_yield_batch (
353       p_api_version        IN              NUMBER := 2.0
354      ,p_validation_level   IN              NUMBER
355             := gme_common_pvt.g_max_errors
356      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
357      ,p_commit             IN              VARCHAR2 := fnd_api.g_false
358      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
359      ,p_org_code           IN              VARCHAR2
360      ,p_scale_factor       IN              NUMBER
361      ,x_message_count      OUT NOCOPY      NUMBER
362      ,x_message_list       OUT NOCOPY      VARCHAR2
363      ,x_return_status      OUT NOCOPY      VARCHAR2);
364 /*#
365 * Update Actual Resource Usage Procedure
366 * This procedure is used to insert a completed resource txn for a
367 * resource.This procedure removes all the existing resource txn for the specified
368 * resource.This API can be used only bor a WIP or Complete step.
369 * @param p_api_version Version of the api
370 * @param p_validation_level validation level
371 * @param p_init_msg_list message list flag - default is False
372 * @param p_commit commit flag - default is False
373 * @param p_org_code Inventory Organization (Plant or Lab)
374 * @param p_batch_no Batch No
375 * @param p_batchstep_no Batch Step No
376 * @param p_activity Activity
377 * @param p_resource Resource
378 * @param p_rsrc_txn_rec gme_rsrc_txn_rec rowtype
379 * @param p_instance_no Instance No
380 * @param p_reason_name Reason Name from the mtl_transaction_reasons
381 * @param p_validate_flexfields validate flexfields flag ('T','F')
382 * @param x_rsrc_txn_rec gme_rsrc_txn_rec rowtype
383 * @param x_message_count # of messages
384 * @param x_message_list List of messages
385 * @param x_return_status return status
386 * @rep:scope public
387 * @rep:lifecycle active
388 * @rep:displayname update_actual_rsrc_usage
389 */
390 
391    /*================================================================================
392     Procedure
393       update_actual_rsrc_usage
394     Description
395       This procedure is used to insert a completed resource txn for a
396       resource.This procedure removes all the existing resource txn for the specified
397       resource.This API can be used only bor a WIP or Complete step.
398 
399     Parameters
400       p_org_code (O)              Organization code of the plant or lab
401       p_batch_no (R)              Batch no.
402       p_batchstep_no (R)          Batch Step no .
403       p_activity (R)              Activity.
404       p_resource (R)              Resource.
405       p_instance_no (O)           instance no - for WPS use
406       p_reason_name (O)           Reasone Name (reason from mtl_transaction_reasons)
407       p_rsrc_txn_rec (R)          gme_resource_txns rowtype
408       p_validate_flexfields (O)   validate flexfield flag ('T','F')
409       x_rsrc_txn_rec (R)          gme_resource_txns rowtype
410       x_return_status             outcome of the API call
411                                   S - Success
412                                   E - Error
413                                   U - Unexpected Error
414   ================================================================================*/
415 
416    PROCEDURE update_actual_rsrc_usage (
417       p_api_version           IN              NUMBER := 2.0
418      ,p_validation_level      IN              NUMBER
419             := gme_common_pvt.g_max_errors
420      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
421      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
422      ,p_org_code              IN              VARCHAR2
423      ,         /* inventory organization under which the batch was created */
424       p_batch_no              IN              VARCHAR2 := NULL
425      ,p_batchstep_no          IN              NUMBER := NULL
426      ,p_activity              IN              VARCHAR2 := NULL
427      ,p_resource              IN              VARCHAR2 := NULL
428      ,p_instance_no           IN              NUMBER := NULL
429      ,p_reason_name           IN              VARCHAR2 := NULL
430      ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
431      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
432      ,                     /* indicates whether to validate the flex fields*/
433       x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
434      ,x_message_count         OUT NOCOPY      NUMBER
435      ,x_message_list          OUT NOCOPY      VARCHAR2
436      ,x_return_status         OUT NOCOPY      VARCHAR2);
437 
438 /*#
439 * Insert Incremental Resource Transaction Procedure
440 * This procedure is used to incrementally insert a complete resource txn allocation for a
441 * resource.This API can be used only for a WIP or Complete step.
442 * @param p_api_version Version of the api
443 * @param p_validation_level validation level
444 * @param p_init_msg_list message list flag - default is False
445 * @param p_commit commit flag - default is False
446 * @param p_org_code Inventory Organization (Plant or Lab)
447 * @param p_batch_no Batch No
448 * @param p_batchstep_no Batch Step No
449 * @param p_activity Activity
450 * @param p_resource Resource
451 * @param p_rsrc_txn_rec gme_rsrc_txn_rec rowtype
452 * @param p_instance_no Instance No
453 * @param p_reason_name Reason Name from the mtl_transaction_reasons
454 * @param p_validate_flexfields validate flexfields flag ('T','F')
455 * @param x_rsrc_txn_rec gme_rsrc_txn_rec rowtype
456 * @param x_message_count # of messages
457 * @param x_message_list List of messages
458 * @param x_return_status return status
459 * @rep:scope public
460 * @rep:lifecycle active
461 * @rep:displayname insert_incr_actual_rsrc_txn
462 */
463 
464    /*================================================================================
465     Procedure
466       insert_incr_actual_rsrc_txn
467     Description
468       This procedure is used to incrementally insert a complete resource txn allocation for a
469       resource.This API can be used only for a WIP or Complete step.
470 
471     Parameters
472       p_org_code (O)              Organization code of the plant or lab
473       p_batch_no (R)              Batch no.
474       p_batchstep_no (R)          Batch Step no .
475       p_activity (R)              Activity.
476       p_resource (R)              Resource.
477       p_instance_no (O)           instance no - for WPS use
478       p_reason_name (O)           Reasone Name (reason from mtl_transaction_reasons)
479       p_rsrc_txn_rec (R)          gme_resource_txns rowtype
480       p_validate_flexfields (O)   validate flexfield flag ('T','F')
481       x_rsrc_txn_rec (R)          gme_resource_txns rowtype
482       x_return_status             outcome of the API call
483                                   S - Success
484                                   E - Error
485                                   U - Unexpected Error
486   ================================================================================*/
487    PROCEDURE insert_incr_actual_rsrc_txn (
488       p_api_version           IN              NUMBER := 2.0
489      ,p_validation_level      IN              NUMBER
490             := gme_common_pvt.g_max_errors
491      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
492      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
493      ,p_org_code              IN              VARCHAR2
494      ,         /* inventory organization under which the batch was created.*/
495       p_batch_no              IN              VARCHAR2 := NULL
496      ,p_batchstep_no          IN              NUMBER := NULL
497      ,p_activity              IN              VARCHAR2 := NULL
498      ,p_resource              IN              VARCHAR2 := NULL
499      ,p_instance_no           IN              NUMBER := NULL
500      ,p_reason_name           IN              VARCHAR2 := NULL
501      ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
502      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
503      ,                    /* indicates whether to validate the flex fields */
504       x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
505      ,x_message_count         OUT NOCOPY      NUMBER
506      ,x_message_list          OUT NOCOPY      VARCHAR2
507      ,x_return_status         OUT NOCOPY      VARCHAR2);
508 
509 /*#
510 * Insert Timed Actual Resource Transaction Procedure
511 * This procedure is used to insert a complete resource txn allocation for a
512 * resource.usage is calculated from txn dates supplied.
513 * This API can be used only bor a WIP or Complete step.
514 * @param p_api_version Version of the api
515 * @param p_validation_level validation level
516 * @param p_init_msg_list message list flag - default is False
517 * @param p_commit commit flag - default is False
518 * @param p_org_code Inventory Organization (Plant or Lab)
519 * @param p_batch_no Batch No
520 * @param p_batchstep_no Batch Step No
521 * @param p_activity Activity
522 * @param p_resource Resource
523 * @param p_rsrc_txn_rec gme_rsrc_txn_rec rowtype
524 * @param p_instance_no Instance No
525 * @param p_reason_name Reason Name from the mtl_transaction_reasons
526 * @param p_validate_flexfields validate flexfields flag ('T','F')
527 * @param x_rsrc_txn_rec gme_rsrc_txn_rec rowtype
528 * @param x_message_count # of messages
529 * @param x_message_list List of messages
530 * @param x_return_status return status
531 * @rep:scope public
532 * @rep:lifecycle active
533 * @rep:displayname insert_timed_actual_rsrc_txn
534 */
535 
536    /*================================================================================
537     Procedure
538       insert_timed_actual_rsrc_txn
539     Description
540       This procedure is used to insert a complete resource txn allocation for a
541       resource.usage is calculated from txn dates supplied.
542       This API can be used only for a WIP or Complete step.
543 
544     Parameters
545       p_org_code (O)              Organization code of the plant or lab
546       p_batch_no (R)              Batch no.
547       p_batchstep_no (R)          Batch Step no .
548       p_activity (R)              Activity.
549       p_resource (R)              Resource.
550       p_instance_no (O)           instance no - for WPS use
551       p_reason_name (O)           Reasone Name (reason from mtl_transaction_reasons)
552       p_rsrc_txn_rec (R)          gme_resource_txns rowtype
553       p_validate_flexfields (O)   validate flexfield flag ('T','F')
554       x_rsrc_txn_rec (R)          gme_resource_txns rowtype
555       x_return_status             outcome of the API call
556                                   S - Success
557                                   E - Error
558                                   U - Unexpected Error
559   ================================================================================*/
560    PROCEDURE insert_timed_actual_rsrc_txn (
561       p_api_version           IN              NUMBER := 2.0
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      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
566      ,p_org_code              IN              VARCHAR2
567      ,        /* inventory organization under which the batch was created. */
568       p_batch_no              IN              VARCHAR2 := NULL
569      ,p_batchstep_no          IN              NUMBER := NULL
570      ,p_activity              IN              VARCHAR2 := NULL
571      ,p_resource              IN              VARCHAR2 := NULL
572      ,p_instance_no           IN              NUMBER := NULL
573      ,p_reason_name           IN              VARCHAR2 := NULL
574      ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
575      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
576      ,                    /* indicates whether to validate the flex fields */
577       x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
578      ,x_message_count         OUT NOCOPY      NUMBER
579      ,x_message_list          OUT NOCOPY      VARCHAR2
580      ,x_return_status         OUT NOCOPY      VARCHAR2);
581 
582 /*#
583 * Start Complete Actual Resource Transaction Procedure
584 * This procedure is used to start a complete resource txn for a resource.
585 * usage of the txn is 0 as the txn has just started.end_cmplt_actual_rsrc_txn
586 * API is used to complete a started txn
587 * @param p_api_version Version of the api
588 * @param p_validation_level validation level
589 * @param p_init_msg_list message list flag - default is False
590 * @param p_commit commit flag - default is False
591 * @param p_org_code Inventory Organization (Plant or Lab)
592 * @param p_batch_no Batch No
593 * @param p_batchstep_no Batch Step No
594 * @param p_activity Activity
595 * @param p_resource Resource
596 * @param p_rsrc_txn_rec gme_rsrc_txn_rec rowtype
597 * @param p_instance_no Instance No
598 * @param p_reason_name Reason Name from the mtl_transaction_reasons
599 * @param p_validate_flexfields validate flexfields flag ('T','F')
600 * @param x_rsrc_txn_rec gme_rsrc_txn_rec rowtype
601 * @param x_message_count # of messages
602 * @param x_message_list List of messages
603 * @param x_return_status return status
604 * @rep:scope public
605 * @rep:lifecycle active
606 * @rep:displayname start_cmplt_actual_rsrc_txn
607 */
608 
609    /*================================================================================
610     Procedure
611       start_cmplt_actual_rsrc_txn
612     Description
613       This procedure is used to start a complete resource txn for a resource.
614       usage of the txn is 0 as the txn has just started.end_cmplt_actual_rsrc_txn
615       API is used to complete a started txn
616 
617     Parameters
618       p_org_code (O)              Organization code of the plant or lab
619       p_batch_no (R)              Batch no.
620       p_batchstep_no (R)          Batch Step no .
621       p_activity (R)              Activity.
622       p_resource (R)              Resource.
623       p_instance_no (O)           instance no - for WPS use
624       p_reason_name (O)           Reasone Name (reason from mtl_transaction_reasons)
625       p_rsrc_txn_rec (R)          gme_resource_txns rowtype
626       p_validate_flexfields (O)   validate flexfield flag ('T','F')
627       x_rsrc_txn_rec (R)          gme_resource_txns rowtype
628       x_return_status             outcome of the API call
629                                   S - Success
630                                   E - Error
631                                   U - Unexpected Error
632   ================================================================================*/
633      PROCEDURE start_cmplt_actual_rsrc_txn (
634       p_api_version           IN              NUMBER := 2.0
635      ,p_validation_level      IN              NUMBER
636             := gme_common_pvt.g_max_errors
637      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
638      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
639      ,p_org_code              IN              VARCHAR2
640      ,          /*inventory organization under which the batch was created.*/
641       p_batch_no              IN              VARCHAR2 := NULL
642      ,p_batchstep_no          IN              NUMBER := NULL
643      ,p_activity              IN              VARCHAR2 := NULL
644      ,p_resource              IN              VARCHAR2 := NULL
645      ,p_instance_no           IN              NUMBER
646      ,p_reason_name           IN              VARCHAR2 := NULL
647      , /*instance of the resource for which the transaction is being added.*/
648       p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
649      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
650      ,                      /*indicates whether to validate the flex fields*/
651       x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
652      ,x_message_count         OUT NOCOPY      NUMBER
653      ,x_message_list          OUT NOCOPY      VARCHAR2
654      ,x_return_status         OUT NOCOPY      VARCHAR2);
655 
656 /*#
657 * End Complete Actual Resource Transaction Procedure
658 * This procedure is used to start a complete resource txn for a resource.
659 * usage of the txn is 0 as the txn has just started.end_cmplt_actual_rsrc_txn
660 * API is used to complete a started txn
661 * @param p_api_version Version of the api
662 * @param p_validation_level validation level
663 * @param p_init_msg_list message list flag - default is False
664 * @param p_commit commit flag - default is False
665 * @param p_rsrc_txn_rec gme_rsrc_txn_rec rowtype
666 * @param p_instance_no Instance No
667 * @param p_reason_name Reason Name from the mtl_transaction_reasons
668 * @param p_validate_flexfields validate flexfields flag ('T','F')
669 * @param x_rsrc_txn_rec gme_rsrc_txn_rec rowtype
670 * @param x_message_count # of messages
671 * @param x_message_list List of messages
672 * @param x_return_status return status
673 * @rep:scope public
674 * @rep:lifecycle active
675 * @rep:displayname end_cmplt_actual_rsrc_txn
676 */
677 
678    /*================================================================================
679     Procedure
680       end_cmplt_actual_rsrc_txn
681     Description
682       This procedure is used to end a rsrc txn that was started earlier using
683       start_cmplt_actual_rsrc_txn API. The usage of specified txn must be 0.
684 
685     Parameters
686       p_instance_no (O)           instance no - for WPS use
687       p_reason_name (O)           Reasone Name (reason from mtl_transaction_reasons)
688       p_rsrc_txn_rec (R)          gme_resource_txns rowtype
689       p_validate_flexfields (O)   validate flexfield flag ('T','F')
690       x_rsrc_txn_rec (R)          gme_resource_txns rowtype
691       x_return_status             outcome of the API call
692                                   S - Success
693                                   E - Error
694                                   U - Unexpected Error
695   ================================================================================*/
696    PROCEDURE end_cmplt_actual_rsrc_txn (
697       p_api_version           IN              NUMBER := 2.0
698      ,p_validation_level      IN              NUMBER
699             := gme_common_pvt.g_max_errors
700      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
701      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
702      ,p_instance_no           IN              NUMBER := NULL
703      ,p_reason_name           IN              VARCHAR2 := NULL
704      ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
705      ,      /*contains information for resource_transaction to be completed*/
706       p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
707      ,                    /* indicates whether to validate the flex fields */
708       x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
709      ,x_message_count         OUT NOCOPY      NUMBER
710      ,x_message_list          OUT NOCOPY      VARCHAR2
711      ,x_return_status         OUT NOCOPY      VARCHAR2);
712 
713 /*#
714 * Reschedule Batch Procedure
715 * This procedure reschedules a batch and all associated phantom batches.
716 * It also reschedules all the steps, if requested so.
717 * @param p_api_version Version of the api
718 * @param p_validation_level validation level
719 * @param p_init_msg_list message list flag - default is False
720 * @param p_commit commit flag - default is False
721 * @param x_message_count # of messages
722 * @param x_message_list List of messages
723 * @param x_return_status return status
724 * @param p_org_code Inventory Organization (Plant or Lab)
725 * @param p_batch_header_rec gme_batch_header rowtype
726 * @param p_use_workday_cal use shop calendar flag
727 * @param p_contiguity_override contiguity override
728 * @param x_batch_header_rec gme_batch_header rowtype
729 * @rep:scope public
730 * @rep:lifecycle active
731 * @rep:displayname reschedule_batch
732 */
733 
734    /*================================================================================
735      Procedure
736        reschedule_batch
737      Description
738        This procedure reschedules batch and all the phantom batches.
739         It also reschedules all the steps, if requested so.
740 
741      Parameters
742        p_org_code (O)            Organization code of the plant or lab
743        p_batch_header (R)        The batch header row to identify the batch
744                                  Following columns are used from this row.
745                                  batch_id  (R)
746                                  plan_start_date (R)
747                                  plan_cmplt_date (R)
748        p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
749        p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
750        x_batch_header            The batch header 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 reschedule_batch (
757       p_api_version           IN              NUMBER := 2.0
758      ,p_validation_level      IN              NUMBER
759             := gme_common_pvt.g_max_errors
760      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
761      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
762      ,p_batch_header_rec      IN              gme_batch_header%ROWTYPE
763      ,p_use_workday_cal       IN              VARCHAR2 := fnd_api.g_false
764      ,p_contiguity_override   IN              VARCHAR2 := fnd_api.g_false
765      ,p_org_code              IN              VARCHAR2
766      ,x_message_count         OUT NOCOPY      NUMBER
767      ,x_message_list          OUT NOCOPY      VARCHAR2
768      ,x_return_status         OUT NOCOPY      VARCHAR2
769      ,x_batch_header_rec      OUT NOCOPY      gme_batch_header%ROWTYPE);
770 
771 /*#
772 * Reschedule Step Procedure
773 * This procedure reschedules a step and all the subsequent steps, if requested so.
774 * @param p_api_version Version of the api
775 * @param p_validation_level validation level
776 * @param p_init_msg_list message list flag - default is False
777 * @param p_commit commit flag - default is False
778 * @param x_message_count # of messages
779 * @param x_message_list List of messages
780 * @param x_return_status return status
781 * @param p_org_code Inventory Organization (Plant or Lab)
782 * @param p_batch_no batch number
783 * @param p_batch_type NUMBER (0,10) Batch, FPO
784 * @param p_batch_step_rec gme_batch_steps rowtype
785 * @param p_reschedule_preceding reschedule preceding steps flag - default is 'T'
786 * @param p_reschedule_succeeding reschedule succeeding steps flag - default is 'T'
787 * @param p_use_workday_cal use shop calendar flag
788 * @param p_contiguity_override contiguity override
789 * @param x_batch_step_rec gme_batch_steps rowtype
790 * @rep:scope public
791 * @rep:lifecycle active
792 * @rep:displayname reschedule_step
793 */
794 
795    /*================================================================================
796      Procedure
797        reschedule_step
798      Description
799        This procedure reschedules step and all the subsequent steps, if requested so.
800 
801      Parameters
802        p_org_code (O)            Organization code of the plant or lab
803        p_batch_no (O)            batch no
804        p_batch_type (O)          batch type (0/10) Batch/FPO
805        p_batch_step_rec (R)      The batch step row to identify the step
806                                  Following columns are used from this row.
807                                  batchstep_id  (R)
808                                  plan_start_date (R)
809                                  plan_cmplt_date (R)
810        p_reschedule_preceding (O) Whether to reschedule preceding steps.
811        p_reschedule_succeeding (O) Whether to reschedule succeeding steps.
812        p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
813        p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
814        x_batch_step_rec          The batch step that is returned, with all the data
815        x_return_status           outcome of the API call
816                                  S - Success
817                                  E - Error
818                                  U - Unexpected Error
819    ================================================================================*/
820    PROCEDURE reschedule_step (
821       p_api_version             IN              NUMBER := 2.0
822      ,p_validation_level        IN              NUMBER
823             := gme_common_pvt.g_max_errors
824      ,p_init_msg_list           IN              VARCHAR2 := fnd_api.g_false
825      ,p_commit                  IN              VARCHAR2 := fnd_api.g_false
826      ,p_batch_step_rec          IN              gme_batch_steps%ROWTYPE
827      ,p_use_workday_cal         IN              VARCHAR2 := fnd_api.g_false
828      ,p_contiguity_override     IN              VARCHAR2 := fnd_api.g_false
829      ,p_org_code                IN              VARCHAR2
830      ,p_batch_no                IN              VARCHAR2
831      ,p_batch_type              IN              NUMBER
832      ,p_reschedule_preceding    IN              VARCHAR2 := fnd_api.g_false
833      ,p_reschedule_succeeding   IN              VARCHAR2 := fnd_api.g_true
834      ,x_message_count           OUT NOCOPY      NUMBER
835      ,x_message_list            OUT NOCOPY      VARCHAR2
836      ,x_return_status           OUT NOCOPY      VARCHAR2
837      ,x_batch_step_rec          OUT NOCOPY      gme_batch_steps%ROWTYPE);
838 
839 /*#
840 * Create Batch Reservations Procedure
841 * This procedure Creaates high level reservations for all the ingredients
842 * of a given batch and all associated phantom batches.
843 * @param p_api_version Version of the api
844 * @param p_validation_level validation level
845 * @param p_init_msg_list message list flag - default is False
846 * @param p_commit commit flag - default is False
847 * @param x_message_count # of messages
848 * @param x_message_list List of messages
849 * @param x_return_status return status
850 * @param p_org_code Inventory Organization (Plant or Lab)
851 * @param p_batch_rec gme_batch_header rowtype
852 * @rep:scope public
853 * @rep:lifecycle active
854 * @rep:displayname create_batch_reservations
855 */
856     /*================================================================================
857      Procedure
858        create_batch_reservations
859      Description
860        This procedure creates high level reservations (at organization level) for ingredient
861        lines within a batch.
862      Parameters
863        p_api_version      (O)    Required API version.
864        p_init_msg_list    (O)    Instructs TRUE or FALSE (T/F) on whether the message stack
865                                  should be initialized
866        p_commit           (O)    Instructs TRUE or FALSE (T/F) on whether a COMMIT should
867                                  be issued on completion of successful processing
868        p_batch_rec        (R)    The batch header row to identify the batch
869                                  against which high level reservations will be created
870                                  Supply either:
871                                  p_batch_rec.batch_no p_batch_rec.batch_type with p_org_code
872                                            OR
873                                  p_batch_rec.batch_id
874        p_org_code         (O)    Must be supplied if p_batch_rec.organization_id is not populated.
875                                  Identifies the organization associated with the batch.
876        x_message_count           Number of messages accumulated on the stack during processing
877        x_message_list            Messages accumulated during processing
878        x_return_status           outcome of the API call
879                                  S - Success
880                                  E - Error
881                                  U - Unexpected Error
882                                  N - Items failed auto allocation
883                                  V - Inventory shortage exists
884    ================================================================================*/
885    PROCEDURE create_batch_reservations (
886       p_api_version      IN              NUMBER := 2.0
887      ,p_validation_level IN              NUMBER
888             := gme_common_pvt.g_max_errors
889      ,p_init_msg_list    IN              VARCHAR2 := fnd_api.g_false
890      ,p_commit           IN              VARCHAR2 := fnd_api.g_false
891      ,p_batch_rec        IN              gme_batch_header%ROWTYPE
892      ,p_org_code         IN              VARCHAR2
893      ,x_message_count    OUT NOCOPY      NUMBER
894      ,x_message_list     OUT NOCOPY      VARCHAR2
895      ,x_return_status    OUT NOCOPY      VARCHAR2);
896 
897 /*#
898 * Create Line Reservations Procedure
899 * This procedure Creaates high level reservations for the given ingredient line
900 * @param p_api_version Version of the api
901 * @param p_validation_level validation level
902 * @param p_init_msg_list message list flag - default is False
903 * @param p_commit commit flag - default is False
904 * @param x_message_count # of messages
905 * @param x_message_list List of messages
906 * @param x_return_status return status
907 * @param p_org_code Inventory Organization (Plant or Lab)
908 * @param p_batch_no Batch number
909 * @param p_line_no Line number of the ingredient
910 * @param p_material_detail_id Identifier for the ingredient line
911 * @rep:scope public
912 * @rep:lifecycle active
913 * @rep:displayname create_line_reservations
914 */
915     /*================================================================================
916      Procedure
917        create_line_reservations
918      Description
919        This procedure creates high level reservations (at organization level) for the input
920        batch ingredient line.
921      Parameters
922        p_api_version      (O)    Required API version.
923        p_init_msg_list    (O)    Instructs TRUE or FALSE (T/F) on whether the message stack
924                                  should be initialized
925        p_commit           (O)    Instructs TRUE or FALSE (T/F) on whether a COMMIT should
926                                  be issued on completion of successful processing
927        p_material_detail_id (O)  The  identifier for the ingredient material detail row
928                                  against which a high level reservation will be created
929                                  If this is not supplied, then org_code, batch_no,line_no must be input
930        p_org_code         (O)    Organization with which the batch and ingredient line are associated
931        p_batch_no         (O)    Owning batch for the ingredient line.
932        p_line_no          (O)    Ingredient line.
933        x_message_count           Number of messages accumulated on the stack during processing
934        x_message_list            Messages accumulated during processing
935        x_return_status           outcome of the API call
936                                  S - Success
937                                  E - Error
938                                  U - Unexpected Error
939                                  N - Items failed auto allocation
940                                  V - Inventory shortage exists
941    ================================================================================*/
942    PROCEDURE create_line_reservations (
943       p_api_version          IN              NUMBER := 2.0
944      ,p_validation_level     IN              NUMBER
945             := gme_common_pvt.g_max_errors
946      ,p_init_msg_list        IN              VARCHAR2 := fnd_api.g_false
947      ,p_commit               IN              VARCHAR2 := fnd_api.g_false
948      ,p_material_detail_id   IN              NUMBER
949      ,p_org_code             IN              VARCHAR2
950      ,p_batch_no             IN              VARCHAR2
951      ,p_line_no              IN              NUMBER
952      ,x_message_count        OUT NOCOPY      NUMBER
953      ,x_message_list         OUT NOCOPY      VARCHAR2
954      ,x_return_status        OUT NOCOPY      VARCHAR2);
955 
956 /*#
957 * Insert Process Parameter Procedure
958 * This particular procedure is used to insert parameter for an resource
959 * @param p_api_version Version of the api
960 * @param p_validation_level validation level
961 * @param p_init_msg_list message list flag - default is False
962 * @param p_commit commit flag - default is False
963 * @param x_message_count # of messages
964 * @param x_message_list List of messages
965 * @param x_return_status return status
966 * @param p_batch_no Batch Number
967 * @param p_org_code Inventory Organization (Plant or Lab)
968 * @param p_validate_flexfields  Indicates whether to validate the flex fields
969 * @param p_batchstep_no Batch Step Number
970 * @param p_activity activity
971 * @param p_parameter process parameter
972 * @param p_process_param_rec gme_process_parameters row type
973 * @param x_process_param_rec gme_process_parameters row type
974 * @rep:scope public
975 * @rep:lifecycle active
976 * @rep:displayname insert_process_parameter
977 */
978 /*===========================================================================================
979    Procedure
980       insert_process_parameter
981    Description
982      This particular procedure is used to insert parameter for an resource
983    Parameters
984      p_process_param_rec.batchstep_resource_id (R) OR
985      p_org_code (O)              Organization Code (Plant or Lab)
986      p_batch_no (O)              Batch Number
987      p_batchstep_no (O)          Batch Step Number
988      p_activity (O)              Activity
989      p_resource (O)              Resource
990      p_parameter (O)             Process Parameter
991                       All of the above to uniquely identify an process parameter
992      p_process_param_rec         Gme_process_parameters%ROWTYPE  - details of the process parameter
993      x_process_param_rec         Gme_process_parameters%ROWTYPE  - Output of the API with all the data
994      x_return_status             Reflects return status of the API
995                                  S - Success
996                                  E - Failure
997                                  U - Unexpected
998 =============================================================================================*/
999    PROCEDURE insert_process_parameter (
1000       p_api_version           IN              NUMBER := 2.0
1001      ,p_validation_level      IN              NUMBER
1002             := gme_common_pvt.g_max_errors
1003      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
1004      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
1005      ,x_message_count         OUT NOCOPY      NUMBER
1006      ,x_message_list          OUT NOCOPY      VARCHAR2
1007      ,x_return_status         OUT NOCOPY      VARCHAR2
1008      ,p_batch_no              IN              VARCHAR2 := NULL
1009      ,p_org_code              IN              VARCHAR2 := NULL
1010      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
1011      ,p_batchstep_no          IN              NUMBER := NULL
1012      ,p_activity              IN              VARCHAR2 := NULL
1013      ,p_parameter             IN              VARCHAR2 := NULL
1014      ,p_process_param_rec     IN              gme_process_parameters%ROWTYPE
1015      ,x_process_param_rec     OUT NOCOPY      gme_process_parameters%ROWTYPE);
1016 
1017 /*#
1018 * Update Process Parameter Procedure
1019 * This particular procedure is used to insert parameter for an resource
1020 * @param p_api_version Version of the api
1021 * @param p_validation_level validation level
1022 * @param p_init_msg_list message list flag - default is False
1023 * @param p_commit commit flag - default is False
1024 * @param x_message_count # of messages
1025 * @param x_message_list List of messages
1026 * @param x_return_status return status
1027 * @param p_batch_no Batch Number
1028 * @param p_org_code Inventory Organization (Plant or Lab)
1029 * @param p_validate_flexfields  Indicates whether to validate the flex fields
1030 * @param p_batchstep_no Batch Step Number
1031 * @param p_activity activity
1032 * @param p_parameter process parameter
1033 * @param p_process_param_rec gme_process_parameters row type
1034 * @param x_process_param_rec gme_process_parameters row type
1035 * @rep:scope public
1036 * @rep:lifecycle active
1037 * @rep:displayname update_process_parameter
1038 */
1039 
1040    /*===========================================================================================
1041    Procedure
1042       update_process_parameter
1043    Description
1044      This particular procedure is used to insert parameter for an resource
1045    Parameters
1046      p_process_param_rec.batchstep_resource_id (R) OR
1047      p_org_code (O)              Organization Code (Plant or Lab)
1048      p_batch_no (O)              Batch Number
1049      p_batchstep_no (O)          Batch Step Number
1050      p_activity (O)              Activity
1051      p_resource (O)              Resource
1052      p_parameter (O)             Process Parameter
1053                       All of the above to uniquely identify an process parameter
1054      p_process_param_rec         Gme_process_parameters%ROWTYPE  - details of the process parameter
1055      x_process_param_rec         Gme_process_parameters%ROWTYPE  - Output of the API with all the data
1056      x_return_status             Reflects return status of the API
1057                                  S - Success
1058                                  E - Failure
1059                                  U - Unexpected
1060 =============================================================================================*/
1061    PROCEDURE update_process_parameter (
1062       p_api_version           IN              NUMBER := 2.0
1063      ,p_validation_level      IN              NUMBER
1064             := gme_common_pvt.g_max_errors
1065      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
1066      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
1067      ,x_message_count         OUT NOCOPY      NUMBER
1068      ,x_message_list          OUT NOCOPY      VARCHAR2
1069      ,x_return_status         OUT NOCOPY      VARCHAR2
1070      ,p_batch_no              IN              VARCHAR2 := NULL
1071      ,p_org_code              IN              VARCHAR2 := NULL
1072      ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
1073      ,p_batchstep_no          IN              NUMBER := NULL
1074      ,p_activity              IN              VARCHAR2 := NULL
1075      ,p_parameter             IN              VARCHAR2 := NULL
1076      ,p_process_param_rec     IN              gme_process_parameters%ROWTYPE
1077      ,x_process_param_rec     OUT NOCOPY      gme_process_parameters%ROWTYPE);
1078 
1079 /*#
1080 * Delete Process Parameter Procedure
1081 * This particular procedure is used to delete a parameter for a given resource
1082 * @param p_api_version Version of the api
1083 * @param p_validation_level validation level
1084 * @param p_init_msg_list message list flag - default is False
1085 * @param p_commit commit flag - default is False
1086 * @param x_message_count # of messages
1087 * @param x_message_list List of messages
1088 * @param x_return_status return status
1089 * @param p_org_code Inventory Organization (Plant or Lab)
1090 * @param p_batch_no Batch Number
1091 * @param p_batchstep_no Batch Step Number
1092 * @param p_activity activity
1093 * @param p_parameter parameter
1094 * @param p_process_param_rec gme_process_parameters row type
1095 * @rep:scope public
1096 * @rep:lifecycle active
1097 * @rep:displayname delete_process_parameter
1098 *//*===========================================================================================
1099    Procedure
1100       delete_process_parameter
1101    Description
1102      This particular procedure is used to insert parameter for an resource
1103    Parameters
1104      p_process_param_rec.batchstep_resource_id (R) OR
1105      p_org_code (O)              Organization Code (Plant or Lab)
1106      p_batch_no (O)              Batch Number
1107      p_batchstep_no (O)          Batch Step Number
1108      p_activity (O)              Activity
1109      p_resource (O)              Resource
1110      p_parameter (O)             Process Parameter
1111                       All of the above to uniquely identify an process parameter
1112      p_process_param_rec         Gme_process_parameters%ROWTYPE  - details of the process parameter
1113      x_return_status             Reflects return status of the API
1114                                  S - Success
1115                                  E - Failure
1116                                  U - Unexpected
1117 =============================================================================================*/
1118    PROCEDURE delete_process_parameter (
1119       p_api_version         IN              NUMBER := 2.0
1120      ,p_validation_level    IN              NUMBER
1121             := gme_common_pvt.g_max_errors
1122      ,p_init_msg_list       IN              VARCHAR2 := fnd_api.g_false
1123      ,p_commit              IN              VARCHAR2 := fnd_api.g_false
1124      ,x_message_count       OUT NOCOPY      NUMBER
1125      ,x_message_list        OUT NOCOPY      VARCHAR2
1126      ,x_return_status       OUT NOCOPY      VARCHAR2
1127      ,p_batch_no            IN              VARCHAR2 := NULL
1128      ,p_org_code            IN              VARCHAR2 := NULL
1129      ,p_batchstep_no        IN              NUMBER := NULL
1130      ,p_activity            IN              VARCHAR2 := NULL
1131      ,p_parameter           IN              VARCHAR2 := NULL
1132      ,p_process_param_rec   IN              gme_process_parameters%ROWTYPE);
1133 
1134 /*#
1135 * Insert batch step procedure
1136 * This procedure inserts the new step to the batch
1137 * @param p_api_version Version of the api
1138 * @param p_validation_level validation level
1139 * @param p_init_msg_list message list flag - default is False
1140 * @param p_commit commit flag - default is False
1141 * @param x_message_count # of messages
1142 * @param x_message_list List of messages
1143 * @param x_return_status return status
1144 * @param p_org_code Inventory Organization (Plant or Lab)
1145 * @param p_validate_flexfields validate flex fields flag - default is False
1146 * @param p_oprn_no Operation Number
1147 * @param p_oprn_vers Operation Version
1148 * @param p_batch_header_rec gme_batch_header rowtype
1149 * @param p_batch_step_rec gme_batch_steps rowtype
1150 * @param x_batch_step_rec gme_batch_steps rowtype
1151 * @rep:scope public
1152 * @rep:lifecycle active
1153 * @rep:displayname insert_step
1154 */
1155 
1156     /*================================================================================
1157      Procedure
1158        insert_step
1159      Description
1160        This procedure inserts the new step to the batch
1161 
1162      Parameters
1163        p_org_code                Organization Code of Plan or Lab
1164        p_batch_header_rec (R)    The batch header to identify unique batch.
1165        p_batch_step_rec (R)      The batch step row to insert to the batch.
1166        p_oprn_no                 Operation Number
1167        p_oprn_vers               Operation Version
1168        x_batch_step_rec          The batch step that is returned, with all the data
1169        x_return_status           outcome of the API call
1170                                  S - Success
1171                                  E - Error
1172                                  U - Unexpected Error
1173     HISTORY
1174      SivakumarG FPBug#4395561 16-NOV-2005
1175       Added new argument p_validate_flexfields
1176    ================================================================================*/
1177    PROCEDURE insert_step (
1178       p_api_version        IN              NUMBER := 2.0
1179      ,p_validation_level   IN              NUMBER
1180             := gme_common_pvt.g_max_errors
1181      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1182      ,p_commit             IN              VARCHAR2
1183      ,p_org_code           IN              VARCHAR2
1184      /*FPBug#4395561*/
1185      ,p_validate_flexfields IN              VARCHAR2 := fnd_api.g_false
1186      ,          /* The inventory organization under which the batch exists.*/
1187       p_oprn_no            IN              VARCHAR2
1188      ,                                /* The operation number for the step */
1189       p_oprn_vers          IN              NUMBER
1190      ,                               /* The operation version for the step */
1191       p_batch_header_rec   IN              gme_batch_header%ROWTYPE
1192      ,p_batch_step_rec     IN              gme_batch_steps%ROWTYPE
1193      ,x_batch_step_rec     OUT NOCOPY      gme_batch_steps%ROWTYPE
1194      ,x_message_count      OUT NOCOPY      NUMBER
1195      ,x_message_list       OUT NOCOPY      VARCHAR2
1196      ,x_return_status      OUT NOCOPY      VARCHAR2);
1197 
1198 /*#
1199 * Insert Material line procedure
1200 * This procedure inserts  new material line in a batch
1201 * @param p_api_version Version of the api
1202 * @param p_validation_level validation level
1203 * @param p_init_msg_list message list flag - default is False
1204 * @param p_commit commit flag - default is False
1205 * @param x_message_count # of messages
1206 * @param x_message_list List of messages
1207 * @param x_return_status return status
1208 * @param p_batch_header_rec gme_batch_header rowtype
1209 * @param p_material_detail_rec gme_material_details rowtype
1210 * @param p_locator_code Default Consumption/Yield Locator Code
1211 * @param p_org_code Inventory Organization
1212 * @param p_batchstep_no Batch Step Number
1213 * @param p_validate_flexfields whether to validate flex fields value is 'T' or 'F'
1214 * @param x_material_detail_rec gme_material_details rowtype
1215 * @rep:scope public
1216 * @rep:lifecycle active
1217 * @rep:displayname insert_material_line
1218 */
1219 
1220 /*================================================================================
1221     Procedure
1222       insert_material_line
1223     Description
1224       This procedure is used to insert a material line
1225 
1226     Parameters
1227       p_batch_header_rec (R)          batch for which material line has to be updated
1228       p_material_detail_rec (R)       material line details line that has to be inserted
1229       p_locator_code (O)              Default Consumption/Yield Locator Code
1230       p_org_code (O)                  organization code
1231       p_batchstep_no(O)               batch step no to be associated with
1232       p_validate_flexfields (O)       Whether to validate the flexfields
1233       x_material_detail_rec           inserted material detail record
1234       x_return_status                 outcome of the API call
1235                                       S - Success
1236                                       E - Error
1237                                       U - Unexpected Error
1238     HISTORY
1239      SivakumarG Bug#5078853 02-MAR-2006
1240       Procedure Created
1241 ================================================================================*/
1242    PROCEDURE insert_material_line (
1243       p_api_version           IN           NUMBER := 2.0
1244      ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
1245      ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
1246      ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
1247      ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
1248      ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
1249      ,p_locator_code          IN           VARCHAR2
1250      ,p_org_code              IN           VARCHAR2
1251      ,p_batchstep_no          IN           NUMBER := NULL
1252      ,p_validate_flexfields   IN           VARCHAR2 DEFAULT fnd_api.g_false
1253      ,x_material_detail_rec   OUT NOCOPY   gme_material_details%ROWTYPE
1254      ,x_message_count         OUT NOCOPY   NUMBER
1255      ,x_message_list          OUT NOCOPY   VARCHAR2
1256      ,x_return_status         OUT NOCOPY   VARCHAR2);
1257 
1258 
1259 /*#
1260 * Update Material line procedure
1261 * This procedure updates the existing material line in a batch
1262 * @param p_api_version Version of the api
1263 * @param p_validation_level validation level
1264 * @param p_init_msg_list message list flag - default is False
1265 * @param p_commit commit flag - default is False
1266 * @param x_message_count # of messages
1267 * @param x_message_list List of messages
1268 * @param x_return_status return status
1269 * @param p_batch_header_rec gme_batch_header rowtype
1270 * @param p_material_detail_rec gme_material_details rowtype
1271 * @param p_locator_code Default Consumption/Yield Locator Code
1272 * @param p_org_code Inventory Organization
1273 * @param p_scale_phantom flag to indicate whether only phantom product to be scaled or complete phantom batch default is False
1274 * @param p_validate_flexfields whether to validate flex fields value is 'T' or 'F'
1275 * @param x_material_detail_rec gme_material_details rowtype
1276 * @rep:scope public
1277 * @rep:lifecycle active
1278 * @rep:displayname update_material_line
1279 */
1280 
1281 
1282 /*================================================================================
1283     Procedure
1284       update_material_line
1285     Description
1286       This procedure is used to update a material line
1287 
1288     Parameters
1289       p_batch_header_rec (R)          batch for which material line has to be updated
1290       p_material_detail_rec (R)       material line that has to be updated
1291       p_locator_code (O)              Default Consumption/Yield Locator Code
1292       p_org_code (O)                  organization code
1293       p_scale_phantom (O)             to scale phantom product only or total batch
1294       p_validate_flexfields (O)       Whether to validate the flexfields
1295       x_material_detail_rec           updated material detail record
1296       x_return_status                 outcome of the API call
1297                                       S - Success
1298                                       E - Error
1299                                       U - Unexpected Error
1300     HISTORY
1301      SivakumarG Bug#5078853 02-MAR-2006
1302       Procedure Created
1303   ================================================================================*/
1304     PROCEDURE update_material_line (
1305       p_api_version           IN           NUMBER := 2.0
1306      ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
1307      ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
1308      ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
1309      ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
1310      ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
1311      ,p_locator_code          IN           VARCHAR2
1312      ,p_org_code              IN           VARCHAR2
1313      ,p_scale_phantom         IN           VARCHAR2 DEFAULT fnd_api.g_false
1314      ,p_validate_flexfields   IN           VARCHAR2 DEFAULT fnd_api.g_false
1315      ,x_material_detail_rec   OUT NOCOPY   gme_material_details%ROWTYPE
1316      ,x_message_count         OUT NOCOPY   NUMBER
1317      ,x_message_list          OUT NOCOPY   VARCHAR2
1318      ,x_return_status         OUT NOCOPY   VARCHAR2 );
1319 
1320 
1321 /*#
1322 * Delete Material line procedure
1323 * This procedure deltes the existing material line in a batch
1324 * @param p_api_version Version of the api
1325 * @param p_validation_level validation level
1326 * @param p_init_msg_list message list flag - default is False
1327 * @param p_commit commit flag - default is False
1328 * @param x_message_count # of messages
1329 * @param x_message_list List of messages
1330 * @param x_return_status return status
1331 * @param p_batch_header_rec gme_batch_header rowtype
1332 * @param p_material_detail_rec gme_material_details rowtype
1333 * @param p_org_code Inventory Organization
1334 * @rep:scope public
1335 * @rep:lifecycle active
1336 * @rep:displayname delete_material_line
1337 */
1338 
1339  /*================================================================================
1340     Procedure
1341       delete_material_line
1342     Description
1343       This procedure is used to delete a material line
1344 
1345     Parameters
1346       p_batch_header_rec (R)          batch for which material line has to be updated
1347       p_material_detail_rec (R)       material line that has to be updated
1348       p_org_code (O)                  organization code
1349       x_return_status                 outcome of the API call
1350                                       S - Success
1351                                       E - Error
1352                                       U - Unexpected Error
1353     HISTORY
1354      SivakumarG Bug#5078853 02-MAR-2006
1355       Procedure Created
1356 ================================================================================*/
1357    PROCEDURE delete_material_line (
1358       p_api_version           IN           NUMBER := 2.0
1359      ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
1360      ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
1361      ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
1362      ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
1363      ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
1364      ,p_org_code              IN           VARCHAR2
1365      ,x_message_count         OUT NOCOPY   NUMBER
1366      ,x_message_list          OUT NOCOPY   VARCHAR2
1367      ,x_return_status         OUT NOCOPY   VARCHAR2);
1368 
1369 
1370 /*#
1371 * Delete batch step procedure
1372 * This procedure deletes an existing step from a batch
1373 * @param p_api_version Version of the api
1374 * @param p_validation_level validation level
1375 * @param p_init_msg_list message list flag - default is False
1376 * @param p_commit commit flag - default is False
1377 * @param x_message_count # of messages
1378 * @param x_message_list List of messages
1379 * @param x_return_status return status
1380 * @param p_org_code Inventory Organization (Plant or Lab)
1381 * @param p_batch_no Batch Number
1382 * @param p_batch_step_rec gme_batch_steps rowtype
1383 * @rep:scope public
1384 * @rep:lifecycle active
1385 * @rep:displayname delete_step
1386 */
1387    /*================================================================================
1388      Procedure
1389        delete_step
1390      Description
1391        This procedure deletes the step associated with the batch
1392 
1393      Parameters
1394        p_org_code                Organization_code of Plant or Lab
1395        p_batch_step_rec (R)      The batch step row to identify the step
1396                                  Following columns are used from this row.
1397                                  batchstep_id  (R)
1398        x_return_status           outcome of the API call
1399                                  S - Success
1400                                  E - Error
1401                                  U - Unexpected Error
1402    ================================================================================*/
1403    PROCEDURE delete_step (
1404       p_api_version        IN              NUMBER := 2.0
1405      ,p_validation_level   IN              NUMBER
1406             := gme_common_pvt.g_max_errors
1407      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1408      ,p_commit             IN              VARCHAR2
1409      ,p_org_code           IN              VARCHAR2
1410      ,p_batch_no           IN              VARCHAR2
1411      ,x_message_count      OUT NOCOPY      NUMBER
1412      ,x_message_list       OUT NOCOPY      VARCHAR2
1413      ,x_return_status      OUT NOCOPY      VARCHAR2
1414      ,p_batch_step_rec     IN              gme_batch_steps%ROWTYPE);
1415 /*#
1416 * Revert Batch Procedure
1417 * This procedure closes batch.
1418 * @param p_continue_lpn_txn Indicates whether to continue processing a batch when product or byproduct has lpn transaction.
1419 * @param p_api_version Version of the api
1420 * @param p_validation_level validation level
1421 * @param p_init_msg_list message list flag - default is False
1422 * @param p_commit commit flag - default is False
1423 * @param x_message_count # of messages
1424 * @param x_message_list List of messages
1425 * @param x_return_status return status
1426 * @param p_batch_header_rec gme_batch_steps rowtype
1427 * @param p_org_code Inventory Organization (Plant or Lab)
1428 * @param x_batch_header_rec gme_batch_steps rowtype
1429 * @rep:scope public
1430 * @rep:lifecycle active
1431 * @rep:displayname revert_batch
1432 */
1433     /*================================================================================
1434      Procedure
1435        revert_batch
1436      Description
1437        This procedure revert batch and all the phantom batches.
1438         It also closes all the steps.
1439 
1440      Parameters
1441        p_org_code (O)            Organization code of Plant or Lab
1442        p_batch_header_rec (R)    The batch header row to identify the batch
1443                                  Following columns are used from this row.
1444                                  batch_id  (R)
1445                                  batch_close_date (O)
1446       p_continue_lpn_txn (O)     Indicates whether to continue processing a batch when product or byproduct has lpn transaction.
1447        x_batch_header_rec        The batch header that is returned, with all the data
1448        x_return_status           outcome of the API call
1449                                  S - Success
1450                                  E - Error
1451                                  U - Unexpected Error
1452    ================================================================================*/
1453     PROCEDURE revert_batch (
1454       p_continue_lpn_txn         IN              VARCHAR2 := 'N'
1455      ,p_api_version            	IN             	NUMBER := 2.0
1456      ,p_validation_level       	IN              NUMBER
1457      ,p_init_msg_list          	IN              VARCHAR2
1458      ,p_commit                 	IN              VARCHAR2
1459      ,x_message_count          	OUT NOCOPY      NUMBER
1460      ,x_message_list           	OUT NOCOPY      VARCHAR2
1461      ,x_return_status          	OUT NOCOPY      VARCHAR2
1462      ,p_org_code              	IN            	VARCHAR2
1463      ,p_batch_header_rec       	IN              gme_batch_header%ROWTYPE
1464      ,x_batch_header_rec      	OUT NOCOPY 	gme_batch_header%ROWTYPE);
1465 
1466 /*#
1467 * Revert Batch Step Procedure
1468 * This procedure revert step.
1469 * @param p_api_version Version of the api
1470 * @param p_validation_level validation level
1471 * @param p_init_msg_list message list flag - default is False
1472 * @param p_commit commit flag - default is False
1473 * @param x_message_count # of messages
1474 * @param x_message_list List of messages
1475 * @param x_return_status return status
1476 * @param p_org_code Inventory Organization (Plant or Lab)
1477 * @param p_batch_no Batch Number
1478 * @param p_batch_step_rec gme_batch_steps rowtype
1479 * @param x_batch_step_rec gme_batch_steps rowtype
1480 * @rep:scope public
1481 * @rep:lifecycle active
1482 * @rep:displayname revert_step
1483 */
1484 
1485    /*================================================================================
1486      Procedure
1487        revert_step
1488      Description
1489        This procedure revert step.
1490 
1491      Parameters
1492        p_org_code (O)            Organization Code for Plant or Lab
1493        p_batch_no (O)            Batch Number to uniquely Identify
1494        p_batch_step_rec (R)      The batch step row to identify the step
1495                                  Following columns are used from this row.
1496                                  batchstep_id  (R)
1497 
1498        x_batch_step_rec          The batch step that is returned, with all the data
1499        x_return_status           outcome of the API call
1500                                  S - Success
1501                                  E - Error
1502                                  U - Unexpected Error
1503    ================================================================================*/
1504     PROCEDURE revert_step (
1505      p_api_version            	IN             	NUMBER := 2.0
1506      ,p_validation_level       	IN              NUMBER
1507      ,p_init_msg_list          	IN              VARCHAR2
1508      ,p_commit                 	IN              VARCHAR2
1509      ,x_message_count          	OUT NOCOPY      NUMBER
1510      ,x_message_list           	OUT NOCOPY      VARCHAR2
1511      ,x_return_status          	OUT NOCOPY      VARCHAR2
1512      ,p_org_code              	IN            	VARCHAR2
1513      ,p_batch_no   		IN		VARCHAR2
1514      ,p_batch_step_rec        	IN         gme_batch_steps%ROWTYPE
1515      ,x_batch_step_rec        	OUT NOCOPY gme_batch_steps%ROWTYPE);
1516 
1517 
1518 /*#
1519 * Close Batch Procedure
1520 * This procedure closes batch.
1521 * @param p_api_version Version of the api
1522 * @param p_validation_level validation level
1523 * @param p_init_msg_list message list flag - default is False
1524 * @param p_commit commit flag - default is False
1525 * @param x_message_count # of messages
1526 * @param x_message_list List of messages
1527 * @param x_return_status return status
1528 * @param p_batch_header_rec gme_batch_steps rowtype
1529 * @param p_org_code Inventory Organization (Plant or Lab)
1530 * @param x_batch_header_rec gme_batch_steps rowtype
1531 * @rep:scope public
1532 * @rep:lifecycle active
1533 * @rep:displayname close_batch
1534 */
1535     /*================================================================================
1536      Procedure
1537        close_batch
1538      Description
1539        This procedure closes batch and all the phantom batches.
1540         It also closes all the steps.
1541 
1542      Parameters
1543        p_org_code (O)            Organization code of Plant or Lab
1544        p_batch_header_rec (R)    The batch header row to identify the batch
1545                                  Following columns are used from this row.
1546                                  batch_id  (R)
1547                                  batch_close_date (O)
1548 
1549        x_batch_header_rec        The batch header that is returned, with all the data
1550        x_return_status           outcome of the API call
1551                                  S - Success
1552                                  E - Error
1553                                  U - Unexpected Error
1554    ================================================================================*/
1555    PROCEDURE close_batch (
1556       p_api_version        IN              NUMBER := 2.0
1557      ,p_validation_level   IN              NUMBER
1558      ,p_init_msg_list      IN              VARCHAR2
1559      ,p_commit             IN              VARCHAR2
1560      ,x_message_count      OUT NOCOPY      NUMBER
1561      ,x_message_list       OUT NOCOPY      VARCHAR2
1562      ,x_return_status      OUT NOCOPY      VARCHAR2
1563      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
1564      ,x_batch_header_rec   OUT NOCOPY      gme_batch_header%ROWTYPE
1565      ,p_org_code           IN              VARCHAR2);
1566 
1567 /*#
1568 * Close Batch Step Procedure
1569 * This procedure closes step.
1570 * @param p_api_version Version of the api
1571 * @param p_validation_level validation level
1572 * @param p_init_msg_list message list flag - default is False
1573 * @param p_commit commit flag - default is False
1574 * @param x_message_count # of messages
1575 * @param x_message_list List of messages
1576 * @param x_return_status return status
1577 * @param p_org_code Inventory Organization (Plant or Lab)
1578 * @param p_batch_no Batch Number
1579 * @param p_batch_step_rec gme_batch_steps rowtype
1580 * @param p_delete_pending delete pending flag - default is 'F'
1581 * @param x_batch_step_rec gme_batch_steps rowtype
1582 * @rep:scope public
1583 * @rep:lifecycle active
1584 * @rep:displayname close_step
1585 */
1586 
1587    /*================================================================================
1588      Procedure
1589        close_step
1590      Description
1591        This procedure closes step.
1592 
1593      Parameters
1594        p_org_code (O)            Organization Code for Plant or Lab
1595        p_batch_no (O)            Batch Number to uniquely Identify
1596        p_batch_step_rec (R)      The batch step row to identify the step
1597                                  Following columns are used from this row.
1598                                  batchstep_id  (R)
1599                                  step_close_date (O)
1600        p_delete_pending (R)      Delete the pending allocations if any for the
1601                                  material lines associated with the step.
1602 
1603        x_batch_step_rec          The batch step that is returned, with all the data
1604        x_return_status           outcome of the API call
1605                                  S - Success
1606                                  E - Error
1607                                  U - Unexpected Error
1608    ================================================================================*/
1609    PROCEDURE close_step (
1610       p_api_version        IN              NUMBER := 2
1611      ,                                                      /* Punit Kumar */
1612       p_validation_level   IN              NUMBER
1613             := gme_common_pvt.g_max_errors
1614      ,                                                      /* Punit Kumar */
1615       p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1616      ,p_commit             IN              VARCHAR2
1617      ,x_message_count      OUT NOCOPY      NUMBER
1618      ,x_message_list       OUT NOCOPY      VARCHAR2
1619      ,x_return_status      OUT NOCOPY      VARCHAR2
1620      ,p_batch_step_rec     IN              gme_batch_steps%ROWTYPE
1621      ,p_delete_pending     IN              VARCHAR2 := fnd_api.g_false
1622      ,p_org_code           IN              VARCHAR2
1623      ,p_batch_no           IN              VARCHAR2
1624      ,x_batch_step_rec     OUT NOCOPY      gme_batch_steps%ROWTYPE);
1625 
1626 /*#
1627 * Cancel Batch Procedure
1628 * This procedure cancels a batch and all associated phantom batches.
1629 * It also cancels all the steps.
1630 * @param p_api_version Version of the api
1631 * @param p_validation_level validation level
1632 * @param p_init_msg_list message list flag - default is False
1633 * @param p_commit commit flag - default is False
1634 * @param x_message_count # of messages
1635 * @param x_message_list List of messages
1636 * @param x_return_status return status
1637 * @param p_org_code Inventory Organization (Plant or Lab)
1638 * @param p_batch_header_rec gme_batch_header rowtype
1639 * @param x_batch_header_rec gme_batch_header rowtype
1640 * @rep:scope public
1641 * @rep:lifecycle active
1642 * @rep:displayname cancel_batch
1643 */
1644    /*================================================================================
1645      Procedure
1646        cancel_batch
1647      Description
1648        This procedure cancels batch and all the phantom batches.
1649         It also cancels all the steps.
1650 
1651      Parameters
1652        p_batch_header_rec (R)    The batch header row to identify the batch
1653                                  Following columns are used from this row.
1654                                  batch_id  (R)
1655        p_org_code                The name of organization to which this batch belongs
1656        x_batch_header_rec        The batch header that is returned, with all the data
1657        x_return_status           outcome of the API call
1658                                  S - Success
1659                                  E - Error
1660                                  U - Unexpected Error
1661    ================================================================================*/
1662    PROCEDURE cancel_batch (
1663       p_api_version        IN              NUMBER := 2.0
1664      ,p_validation_level   IN              NUMBER
1665             := gme_common_pvt.g_max_errors
1666      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1667      ,p_commit             IN              VARCHAR2 := fnd_api.g_false
1668      ,x_message_count      OUT NOCOPY      NUMBER
1669      ,x_message_list       OUT NOCOPY      VARCHAR2
1670      ,x_return_status      OUT NOCOPY      VARCHAR2
1671      ,p_org_code           IN              VARCHAR2
1672      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
1673      ,x_batch_header_rec   OUT NOCOPY      gme_batch_header%ROWTYPE);
1674 
1675    /*#
1676 * Reopen Batch Procedure
1677 * This procedure reopens a batch and all associated phantom batches.
1678 * It also reopens all the steps, if requested
1679 * @param p_api_version Version of the api
1680 * @param p_validation_level validation level
1681 * @param p_init_msg_list message list flag - default is False
1682 * @param p_commit commit flag - default is False
1683 * @param x_message_count # of messages
1684 * @param x_message_list List of messages
1685 * @param x_return_status return status
1686 * @param p_org_code Inventory Organization (Plant or Lab)
1687 * @param p_batch_header_rec gme_batch_header rowtype
1688 * @param p_reopen_steps reopen steps flag - default is 'F'
1689 * @param x_batch_header_rec gme_batch_header rowtype
1690 * @rep:scope public
1691 * @rep:lifecycle active
1692 * @rep:displayname reopen_batch
1693 */
1694    /*================================================================================
1695     Procedure
1696       reopen_batch
1697     Description
1698       This procedure reopens batch and all the phantom batches.
1699        It also reopens all the steps, if requested so.
1700 
1701     Parameters
1702       p_org_code                Organization code for the Plant or Lab
1703       p_batch_header_rec (R)    The batch header row to identify the batch
1704                                 Following columns are used from this row.
1705                                 batch_id  (R)
1706       p_reopen_steps (O)        Reopen all the steps.
1707 
1708       x_batch_header_rec        The batch header that is returned, with all the data
1709       x_return_status           outcome of the API call
1710                                 S - Success
1711                                 E - Error
1712                                 U - Unexpected Error
1713   ================================================================================*/
1714    PROCEDURE reopen_batch (
1715       p_api_version        IN              NUMBER := 2
1716      ,                                                      /* Punit Kumar */
1717       p_validation_level   IN              NUMBER
1718             := gme_common_pvt.g_max_errors
1719      ,                                                      /* Punit Kumar */
1720       p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1721      ,p_commit             IN              VARCHAR2
1722      ,x_message_count      OUT NOCOPY      NUMBER
1723      ,x_message_list       OUT NOCOPY      VARCHAR2
1724      ,x_return_status      OUT NOCOPY      VARCHAR2
1725      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
1726      ,p_org_code           IN              VARCHAR2
1727      ,p_reopen_steps       IN              VARCHAR2 := fnd_api.g_false
1728      ,x_batch_header_rec   OUT NOCOPY      gme_batch_header%ROWTYPE);
1729 
1730 /*#
1731 * Reopen Step Procedure
1732 * This procedure reopens a step.
1733 * @param p_api_version Version of the api
1734 * @param p_validation_level validation level
1735 * @param p_init_msg_list message list flag - default is False
1736 * @param p_commit commit flag - default is False
1737 * @param x_message_count # of messages
1738 * @param x_message_list List of messages
1739 * @param x_return_status return status
1740 * @param p_org_code Inventory Organization (Plant or Lab)
1741 * @param p_batch_header_rec gme_batch_header rowtype
1742 * @param p_batch_step_rec gme_batch_steps rowtype
1743 * @param x_batch_step_rec gme_batch_steps rowtype
1744 * @rep:scope public
1745 * @rep:lifecycle active
1746 * @rep:displayname reopen_step
1747 */
1748 
1749    /*================================================================================
1750      Procedure
1751        reopen_step
1752      Description
1753        This procedure reopens step.
1754 
1755      Parameters
1756        p_batch_step_rec (R)      The batch header row to identify the batch
1757                                  Following columns are used from this row.
1758                                  batchstep_id  (R)
1759 
1760        x_batch_step_rec          The batch step that is returned, with all the data
1761        p_batch_header_rec        The batch header to identify unique batch
1762        x_return_status           outcome of the API call
1763                                  S - Success
1764                                  E - Error
1765                                  U - Unexpected Error
1766    ================================================================================*/
1767    PROCEDURE reopen_step (
1768       p_api_version        IN              NUMBER := 2
1769      ,                                                      /* Punit Kumar */
1770       p_validation_level   IN              NUMBER
1771             := gme_common_pvt.g_max_errors
1772      ,                                                      /* Punit Kumar */
1773       p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1774      ,p_commit             IN              VARCHAR2
1775      ,x_message_count      OUT NOCOPY      NUMBER
1776      ,x_message_list       OUT NOCOPY      VARCHAR2
1777      ,x_return_status      OUT NOCOPY      VARCHAR2
1778      ,p_org_code           IN              VARCHAR2
1779      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
1780      ,p_batch_step_rec     IN              gme_batch_steps%ROWTYPE
1781      ,x_batch_step_rec     OUT NOCOPY      gme_batch_steps%ROWTYPE);
1782 
1783 /*#
1784 * Incremental Backflush Procedure
1785 * This particular procedure is used to delete a parameter for a given resource
1786 * @param p_api_version Version of the api
1787 * @param p_validation_level validation level
1788 * @param p_init_msg_list message list flag - default is False
1789 * @param p_commit commit flag - default is False
1790 * @param x_message_count # of messages
1791 * @param x_message_list List of messages
1792 * @param x_return_status return status
1793 * @param p_batch_header_rec gme_batch_header rowtype
1794 * @param p_org_code Organization code that the batch belongs to
1795 * @param p_material_detail_rec gme_material_details rowtype
1796 * @param p_qty Incremental Quantity
1797 * @param p_qty_type Supplied quantity type (incremental, actual, percentage)
1798 * @param p_trans_date Transaction Date for the incremental backflush
1799 * @param p_ignore_exception Ignore exceptions raised during Incremental Backflush
1800 * @param p_adjust_cmplt Treat the Incremental backflush as adjustment for the completed batch
1801 * @param x_exception_material_tbl table of exception records
1802 * @rep:scope public
1803 * @rep:lifecycle active
1804 * @rep:displayname incremental_batckflush
1805 */
1806 /*===========================================================================================
1807    Procedure
1808       incremental_backflush
1809    Description
1810      This particular procedure is used to incrementally backflush a batch.
1811 
1812 =============================================================================================*/
1813    PROCEDURE incremental_backflush (
1814       p_api_version              IN              NUMBER
1815      ,p_validation_level         IN              NUMBER
1816             := gme_common_pvt.g_max_errors
1817      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
1818      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
1819      ,x_message_count            OUT NOCOPY      NUMBER
1820      ,x_message_list             OUT NOCOPY      VARCHAR2
1821      ,x_return_status            OUT NOCOPY      VARCHAR2
1822      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
1823      ,p_org_code                 IN              VARCHAR2
1824      ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
1825      ,p_qty                      IN              NUMBER
1826      ,p_qty_type                 IN              NUMBER := 0
1827      ,p_trans_date               IN              DATE
1828      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
1829      ,p_adjust_cmplt             IN              VARCHAR2 := fnd_api.g_true
1830      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
1831 /*#
1832 * Create Material Transaction Procedure
1833 * This procedure Creates a Material Transaction.
1834 * @param p_api_version Version of the api
1835 * @param p_validation_level validation level
1836 * @param p_init_msg_list message list flag - default is False
1837 * @param p_commit commit flag - default is False
1838 * @param p_save_batch Call save batch api - default is True
1839 * @param x_message_count # of messages
1840 * @param x_message_list List of messages
1841 * @param x_return_status return status
1842 * @param p_org_code Inventory Organization (Plant or Lab)
1843 * @param p_mmti_rec mtl_transactions_interface rowtype
1844 * @param p_mmli_tbl table of lot records
1845 * @param p_batch_no Batch Number
1846 * @param p_line_no Line Number
1847 * @param p_line_type Material Type (Ingredient, Product, Byproduct)
1848 * @param p_create_lot If new lot should be created ('T','F')
1849 * @param p_generate_lot If lot should be generated ('T','F')
1850 * @param p_generate_parent_lot If parent lot should be generated ('T','F')
1851 * @param x_mmt_rec mtl_material_transactions rowtype with the data
1852 * @param x_mmln_tbl table of lot records, those were inserted
1853 * @rep:scope public
1854 * @rep:lifecycle active
1855 * @rep:displayname create_material_txn
1856 */
1857 
1858    /*================================================================================
1859      Procedure
1860        create_material_txn
1861      Description
1862        This procedure creates material transaction.
1863 
1864      Parameters
1865        x_return_status           outcome of the API call
1866                                  S - Success
1867                                  E - Error
1868                                  U - Unexpected Error
1869    ================================================================================*/
1870 
1871    PROCEDURE create_material_txn (
1872       p_api_version           IN              NUMBER := 2.0
1873      ,p_validation_level      IN              NUMBER
1874             := gme_common_pvt.g_max_errors
1875      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
1876      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
1877      ,p_save_batch            IN              VARCHAR2 := fnd_api.g_true  -- Bug 14685438
1878      ,x_message_count         OUT NOCOPY      NUMBER
1879      ,x_message_list          OUT NOCOPY      VARCHAR2
1880      ,x_return_status         OUT NOCOPY      VARCHAR2
1881      ,p_org_code              IN              VARCHAR2 := NULL
1882      ,p_mmti_rec              IN              mtl_transactions_interface%ROWTYPE
1883      ,p_mmli_tbl              IN              gme_common_pvt.mtl_trans_lots_inter_tbl
1884      ,p_batch_no              IN              VARCHAR2 := NULL
1885      ,p_line_no               IN              NUMBER := NULL
1886      ,p_line_type             IN              NUMBER := NULL
1887      ,p_create_lot            IN              VARCHAR2 := NULL
1888      ,p_generate_lot          IN              VARCHAR2 := NULL
1889      ,p_generate_parent_lot   IN              VARCHAR2 := NULL
1890      ,x_mmt_rec               OUT NOCOPY      mtl_material_transactions%ROWTYPE
1891      ,x_mmln_tbl              OUT NOCOPY      gme_common_pvt.mtl_trans_lots_num_tbl);
1892 /*#
1893 * Update Material Transaction Procedure
1894 * This procedure Creates a Material Transaction.
1895 * @param p_api_version Version of the api
1896 * @param p_validation_level validation level
1897 * @param p_init_msg_list message list flag - default is False
1898 * @param p_commit commit flag - default is False
1899 * @param x_message_count # of messages
1900 * @param x_message_list List of messages
1901 * @param x_return_status return status
1902 * @param p_transaction_id Identifier to the transaction to be updated.
1903 * @param p_mmti_rec mtl_transactions_interface rowtype
1904 * @param p_mmli_tbl table of lot records
1905 * @param p_create_lot If new lot should be created ('T','F')
1906 * @param p_generate_lot If lot should be generated ('T','F')
1907 * @param p_generate_parent_lot If parent lot should be generated ('T','F')
1908 * @param x_mmt_rec mtl_material_transactions rowtype with the data
1909 * @param x_mmln_tbl table of lot records, those were inserted
1910 * @rep:scope public
1911 * @rep:lifecycle active
1912 * @rep:displayname update_material_txn
1913 */
1914 
1915    /*================================================================================
1916      Procedure
1917        update_material_txn
1918      Description
1919        This procedure updates material transaction.
1920 
1921      Parameters
1922        x_return_status           outcome of the API call
1923                                  S - Success
1924                                  E - Error
1925                                  U - Unexpected Error
1926    ================================================================================*/
1927 
1928    PROCEDURE update_material_txn (
1929       p_api_version           IN              NUMBER := 2.0
1930      ,p_validation_level      IN              NUMBER
1931             := gme_common_pvt.g_max_errors
1932      ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
1933      ,p_commit                IN              VARCHAR2 := fnd_api.g_false
1934      ,x_message_count         OUT NOCOPY      NUMBER
1935      ,x_message_list          OUT NOCOPY      VARCHAR2
1936      ,x_return_status         OUT NOCOPY      VARCHAR2
1937      ,p_transaction_id        IN              NUMBER
1938      ,p_mmti_rec              IN              mtl_transactions_interface%ROWTYPE
1939      ,p_mmli_tbl              IN              gme_common_pvt.mtl_trans_lots_inter_tbl
1940      ,p_create_lot            IN              VARCHAR2 := NULL
1941      ,p_generate_lot          IN              VARCHAR2 := NULL
1942      ,p_generate_parent_lot   IN              VARCHAR2 := NULL
1943      ,x_mmt_rec               OUT NOCOPY      mtl_material_transactions%ROWTYPE
1944      ,x_mmln_tbl              OUT NOCOPY      gme_common_pvt.mtl_trans_lots_num_tbl);
1945 
1946 /*#
1947 * Delete Material Transaction Procedure
1948 * This procedure deletes a Material Transaction.
1949 * @param p_api_version Version of the api
1950 * @param p_validation_level validation level
1951 * @param p_init_msg_list message list flag - default is False
1952 * @param p_commit commit flag - default is False
1953 * @param x_message_count # of messages
1954 * @param x_message_list List of messages
1955 * @param x_return_status return status
1956 * @param p_transaction_id Identifier to the transaction to be updated.
1957 * @rep:scope public
1958 * @rep:lifecycle active
1959 * @rep:displayname delete_material_txn
1960 */
1961 
1962    /*================================================================================
1963      Procedure
1964        delete_material_txn
1965      Description
1966        This procedure updates material transaction.
1967 
1968      Parameters
1969        x_return_status           outcome of the API call
1970                                  S - Success
1971                                  E - Error
1972                                  U - Unexpected Error
1973    ================================================================================*/
1974    PROCEDURE delete_material_txn (
1975       p_api_version        IN              NUMBER := 2.0
1976      ,p_validation_level   IN              NUMBER
1977             := gme_common_pvt.g_max_errors
1978      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
1979      ,p_commit             IN              VARCHAR2 := fnd_api.g_false
1980      ,x_message_count      OUT NOCOPY      NUMBER
1981      ,x_message_list       OUT NOCOPY      VARCHAR2
1982      ,x_return_status      OUT NOCOPY      VARCHAR2
1983      ,p_transaction_id     IN              NUMBER);
1984 
1985 /*#
1986 * Reroute Batch Procedure
1987 * This procedure reroutes batch (typically change the route associated with the batch).
1988 * @param p_api_version Version of the api
1989 * @param p_validation_level validation level
1990 * @param p_init_msg_list message list flag - default is False
1991 * @param p_commit commit flag - default is False
1992 * @param x_message_count # of messages
1993 * @param x_message_list List of messages
1994 * @param x_return_status return status
1995 * @param p_batch_header_rec gme_batch_header rowtype
1996 * @param p_validity_rule_id validity rule id
1997 * @param x_batch_header_rec gme_batch_header rowtype
1998 * @param p_org_code Inventory Organization (Plant or Lab)
1999 * @param p_use_workday_cal Whether workday calendar will be used for batch date calculations
2000 * @param p_contiguity_override Whether indicates batch needs to be completed in one contiguous block of time
2001 * @rep:scope public
2002 * @rep:lifecycle active
2003 * @rep:displayname reroute_batch
2004 */
2005 
2006    /*================================================================================
2007      Procedure
2008        reroute_batch
2009      Description
2010        This procedure reroutes batch (typically change the route associated with the batch).
2011 
2012      Parameters
2013        p_batch_header_rec (R)    The batch header row to identify the batch
2014                                  Following columns are used from this row.
2015                                  batch_id  (R)
2016        p_org_code                (R) if batch_no is specified instead of batch_id
2017                                  on batch header row
2018        p_validity_rule_id (R)    Recipe validity rule id for the new recipe.
2019        p_use_workday_cal         VARCHAR2('F','T') - to use workday calendar or not.
2020        p_contiguity_override     VARCHAR2('F','T') - for contigious period of calendar.
2021        x_batch_header_rec        The batch header that is returned, with all the data
2022        x_return_status           outcome of the API call
2023                                  S - Success
2024                                  E - Error
2025                                  U - Unexpected Error
2026                                  C - No continous periods found
2027    ================================================================================*/
2028    PROCEDURE reroute_batch (
2029       p_api_version           IN              NUMBER := 2.0
2030      ,p_validation_level      IN              NUMBER
2031             := gme_common_pvt.g_max_errors
2032      ,p_init_msg_list         IN              VARCHAR2
2033             DEFAULT fnd_api.g_false
2034      ,p_commit                IN              VARCHAR2
2035             DEFAULT fnd_api.g_false
2036      ,p_batch_header_rec      IN              gme_batch_header%ROWTYPE
2037      ,p_validity_rule_id      IN              NUMBER
2038      ,p_org_code              IN              VARCHAR2
2039      ,p_use_workday_cal       IN              VARCHAR2
2040             DEFAULT fnd_api.g_false
2041      ,p_contiguity_override   IN              VARCHAR2
2042             DEFAULT fnd_api.g_false
2043      ,x_message_count         OUT NOCOPY      NUMBER
2044      ,x_message_list          OUT NOCOPY      VARCHAR2
2045      ,x_return_status         OUT NOCOPY      VARCHAR2
2046      ,x_batch_header_rec      OUT NOCOPY      gme_batch_header%ROWTYPE);
2047 
2048 
2049 /*#
2050 * Terminate Batch Procedure
2051 * This procedure terminates a batch and all associated phantom batches.
2052 * It also terminates all the steps.
2053 * @param p_api_version Version of the api
2054 * @param p_validation_level validation level
2055 * @param p_init_msg_list message list flag - default is False
2056 * @param p_commit commit flag - default is False
2057 * @param x_message_count # of messages
2058 * @param x_message_list List of messages
2059 * @param x_return_status return status
2060 * @param p_org_code Inventory Organization (Plant or Lab)
2061 * @param p_reason_name Reason Code for termination
2062 * @param p_batch_header_rec gme_batch_header rowtype
2063 * @param x_batch_header_rec gme_batch_header rowtype
2064 * @rep:scope public
2065 * @rep:lifecycle active
2066 * @rep:displayname terminate_batch
2067 */
2068    /*================================================================================
2069     Procedure
2070       terminate_batch
2071 
2072     Description
2073       This procedure terminates batch and all the phantom batches.
2074        It also terminates all the steps.
2075 
2076     Parameters
2077       p_batch_header_rec (R)    The batch header row to identify the batch
2078                                 Following columns are used from this row.
2079                                 batch_id  (R)
2080       p_org_code (O)            The name of organization to which this batch belongs
2081       p_reason_name (O)         Reason to terminate the batch
2082       x_batch_header_rec        The batch header that is returned, with all the data
2083       x_return_status           outcome of the API call
2084                                 S - Success
2085                                 E - Error
2086                                 U - Unexpected Error
2087   ================================================================================*/
2088    PROCEDURE terminate_batch (
2089       p_api_version        IN              NUMBER := 2.0
2090      ,p_validation_level   IN              NUMBER
2091             := gme_common_pvt.g_max_errors
2092      ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
2093      ,p_commit             IN              VARCHAR2 := fnd_api.g_false
2094      ,x_message_count      OUT NOCOPY      NUMBER
2095      ,x_message_list       OUT NOCOPY      VARCHAR2
2096      ,x_return_status      OUT NOCOPY      VARCHAR2
2097      ,p_org_code           IN              VARCHAR2
2098      ,p_reason_name        IN              VARCHAR2
2099      ,p_batch_header_rec   IN              gme_batch_header%ROWTYPE
2100      ,x_batch_header_rec   OUT NOCOPY      gme_batch_header%ROWTYPE);
2101 
2102 /*#
2103 * Convert Detail Reservation Procedure
2104 * This procedure converted detail level reservation into transaction
2105 * It also relieves the reservation.
2106 * @param p_api_version Version of the api
2107 * @param p_validation_level validation level
2108 * @param p_init_msg_list message list flag - default is False
2109 * @param p_commit commit flag - default is False
2110 * @param x_message_count # of messages
2111 * @param x_message_list List of messages
2112 * @param x_return_status return status
2113 * @param p_qty_convert Quantity to be converted
2114 * @param p_reservation_rec mtl_reservations rowtype
2115 * @param p_trans_date User specified transaction date.
2116 * @rep:scope public
2117 * @rep:lifecycle active
2118 * @rep:displayname convert_dtl_reservation
2119 */
2120     /*================================================================================
2121      Procedure
2122        convert_dtl_reservation
2123      Description
2124        This procedure is used to convert a detailed reservation to WIP issue transaction.
2125        The full reservation quantity or a part quantity can be converted.  The reservation
2126        will be relieved accordingly.  Where the reservation is fully relieved, it is deleted.
2127        Where a reservation is at high level or part level and subinventory or locator information
2128        is missing, there will be an attempt to complete the detailing by defaulting values from
2129        the material detail line or org params.
2130 
2131      Parameters
2132        p_api_version     (O)     Requested api version.  Currently at 2.0
2133 
2134        p_init_msg_list   (O)     To initialize the message stack. Default is FALSE
2135 
2136        p_commit    (O)           Indicates whether to commit.  This is defaulted to FALSE
2137 
2138        x_message_count           Number of messages returned by the processing
2139 
2140        x_message_list            Message stack returned by the processing
2141 
2142        x_return_status           outcome of the API call
2143                                  S - Success
2144                                  E - Error
2145                                  U - Unexpected Error
2146 
2147        p_reservation_rec (R)     The reservation row identifying the target reservation
2148                                  Following columns are used from this row.
2149                                  reservation_id  (R)
2150 
2151        p_trans_date      (O)     The user can pass in a transaction date otherwise it
2152                                  will default to sysdate.
2153 
2154        p_qty_convert     (O)     The quantity to be converted to an inventory transaction
2155                                  This can be the full reservation quantity or part of it.
2156                                  Reflects the UOM defined for gme_material_details.dtl_um
2157                                  Default value is the full reservation quantity
2158       Clarification of how p_qty_convert is used from bug 6778968 going forward.
2159          If p_qty_convert passes a negative value, it will result in an error.
2160          When p_qty_convert is equal to or greater than reservation, qty converts the reservation
2161          qty to a transaction and passing less than reservation qty creates transaction for
2162          the p_qty_convert and relieves the reservation for that qty.
2163    ================================================================================*/
2164    PROCEDURE convert_dtl_reservation (
2165       p_api_version       IN              NUMBER := 2.0
2166      ,p_validation_level  IN              NUMBER
2167             := gme_common_pvt.g_max_errors
2168      ,p_init_msg_list     IN              VARCHAR2 := fnd_api.g_false
2169      ,p_commit            IN              VARCHAR2 := fnd_api.g_false
2170      ,x_message_count     OUT NOCOPY      NUMBER
2171      ,x_message_list      OUT NOCOPY      VARCHAR2
2172      ,x_return_status     OUT NOCOPY      VARCHAR2
2173      ,p_reservation_rec   IN              mtl_reservations%ROWTYPE
2174      ,p_trans_date        IN              DATE DEFAULT NULL    -- Bug 13532998
2175      ,p_qty_convert       IN              NUMBER := NULL);
2176 
2177 /*#
2178 * Insert Batch Step Resource Procedure
2179 * This procedure is used to insert a resource in a batchstep activity.
2180 * @param p_api_version Version of the api
2181 * @param p_validation_level validation level
2182 * @param p_init_msg_list message list flag - default is False
2183 * @param p_commit commit flag - default is False
2184 * @param p_org_code Inventory Organization (Plant or Lab)
2185 * @param p_batch_no Batch Number
2186 * @param p_batchstep_no Batch Step Number
2187 * @param p_activity Activity
2188 * @param p_ignore_qty_below_cap Ignore if peocess qty is below capacity of the resource
2189 * @param p_batchstep_resource_rec gme_batchstep_resource rowtype
2190 * @param p_validate_flexfields validate flexfields flag ('T','F')
2191 * @param x_batchstep_resource_rec gme_batchstep_resource rowtype
2192 * @param x_message_count # of messages
2193 * @param x_message_list List of messages
2194 * @param x_return_status return status
2195 * @rep:scope public
2196 * @rep:lifecycle active
2197 * @rep:displayname insert_batchstep_resource
2198 */
2199     /*================================================================================
2200      Procedure
2201        insert_batchstep_resource
2202      Description
2203        This procedure is used to insert a resource for an activity of a step
2204        The target placement for the new resource can be identified using the ID
2205        columns within p_batchstep_resource_rec.
2206        Alternatively the following keys can be used together
2207        p_org_code
2208        p_batch_no
2209        p_batchstep_no
2210        p_activity
2211        p_batchstep_resource_rec.resources
2212 
2213        The procedure will return the newly inserted row including the identifier
2214        x_batchstep_resource.batchstep_resource_id
2215 
2216      Parameters
2217        p_api_version               required API version
2218        p_validation_level          required level of validation
2219        p_init_msg_list             initialization of message stack
2220        p_commit                    controls whether or not commit is issued
2221        p_batchstep_resource_rec    batchstep resource to be inserted for an activity
2222                                    Ensure that the resources column is populated.
2223        p_org_code                  organization code
2224        p_batch_no                  batch number
2225        p_batchstep_no              batch step number
2226        p_activity                  batch step activity
2227        p_ignore_qty_below_cap      controls whether or not rsrc_qty can go below rsrc capacity
2228        p_validate_flexfield        controls whether or not flexfield validation is instigated
2229        x_batchstep_resource        returns inserted batchstep resource row
2230        x_message_count             number of messages on stack
2231        x_message_list              messages added to the stack during processing
2232        x_return_status             outcome of the API call
2233                                    S - Success
2234                                    E - Error
2235                                    U - Unexpected Error
2236    ================================================================================*/
2237    PROCEDURE insert_batchstep_resource (
2238       p_api_version              IN              NUMBER
2239      ,p_validation_level         IN              NUMBER
2240             := gme_common_pvt.g_max_errors
2241      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
2242      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
2243      ,p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
2244      ,p_org_code                 IN              VARCHAR2 := NULL
2245      ,p_batch_no                 IN              VARCHAR2 := NULL
2246      ,p_batchstep_no             IN              NUMBER := NULL
2247      ,p_activity                 IN              VARCHAR2 := NULL
2248      ,p_ignore_qty_below_cap     IN              VARCHAR2 := fnd_api.g_false
2249      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
2250      ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
2251      ,x_message_count            OUT NOCOPY      NUMBER
2252      ,x_message_list             OUT NOCOPY      VARCHAR2
2253      ,x_return_status            OUT NOCOPY      VARCHAR2);
2254 
2255 /*#
2256 * Update Batch Step Resource Procedure
2257 * This procedure is used to insert a resource in a batchstep activity.
2258 * @param p_api_version Version of the api
2259 * @param p_validation_level validation level
2260 * @param p_init_msg_list message list flag - default is False
2261 * @param p_commit commit flag - default is False
2262 * @param p_org_code Inventory Organization (Plant or Lab)
2263 * @param p_batch_no Batch Number
2264 * @param p_batchstep_no Batch Step Number
2265 * @param p_activity Activity
2266 * @param p_ignore_qty_below_cap Ignore if peocess qty is below capacity of the resource
2267 * @param p_batchstep_resource_rec gme_batchstep_resource rowtype
2268 * @param p_validate_flexfields validate flexfields flag ('T','F')
2269 * @param x_batchstep_resource_rec gme_batchstep_resource rowtype
2270 * @param x_message_count # of messages
2271 * @param x_message_list List of messages
2272 * @param x_return_status return status
2273 * @rep:scope public
2274 * @rep:lifecycle active
2275 * @rep:displayname update_batchstep_resource
2276 */
2277 /*================================================================================
2278     Procedure
2279       update_batchstep_resource
2280     Description
2281       This procedure is used to update an existing resource of an activity of a step
2282       Provide either a unique identifier or key field values to target the row for update.
2283 
2284     Parameters
2285       p_api_version               required API version
2286       p_validation_level          required level of validation
2287       p_init_msg_list             initialization of message stack
2288       p_commit                    controls whether or not commit is issued
2289       p_batchstep_resource_rec    batchstep resource updates to be applied
2290                                   provide batchstep_resource_id as a unique identifier for the target row
2291                                   Alternatively, populate key fields below in conjunction with
2292                                   resources
2293       p_org_code                  organization code
2294       p_batch_no                  batch number
2295       p_batchstep_no              batch step number
2296       p_activity                  batch step activity
2297       p_ignore_qty_below_cap      controls whether or not rsrc_qty can go below rsrc capacity
2298       p_validate_flexfield        controls whether or not flexfield validation is instigated
2299       x_batchstep_resource        returns inserted batchstep resource row
2300       x_message_count             number of messages on stack
2301       x_message_list              messages added to the stack during processing
2302       x_return_status             outcome of the API call
2303                                   S - Success
2304                                   E - Error
2305                                   U - Unexpected Error
2306   ================================================================================*/
2307    PROCEDURE update_batchstep_resource (
2308       p_api_version              IN              NUMBER
2309      ,p_validation_level         IN              NUMBER
2310             := gme_common_pvt.g_max_errors
2311      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
2312      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
2313      ,p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
2314      ,p_org_code                 IN              VARCHAR2 := NULL
2315      ,p_batch_no                 IN              VARCHAR2 := NULL
2316      ,p_batchstep_no             IN              NUMBER := NULL
2317      ,p_activity                 IN              VARCHAR2 := NULL
2318      ,p_ignore_qty_below_cap     IN              VARCHAR2 := fnd_api.g_false
2319      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
2320      ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
2321      ,x_message_count            OUT NOCOPY      NUMBER
2322      ,x_message_list             OUT NOCOPY      VARCHAR2
2323      ,x_return_status            OUT NOCOPY      VARCHAR2);
2324 
2325 /*#
2326 * Delete Batch Step Resource Procedure
2327 * This procedure is used to delete a resource from a batchstep activity.
2328 * @param p_api_version Version of the api
2329 * @param p_validation_level validation level
2330 * @param p_init_msg_list message list flag - default is False
2331 * @param p_commit commit flag - default is False
2332 * @param p_org_code Inventory Organization (Plant or Lab)
2333 * @param p_batch_no Batch Number
2334 * @param p_batchstep_no Batch Step Number
2335 * @param p_activity Activity
2336 * @param p_batchstep_resource_id To uniquely identify gme_batchstep_resource
2337 * @param p_resource Resource Name
2338 * @param x_message_count # of messages
2339 * @param x_message_list List of messages
2340 * @param x_return_status return status
2341 * @rep:scope public
2342 * @rep:lifecycle active
2343 * @rep:displayname delete_batchstep_resource
2344 */
2345 /*================================================================================
2346     Procedure
2347       delete_batchstep_resource
2348     Description
2349       This procedure is used to delete an existing resource of an activity of a step
2350       Provide either a unique identifier or key field values to target the row.
2351 
2352     Parameters
2353       p_api_version               required API version
2354       p_validation_level          required level of validation
2355       p_init_msg_list             initialization of message stack
2356       p_commit                    controls whether or not commit is issued
2357       p_batchstep_resource_id     uniquely identifies the batchstep resource for deletion
2358       p_org_code                  organization code
2359       p_batch_no                  batch number
2360       p_batchstep_no              batch step number
2361       p_activity                  batch step activity
2362       p_resource                  batch step activity resource
2363       x_return_status             outcome of the API call
2364                                   S - Success
2365                                   E - Error
2366                                   U - Unexpected Error
2367   ================================================================================*/
2368    PROCEDURE delete_batchstep_resource (
2369       p_api_version             IN              NUMBER := 2.0
2370      ,p_validation_level        IN              NUMBER
2371             := gme_common_pvt.g_max_errors
2372      ,p_init_msg_list           IN              VARCHAR2 := fnd_api.g_false
2373      ,p_commit                  IN              VARCHAR2 := fnd_api.g_false
2374      ,p_batchstep_resource_id   IN              NUMBER := NULL
2375      ,p_org_code                IN              VARCHAR2 := NULL
2376      ,p_batch_no                IN              VARCHAR2 := NULL
2377      ,p_batchstep_no            IN              NUMBER := NULL
2378      ,p_activity                IN              VARCHAR2 := NULL
2379      ,p_resource                IN              VARCHAR2 := NULL
2380      ,x_message_count           OUT NOCOPY      NUMBER
2381      ,x_message_list            OUT NOCOPY      VARCHAR2
2382      ,x_return_status           OUT NOCOPY      VARCHAR2);
2383 
2384 /*#
2385 * Auto Detail Line Procedure
2386 * This procedure Creates detail level reservations for the given ingredient line
2387 *   as per the picking rules defined.
2388 * @param p_api_version Version of the api
2389 * @param p_validation_level validation level
2390 * @param p_init_msg_list message list flag - default is False
2391 * @param p_commit commit flag - default is False
2392 * @param x_message_count # of messages
2393 * @param x_message_list List of messages
2394 * @param x_return_status return status
2395 * @param p_org_code Inventory Organization (Plant or Lab)
2396 * @param p_batch_no Batch number
2397 * @param p_line_no Line number of the ingredient
2398 * @param p_material_detail_id Identifier for the ingredient line
2399 * @rep:scope public
2400 * @rep:lifecycle active
2401 * @rep:displayname auto_detail_line
2402 */
2403     /*================================================================================
2404      Procedure
2405        auto_detail_line
2406      Description
2407        This procedure is used to generate detailed reservations for an ingredient line.
2408        The WMS rules engine is called to determine which inventory is reserved according to
2409        availability and selection rules.
2410        The ingredeint line MUST be identified either using p_material_detail_id OR
2411        the combination of p_org_code,p_batch_no,p_line_no
2412 
2413      Parameters
2414        p_api_version     (O)     Requested api version.  Currently at 2.0
2415        p_init_msg_list   (O)     To initialize the message stack. Default is FALSE
2416        p_commit          (O)     Indicates whether to commit.  This is defaulted to FALSE
2417        x_message_count           Number of messages returned by the processing
2418        x_message_list            Message stack returned by the processing
2419        x_return_status           outcome of the API call
2420                                  S - Success
2421                                  E - Error
2422                                  U - Unexpected Error
2423 
2424        p_material_detail_id (O)  Identifier for the ingredient row against which
2425                                  detailed reservations will be placed.
2426                                  Must be supplied if org/batch/line below are not.
2427 
2428        p_org_code           (O)  Organization owning the production batch
2429        p_batch_no           (O)  Production batch
2430        p_line_no            (O)  Ingredient line within the production batch
2431    ================================================================================*/
2432    PROCEDURE auto_detail_line (
2433       p_api_version          IN              NUMBER := 2.0
2434      ,p_validation_level     IN              NUMBER
2435             := gme_common_pvt.g_max_errors
2436      ,p_init_msg_list        IN              VARCHAR2 := fnd_api.g_false
2437      ,p_commit               IN              VARCHAR2 := fnd_api.g_false
2438      ,x_message_count        OUT NOCOPY      NUMBER
2439      ,x_message_list         OUT NOCOPY      VARCHAR2
2440      ,x_return_status        OUT NOCOPY      VARCHAR2
2441      ,p_material_detail_id   IN              NUMBER
2442      ,p_org_code             IN              VARCHAR2
2443      ,p_batch_no             IN              VARCHAR2
2444      ,p_line_no              IN              NUMBER);
2445 
2446 /*#
2447 * Auto Detail Batch Reservations Procedure
2448 * This procedure Creates detail level reservations for each ingredient line
2449 *   in the production batch as per the picking rules defined.
2450 * @param p_api_version Version of the api
2451 * @param p_init_msg_list message list flag - default is False
2452 * @param p_commit commit flag - default is False
2453 * @param x_message_count # of messages
2454 * @param x_message_list List of messages
2455 * @param x_return_status return status
2456 * @param p_org_code Inventory Organization
2457 * @param p_batch_rec Batch header row
2458 * @rep:scope public
2459 * @rep:lifecycle active
2460 * @rep:displayname auto_detail_batch
2461 */
2462    /*================================================================================
2463     Procedure
2464       auto_detail_batch
2465     Description
2466       This procedure is used to generate detailed reservations for the ingredient lines
2467       of a production batch.
2468       The WMS rules engine is called to determine which inventory is reserved according to
2469       availability and selection rules.
2470 
2471     Parameters
2472       p_api_version     (O)     Requested api version.  Currently at 2.0
2473       p_init_msg_list   (O)     To initialize the message stack. Default is FALSE
2474       p_commit		(O)     Indicates whether to commit.  This is defaulted to FALSE
2475       x_message_count           Number of messages returned by the processing
2476       x_message_list            Message stack returned by the processing
2477       x_return_status           outcome of the API call
2478                                 S - Success
2479                                 E - Error
2480                                 U - Unexpected Error
2481 
2482       p_org_code           (R)  Organization owning the production batch
2483       p_batch_rec          (R)  Production batch
2484   ================================================================================*/
2485 
2486   PROCEDURE auto_detail_batch      (p_api_version            IN          NUMBER := 2.0
2487                                    ,p_init_msg_list          IN          VARCHAR2 := FND_API.G_FALSE
2488                                    ,p_commit                 IN          VARCHAR2 := FND_API.G_FALSE
2489                                    ,x_message_count          OUT NOCOPY  NUMBER
2490                                    ,x_message_list           OUT NOCOPY  VARCHAR2
2491                                    ,x_return_status          OUT NOCOPY  VARCHAR2
2492                                    ,p_org_code               IN          VARCHAR2
2493                                    ,p_batch_rec              IN          GME_BATCH_HEADER%ROWTYPE);
2494 /*#
2495 * Inserts an activity for a step.
2496 * @param p_api_version Version of the api
2497 * @param p_validation_level validation level
2498 * @param p_init_msg_list message list flag - default is False
2499 * @param p_commit commit flag - default is False
2500 * @param x_message_count # of messages
2501 * @param x_message_list List of messages
2502 * @param x_return_status return status
2503 * @param p_batchstep_activity_rec Batch step activity record to identify step activities
2504 * @param p_batchstep_resource_tbl Resources table
2505 * @param p_org_code Organization Code
2506 * @param p_batch_no Batch Number
2507 * @param p_batchstep_no Batch Step Number
2508 * @param p_ignore_qty_below_cap Ignore quantity below cap flag - default is False
2509 * @param p_validate_flexfield Whether to validate the flexfields - default is False
2510 * @param x_batchstep_activity_rec Batch step activity record to identify step activities
2511 * @rep:scope public
2515 
2512 * @rep:lifecycle active
2513 * @rep:displayname Insert Batchstep Activity
2514 */
2516    /*================================================================================
2517     Procedure
2518       insert_batchstep_activity
2519     Description
2520       This procedure is used to insert an activity for a step
2521 
2522     Parameters
2523       p_batchstep_activity_rec (R)    activity to be inserted for a step
2524       p_batchstep_resource_tbl (R) one or more resources to be inserted for the activity
2525       p_org_code (O)              organization code
2526       p_batch_no (O)              batch number
2527       p_batchstep_no(O)           batch step number
2528       p_ignore_qty_below_cap (O)  controls - allow rsrc_qty going below rsrc capacity
2529       p_validate_flexfield (O)    Whether to validate the flexfields
2530       x_batchstep_activity_rec        newly inserted activity row, can be used for update etc
2531       x_return_status             outcome of the API call
2532                                   S - Success
2533                                   E - Error
2534                                   U - Unexpected Error
2535   ================================================================================*/
2536    PROCEDURE insert_batchstep_activity (
2537       p_api_version              IN              NUMBER ,
2538       p_validation_level         IN              NUMBER
2539             := gme_common_pvt.g_max_errors,
2540       p_init_msg_list            IN              VARCHAR2
2541             DEFAULT fnd_api.g_false,
2542       p_commit                   IN              VARCHAR2
2543             DEFAULT fnd_api.g_false,
2544       p_org_code                 IN              VARCHAR2,
2545       p_batchstep_activity_rec   IN              gme_batch_step_activities%ROWTYPE,
2546       p_batchstep_resource_tbl   IN              gme_create_step_pvt.resources_tab,
2547       p_batch_no                 IN              VARCHAR2 := NULL,
2548       p_batchstep_no             IN              NUMBER := NULL,
2549       p_ignore_qty_below_cap     IN              VARCHAR2
2550             DEFAULT fnd_api.g_false,
2551       p_validate_flexfield       IN              VARCHAR2
2552             DEFAULT fnd_api.g_false,
2553       x_batchstep_activity_rec   OUT NOCOPY      gme_batch_step_activities%ROWTYPE,
2554       x_message_count            OUT NOCOPY      NUMBER,
2555       x_message_list             OUT NOCOPY      VARCHAR2,
2556       x_return_status            OUT NOCOPY      VARCHAR2
2557    );
2558 
2559 /*#
2560 * Updates an activity for a step.
2561 * @param p_api_version Version of the api
2562 * @param p_validation_level validation level
2563 * @param p_init_msg_list message list flag - default is False
2564 * @param p_commit commit flag - default is False
2565 * @param x_message_count # of messages
2566 * @param x_message_list List of messages
2567 * @param x_return_status return status
2568 * @param p_batchstep_activity_rec Batch step activity record to identify step activities
2569 * @param p_org_code Organization Code
2570 * @param p_batch_no Batch Number
2571 * @param p_batchstep_no Batch Step Number
2572 * @param p_validate_flexfield Whether to validate the flexfields - default is False
2573 * @param x_batchstep_activity_rec Batch step activity record to identify step activities
2574 * @rep:scope public
2575 * @rep:lifecycle active
2576 * @rep:displayname Update Batchstep Activity
2577 */
2578 
2579    /*================================================================================
2580     Procedure
2581       update_batchstep_activity
2582     Description
2583       This procedure is used to update an activity for a step
2584 
2585     Parameters
2586       p_batchstep_activity (R)    activity to be updated
2587       p_org_code (O)              organization code
2588       p_batch_no (O)              batch number
2589       p_batchstep_no(O)           batch step number
2590       p_validate_flexfield (O)    Whether to validate the flexfields
2591       x_batchstep_activity        updated activity row
2592       x_return_status             outcome of the API call
2593                                   S - Success
2594                                   E - Error
2595                                   U - Unexpected Error
2596   ================================================================================*/
2597    PROCEDURE update_batchstep_activity (
2598       p_api_version              IN              NUMBER ,
2599       p_validation_level         IN              NUMBER
2600             := gme_common_pvt.g_max_errors,
2601       p_init_msg_list            IN              VARCHAR2
2602             DEFAULT fnd_api.g_false,
2603       p_commit                   IN              VARCHAR2
2604             DEFAULT fnd_api.g_false,
2605       p_org_code                 IN              VARCHAR2,
2606       p_batchstep_activity_rec   IN              gme_batch_step_activities%ROWTYPE,
2607       p_batch_no                 IN              VARCHAR2 := NULL,
2608       p_batchstep_no             IN              NUMBER := NULL,
2609       p_validate_flexfield       IN              VARCHAR2
2610             DEFAULT fnd_api.g_false,
2611       x_batchstep_activity_rec   OUT NOCOPY      gme_batch_step_activities%ROWTYPE,
2612       x_message_count            OUT NOCOPY      NUMBER,
2613       x_message_list             OUT NOCOPY      VARCHAR2,
2614       x_return_status            OUT NOCOPY      VARCHAR2
2615    );
2616 
2617 /*#
2618 * Deletes an activity from a step. Note that proper identification like
2619 * activity id or a combination of organization code, batch number, and batch step
2620 * number must be provided for the batch step to be deleted.
2621 * @param p_api_version Version of the API
2622 * @param p_validation_level Validation level
2623 * @param p_init_msg_list Message list flag - default is False
2624 * @param p_commit Commit flag - default is False
2625 * @param p_batchstep_activity_id Batch step activity id
2626 * @param p_org_code Organization Code
2627 * @param p_batch_no Batch Number
2628 * @param p_batchstep_no Batch Step Number
2629 * @param p_activity Activity
2630 * @param x_message_count Number of messages
2631 * @param x_message_list List of messages
2632 * @param x_return_status Indicates the return status of an API.
2633 * @rep:scope public
2634 * @rep:lifecycle active
2635 * @rep:displayname Delete Batchstep Activity
2636 */
2637 
2638    /*================================================================================
2639     Procedure
2640       delete_batchstep_activity
2641     Description
2642       This procedure is used to delete an activity from a step.  Note that either the
2643       activity_id must be provided or the combination of organization_code, batch_no, batchstep_no,
2644       and activity in order to uniquely identify an activity to be deleted.
2645 
2646     Parameters
2647       p_batchstep_activity_id (O) activity_id to be deleted
2648       p_org_code (O)              organization code
2649       p_batch_no (O)              batch number
2650       p_batchstep_no(O)           batch step number
2651       p_activity(O)               activity
2652       x_return_status             outcome of the API call
2653                                   S - Success
2654                                   E - Error
2655                                   U - Unexpected Error
2656   ================================================================================*/
2657    PROCEDURE delete_batchstep_activity (
2658       p_api_version             IN              NUMBER := 2.0,
2659       p_validation_level        IN              NUMBER
2660             := gme_common_pvt.g_max_errors,
2661       p_init_msg_list           IN              VARCHAR2
2662             DEFAULT fnd_api.g_false,
2663       p_commit                  IN              VARCHAR2
2664             DEFAULT fnd_api.g_false,
2665       p_org_code                IN              VARCHAR2,
2666       p_batchstep_activity_id   IN              NUMBER := NULL,
2667       p_batch_no                IN              VARCHAR2 := NULL,
2668       p_batchstep_no            IN              NUMBER := NULL,
2669       p_activity                IN              VARCHAR2 := NULL,
2670       x_message_count           OUT NOCOPY      NUMBER,
2671       x_message_list            OUT NOCOPY      VARCHAR2,
2672       x_return_status           OUT NOCOPY      VARCHAR2
2673    );
2674 /*#
2675 * Convert Fpo Procedure
2676 * This procedure is used to convert the firm planned order to one of many batches.
2677 * @param p_api_version Version of the api
2678 * @param p_validation_level validation level
2679 * @param p_init_msg_list message list flag - default is False
2680 * @param p_commit commit flag - default is False
2681 * @param x_message_count # of messages
2682 * @param x_message_list List of messages
2683 * @param p_enforce_vldt_check enforce validity check
2684 * @param x_return_status return status
2685 * @param p_org_code organization code
2686 * @param p_batch_header gme_batch_header rowtype
2687 * @param x_batch_header gme_batch_header rowtype
2688 * @param p_batch_size batch size
2689 * @param p_num_batches number of batches
2690 * @param p_validity_rule_id recipe_validity_rule_id Validity rule id
2691 * @param p_validity_rule_tab recipe_validity_rule_tab record type
2692 * @param p_leadtime leadtime
2693 * @param p_batch_offset batch offset
2694 * @param p_offset_type offset type
2695 * @param p_plan_start_date plan start date
2696 * @param p_plan_cmplt_date plan cmplt date
2697 * @param p_use_shop_cal use shop calendar flag
2698 * @param p_contiguity_override contiguity override
2699 * @param p_use_for_all use validity rule for all batches flag - default is True
2700 * @rep:scope public
2701 * @rep:lifecycle active
2702 * @rep:displayname convert_fpo
2703 */
2704 
2705    /*================================================================================
2706     Procedure
2707       convert_fpo
2708     Description
2709       This procedure is used to convert a firm planned order to one or many batches.
2710 
2711     Parameters
2712       p_api_version         (O) API version number
2713       p_validation_level    (O) Required level of validation
2714       p_init_msg_list       (O) Indicates whether or not message stack should be initialized
2715       p_commit              (O) T/F to instigate a COMMIT or not
2716       p_enforce_vldt_check  (O) T/F for validity rule verification
2717       p_org_code            (O) Organization Code associated with the batch
2718       p_batch_header        (R) The FPO row to identify the FPO
2719                                 Following columns are used from this row.
2720                                 batch_id  (R) organization_id
2721       p_batch_size          (R) The size of the batch to be created.
2722       p_num_batches         (R) Number of batches to be created.
2723       p_validity_rule_id    (R) The validity rule to be used to create the batch (if
2727                                 production rules does not exists.
2724                                 converting to 1 batch or p_use_for_all is set to True)
2725       p_validity_rule_tab   (O) The validity rules tab (if converting to multiple batches)
2726       p_leadtime            (O) The batch duration in case routing data or
2728       p_batch_offset        (O) The offset time between batches.
2729       p_offset_type         (O) The offset type.
2730                                 0 - Start to start
2731                                 1 - Finish to start
2732       p_plan_start_date     (O) The start date of the first batch. Must be provided if plan_cmplt_date is not.
2733       p_plan_cmplt_date     (O) The completion date of the last batch
2734       p_use_shop_cal        (O) T/F - to use shop calendar or not.
2735       p_contiguity_override (O) T/F - for contigious period of calendar.
2736       p_use_for_all         (O) T/F - Use the same validity rule for all the batches.
2737       x_return_status           outcome of the API call
2738                                 S - Success
2739                                 E - Error
2740                                 U - Unexpected Error
2741                                 V - Inventory shortages exist
2742   ================================================================================*/
2743 
2744    PROCEDURE convert_fpo (
2745       p_api_version          IN         NUMBER := 2.0
2746      ,p_validation_level     IN         NUMBER := gme_common_pvt.g_max_errors
2747      ,p_init_msg_list        IN         VARCHAR2 := fnd_api.g_false
2748      ,p_commit               IN         VARCHAR2 := fnd_api.g_false
2749      ,x_message_count        OUT NOCOPY NUMBER
2750      ,x_message_list         OUT NOCOPY VARCHAR2
2751      ,p_enforce_vldt_check   IN         VARCHAR2 := fnd_api.g_true
2752      ,x_return_status        OUT NOCOPY VARCHAR2
2753      ,p_org_code             IN         VARCHAR2 := NULL
2754      ,p_batch_header         IN         gme_batch_header%ROWTYPE
2755      ,x_batch_header         OUT NOCOPY gme_batch_header%ROWTYPE
2756      ,p_batch_size           IN         NUMBER
2757      ,p_num_batches          IN         NUMBER
2758      ,p_validity_rule_id     IN         NUMBER
2759      ,p_validity_rule_tab    IN         gme_common_pvt.recipe_validity_rule_tab
2760      ,p_leadtime             IN         NUMBER DEFAULT 0
2761      ,p_batch_offset         IN         NUMBER DEFAULT 0
2762      ,p_offset_type          IN         NUMBER DEFAULT 0
2763      ,p_plan_start_date      IN         gme_batch_header.plan_start_date%TYPE
2764      ,p_plan_cmplt_date      IN         gme_batch_header.plan_cmplt_date%TYPE
2765      ,p_use_shop_cal         IN         VARCHAR2 := fnd_api.g_false
2766      ,p_contiguity_override  IN         VARCHAR2 := fnd_api.g_true
2767      ,p_use_for_all          IN         VARCHAR2 := fnd_api.g_true);
2768 
2769 /*#
2770 * Create a pending product lot. Note that identification must be provided:
2771 * material detail id or batch_id, line_no, line_type or
2772 * batch_no, org_code, line_no, line_type (batch_type is assumed to be Batch)
2773 * @param p_api_version Version of the API
2774 * @param p_validation_level Validation level
2775 * @param p_init_msg_list Message list flag - default is False
2776 * @param p_commit Commit flag - default is False
2777 * @param p_batch_header_rec Batch header record with optional key specified
2778 * @param p_org_code Organization Code
2779 * @param p_material_detail_rec Material detail record with key combination specified
2780 * @param p_pending_product_lots_rec Pending product lot record with data to populate
2781 * @param p_expiration_date Expiration date for item with expiration control as user-defined.
2782 * @param p_create_lot Create product lot if it does not exist. Product and by-product only.
2783 * @param p_generate_lot Generate product lot if nothing is passed. Product and by-product only.
2784 * @param p_generate_parent_lot Generate parent product lot. Product and by-product only.
2785 * @param p_parent_lot Specify parent lot.
2786 * @param x_pending_product_lots_rec Output Pending product lot record.
2787 * @param x_message_count Number of messages
2788 * @param x_message_list List of messages
2789 * @param x_return_status Indicates the return status of an API.
2790 * @rep:scope public
2791 * @rep:lifecycle active
2792 * @rep:displayname Create Pending Product Lot
2793 */
2794 
2795    /*================================================================================
2796     Procedure
2797       create_pending_product_lot
2798     Description
2799       This procedure is used to create a pending product lot record for a specified
2800       material detail record.
2801       Following key sequences can be specified:
2802       material_detail_id OR
2803       batch_id, line_no, line_type OR
2804       batch_no, org_code, line_no, line_type (batch_type is assumed to be Batch)
2805 
2806     Parameters
2807       p_batch_header_rec (O)      batch header record
2808       p_org_code (O)              organization code
2809       p_material_detail_rec (O)   material detail record
2810       p_pending_product_lots_rec (R) pending product lots record
2811       p_create_lot (O)            This indicates whether to create the lot if the lot does
2812                                   not exist.  Default to False, do not create the lot.  This
2813                                   applies to products and by-products only.
2814       p_expiration_date           If Expiration control is user-defined, this parameter is used
2815                                   to provide the expiration date. It is applicable if p_create_lot is True
2816       p_generate_lot (O)          This indicates to generate a lot if there is nothing passed
2817                                   in the lot number field of p_pending_product_lots_rec.  Default
2818                                   to False, do not generate the lot.  This applies to products and
2819                                   by-products only.
2820       p_generate_parent_lot (O)   This indicates to generate a parent lot.  Default
2821                                   to False, do not generate the parent lot.  This applies to products and
2822                                   by-products only.
2823       x_return_status             outcome of the API call
2824                                   S - Success
2825                                   E - Error
2826                                   U - Unexpected Error
2827 
2828     History
2829        G. Muratore    13-MAY-2010 Bug 9482460
2830           Introduced new p_parent_lot parameter.
2831   ================================================================================*/
2832 
2833    PROCEDURE create_pending_product_lot
2834      (p_api_version              IN              NUMBER
2835      ,p_validation_level         IN              NUMBER
2836             := gme_common_pvt.g_max_errors
2837      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
2838      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
2839      ,x_message_count            OUT NOCOPY      NUMBER
2840      ,x_message_list             OUT NOCOPY      VARCHAR2
2841      ,x_return_status            OUT NOCOPY      VARCHAR2
2842      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
2843      ,p_org_code                 IN              VARCHAR2
2844      ,p_create_lot               IN              VARCHAR2 := fnd_api.g_false
2845      ,p_generate_lot             IN              VARCHAR2 := fnd_api.g_false
2846      ,p_generate_parent_lot      IN              VARCHAR2 := fnd_api.g_false
2847      ,p_parent_lot               IN              mtl_lot_numbers.lot_number%TYPE := NULL
2848      ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
2849       /* nsinghi bug#4486074 Added the p_expiration_dt parameter. */
2850      ,p_expiration_date            IN              mtl_lot_numbers.expiration_date%TYPE := NULL
2851      ,p_pending_product_lots_rec IN              gme_pending_product_lots%ROWTYPE
2852      ,x_pending_product_lots_rec OUT NOCOPY      gme_pending_product_lots%ROWTYPE);
2853 
2854 /*#
2855 * Update a pending product lot. Note that identification:
2856 * pending product lot id or a combination of keys must be provided.
2857 * @param p_api_version Version of the API
2858 * @param p_validation_level Validation level
2859 * @param p_init_msg_list Message list flag - default is False
2860 * @param p_commit Commit flag - default is False
2861 * @param p_batch_header_rec Batch header record with optional key specified
2862 * @param p_org_code Organization Code
2863 * @param p_material_detail_rec Material detail record with key combination specified
2864 * @param p_pending_product_lots_rec Pending product lot record with data to update
2865 * @param x_pending_product_lots_rec Output Pending product lot record.
2866 * @param x_message_count Number of messages
2867 * @param x_message_list List of messages
2868 * @param x_return_status Indicates the return status of an API.
2869 * @rep:scope public
2870 * @rep:lifecycle active
2871 * @rep:displayname Update Pending Product Lot
2872 */
2873 
2874    /*================================================================================
2875     Procedure
2876       update_pending_product_lot
2877     Description
2878       This procedure is used to update a pending product lot record for a specified
2879       pending product lot record
2880       Following key sequences can be specified:
2881       pending_product_lot_id OR
2882       batch_id, line_no, line_type, sequence OR
2883       batch_no, org_code, line_no, line_type, sequence (batch_type is assumed to be Batch)
2884 
2885     Parameters
2886       p_batch_header_rec (O)      batch header record
2887       p_org_code (O)              organization code
2888       p_material_detail_rec (O)   material detail record
2889       p_pending_product_lots_rec (R) pending product lots record
2890       x_return_status             outcome of the API call
2891                                   S - Success
2892                                   E - Error
2893                                   U - Unexpected Error
2897      (p_api_version              IN              NUMBER
2894   ================================================================================*/
2895 
2896    PROCEDURE update_pending_product_lot
2898      ,p_validation_level         IN              NUMBER
2899             := gme_common_pvt.g_max_errors
2900      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
2901      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
2902      ,x_message_count            OUT NOCOPY      NUMBER
2903      ,x_message_list             OUT NOCOPY      VARCHAR2
2904      ,x_return_status            OUT NOCOPY      VARCHAR2
2905      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
2906      ,p_org_code                 IN              VARCHAR2
2907      ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
2908      ,p_pending_product_lots_rec IN              gme_pending_product_lots%ROWTYPE
2909      ,x_pending_product_lots_rec OUT NOCOPY      gme_pending_product_lots%ROWTYPE);
2910 
2911 /*#
2912 * Delete a pending product lot. Note that identification:
2913 * pending product lot id or a combination of keys must be provided.
2914 * @param p_api_version Version of the API
2915 * @param p_validation_level Validation level
2916 * @param p_init_msg_list Message list flag - default is False
2917 * @param p_commit Commit flag - default is False
2918 * @param p_batch_header_rec Batch header record with optional key specified
2919 * @param p_org_code Organization Code
2920 * @param p_material_detail_rec Material detail record with key combination specified
2921 * @param p_pending_product_lots_rec Pending product lot record to delete
2922 * @param x_message_count Number of messages
2923 * @param x_message_list List of messages
2924 * @param x_return_status Indicates the return status of an API.
2925 * @rep:scope public
2926 * @rep:lifecycle active
2927 * @rep:displayname Delete Pending Product Lot
2928 */
2929 
2930    /*================================================================================
2931     Procedure
2932       Delete_pending_product_lot
2933     Description
2934       This procedure is used to delete a pending product lot record for a specified
2935       pending product lot record
2936       Following key sequences can be specified:
2937       pending_product_lot_id OR
2938       batch_id, line_no, line_type, sequence OR
2939       batch_no, org_code, line_no, line_type, sequence (batch_type is assumed to be Batch)
2940 
2941     Parameters
2942       p_batch_header_rec (O)      batch header record
2943       p_org_code (O)              organization code
2944       p_material_detail_rec (O)   material detail record
2945       p_pending_product_lots_rec (R) pending product lots record
2946       x_return_status             outcome of the API call
2947                                   S - Success
2948                                   E - Error
2949                                   U - Unexpected Error
2950   ================================================================================*/
2951 
2952    PROCEDURE delete_pending_product_lot
2953      (p_api_version              IN              NUMBER
2954      ,p_validation_level         IN              NUMBER
2955             := gme_common_pvt.g_max_errors
2956      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
2957      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
2958      ,x_message_count            OUT NOCOPY      NUMBER
2959      ,x_message_list             OUT NOCOPY      VARCHAR2
2960      ,x_return_status            OUT NOCOPY      VARCHAR2
2961      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
2962      ,p_org_code                 IN              VARCHAR2
2963      ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
2964      ,p_pending_product_lots_rec IN              gme_pending_product_lots%ROWTYPE);
2965 
2966 /*#
2967 * Unrelease a batch. Note that identification is required:
2968 * p_batch_id or p_batch_no and p_org_code (batch_type is assumed to be batch)
2969 * @param p_api_version Version of the API
2970 * @param p_validation_level Validation level
2971 * @param p_init_msg_list Message list flag - default is False
2972 * @param p_commit Commit flag - default is False
2973 * @param p_batch_header_rec Identifies what batch to unrelease
2974 * @param p_org_code Organization Code
2975 * @param p_create_resv_pend_lots Indicates to create Reservations for ingredients and Pending Product Lots for Products
2976 * @param p_continue_lpn_txn Indicates whether to continue processing the batch when product or byproduct is yielded into LPN - default is 'N'
2977 * @param x_batch_header_rec Batch Header output record after unrelease
2978 * @param x_message_count Number of messages
2979 * @param x_message_list List of messages
2980 * @param x_return_status Indicates the return status of an API.
2981 * @rep:scope public
2982 * @rep:lifecycle active
2983 * @rep:displayname Unrelease Batch
2984 */
2985 
2986    /*================================================================================
2987     Procedure
2988       unrelease_batch
2989     Description
2990       This procedure is used to unrelease a WIP batch.
2991       One of the following key sequences must be specified:
2992       batch_id OR
2993       batch_no, org_code  batch_type assumed to be batch
2994 
2995     Parameters
2996       p_batch_header_rec (O)      batch header to identify the batch to unrelease
2997       p_org_code (O)              organization code to identigy the batch is conjunction with p_batch_no
2998       p_create_resv_pend_lots (R) indicates whether to create reservations or pending product lots
2999                                   depending on the line type.
3000       p_continue_lpn_txn (O)      indicates wheter to continue processing a batch when product or byproduct has lpn transaction.
3001       x_batch_header_rec          Output batch header record after unrelease
3002       x_return_status             outcome of the API call
3003                                   S - Success
3004                                   E - Error
3005                                   U - Unexpected Error
3006   ================================================================================*/
3007    PROCEDURE unrelease_batch
3008      (p_api_version              IN              NUMBER
3009      ,p_validation_level         IN              NUMBER
3010             := gme_common_pvt.g_max_errors
3011      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3012      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3013      ,x_message_count            OUT NOCOPY      NUMBER
3014      ,x_message_list             OUT NOCOPY      VARCHAR2
3015      ,x_return_status            OUT NOCOPY      VARCHAR2
3016      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
3017      ,p_org_code                 IN              VARCHAR2
3018      ,p_create_resv_pend_lots    IN              NUMBER
3019      ,p_continue_lpn_txn         IN              VARCHAR2 := 'N'
3020      ,x_batch_header_rec         OUT NOCOPY      gme_batch_header%ROWTYPE);
3021 
3022 /*#
3023 * Unrelease a step. Note that identification is required:
3024 * p_batchstep_id or p_batch_id, p_batchstep_no or p_batch_no, p_org_code
3025 * and batchstep_no (batch_type is assumed to be batch)
3026 * @param p_api_version Version of the API
3027 * @param p_validation_level Validation level
3028 * @param p_init_msg_list Message list flag - default is False
3029 * @param p_commit Commit flag - default is False
3030 * @param p_batch_step_rec Identifies what step to unrelease
3031 * @param p_batch_no Batch Number
3032 * @param p_org_code Organization Code
3033 * @param p_create_resv_pend_lots Indicates to create Reservations for ingredients and Pending Product Lots for Products associated to the step
3034 * @param x_batch_step_rec Batch Header output record after unrelease
3035 * @param x_message_count Number of messages
3036 * @param x_message_list List of messages
3037 * @param x_return_status Indicates the return status of an API.
3038 * @rep:scope public
3039 * @rep:lifecycle active
3040 * @rep:displayname Unrelease Step
3041 */
3042 
3043    /*================================================================================
3044     Procedure
3045       unrelease_step
3046     Description
3047       This procedure is used to unrelease a WIP step.
3048       One of the following key sequences must be specified:
3049       batchstep_id OR
3050       batch_id, batchstep_no OR
3051       batch_no, org_code, batchstep_no  batch_type assumed to be batch
3052 
3053     Parameters
3054       p_batch_step_rec (O)        batch step to identify the step to unrelease.
3055       p_batch_no (O)              batch number to identify the step
3056       p_org_code (O)              organization code to identify the step
3057       p_create_resv_pend_lots (R) indicates whether to create reservations or pending product lots
3058                                   depending on the line type associated to the step.
3059       x_batch_step_rec            Output step record after unrelease
3060       x_return_status             outcome of the API call
3061                                   S - Success
3062                                   E - Error
3063                                   U - Unexpected Error
3064   ================================================================================*/
3065    PROCEDURE unrelease_step
3066      (p_api_version              IN              NUMBER
3067      ,p_validation_level         IN              NUMBER
3068             := gme_common_pvt.g_max_errors
3069      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3070      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3071      ,x_message_count            OUT NOCOPY      NUMBER
3072      ,x_message_list             OUT NOCOPY      VARCHAR2
3073      ,x_return_status            OUT NOCOPY      VARCHAR2
3074      ,p_batch_step_rec           IN              gme_batch_steps%ROWTYPE
3075      ,p_batch_no                 IN              VARCHAR2
3076      ,p_org_code                 IN              VARCHAR2
3077      ,p_create_resv_pend_lots    IN              NUMBER
3078      ,x_batch_step_rec           OUT NOCOPY      gme_batch_steps%ROWTYPE);
3079 
3080 /*#
3081 * Complete a batch. Note that identification is required:
3082 * batch_id or batch_no and p_org_code (batch_type is assumed to be batch)
3083 * @param p_api_version Version of the API
3084 * @param p_validation_level Validation level
3085 * @param p_init_msg_list Message list flag - default is False
3086 * @param p_commit Commit flag - default is False
3087 * @param p_batch_header_rec Identifies what batch to complete; also contains actual dates
3088 * @param p_org_code Organization Code
3089 * @param p_ignore_exception Indicates whether to ignore batch exceptions.
3090 * @param p_validate_flexfields Indicates whether to validate flexfields
3094 * @param x_message_list List of messages
3091 * @param x_batch_header_rec Batch Header output record after complete
3092 * @param x_exception_material_tbl Contains the exception material that was found.
3093 * @param x_message_count Number of messages
3095 * @param x_return_status Indicates the return status of an API.
3096 * @rep:scope public
3097 * @rep:lifecycle active
3098 * @rep:displayname Complete Batch
3099 */
3100 
3101    /*================================================================================
3102     Procedure
3103       complete_batch
3104     Description
3105       This procedure is used to complete a Pending or WIP batch.
3106       One of the following key sequences must be specified:
3107       batch_id OR
3108       batch_no, org_code  batch_type assumed to be batch
3109 
3110     Parameters
3111       p_batch_header_rec (O)      batch header to identify the batch to complete;
3112       p_org_code (O)              organization code to identify the batch is conjunction with batch_no in p_batch_header_rec
3113       p_ignore_exception (O)      indicates whether to ignore exceptions; if exceptions are ignored,
3114                                   x_exception_material_tbl won't be populated ever if exceptions were found
3115       p_validate_flexfields (O)   indicates whether to validate flexfields... Defaults to fnd_api.g_false;
3116                                   this is used for direct completion only because of release batch
3117       x_batch_header_rec          Output batch header record after complete
3118       x_exception_material_tbl    Batch exceptions found during batch complete. Won't be reported if
3119                                   p_ignore_exception is set to fnd_api.g_true.
3120       x_return_status             outcome of the API call
3121                                   S - Success
3122                                   E - Error
3123                                   U - Unexpected Error
3124                                   X - Batch Exception
3125   ================================================================================*/
3126    PROCEDURE complete_batch
3127      (p_api_version              IN              NUMBER
3128      ,p_validation_level         IN              NUMBER
3129             := gme_common_pvt.g_max_errors
3130      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3131      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3132      ,x_message_count            OUT NOCOPY      NUMBER
3133      ,x_message_list             OUT NOCOPY      VARCHAR2
3134      ,x_return_status            OUT NOCOPY      VARCHAR2
3135      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
3136      ,p_org_code                 IN              VARCHAR2
3137      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
3138      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
3139      ,x_batch_header_rec         OUT NOCOPY      gme_batch_header%ROWTYPE
3140      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
3141 
3142 /*#
3143 * Complete a step. Note that identification is required:
3144 * batchstep_id or batch_id, batchstep_no or batch_no, p_org_code and batchstep_no
3145 * (batch_type is assumed to be batch)
3146 * @param p_api_version Version of the API
3147 * @param p_validation_level Validation level
3148 * @param p_init_msg_list Message list flag - default is False
3149 * @param p_commit Commit flag - default is False
3150 * @param p_save_batch Call save batch api - default is True
3151 * @param p_batch_step_rec Identifies what step to complete; also contains actual dates
3152 * @param p_batch_no Batch number to identify step
3153 * @param p_org_code Organization Code
3154 * @param p_ignore_exception Indicates whether to ignore step exceptions.
3155 * @param p_override_quality Indicates whether to override quality status.
3156 * @param p_validate_flexfields Indicates whether to validate flexfields (for pending batch only)
3157 * @param x_batch_step_rec Batch Step output record after complete
3158 * @param x_exception_material_tbl Contains the exception material that was found.
3159 * @param x_message_count Number of messages
3160 * @param x_message_list List of messages
3161 * @param x_return_status Indicates the return status of an API.
3162 * @rep:scope public
3163 * @rep:lifecycle active
3164 * @rep:displayname Complete Step
3165 */
3166 
3167    /*================================================================================
3168     Procedure
3169       complete_step
3170     Description
3171       This procedure is used to complete a step
3172       One of the following key sequences must be specified:
3173       batchstep_id
3174       batch_id, batchstep_no OR
3175       batch_no, org_code, batchstep_no batch_type assumed to be batch
3176 
3177     Parameters
3178       p_batch_step_rec (O)        batch step to identify the step to complete.
3179       p_batch_no (O)              batch_no to identify the step
3180       p_org_code (O)              organization code to identify the step is conjunction with batch_no in p_batch_header_rec
3181       p_ignore_exception (O)      indicates whether to ignore exceptions; if exceptions are ignored,
3182                                   x_exception_material_tbl won't be populated ever if exceptions were found
3183       p_override_quality (O)      Override quality indicator; defaults to fnd_api.g_false
3184       p_validate_flexfields (O)   indicates whether to validate flexfields... Defaults to fnd_api.g_false;
3185                                   this is used for direct step completion (pending_batch) only, because of release batch
3186       x_batch_step_rec            Output batch step record after complete
3187       x_exception_material_tbl    Material exceptions found in complete step (only those associated to step)
3188       x_return_status             outcome of the API call
3189                                   S - Success
3190                                   E - Error
3191                                   U - Unexpected Error
3192                                   X - Batch Exception
3193   ================================================================================*/
3194    PROCEDURE complete_step
3195      (p_api_version              IN              NUMBER
3196      ,p_validation_level         IN              NUMBER
3197             := gme_common_pvt.g_max_errors
3198      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3199      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3200      ,p_save_batch               IN              VARCHAR2 := fnd_api.g_true  -- Bug 16079623
3201      ,x_message_count            OUT NOCOPY      NUMBER
3202      ,x_message_list             OUT NOCOPY      VARCHAR2
3203      ,x_return_status            OUT NOCOPY      VARCHAR2
3204      ,p_batch_step_rec           IN              gme_batch_steps%ROWTYPE
3205      ,p_batch_no                 IN              VARCHAR2
3206      ,p_org_code                 IN              VARCHAR2
3207      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
3208      ,p_override_quality         IN              VARCHAR2 := fnd_api.g_false
3209      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
3210      ,x_batch_step_rec           OUT NOCOPY      gme_batch_steps%ROWTYPE
3211      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
3212 
3213 /*#
3214 * Release a batch. Note that identification is required:
3215 * batch_id or batch_no and p_org_code (batch_type is assumed to be batch)
3216 * @param p_api_version Version of the API
3217 * @param p_validation_level Validation level
3218 * @param p_init_msg_list Message list flag - default is False
3219 * @param p_commit Commit flag - default is False
3220 * @param p_batch_header_rec Identifies what batch to release; also contains actual start date
3221 * @param p_org_code Organization Code
3222 * @param p_ignore_exception Indicates whether to ignore batch exceptions.
3223 * @param p_validate_flexfields Indicates whether to validate flexfields
3224 * @param x_batch_header_rec Batch Header output record after release
3225 * @param x_exception_material_tbl Contains the exception material that was found.
3226 * @param x_message_count Number of messages
3227 * @param x_message_list List of messages
3228 * @param x_return_status Indicates the return status of an API.
3229 * @rep:scope public
3230 * @rep:lifecycle active
3231 * @rep:displayname Release Batch
3232 */
3233 
3234    /*================================================================================
3235     Procedure
3236       release_batch
3237     Description
3238       This procedure is used to release a batch
3239       One of the following key sequences must be specified:
3240       batch_id OR
3241       batch_no, org_code, batch_type assumed to be batch
3242 
3243     Parameters
3244       p_batch_header_rec (O)      batch header to identify the batch to release;
3245       p_org_code (O)              organization code to identify the batch is conjunction with batch_no in p_batch_header_rec
3246       p_ignore_exception (O)      indicates whether to ignore exceptions; if exceptions are ignored,
3247                                   x_exception_material_tbl won't be populated even if exceptions were found
3248       p_validate_flexfields (O)   indicates whether to validate flexfields... Defaults to fnd_api.g_false;
3249       x_batch_header_rec          Output batch header record after release
3250       x_exception_material_tbl    Batch exceptions found in release batch
3251       x_return_status             outcome of the API call
3252                                   S - Success
3253                                   E - Error
3254                                   U - Unexpected Error
3255                                   X - Batch Exception
3256   ================================================================================*/
3257    PROCEDURE release_batch
3258      (p_api_version              IN              NUMBER
3259      ,p_validation_level         IN              NUMBER
3260             := gme_common_pvt.g_max_errors
3261      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3262      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3263      ,x_message_count            OUT NOCOPY      NUMBER
3264      ,x_message_list             OUT NOCOPY      VARCHAR2
3265      ,x_return_status            OUT NOCOPY      VARCHAR2
3266      ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
3267      ,p_org_code                 IN              VARCHAR2
3268      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
3269      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
3270      ,x_batch_header_rec         OUT NOCOPY      gme_batch_header%ROWTYPE
3274 * Release a step. Note that identification is required:
3271      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
3272 
3273 /*#
3275 * batchstep_id or batch_id, batchstep_no or batch_no, p_org_code and batchstep_no
3276 * (batch_type is assumed to be batch)
3277 * @param p_api_version Version of the API
3278 * @param p_validation_level Validation level
3279 * @param p_init_msg_list Message list flag - default is False
3280 * @param p_commit Commit flag - default is False
3281 * @param p_save_batch Call save batch api - default is True
3282 * @param p_batch_step_rec Identifies what step to release; also contains actual start date
3283 * @param p_batch_no Batch number to identify step
3284 * @param p_org_code Organization Code
3285 * @param p_ignore_exception Indicates whether to ignore step exceptions.
3286 * @param p_validate_flexfields Indicates whether to validate flexfields (for step or batch (when pending))
3287 * @param x_batch_step_rec Batch Step output record after release
3288 * @param x_exception_material_tbl Contains the exception material that was found.
3289 * @param x_message_count Number of messages
3290 * @param x_message_list List of messages
3291 * @param x_return_status Indicates the return status of an API.
3292 * @rep:scope public
3293 * @rep:lifecycle active
3294 * @rep:displayname Release Step
3295 */
3296 
3297    /*================================================================================
3298     Procedure
3299       release_step
3300     Description
3301       This procedure is used to release a step
3302       One of the following key sequences must be specified:
3303       batchstep_id
3304       batch_id, batchstep_no OR
3305       batch_no, org_code, batchstep_no batch_type assumed to be batch
3306 
3307     Parameters
3308       p_batch step_rec (O)        batch step to identify the step to release.
3309       p_batch_no (O)              batch_no to identify the step
3310       p_org_code (O)              organization code to identify the step is conjunction with batch_no in p_batch_header_rec
3311       p_ignore_exception (O)      indicates whether to ignore exceptions; if exceptions are ignored,
3312                                   x_exception_material_tbl won't be populated ever if exceptions were found
3313       p_validate_flexfields (O)   indicates whether to validate flexfields... Defaults to fnd_api.g_false;
3314       x_batch_step_rec            Output batch step record after release
3315       x_exception_material_tbl    Material exceptions found in release step (only those associated to step and processed dep steps)
3316       x_return_status             outcome of the API call
3317                                   S - Success
3318                                   E - Error
3319                                   U - Unexpected Error
3320                                   X - Batch Exception
3321   ================================================================================*/
3322    PROCEDURE release_step
3323      (p_api_version              IN              NUMBER
3324      ,p_validation_level         IN              NUMBER
3325             := gme_common_pvt.g_max_errors
3326      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3327      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3328      ,p_save_batch               IN              VARCHAR2 := fnd_api.g_true  -- Bug 16079623
3329      ,x_message_count            OUT NOCOPY      NUMBER
3330      ,x_message_list             OUT NOCOPY      VARCHAR2
3331      ,x_return_status            OUT NOCOPY      VARCHAR2
3332      ,p_batch_step_rec           IN              gme_batch_steps%ROWTYPE
3333      ,p_batch_no                 IN              VARCHAR2
3334      ,p_org_code                 IN              VARCHAR2
3335      ,p_ignore_exception         IN              VARCHAR2 := fnd_api.g_false
3336      ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
3337      ,x_batch_step_rec           OUT NOCOPY      gme_batch_steps%ROWTYPE
3338      ,x_exception_material_tbl   OUT NOCOPY      gme_common_pvt.exceptions_tab);
3339 
3340 /*#
3341 * Process a Group.
3342 * This API is used to perform mass batch actions on a group of batches.
3343 * Required parameters are - group_name, org_code, action and on_error_flag.
3344 * group_name and org_code.
3345 * @param p_api_version Version of the API
3346 * @param p_validation_level Validation level
3347 * @param p_init_msg_list Message list flag - default is False
3348 * @param p_commit Commit flag - default is False
3349 * @param p_group_name Group name.
3350 * @param p_org_code Organization code
3351 * @param p_action Identifies what batch action to perform. Valid values from lookup type GME_BATCH_GROUP_ACTION (3,4,5,6,7,8,9,10,11)
3352 * @param p_on_error_flag Indicates whether to continue or stop processing in case of an error. Valid values are 'STOP' OR 'CONTINUE'
3353 * @param x_message_count Number of messages
3354 * @param x_message_list List of messages
3355 * @param x_return_status Indicates the return status of an API.
3356 * @rep:scope public
3357 * @rep:lifecycle active
3358 * @rep:displayname Process Group
3359 */
3360 
3361    /*================================================================================
3362     Procedure
3363       process_group
3364     Description
3365       This procedure is used to perform mass batch actions on group of batches.
3366       Required parameters are:
3367       group_name, org_code, action and on_error_flag.
3368 
3369     Parameters
3370       p_group_name                Group name to identify the group of batches to process;
3371                                   Set of batches can grouped under a group name which can be created
3372                                   from the batch group management form.
3373       p_org_code                  organization code to identify the group_name is conjunction with group_name in p_batch_header_rec
3374       p_action                    Identifies what batch action to perform
3375                                   Valid values from lookup type GME_BATCH_GROUP_ACTION (3,4,5,6,7,8,9,10,11)
3376       p_on_error_flag             Indicates whether to continue or stop processing in case of an error.
3377                                   Valid values are 'STOP' OR 'CONTINUE'
3378       x_return_status             outcome of the API call
3379                                   S - Success
3380                                   E - Error
3381                                   U - Unexpected Error
3382                                   X - Batch Exception
3383   ================================================================================*/
3384    PROCEDURE process_group
3385      (p_api_version              IN              NUMBER
3386      ,p_validation_level         IN              NUMBER
3387             := gme_common_pvt.g_max_errors
3388      ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
3389      ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
3390      ,p_group_name               IN              VARCHAR2
3391      ,p_org_code                 IN              VARCHAR2
3392      ,p_action                   IN              NUMBER
3393      ,p_on_error_flag            IN              VARCHAR2
3394      ,x_message_count            OUT NOCOPY      NUMBER
3395      ,x_message_list             OUT NOCOPY      VARCHAR2
3396      ,x_return_status            OUT NOCOPY      VARCHAR2
3397      );
3398 
3399    /*================================================================================
3400     Procedure
3401       update_batchstep_qty
3402     Description
3403       This api procedure is used only for updating actual_step_qty.
3404       Charges will also be recalculated.
3405       One of the following key sequences must be specified:
3406       batchstep_id
3407       batch_id, batchstep_no OR
3408       batch_no, org_code, batchstep_no batch_type assumed to be batch
3409 
3410     Parameters
3411       p_batch step_rec (O)        batch step to identify the step to update.
3412       p_org_code (O)              organization code to identify the step is conjunction with batch_no in p_batch_header_rec
3413       p_batch_no (O)              batch_no to identify the step
3414       p_add (O)                   indicates whether to add to the actual step qty for incremental
3415                                   recording or overwrite. Default is 'N' Meaning overwrite.
3416       x_batch_step_rec            Output batch step record after update
3417       x_return_status             outcome of the API call
3418                                   S - Success
3419                                   E - Error
3420                                   U - Unexpected Error
3421                                   X - Batch Exception
3422 
3423     History:
3424       G. Muratore    15-JUN-2009  Bug 7447757
3425          Introduced new api for update actual_step_qty
3426   ================================================================================*/
3427    PROCEDURE update_batchstep_qty (
3428       p_api_version         IN              NUMBER   := 1.0
3429      ,p_validation_level    IN              NUMBER   := gme_common_pvt.g_max_errors
3430      ,p_init_msg_list       IN              VARCHAR2 := fnd_api.g_false
3431      ,p_commit              IN              VARCHAR2
3432      ,p_org_code            IN              VARCHAR2
3433      ,p_batch_no            IN              VARCHAR2 := NULL
3434      ,p_add                 IN              VARCHAR2 := 'N'
3435      ,p_batch_step_rec      IN              gme_batch_steps%ROWTYPE
3436      ,x_batch_step_rec      OUT NOCOPY      gme_batch_steps%ROWTYPE
3437      ,x_message_count       OUT NOCOPY      NUMBER
3438      ,x_message_list        OUT NOCOPY      VARCHAR2
3439      ,x_return_status       OUT NOCOPY      VARCHAR2);
3440 
3441    /*================================================================================
3442     Procedure
3443       reset_txn_header_id
3444     Description
3445       This api procedure is used for resetting gme_common_pvt.g_transaction_header_id.
3446 
3447     Parameters
3448 
3449     History:
3450       G. Muratore    06-DEC-2012  Bug 14685438
3451          Introduced new api to reset g_transaction_header_id.
3452   ================================================================================*/
3453    PROCEDURE reset_txn_header_id;
3454 
3455 END gme_api_pub;