5:
6: /*************************************************************************/
7: PROCEDURE create_batch (
8: p_validation_level IN NUMBER
9: := gme_common_pvt.g_max_errors
10: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
11: ,x_message_count OUT NOCOPY NUMBER
12: ,x_message_list OUT NOCOPY VARCHAR2
13: ,x_return_status OUT NOCOPY VARCHAR2
24: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
25: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
26: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_false
27: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
28: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
29: IS
30: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_BATCH';
31: setup_failure EXCEPTION;
32: batch_creation_failure EXCEPTION;
42: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
43: || l_api_name);
44: END IF;
45:
46: IF NOT gme_common_pvt.g_setup_done THEN
47: gme_common_pvt.g_setup_done :=
48: gme_common_pvt.setup (p_batch_header_rec.organization_id);
49:
50: IF NOT gme_common_pvt.g_setup_done THEN
43: || l_api_name);
44: END IF;
45:
46: IF NOT gme_common_pvt.g_setup_done THEN
47: gme_common_pvt.g_setup_done :=
48: gme_common_pvt.setup (p_batch_header_rec.organization_id);
49:
50: IF NOT gme_common_pvt.g_setup_done THEN
51: x_return_status := fnd_api.g_ret_sts_error;
44: END IF;
45:
46: IF NOT gme_common_pvt.g_setup_done THEN
47: gme_common_pvt.g_setup_done :=
48: gme_common_pvt.setup (p_batch_header_rec.organization_id);
49:
50: IF NOT gme_common_pvt.g_setup_done THEN
51: x_return_status := fnd_api.g_ret_sts_error;
52: RAISE setup_failure;
46: IF NOT gme_common_pvt.g_setup_done THEN
47: gme_common_pvt.g_setup_done :=
48: gme_common_pvt.setup (p_batch_header_rec.organization_id);
49:
50: IF NOT gme_common_pvt.g_setup_done THEN
51: x_return_status := fnd_api.g_ret_sts_error;
52: RAISE setup_failure;
53: END IF;
54: END IF;
58:
59: -- Initialize message list and count if needed
60: IF p_init_msg_list = fnd_api.g_true THEN
61: fnd_msg_pub.initialize;
62: gme_common_pvt.g_error_count := 0;
63: END IF;
64:
65: gme_common_pvt.set_timestamp;
66: gme_create_batch_pvt.create_batch
61: fnd_msg_pub.initialize;
62: gme_common_pvt.g_error_count := 0;
63: END IF;
64:
65: gme_common_pvt.set_timestamp;
66: gme_create_batch_pvt.create_batch
67: (p_validation_level => p_validation_level
68: ,p_batch_header_rec => p_batch_header_rec
69: ,p_batch_size => p_batch_size
81: RAISE batch_creation_failure;
82: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
83:
84: IF x_message_count = 0 THEN
85: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
86: END IF;
87:
88: gme_common_pvt.count_and_get (x_count => x_message_count
89: ,p_encoded => fnd_api.g_false
84: IF x_message_count = 0 THEN
85: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
86: END IF;
87:
88: gme_common_pvt.count_and_get (x_count => x_message_count
89: ,p_encoded => fnd_api.g_false
90: ,x_data => x_message_list);
91:
92: IF (g_debug IS NOT NULL) THEN
100: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
101: END IF;
102: EXCEPTION
103: WHEN batch_creation_failure THEN
104: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
105: ROLLBACK TO SAVEPOINT create_batch;
106: x_batch_header_rec := NULL;
107: END IF;
108:
105: ROLLBACK TO SAVEPOINT create_batch;
106: x_batch_header_rec := NULL;
107: END IF;
108:
109: gme_common_pvt.count_and_get (x_count => x_message_count
110: ,p_encoded => fnd_api.g_false
111: ,x_data => x_message_list);
112: WHEN setup_failure THEN
113: ROLLBACK TO SAVEPOINT create_batch;
111: ,x_data => x_message_list);
112: WHEN setup_failure THEN
113: ROLLBACK TO SAVEPOINT create_batch;
114: x_batch_header_rec := NULL;
115: gme_common_pvt.count_and_get (x_count => x_message_count
116: ,p_encoded => fnd_api.g_false
117: ,x_data => x_message_list);
118: x_return_status := fnd_api.g_ret_sts_error;
119: WHEN OTHERS THEN
127: END IF;
128:
129: ROLLBACK TO SAVEPOINT create_batch;
130: x_batch_header_rec := NULL;
131: gme_common_pvt.count_and_get (x_count => x_message_count
132: ,p_encoded => fnd_api.g_false
133: ,x_data => x_message_list);
134: x_return_status := fnd_api.g_ret_sts_unexp_error;
135: END create_batch;
136:
137: /*************************************************************************/
138: PROCEDURE create_phantom (
139: p_validation_level IN NUMBER
140: := gme_common_pvt.g_max_errors
141: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
142: ,x_message_count OUT NOCOPY NUMBER
143: ,x_message_list OUT NOCOPY VARCHAR2
144: ,x_return_status OUT NOCOPY VARCHAR2
149: ,p_validity_rule_id IN NUMBER
150: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
151: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
152: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
153: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
154: IS
155: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_PHANTOM';
156: setup_failure EXCEPTION;
157: phantom_creation_failure EXCEPTION;
168: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
169: || l_api_name);
170: END IF;
171:
172: IF NOT gme_common_pvt.g_setup_done THEN
173: gme_common_pvt.g_setup_done :=
174: gme_common_pvt.setup (p_material_detail_rec.organization_id);
175:
176: IF NOT gme_common_pvt.g_setup_done THEN
169: || l_api_name);
170: END IF;
171:
172: IF NOT gme_common_pvt.g_setup_done THEN
173: gme_common_pvt.g_setup_done :=
174: gme_common_pvt.setup (p_material_detail_rec.organization_id);
175:
176: IF NOT gme_common_pvt.g_setup_done THEN
177: x_return_status := fnd_api.g_ret_sts_error;
170: END IF;
171:
172: IF NOT gme_common_pvt.g_setup_done THEN
173: gme_common_pvt.g_setup_done :=
174: gme_common_pvt.setup (p_material_detail_rec.organization_id);
175:
176: IF NOT gme_common_pvt.g_setup_done THEN
177: x_return_status := fnd_api.g_ret_sts_error;
178: RAISE setup_failure;
172: IF NOT gme_common_pvt.g_setup_done THEN
173: gme_common_pvt.g_setup_done :=
174: gme_common_pvt.setup (p_material_detail_rec.organization_id);
175:
176: IF NOT gme_common_pvt.g_setup_done THEN
177: x_return_status := fnd_api.g_ret_sts_error;
178: RAISE setup_failure;
179: END IF;
180: END IF;
181:
182: -- Initialize message list and count if needed
183: IF p_init_msg_list = fnd_api.g_true THEN
184: fnd_msg_pub.initialize;
185: gme_common_pvt.g_error_count := 0;
186: END IF;
187:
188: /* Set the return status to success initially */
189: x_return_status := fnd_api.g_ret_sts_success;
186: END IF;
187:
188: /* Set the return status to success initially */
189: x_return_status := fnd_api.g_ret_sts_success;
190: gme_common_pvt.set_timestamp;
191: gme_phantom_pvt.create_phantom
192: (p_material_detail_rec => p_material_detail_rec
193: ,p_batch_header_rec => p_batch_header_rec --Bug#6738476
194: ,p_batch_no => p_batch_no
213: EXCEPTION
214: WHEN phantom_creation_failure OR setup_failure THEN
215: ROLLBACK TO SAVEPOINT create_phantom;
216: x_material_detail_rec := NULL;
217: gme_common_pvt.count_and_get (x_count => x_message_count
218: ,p_encoded => fnd_api.g_false
219: ,x_data => x_message_list);
220: WHEN OTHERS THEN
221: IF g_debug <= gme_debug.g_log_unexpected THEN
229:
230: ROLLBACK TO SAVEPOINT create_phantom;
231: x_material_detail_rec := NULL;
232: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
233: gme_common_pvt.count_and_get (x_count => x_message_count
234: ,p_encoded => fnd_api.g_false
235: ,x_data => x_message_list);
236: x_return_status := fnd_api.g_ret_sts_unexp_error;
237: END create_phantom;
245: ,p_qty_type IN NUMBER
246: ,p_recalc_dates IN VARCHAR2
247: ,p_use_workday_cal IN VARCHAR2
248: ,p_contiguity_override IN VARCHAR2
249: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
250: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
251: ,x_message_count OUT NOCOPY NUMBER
252: ,x_message_list OUT NOCOPY VARCHAR2
253: ,x_return_status OUT NOCOPY VARCHAR2)
270: || l_api_name);
271: END IF;
272:
273: /* Setup the common constants used accross the apis */
274: IF NOT gme_common_pvt.g_setup_done THEN
275: gme_common_pvt.g_setup_done :=
276: gme_common_pvt.setup (p_batch_header_rec.organization_id);
277:
278: IF NOT gme_common_pvt.g_setup_done THEN
271: END IF;
272:
273: /* Setup the common constants used accross the apis */
274: IF NOT gme_common_pvt.g_setup_done THEN
275: gme_common_pvt.g_setup_done :=
276: gme_common_pvt.setup (p_batch_header_rec.organization_id);
277:
278: IF NOT gme_common_pvt.g_setup_done THEN
279: x_return_status := fnd_api.g_ret_sts_error;
272:
273: /* Setup the common constants used accross the apis */
274: IF NOT gme_common_pvt.g_setup_done THEN
275: gme_common_pvt.g_setup_done :=
276: gme_common_pvt.setup (p_batch_header_rec.organization_id);
277:
278: IF NOT gme_common_pvt.g_setup_done THEN
279: x_return_status := fnd_api.g_ret_sts_error;
280: RAISE setup_failure;
274: IF NOT gme_common_pvt.g_setup_done THEN
275: gme_common_pvt.g_setup_done :=
276: gme_common_pvt.setup (p_batch_header_rec.organization_id);
277:
278: IF NOT gme_common_pvt.g_setup_done THEN
279: x_return_status := fnd_api.g_ret_sts_error;
280: RAISE setup_failure;
281: END IF;
282: END IF;
284:
285: /* Initialize message list and count if needed */
286: IF p_init_msg_list = fnd_api.g_true THEN
287: fnd_msg_pub.initialize;
288: gme_common_pvt.g_error_count := 0;
289: END IF;
290:
291: x_batch_header_rec := p_batch_header_rec;
292: gme_common_pvt.set_timestamp;
288: gme_common_pvt.g_error_count := 0;
289: END IF;
290:
291: x_batch_header_rec := p_batch_header_rec;
292: gme_common_pvt.set_timestamp;
293:
294: gme_scale_batch_pvt.scale_batch
295: (p_batch_header_rec => p_batch_header_rec
296: ,p_scale_factor => p_scale_factor
306: -- pawan kumar bug 5358705 add condition for different return status 'c' and 'w'
307: IF x_return_status NOT IN (fnd_api.g_ret_sts_success, 'C', 'W') THEN
308: RAISE scale_batch_failed;
309: END IF;
310: gme_common_pvt.log_message ('GME_SCALE_SUCCESS');
311: IF (g_debug <= gme_debug.g_log_procedure) THEN
312: gme_debug.put_line ( 'Completed '
313: || l_api_name
314: || ' at '
318: WHEN setup_failure THEN
319: ROLLBACK TO SAVEPOINT scale_batch;
320: x_batch_header_rec := NULL;
321: x_return_status := fnd_api.g_ret_sts_error;
322: gme_common_pvt.count_and_get (x_count => x_message_count
323: ,p_encoded => fnd_api.g_false
324: ,x_data => x_message_list);
325: WHEN scale_batch_failed THEN
326: ROLLBACK TO SAVEPOINT scale_batch;
324: ,x_data => x_message_list);
325: WHEN scale_batch_failed THEN
326: ROLLBACK TO SAVEPOINT scale_batch;
327: x_batch_header_rec := NULL;
328: gme_common_pvt.count_and_get (x_count => x_message_count
329: ,p_encoded => fnd_api.g_false
330: ,x_data => x_message_list);
331: WHEN batch_save_failed OR batch_fetch_error THEN
332: ROLLBACK TO SAVEPOINT scale_batch;
330: ,x_data => x_message_list);
331: WHEN batch_save_failed OR batch_fetch_error THEN
332: ROLLBACK TO SAVEPOINT scale_batch;
333: x_batch_header_rec := NULL;
334: gme_common_pvt.count_and_get (x_count => x_message_count
335: ,p_encoded => fnd_api.g_false
336: ,x_data => x_message_list);
337: WHEN OTHERS THEN
338: ROLLBACK TO SAVEPOINT scale_batch;
337: WHEN OTHERS THEN
338: ROLLBACK TO SAVEPOINT scale_batch;
339: x_batch_header_rec := NULL;
340: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
341: gme_common_pvt.count_and_get (x_count => x_message_count
342: ,p_encoded => fnd_api.g_false
343: ,x_data => x_message_list);
344: x_return_status := fnd_api.g_ret_sts_unexp_error;
345: END scale_batch;
372: || l_api_name);
373: END IF;
374:
375: /* Setup the common constants used accross the apis */
376: IF NOT gme_common_pvt.g_setup_done THEN
377: gme_common_pvt.g_setup_done :=
378: gme_common_pvt.setup
379: (p_org_id => p_batch_header_rec.organization_id);
380:
373: END IF;
374:
375: /* Setup the common constants used accross the apis */
376: IF NOT gme_common_pvt.g_setup_done THEN
377: gme_common_pvt.g_setup_done :=
378: gme_common_pvt.setup
379: (p_org_id => p_batch_header_rec.organization_id);
380:
381: IF NOT gme_common_pvt.g_setup_done THEN
374:
375: /* Setup the common constants used accross the apis */
376: IF NOT gme_common_pvt.g_setup_done THEN
377: gme_common_pvt.g_setup_done :=
378: gme_common_pvt.setup
379: (p_org_id => p_batch_header_rec.organization_id);
380:
381: IF NOT gme_common_pvt.g_setup_done THEN
382: RAISE setup_failure;
377: gme_common_pvt.g_setup_done :=
378: gme_common_pvt.setup
379: (p_org_id => p_batch_header_rec.organization_id);
380:
381: IF NOT gme_common_pvt.g_setup_done THEN
382: RAISE setup_failure;
383: END IF;
384: END IF;
385:
385:
386: /* Initialize message list and count if needed */
387: IF p_init_msg_list = fnd_api.g_true THEN
388: fnd_msg_pub.initialize;
389: gme_common_pvt.g_error_count := 0;
390: END IF;
391:
392: gme_common_pvt.set_timestamp;
393: gme_scale_batch_pvt.theoretical_yield_batch
388: fnd_msg_pub.initialize;
389: gme_common_pvt.g_error_count := 0;
390: END IF;
391:
392: gme_common_pvt.set_timestamp;
393: gme_scale_batch_pvt.theoretical_yield_batch
394: (p_batch_header_rec => p_batch_header_rec
395: ,p_scale_factor => p_scale_factor
396: ,x_return_status => x_return_status);
398: IF x_return_status <> fnd_api.g_ret_sts_success THEN
399: RAISE theoretical_yield_failed;
400: END IF;
401:
402: gme_common_pvt.count_and_get (x_count => x_message_count
403: ,p_encoded => fnd_api.g_false
404: ,x_data => x_message_list);
405:
406: IF (g_debug <= gme_debug.g_log_procedure) THEN
412: EXCEPTION
413: WHEN setup_failure THEN
414: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
415: x_return_status := fnd_api.g_ret_sts_error;
416: gme_common_pvt.count_and_get (x_count => x_message_count
417: ,p_encoded => fnd_api.g_false
418: ,x_data => x_message_list);
419: WHEN theoretical_yield_failed OR batch_save_failed THEN
420: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
417: ,p_encoded => fnd_api.g_false
418: ,x_data => x_message_list);
419: WHEN theoretical_yield_failed OR batch_save_failed THEN
420: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
421: gme_common_pvt.count_and_get (x_count => x_message_count
422: ,p_encoded => fnd_api.g_false
423: ,x_data => x_message_list);
424: WHEN OTHERS THEN
425: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
423: ,x_data => x_message_list);
424: WHEN OTHERS THEN
425: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
426: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
427: gme_common_pvt.count_and_get (x_count => x_message_count
428: ,p_encoded => fnd_api.g_false
429: ,x_data => x_message_list);
430: x_return_status := fnd_api.g_ret_sts_unexp_error;
431: END theoretical_yield_batch;
432:
433: /*************************************************************************/
434: PROCEDURE insert_material_line (
435: p_validation_level IN NUMBER
436: := gme_common_pvt.g_max_errors
437: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
438: ,x_message_count OUT NOCOPY NUMBER
439: ,x_message_list OUT NOCOPY VARCHAR2
440: ,x_return_status OUT NOCOPY VARCHAR2
470: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
471: || l_api_name);
472: END IF;
473:
474: IF NOT gme_common_pvt.g_setup_done THEN
475: gme_common_pvt.g_setup_done :=
476: gme_common_pvt.setup (p_batch_header_rec.organization_id);
477:
478: IF NOT gme_common_pvt.g_setup_done THEN
471: || l_api_name);
472: END IF;
473:
474: IF NOT gme_common_pvt.g_setup_done THEN
475: gme_common_pvt.g_setup_done :=
476: gme_common_pvt.setup (p_batch_header_rec.organization_id);
477:
478: IF NOT gme_common_pvt.g_setup_done THEN
479: x_return_status := fnd_api.g_ret_sts_error;
472: END IF;
473:
474: IF NOT gme_common_pvt.g_setup_done THEN
475: gme_common_pvt.g_setup_done :=
476: gme_common_pvt.setup (p_batch_header_rec.organization_id);
477:
478: IF NOT gme_common_pvt.g_setup_done THEN
479: x_return_status := fnd_api.g_ret_sts_error;
480: RAISE setup_failure;
474: IF NOT gme_common_pvt.g_setup_done THEN
475: gme_common_pvt.g_setup_done :=
476: gme_common_pvt.setup (p_batch_header_rec.organization_id);
477:
478: IF NOT gme_common_pvt.g_setup_done THEN
479: x_return_status := fnd_api.g_ret_sts_error;
480: RAISE setup_failure;
481: END IF;
482: END IF;
483:
484: -- Initialize message list and count if needed
485: IF p_init_msg_list = fnd_api.g_true THEN
486: fnd_msg_pub.initialize;
487: gme_common_pvt.g_error_count := 0;
488: END IF;
489:
490: gme_common_pvt.set_timestamp;
491:
486: fnd_msg_pub.initialize;
487: gme_common_pvt.g_error_count := 0;
488: END IF;
489:
490: gme_common_pvt.set_timestamp;
491:
492: IF p_batch_step_id IS NOT NULL THEN
493: l_batch_step_rec.batchstep_id := p_batch_step_id;
494:
527: THEN
528: RAISE gmf_cost_failure;
529: END IF;
530: -- NEW
531: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_ADDED
532: ,P_EVENT_KEY => x_material_detail_rec.batch_id||'-'||x_material_detail_rec.material_detail_id
533: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
534: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
535: '-'||p_batch_header_rec.batch_no||'-'|| x_material_detail_rec.Line_no
530: -- NEW
531: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_ADDED
532: ,P_EVENT_KEY => x_material_detail_rec.batch_id||'-'||x_material_detail_rec.material_detail_id
533: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
534: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
535: '-'||p_batch_header_rec.batch_no||'-'|| x_material_detail_rec.Line_no
536: ||'-'||GME_ERES_PKG.GET_ITEM_NUMBER(x_material_detail_rec.organization_id,x_material_detail_rec.inventory_item_id)
537: ,P_POST_OP_API => 'NONE'
538: ,P_PARENT_EVENT => NULL
542: IF x_return_status <> fnd_api.g_ret_sts_success THEN
543: RAISE ins_mtl_line_failure;
544: END IF;
545:
546: gme_common_pvt.count_and_get (x_count => x_message_count
547: ,p_encoded => fnd_api.g_false
548: ,x_data => x_message_list);
549:
550: IF (g_debug IS NOT NULL) THEN
561: -- Bug 5903208
562: x_return_status := FND_API.G_RET_STS_ERROR;
563:
564: WHEN ins_mtl_line_failure THEN
565: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
566: ROLLBACK TO SAVEPOINT insert_material_line1;
567: x_material_detail_rec := NULL;
568: END IF;
569:
566: ROLLBACK TO SAVEPOINT insert_material_line1;
567: x_material_detail_rec := NULL;
568: END IF;
569:
570: gme_common_pvt.count_and_get (x_count => x_message_count
571: ,p_encoded => fnd_api.g_false
572: ,x_data => x_message_list);
573: WHEN setup_failure THEN
574: ROLLBACK TO SAVEPOINT insert_material_line1;
572: ,x_data => x_message_list);
573: WHEN setup_failure THEN
574: ROLLBACK TO SAVEPOINT insert_material_line1;
575: x_material_detail_rec := NULL;
576: gme_common_pvt.count_and_get (x_count => x_message_count
577: ,p_encoded => fnd_api.g_false
578: ,x_data => x_message_list);
579: x_return_status := fnd_api.g_ret_sts_error;
580: WHEN OTHERS THEN
589: || 'When others exception:'
590: || SQLERRM);
591: END IF;
592:
593: gme_common_pvt.count_and_get (x_count => x_message_count
594: ,p_encoded => fnd_api.g_false
595: ,x_data => x_message_list);
596: x_return_status := fnd_api.g_ret_sts_unexp_error;
597: END insert_material_line;
598:
599: /*************************************************************************/
600: PROCEDURE insert_material_line (
601: p_validation_level IN NUMBER
602: := gme_common_pvt.g_max_errors
603: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
604: ,x_message_count OUT NOCOPY NUMBER
605: ,x_message_list OUT NOCOPY VARCHAR2
606: ,x_return_status OUT NOCOPY VARCHAR2
629: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
630: || l_api_name);
631: END IF;
632:
633: IF NOT gme_common_pvt.g_setup_done THEN
634: gme_common_pvt.g_setup_done :=
635: gme_common_pvt.setup (p_batch_header_rec.organization_id);
636:
637: IF NOT gme_common_pvt.g_setup_done THEN
630: || l_api_name);
631: END IF;
632:
633: IF NOT gme_common_pvt.g_setup_done THEN
634: gme_common_pvt.g_setup_done :=
635: gme_common_pvt.setup (p_batch_header_rec.organization_id);
636:
637: IF NOT gme_common_pvt.g_setup_done THEN
638: x_return_status := fnd_api.g_ret_sts_error;
631: END IF;
632:
633: IF NOT gme_common_pvt.g_setup_done THEN
634: gme_common_pvt.g_setup_done :=
635: gme_common_pvt.setup (p_batch_header_rec.organization_id);
636:
637: IF NOT gme_common_pvt.g_setup_done THEN
638: x_return_status := fnd_api.g_ret_sts_error;
639: RAISE setup_failure;
633: IF NOT gme_common_pvt.g_setup_done THEN
634: gme_common_pvt.g_setup_done :=
635: gme_common_pvt.setup (p_batch_header_rec.organization_id);
636:
637: IF NOT gme_common_pvt.g_setup_done THEN
638: x_return_status := fnd_api.g_ret_sts_error;
639: RAISE setup_failure;
640: END IF;
641: END IF;
642:
643: -- Initialize message list and count if needed
644: IF p_init_msg_list = fnd_api.g_true THEN
645: fnd_msg_pub.initialize;
646: gme_common_pvt.g_error_count := 0;
647: END IF;
648:
649: gme_common_pvt.set_timestamp;
650:
645: fnd_msg_pub.initialize;
646: gme_common_pvt.g_error_count := 0;
647: END IF;
648:
649: gme_common_pvt.set_timestamp;
650:
651: gme_material_detail_pvt.insert_material_line
652: (p_batch_header_rec => p_batch_header_rec
653: ,p_material_detail_rec => p_material_detail_rec
660: IF x_return_status <> fnd_api.g_ret_sts_success THEN
661: RAISE ins_mtl_line_failure;
662: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
663:
664: gme_common_pvt.log_message ('GME_MTL_LINE_INSERTED');
665:
666:
667: gme_common_pvt.count_and_get (x_count => x_message_count
668: ,p_encoded => fnd_api.g_false
663:
664: gme_common_pvt.log_message ('GME_MTL_LINE_INSERTED');
665:
666:
667: gme_common_pvt.count_and_get (x_count => x_message_count
668: ,p_encoded => fnd_api.g_false
669: ,x_data => x_message_list);
670:
671: IF (g_debug IS NOT NULL) THEN
678: x_return_status := fnd_api.g_ret_sts_success;
679: END IF;
680: EXCEPTION
681: WHEN ins_mtl_line_failure THEN
682: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
683: ROLLBACK TO SAVEPOINT insert_material_line;
684: x_material_detail_rec := NULL;
685: END IF;
686:
683: ROLLBACK TO SAVEPOINT insert_material_line;
684: x_material_detail_rec := NULL;
685: END IF;
686:
687: gme_common_pvt.count_and_get (x_count => x_message_count
688: ,p_encoded => fnd_api.g_false
689: ,x_data => x_message_list);
690: WHEN setup_failure THEN
691: ROLLBACK TO SAVEPOINT insert_material_line;
689: ,x_data => x_message_list);
690: WHEN setup_failure THEN
691: ROLLBACK TO SAVEPOINT insert_material_line;
692: x_material_detail_rec := NULL;
693: gme_common_pvt.count_and_get (x_count => x_message_count
694: ,p_encoded => fnd_api.g_false
695: ,x_data => x_message_list);
696: x_return_status := fnd_api.g_ret_sts_error;
697: WHEN OTHERS THEN
706: || 'When others exception:'
707: || SQLERRM);
708: END IF;
709:
710: gme_common_pvt.count_and_get (x_count => x_message_count
711: ,p_encoded => fnd_api.g_false
712: ,x_data => x_message_list);
713: x_return_status := fnd_api.g_ret_sts_unexp_error;
714: END insert_material_line;
715:
716: /*************************************************************************/
717: PROCEDURE update_material_line (
718: p_validation_level IN NUMBER
719: := gme_common_pvt.g_max_errors
720: ,p_init_msg_list IN VARCHAR2
721: := fnd_api.g_false
722: ,x_message_count OUT NOCOPY NUMBER
723: ,x_message_list OUT NOCOPY VARCHAR2
752: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
753: || l_api_name);
754: END IF;
755:
756: IF NOT gme_common_pvt.g_setup_done THEN
757: gme_common_pvt.g_setup_done :=
758: gme_common_pvt.setup (p_batch_header_rec.organization_id);
759:
760: IF NOT gme_common_pvt.g_setup_done THEN
753: || l_api_name);
754: END IF;
755:
756: IF NOT gme_common_pvt.g_setup_done THEN
757: gme_common_pvt.g_setup_done :=
758: gme_common_pvt.setup (p_batch_header_rec.organization_id);
759:
760: IF NOT gme_common_pvt.g_setup_done THEN
761: x_return_status := fnd_api.g_ret_sts_error;
754: END IF;
755:
756: IF NOT gme_common_pvt.g_setup_done THEN
757: gme_common_pvt.g_setup_done :=
758: gme_common_pvt.setup (p_batch_header_rec.organization_id);
759:
760: IF NOT gme_common_pvt.g_setup_done THEN
761: x_return_status := fnd_api.g_ret_sts_error;
762: RAISE setup_failure;
756: IF NOT gme_common_pvt.g_setup_done THEN
757: gme_common_pvt.g_setup_done :=
758: gme_common_pvt.setup (p_batch_header_rec.organization_id);
759:
760: IF NOT gme_common_pvt.g_setup_done THEN
761: x_return_status := fnd_api.g_ret_sts_error;
762: RAISE setup_failure;
763: END IF;
764: END IF;
765:
766: -- Initialize message list and count if needed
767: IF p_init_msg_list = fnd_api.g_true THEN
768: fnd_msg_pub.initialize;
769: gme_common_pvt.g_error_count := 0;
770: END IF;
771:
772: gme_common_pvt.set_timestamp;
773:
768: fnd_msg_pub.initialize;
769: gme_common_pvt.g_error_count := 0;
770: END IF;
771:
772: gme_common_pvt.set_timestamp;
773:
774: IF p_batch_step_id IS NOT NULL THEN
775: l_batch_step_rec.batchstep_id := p_batch_step_id;
776:
805: RAISE upd_mtl_line_failure;
806: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
807:
808: -- NEW
809: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_UPDATED
810: ,P_EVENT_KEY => p_material_detail_rec.batch_id||'-'||p_material_detail_rec.material_detail_id
811: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
812: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
813: '-'||p_batch_header_rec.batch_no||'-'|| p_material_detail_rec.Line_no
808: -- NEW
809: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_UPDATED
810: ,P_EVENT_KEY => p_material_detail_rec.batch_id||'-'||p_material_detail_rec.material_detail_id
811: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
812: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
813: '-'||p_batch_header_rec.batch_no||'-'|| p_material_detail_rec.Line_no
814: ||'-'||GME_ERES_PKG.GET_ITEM_NUMBER(p_material_detail_rec.organization_id,p_material_detail_rec.inventory_item_id)
815: ,P_POST_OP_API => 'NONE'
816: ,P_PARENT_EVENT => NULL
821: IF x_return_status <> fnd_api.g_ret_sts_success THEN
822: RAISE upd_mtl_line_failure;
823: END IF;
824:
825: gme_common_pvt.count_and_get (x_count => x_message_count
826: ,p_encoded => fnd_api.g_false
827: ,x_data => x_message_list);
828:
829: IF (g_debug IS NOT NULL) THEN
836: x_return_status := fnd_api.g_ret_sts_success;
837: END IF;
838: EXCEPTION
839: WHEN upd_mtl_line_failure THEN
840: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
841: ROLLBACK TO SAVEPOINT update_material_line1;
842: x_material_detail_rec := NULL;
843: END IF;
844:
841: ROLLBACK TO SAVEPOINT update_material_line1;
842: x_material_detail_rec := NULL;
843: END IF;
844:
845: gme_common_pvt.count_and_get (x_count => x_message_count
846: ,p_encoded => fnd_api.g_false
847: ,x_data => x_message_list);
848: WHEN setup_failure THEN
849: ROLLBACK TO SAVEPOINT update_material_line1;
847: ,x_data => x_message_list);
848: WHEN setup_failure THEN
849: ROLLBACK TO SAVEPOINT update_material_line1;
850: x_material_detail_rec := NULL;
851: gme_common_pvt.count_and_get (x_count => x_message_count
852: ,p_encoded => fnd_api.g_false
853: ,x_data => x_message_list);
854: x_return_status := fnd_api.g_ret_sts_error;
855: WHEN OTHERS THEN
864: || 'When others exception:'
865: || SQLERRM);
866: END IF;
867:
868: gme_common_pvt.count_and_get (x_count => x_message_count
869: ,p_encoded => fnd_api.g_false
870: ,x_data => x_message_list);
871: x_return_status := fnd_api.g_ret_sts_unexp_error;
872: END update_material_line;
873:
874: /*************************************************************************/
875: PROCEDURE update_material_line (
876: p_validation_level IN NUMBER
877: := gme_common_pvt.g_max_errors
878: ,p_init_msg_list IN VARCHAR2
879: := fnd_api.g_false
880: ,x_message_count OUT NOCOPY NUMBER
881: ,x_message_list OUT NOCOPY VARCHAR2
904: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
905: || l_api_name);
906: END IF;
907:
908: IF NOT gme_common_pvt.g_setup_done THEN
909: gme_common_pvt.g_setup_done :=
910: gme_common_pvt.setup (p_batch_header_rec.organization_id);
911:
912: IF NOT gme_common_pvt.g_setup_done THEN
905: || l_api_name);
906: END IF;
907:
908: IF NOT gme_common_pvt.g_setup_done THEN
909: gme_common_pvt.g_setup_done :=
910: gme_common_pvt.setup (p_batch_header_rec.organization_id);
911:
912: IF NOT gme_common_pvt.g_setup_done THEN
913: x_return_status := fnd_api.g_ret_sts_error;
906: END IF;
907:
908: IF NOT gme_common_pvt.g_setup_done THEN
909: gme_common_pvt.g_setup_done :=
910: gme_common_pvt.setup (p_batch_header_rec.organization_id);
911:
912: IF NOT gme_common_pvt.g_setup_done THEN
913: x_return_status := fnd_api.g_ret_sts_error;
914: RAISE setup_failure;
908: IF NOT gme_common_pvt.g_setup_done THEN
909: gme_common_pvt.g_setup_done :=
910: gme_common_pvt.setup (p_batch_header_rec.organization_id);
911:
912: IF NOT gme_common_pvt.g_setup_done THEN
913: x_return_status := fnd_api.g_ret_sts_error;
914: RAISE setup_failure;
915: END IF;
916: END IF;
920:
921: -- Initialize message list and count if needed
922: IF p_init_msg_list = fnd_api.g_true THEN
923: fnd_msg_pub.initialize;
924: gme_common_pvt.g_error_count := 0;
925: END IF;
926:
927: gme_common_pvt.set_timestamp;
928: gme_material_detail_pvt.update_material_line
923: fnd_msg_pub.initialize;
924: gme_common_pvt.g_error_count := 0;
925: END IF;
926:
927: gme_common_pvt.set_timestamp;
928: gme_material_detail_pvt.update_material_line
929: (p_batch_header_rec => p_batch_header_rec
930: ,p_material_detail_rec => p_material_detail_rec
931: ,p_stored_material_detail_rec => p_stored_material_detail_rec
939: IF x_return_status <> fnd_api.g_ret_sts_success THEN
940: RAISE upd_mtl_line_failure;
941: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
942:
943: gme_common_pvt.log_message ('GME_MTL_LINE_UPDATED');
944:
945:
946: gme_common_pvt.count_and_get (x_count => x_message_count
947: ,p_encoded => fnd_api.g_false
942:
943: gme_common_pvt.log_message ('GME_MTL_LINE_UPDATED');
944:
945:
946: gme_common_pvt.count_and_get (x_count => x_message_count
947: ,p_encoded => fnd_api.g_false
948: ,x_data => x_message_list);
949:
950: IF (g_debug IS NOT NULL) THEN
957: x_return_status := fnd_api.g_ret_sts_success;
958: END IF;
959: EXCEPTION
960: WHEN upd_mtl_line_failure THEN
961: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
962: ROLLBACK TO SAVEPOINT update_material_line;
963: x_material_detail_rec := NULL;
964: END IF;
965:
962: ROLLBACK TO SAVEPOINT update_material_line;
963: x_material_detail_rec := NULL;
964: END IF;
965:
966: gme_common_pvt.count_and_get (x_count => x_message_count
967: ,p_encoded => fnd_api.g_false
968: ,x_data => x_message_list);
969: WHEN setup_failure THEN
970: ROLLBACK TO SAVEPOINT update_material_line;
968: ,x_data => x_message_list);
969: WHEN setup_failure THEN
970: ROLLBACK TO SAVEPOINT update_material_line;
971: x_material_detail_rec := NULL;
972: gme_common_pvt.count_and_get (x_count => x_message_count
973: ,p_encoded => fnd_api.g_false
974: ,x_data => x_message_list);
975: x_return_status := fnd_api.g_ret_sts_error;
976: WHEN OTHERS THEN
985: || 'When others exception:'
986: || SQLERRM);
987: END IF;
988:
989: gme_common_pvt.count_and_get (x_count => x_message_count
990: ,p_encoded => fnd_api.g_false
991: ,x_data => x_message_list);
992: x_return_status := fnd_api.g_ret_sts_unexp_error;
993: END update_material_line;
994:
995: /*************************************************************************/
996: PROCEDURE delete_material_line (
997: p_validation_level IN NUMBER
998: := gme_common_pvt.g_max_errors
999: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1000: ,x_message_count OUT NOCOPY NUMBER
1001: ,x_message_list OUT NOCOPY VARCHAR2
1002: ,x_return_status OUT NOCOPY VARCHAR2
1032: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1033: || l_api_name);
1034: END IF;
1035:
1036: IF NOT gme_common_pvt.g_setup_done THEN
1037: gme_common_pvt.g_setup_done :=
1038: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1039:
1040: IF NOT gme_common_pvt.g_setup_done THEN
1033: || l_api_name);
1034: END IF;
1035:
1036: IF NOT gme_common_pvt.g_setup_done THEN
1037: gme_common_pvt.g_setup_done :=
1038: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1039:
1040: IF NOT gme_common_pvt.g_setup_done THEN
1041: x_return_status := fnd_api.g_ret_sts_error;
1034: END IF;
1035:
1036: IF NOT gme_common_pvt.g_setup_done THEN
1037: gme_common_pvt.g_setup_done :=
1038: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1039:
1040: IF NOT gme_common_pvt.g_setup_done THEN
1041: x_return_status := fnd_api.g_ret_sts_error;
1042: RAISE setup_failure;
1036: IF NOT gme_common_pvt.g_setup_done THEN
1037: gme_common_pvt.g_setup_done :=
1038: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1039:
1040: IF NOT gme_common_pvt.g_setup_done THEN
1041: x_return_status := fnd_api.g_ret_sts_error;
1042: RAISE setup_failure;
1043: END IF;
1044: END IF;
1045:
1046: -- Initialize message list and count if needed
1047: IF p_init_msg_list = fnd_api.g_true THEN
1048: fnd_msg_pub.initialize;
1049: gme_common_pvt.g_error_count := 0;
1050: END IF;
1051:
1052: gme_common_pvt.set_timestamp;
1053:
1048: fnd_msg_pub.initialize;
1049: gme_common_pvt.g_error_count := 0;
1050: END IF;
1051:
1052: gme_common_pvt.set_timestamp;
1053:
1054: IF p_batch_step_id IS NOT NULL THEN
1055: l_batch_step_rec.batchstep_id := p_batch_step_id;
1056:
1090: END IF;
1091: -- End Bug 5903208
1092:
1093: -- NEW
1094: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_REMOVED
1095: ,P_EVENT_KEY => p_material_detail_rec.batch_id||'-'||p_material_detail_rec.material_detail_id
1096: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
1097: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
1098: '-'||p_batch_header_rec.batch_no||'-'|| p_material_detail_rec.Line_no
1093: -- NEW
1094: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHMTL_REMOVED
1095: ,P_EVENT_KEY => p_material_detail_rec.batch_id||'-'||p_material_detail_rec.material_detail_id
1096: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_MATL_LABEL')
1097: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
1098: '-'||p_batch_header_rec.batch_no||'-'|| p_material_detail_rec.Line_no
1099: ||'-'||GME_ERES_PKG.GET_ITEM_NUMBER(p_material_detail_rec.organization_id,p_material_detail_rec.inventory_item_id)
1100: ,P_POST_OP_API => 'NONE'
1101: ,P_PARENT_EVENT => NULL
1106: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1107: RAISE del_mtl_line_failure;
1108: END IF;
1109:
1110: gme_common_pvt.count_and_get (x_count => x_message_count
1111: ,p_encoded => fnd_api.g_false
1112: ,x_data => x_message_list);
1113:
1114: IF (g_debug IS NOT NULL) THEN
1125: -- Bug 5903208
1126: x_return_status := FND_API.G_RET_STS_ERROR;
1127:
1128: WHEN del_mtl_line_failure THEN
1129: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
1130: ROLLBACK TO SAVEPOINT delete_material_line1;
1131: END IF;
1132:
1133: gme_common_pvt.count_and_get (x_count => x_message_count
1129: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
1130: ROLLBACK TO SAVEPOINT delete_material_line1;
1131: END IF;
1132:
1133: gme_common_pvt.count_and_get (x_count => x_message_count
1134: ,p_encoded => fnd_api.g_false
1135: ,x_data => x_message_list);
1136: WHEN setup_failure THEN
1137: ROLLBACK TO SAVEPOINT delete_material_line1;
1134: ,p_encoded => fnd_api.g_false
1135: ,x_data => x_message_list);
1136: WHEN setup_failure THEN
1137: ROLLBACK TO SAVEPOINT delete_material_line1;
1138: gme_common_pvt.count_and_get (x_count => x_message_count
1139: ,p_encoded => fnd_api.g_false
1140: ,x_data => x_message_list);
1141: x_return_status := fnd_api.g_ret_sts_error;
1142: WHEN OTHERS THEN
1150: || 'When others exception:'
1151: || SQLERRM);
1152: END IF;
1153:
1154: gme_common_pvt.count_and_get (x_count => x_message_count
1155: ,p_encoded => fnd_api.g_false
1156: ,x_data => x_message_list);
1157: x_return_status := fnd_api.g_ret_sts_unexp_error;
1158: END delete_material_line;
1159:
1160: /*************************************************************************/
1161: PROCEDURE delete_material_line (
1162: p_validation_level IN NUMBER
1163: := gme_common_pvt.g_max_errors
1164: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1165: ,x_message_count OUT NOCOPY NUMBER
1166: ,x_message_list OUT NOCOPY VARCHAR2
1167: ,x_return_status OUT NOCOPY VARCHAR2
1188: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1189: || l_api_name);
1190: END IF;
1191:
1192: IF NOT gme_common_pvt.g_setup_done THEN
1193: gme_common_pvt.g_setup_done :=
1194: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1195:
1196: IF NOT gme_common_pvt.g_setup_done THEN
1189: || l_api_name);
1190: END IF;
1191:
1192: IF NOT gme_common_pvt.g_setup_done THEN
1193: gme_common_pvt.g_setup_done :=
1194: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1195:
1196: IF NOT gme_common_pvt.g_setup_done THEN
1197: x_return_status := fnd_api.g_ret_sts_error;
1190: END IF;
1191:
1192: IF NOT gme_common_pvt.g_setup_done THEN
1193: gme_common_pvt.g_setup_done :=
1194: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1195:
1196: IF NOT gme_common_pvt.g_setup_done THEN
1197: x_return_status := fnd_api.g_ret_sts_error;
1198: RAISE setup_failure;
1192: IF NOT gme_common_pvt.g_setup_done THEN
1193: gme_common_pvt.g_setup_done :=
1194: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1195:
1196: IF NOT gme_common_pvt.g_setup_done THEN
1197: x_return_status := fnd_api.g_ret_sts_error;
1198: RAISE setup_failure;
1199: END IF;
1200: END IF;
1201:
1202: -- Initialize message list and count if needed
1203: IF p_init_msg_list = fnd_api.g_true THEN
1204: fnd_msg_pub.initialize;
1205: gme_common_pvt.g_error_count := 0;
1206: END IF;
1207:
1208: gme_common_pvt.set_timestamp;
1209: gme_material_detail_pvt.delete_material_line
1204: fnd_msg_pub.initialize;
1205: gme_common_pvt.g_error_count := 0;
1206: END IF;
1207:
1208: gme_common_pvt.set_timestamp;
1209: gme_material_detail_pvt.delete_material_line
1210: (p_batch_header_rec => p_batch_header_rec
1211: ,p_material_detail_rec => p_material_detail_rec
1212: ,p_batch_step_rec => p_batch_step_rec
1216: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1217: RAISE del_mtl_line_failure;
1218: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
1219:
1220: gme_common_pvt.log_message ('GME_MTL_LINE_DELETED');
1221:
1222: gme_common_pvt.count_and_get (x_count => x_message_count
1223: ,p_encoded => fnd_api.g_false
1224: ,x_data => x_message_list);
1218: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
1219:
1220: gme_common_pvt.log_message ('GME_MTL_LINE_DELETED');
1221:
1222: gme_common_pvt.count_and_get (x_count => x_message_count
1223: ,p_encoded => fnd_api.g_false
1224: ,x_data => x_message_list);
1225:
1226: IF (g_debug IS NOT NULL) THEN
1233: x_return_status := fnd_api.g_ret_sts_success;
1234: END IF;
1235: EXCEPTION
1236: WHEN del_mtl_line_failure THEN
1237: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
1238: ROLLBACK TO SAVEPOINT delete_material_line;
1239: END IF;
1240:
1241: gme_common_pvt.count_and_get (x_count => x_message_count
1237: IF x_return_status NOT IN (gme_common_pvt.g_inv_short_err) THEN
1238: ROLLBACK TO SAVEPOINT delete_material_line;
1239: END IF;
1240:
1241: gme_common_pvt.count_and_get (x_count => x_message_count
1242: ,p_encoded => fnd_api.g_false
1243: ,x_data => x_message_list);
1244: WHEN setup_failure THEN
1245: ROLLBACK TO SAVEPOINT delete_material_line;
1242: ,p_encoded => fnd_api.g_false
1243: ,x_data => x_message_list);
1244: WHEN setup_failure THEN
1245: ROLLBACK TO SAVEPOINT delete_material_line;
1246: gme_common_pvt.count_and_get (x_count => x_message_count
1247: ,p_encoded => fnd_api.g_false
1248: ,x_data => x_message_list);
1249: x_return_status := fnd_api.g_ret_sts_error;
1250: WHEN OTHERS THEN
1258: || 'When others exception:'
1259: || SQLERRM);
1260: END IF;
1261:
1262: gme_common_pvt.count_and_get (x_count => x_message_count
1263: ,p_encoded => fnd_api.g_false
1264: ,x_data => x_message_list);
1265: x_return_status := fnd_api.g_ret_sts_unexp_error;
1266: END delete_material_line;
1293: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
1294: || 'Entering');
1295: END IF;
1296:
1297: IF NOT gme_common_pvt.g_setup_done THEN
1298: gme_common_pvt.g_setup_done :=
1299: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1300:
1301: IF NOT gme_common_pvt.g_setup_done THEN
1294: || 'Entering');
1295: END IF;
1296:
1297: IF NOT gme_common_pvt.g_setup_done THEN
1298: gme_common_pvt.g_setup_done :=
1299: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1300:
1301: IF NOT gme_common_pvt.g_setup_done THEN
1302: x_return_status := fnd_api.g_ret_sts_error;
1295: END IF;
1296:
1297: IF NOT gme_common_pvt.g_setup_done THEN
1298: gme_common_pvt.g_setup_done :=
1299: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1300:
1301: IF NOT gme_common_pvt.g_setup_done THEN
1302: x_return_status := fnd_api.g_ret_sts_error;
1303: RAISE setup_failure;
1297: IF NOT gme_common_pvt.g_setup_done THEN
1298: gme_common_pvt.g_setup_done :=
1299: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1300:
1301: IF NOT gme_common_pvt.g_setup_done THEN
1302: x_return_status := fnd_api.g_ret_sts_error;
1303: RAISE setup_failure;
1304: END IF;
1305: END IF;
1306:
1307: /* Initialize message list and count if needed */
1308: IF p_init_msg_list = fnd_api.g_true THEN
1309: fnd_msg_pub.initialize;
1310: gme_common_pvt.g_error_count := 0;
1311: END IF;
1312:
1313: gme_common_pvt.set_timestamp;
1314:
1309: fnd_msg_pub.initialize;
1310: gme_common_pvt.g_error_count := 0;
1311: END IF;
1312:
1313: gme_common_pvt.set_timestamp;
1314:
1315: IF (NVL (g_debug, 0) = gme_debug.g_log_statement) THEN
1316: gme_debug.put_line ( g_pkg_name
1317: || '.'
1335: IF x_return_status NOT IN (fnd_api.g_ret_sts_success, 'C') THEN
1336: RAISE reschedule_batch_failed;
1337: END IF;
1338:
1339: gme_common_pvt.count_and_get (x_count => x_message_count
1340: ,p_encoded => fnd_api.g_false
1341: ,x_data => x_message_list);
1342:
1343: IF g_debug <= gme_debug.g_log_procedure THEN
1354: WHEN setup_failure THEN
1355: ROLLBACK TO SAVEPOINT reschedule_batch;
1356: x_batch_header_rec := NULL;
1357: x_return_status := fnd_api.g_ret_sts_error;
1358: gme_common_pvt.count_and_get (x_count => x_message_count
1359: ,p_encoded => fnd_api.g_false
1360: ,x_data => x_message_list);
1361: WHEN reschedule_batch_failed THEN
1362: ROLLBACK TO SAVEPOINT reschedule_batch;
1360: ,x_data => x_message_list);
1361: WHEN reschedule_batch_failed THEN
1362: ROLLBACK TO SAVEPOINT reschedule_batch;
1363: x_batch_header_rec := NULL;
1364: gme_common_pvt.count_and_get (x_count => x_message_count
1365: ,p_encoded => fnd_api.g_false
1366: ,x_data => x_message_list);
1367: WHEN OTHERS THEN
1368: ROLLBACK TO SAVEPOINT reschedule_batch;
1367: WHEN OTHERS THEN
1368: ROLLBACK TO SAVEPOINT reschedule_batch;
1369: x_batch_header_rec := NULL;
1370: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1371: gme_common_pvt.count_and_get (x_count => x_message_count
1372: ,p_encoded => fnd_api.g_false
1373: ,x_data => x_message_list);
1374: x_return_status := fnd_api.g_ret_sts_unexp_error;
1375: END reschedule_batch;
1410: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
1411: || 'Entering');
1412: END IF;
1413:
1414: IF NOT gme_common_pvt.g_setup_done THEN
1415: gme_common_pvt.g_setup_done :=
1416: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1417:
1418: IF NOT gme_common_pvt.g_setup_done THEN
1411: || 'Entering');
1412: END IF;
1413:
1414: IF NOT gme_common_pvt.g_setup_done THEN
1415: gme_common_pvt.g_setup_done :=
1416: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1417:
1418: IF NOT gme_common_pvt.g_setup_done THEN
1419: x_return_status := fnd_api.g_ret_sts_error;
1412: END IF;
1413:
1414: IF NOT gme_common_pvt.g_setup_done THEN
1415: gme_common_pvt.g_setup_done :=
1416: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1417:
1418: IF NOT gme_common_pvt.g_setup_done THEN
1419: x_return_status := fnd_api.g_ret_sts_error;
1420: RAISE setup_failure;
1414: IF NOT gme_common_pvt.g_setup_done THEN
1415: gme_common_pvt.g_setup_done :=
1416: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1417:
1418: IF NOT gme_common_pvt.g_setup_done THEN
1419: x_return_status := fnd_api.g_ret_sts_error;
1420: RAISE setup_failure;
1421: END IF;
1422: END IF;
1423:
1424: /* Initialize message list and count if needed */
1425: IF p_init_msg_list = fnd_api.g_true THEN
1426: fnd_msg_pub.initialize;
1427: gme_common_pvt.g_error_count := 0;
1428: END IF;
1429:
1430: gme_common_pvt.set_timestamp;
1431:
1426: fnd_msg_pub.initialize;
1427: gme_common_pvt.g_error_count := 0;
1428: END IF;
1429:
1430: gme_common_pvt.set_timestamp;
1431:
1432: IF (NVL (g_debug, 0) = gme_debug.g_log_statement) THEN
1433: gme_debug.put_line ( g_pkg_name
1434: || '.'
1460: ELSE
1461: RAISE reschedule_step_failed;
1462: END IF;
1463:
1464: gme_common_pvt.log_message ('GME_API_STEP_RESCH');
1465:
1466:
1467: gme_common_pvt.count_and_get (x_count => x_message_count
1468: ,p_encoded => fnd_api.g_false
1463:
1464: gme_common_pvt.log_message ('GME_API_STEP_RESCH');
1465:
1466:
1467: gme_common_pvt.count_and_get (x_count => x_message_count
1468: ,p_encoded => fnd_api.g_false
1469: ,x_data => x_message_list);
1470:
1471: IF g_debug <= gme_debug.g_log_procedure THEN
1481: EXCEPTION
1482: WHEN reschedule_step_failed OR setup_failure THEN
1483: ROLLBACK TO SAVEPOINT reschedule_batch_step;
1484: x_batch_step_rec := NULL;
1485: gme_common_pvt.count_and_get (x_count => x_message_count
1486: ,p_encoded => fnd_api.g_false
1487: ,x_data => x_message_list);
1488: WHEN expected_error THEN
1489: ROLLBACK TO SAVEPOINT reschedule_batch_step;
1492: WHEN OTHERS THEN
1493: ROLLBACK TO SAVEPOINT reschedule_batch_step;
1494: x_batch_step_rec := NULL;
1495: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1496: gme_common_pvt.count_and_get (x_count => x_message_count
1497: ,p_encoded => fnd_api.g_false
1498: ,x_data => x_message_list);
1499: x_return_status := fnd_api.g_ret_sts_unexp_error;
1500: END reschedule_step;
1522: IF (g_debug IS NOT NULL) THEN
1523: gme_debug.log_initialize ('CreateBatchReservations');
1524: END IF;
1525:
1526: IF NOT gme_common_pvt.g_setup_done THEN
1527: gme_common_pvt.g_setup_done :=
1528: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1529:
1530: IF NOT gme_common_pvt.g_setup_done THEN
1523: gme_debug.log_initialize ('CreateBatchReservations');
1524: END IF;
1525:
1526: IF NOT gme_common_pvt.g_setup_done THEN
1527: gme_common_pvt.g_setup_done :=
1528: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1529:
1530: IF NOT gme_common_pvt.g_setup_done THEN
1531: RAISE setup_failure;
1524: END IF;
1525:
1526: IF NOT gme_common_pvt.g_setup_done THEN
1527: gme_common_pvt.g_setup_done :=
1528: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1529:
1530: IF NOT gme_common_pvt.g_setup_done THEN
1531: RAISE setup_failure;
1532: END IF;
1526: IF NOT gme_common_pvt.g_setup_done THEN
1527: gme_common_pvt.g_setup_done :=
1528: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1529:
1530: IF NOT gme_common_pvt.g_setup_done THEN
1531: RAISE setup_failure;
1532: END IF;
1533: END IF;
1534:
1537:
1538: -- Initialize message list and count if needed
1539: IF p_init_msg_list = fnd_api.g_true THEN
1540: fnd_msg_pub.initialize;
1541: gme_common_pvt.g_error_count := 0;
1542: END IF;
1543:
1544: gme_common_pvt.set_timestamp;
1545: gme_reservations_pvt.create_batch_reservations
1540: fnd_msg_pub.initialize;
1541: gme_common_pvt.g_error_count := 0;
1542: END IF;
1543:
1544: gme_common_pvt.set_timestamp;
1545: gme_reservations_pvt.create_batch_reservations
1546: (p_batch_id => p_batch_header_rec.batch_id
1547: ,p_timefence => 1000000
1548: ,x_return_status => x_return_status);
1547: ,p_timefence => 1000000
1548: ,x_return_status => x_return_status);
1549:
1550: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1551: gme_common_pvt.log_message ('GME_BATCH_HL_RESERVATION_FAIL');
1552: RAISE batch_reservations_failure;
1553: END IF;
1554:
1555: gme_common_pvt.log_message ('GME_BATCH_HI_RESR_CREATED');
1551: gme_common_pvt.log_message ('GME_BATCH_HL_RESERVATION_FAIL');
1552: RAISE batch_reservations_failure;
1553: END IF;
1554:
1555: gme_common_pvt.log_message ('GME_BATCH_HI_RESR_CREATED');
1556:
1557: IF (g_debug IS NOT NULL) THEN
1558: gme_debug.put_line ( 'Completed '
1559: || l_api_name
1566: END IF;
1567: EXCEPTION
1568: WHEN batch_reservations_failure THEN
1569: ROLLBACK TO SAVEPOINT create_batch_reservations;
1570: gme_common_pvt.count_and_get (x_count => x_message_count
1571: ,p_encoded => fnd_api.g_false
1572: ,x_data => x_message_list);
1573: WHEN OTHERS THEN
1574: IF g_debug <= gme_debug.g_log_unexpected THEN
1580: || SQLERRM);
1581: END IF;
1582:
1583: ROLLBACK TO SAVEPOINT create_batch_reservations;
1584: gme_common_pvt.count_and_get (x_count => x_message_count
1585: ,p_encoded => fnd_api.g_false
1586: ,x_data => x_message_list);
1587: x_return_status := fnd_api.g_ret_sts_unexp_error;
1588: END create_batch_reservations;
1620: IF (g_debug IS NOT NULL) THEN
1621: gme_debug.log_initialize ('CreateLineReservations');
1622: END IF;
1623:
1624: IF NOT gme_common_pvt.g_setup_done THEN
1625: gme_common_pvt.g_setup_done :=
1626: gme_common_pvt.setup (p_matl_dtl_rec.organization_id);
1627:
1628: IF NOT gme_common_pvt.g_setup_done THEN
1621: gme_debug.log_initialize ('CreateLineReservations');
1622: END IF;
1623:
1624: IF NOT gme_common_pvt.g_setup_done THEN
1625: gme_common_pvt.g_setup_done :=
1626: gme_common_pvt.setup (p_matl_dtl_rec.organization_id);
1627:
1628: IF NOT gme_common_pvt.g_setup_done THEN
1629: RAISE setup_failure;
1622: END IF;
1623:
1624: IF NOT gme_common_pvt.g_setup_done THEN
1625: gme_common_pvt.g_setup_done :=
1626: gme_common_pvt.setup (p_matl_dtl_rec.organization_id);
1627:
1628: IF NOT gme_common_pvt.g_setup_done THEN
1629: RAISE setup_failure;
1630: END IF;
1624: IF NOT gme_common_pvt.g_setup_done THEN
1625: gme_common_pvt.g_setup_done :=
1626: gme_common_pvt.setup (p_matl_dtl_rec.organization_id);
1627:
1628: IF NOT gme_common_pvt.g_setup_done THEN
1629: RAISE setup_failure;
1630: END IF;
1631: END IF;
1632:
1635:
1636: -- Initialize message list and count if needed
1637: IF p_init_msg_list = fnd_api.g_true THEN
1638: fnd_msg_pub.initialize;
1639: gme_common_pvt.g_error_count := 0;
1640: END IF;
1641:
1642: gme_common_pvt.set_timestamp;
1643:
1638: fnd_msg_pub.initialize;
1639: gme_common_pvt.g_error_count := 0;
1640: END IF;
1641:
1642: gme_common_pvt.set_timestamp;
1643:
1644: OPEN cur_get_item (p_matl_dtl_rec.organization_id
1645: ,p_matl_dtl_rec.inventory_item_id);
1646:
1651:
1652: -- Use Suggestions mode (S) in the called by param to assess the total
1653: -- unreserved quantity
1654: /* Bug 5441643 Added NVL condition for location control code*/
1655: gme_common_pvt.get_open_qty
1656: (p_mtl_dtl_rec => p_matl_dtl_rec
1657: ,p_called_by => 'S'
1658: ,p_item_location_control => NVL(l_location_control_code,1)
1659: ,p_item_restrict_locators => l_restrict_locators_code
1690: || x_return_status);
1691: END IF;
1692:
1693: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1694: gme_common_pvt.log_message ('GME_LINE_HL_RESERVATION_FAIL');
1695: RAISE line_reservation_failure;
1696: END IF;
1697:
1698: gme_common_pvt.log_message ('GME_LINE_HI_RESR_CREATED');
1694: gme_common_pvt.log_message ('GME_LINE_HL_RESERVATION_FAIL');
1695: RAISE line_reservation_failure;
1696: END IF;
1697:
1698: gme_common_pvt.log_message ('GME_LINE_HI_RESR_CREATED');
1699: IF (g_debug IS NOT NULL) THEN
1700: gme_debug.put_line ( 'Completed '
1701: || l_api_name
1702: || ' at '
1708: END IF;
1709: EXCEPTION
1710: WHEN setup_failure OR get_open_qty_failure OR line_reservation_failure THEN
1711: ROLLBACK TO SAVEPOINT create_line_reservations;
1712: gme_common_pvt.count_and_get (x_count => x_message_count
1713: ,p_encoded => fnd_api.g_false
1714: ,x_data => x_message_list);
1715: x_return_status := fnd_api.g_ret_sts_error;
1716: WHEN OTHERS THEN
1723: || SQLERRM);
1724: END IF;
1725:
1726: ROLLBACK TO SAVEPOINT create_line_reservations;
1727: gme_common_pvt.count_and_get (x_count => x_message_count
1728: ,p_encoded => fnd_api.g_false
1729: ,x_data => x_message_list);
1730: x_return_status := fnd_api.g_ret_sts_unexp_error;
1731: END create_line_reservations;
1732:
1733: /*************************************************************************/
1734: PROCEDURE release_batch (
1735: p_validation_level IN NUMBER
1736: := gme_common_pvt.g_max_errors
1737: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1738: ,x_message_count OUT NOCOPY NUMBER
1739: ,x_message_list OUT NOCOPY VARCHAR2
1740: ,x_return_status OUT NOCOPY VARCHAR2
1739: ,x_message_list OUT NOCOPY VARCHAR2
1740: ,x_return_status OUT NOCOPY VARCHAR2
1741: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
1742: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
1743: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
1744: ,p_ignore_exception IN VARCHAR2 := NULL) --Bug#5186328
1745: IS
1746: l_api_name CONSTANT VARCHAR2 (30) := 'RELEASE_BATCH';
1747: setup_failure EXCEPTION;
1758: IF (g_debug IS NOT NULL) THEN
1759: gme_debug.log_initialize ('ReleaseBatch');
1760: END IF;
1761:
1762: IF NOT gme_common_pvt.g_setup_done THEN
1763: gme_common_pvt.g_setup_done :=
1764: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1765:
1766: IF NOT gme_common_pvt.g_setup_done THEN
1759: gme_debug.log_initialize ('ReleaseBatch');
1760: END IF;
1761:
1762: IF NOT gme_common_pvt.g_setup_done THEN
1763: gme_common_pvt.g_setup_done :=
1764: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1765:
1766: IF NOT gme_common_pvt.g_setup_done THEN
1767: x_return_status := fnd_api.g_ret_sts_error;
1760: END IF;
1761:
1762: IF NOT gme_common_pvt.g_setup_done THEN
1763: gme_common_pvt.g_setup_done :=
1764: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1765:
1766: IF NOT gme_common_pvt.g_setup_done THEN
1767: x_return_status := fnd_api.g_ret_sts_error;
1768: RAISE setup_failure;
1762: IF NOT gme_common_pvt.g_setup_done THEN
1763: gme_common_pvt.g_setup_done :=
1764: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1765:
1766: IF NOT gme_common_pvt.g_setup_done THEN
1767: x_return_status := fnd_api.g_ret_sts_error;
1768: RAISE setup_failure;
1769: END IF;
1770: END IF;
1774:
1775: -- Initialize message list and count if needed
1776: IF p_init_msg_list = fnd_api.g_true THEN
1777: fnd_msg_pub.initialize;
1778: gme_common_pvt.g_error_count := 0;
1779: END IF;
1780:
1781: gme_common_pvt.set_timestamp;
1782: gme_release_batch_pvt.release_batch
1777: fnd_msg_pub.initialize;
1778: gme_common_pvt.g_error_count := 0;
1779: END IF;
1780:
1781: gme_common_pvt.set_timestamp;
1782: gme_release_batch_pvt.release_batch
1783: (p_batch_header_rec => p_batch_header_rec
1784: ,p_phantom_product_id => NULL
1785: ,x_batch_header_rec => x_batch_header_rec
1785: ,x_batch_header_rec => x_batch_header_rec
1786: ,x_return_status => x_return_status
1787: ,x_exception_material_tbl => x_exception_material_tbl);
1788:
1789: IF x_return_status NOT IN (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
1790: RAISE batch_release_failure;
1791: END IF; /* IF x_return_status NOT IN */
1792:
1793: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1791: END IF; /* IF x_return_status NOT IN */
1792:
1793: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1794: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1795: x_return_status = gme_common_pvt.g_exceptions_err THEN
1796: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1797: ELSE
1798: gme_common_pvt.log_message ('GME_API_BATCH_RELEASED');
1799: END IF;
1792:
1793: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1794: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1795: x_return_status = gme_common_pvt.g_exceptions_err THEN
1796: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1797: ELSE
1798: gme_common_pvt.log_message ('GME_API_BATCH_RELEASED');
1799: END IF;
1800:
1794: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1795: x_return_status = gme_common_pvt.g_exceptions_err THEN
1796: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1797: ELSE
1798: gme_common_pvt.log_message ('GME_API_BATCH_RELEASED');
1799: END IF;
1800:
1801:
1802: gme_common_pvt.count_and_get (x_count => x_message_count
1798: gme_common_pvt.log_message ('GME_API_BATCH_RELEASED');
1799: END IF;
1800:
1801:
1802: gme_common_pvt.count_and_get (x_count => x_message_count
1803: ,p_encoded => fnd_api.g_false
1804: ,x_data => x_message_list);
1805:
1806: IF (g_debug IS NOT NULL) THEN
1816: EXCEPTION
1817: WHEN batch_release_failure THEN
1818: ROLLBACK TO SAVEPOINT release_batch;
1819: x_batch_header_rec := NULL;
1820: gme_common_pvt.count_and_get (x_count => x_message_count
1821: ,p_encoded => fnd_api.g_false
1822: ,x_data => x_message_list);
1823: WHEN setup_failure THEN
1824: ROLLBACK TO SAVEPOINT release_batch;
1822: ,x_data => x_message_list);
1823: WHEN setup_failure THEN
1824: ROLLBACK TO SAVEPOINT release_batch;
1825: x_batch_header_rec := NULL;
1826: gme_common_pvt.count_and_get (x_count => x_message_count
1827: ,p_encoded => fnd_api.g_false
1828: ,x_data => x_message_list);
1829: x_return_status := fnd_api.g_ret_sts_error;
1830: WHEN OTHERS THEN
1838: END IF;
1839:
1840: ROLLBACK TO SAVEPOINT release_batch;
1841: x_batch_header_rec := NULL;
1842: gme_common_pvt.count_and_get (x_count => x_message_count
1843: ,p_encoded => fnd_api.g_false
1844: ,x_data => x_message_list);
1845: x_return_status := fnd_api.g_ret_sts_unexp_error;
1846: END release_batch;
1847:
1848: /*************************************************************************/
1849: PROCEDURE release_step (
1850: p_validation_level IN NUMBER
1851: := gme_common_pvt.g_max_errors
1852: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1853: ,x_message_count OUT NOCOPY NUMBER
1854: ,x_message_list OUT NOCOPY VARCHAR2
1855: ,x_return_status OUT NOCOPY VARCHAR2
1855: ,x_return_status OUT NOCOPY VARCHAR2
1856: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
1857: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
1858: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
1859: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
1860: ,p_ignore_exception IN VARCHAR2 := NULL) --Bug#5186328
1861: IS
1862: l_api_name CONSTANT VARCHAR2 (30) := 'RELEASE_STEP';
1863: setup_failure EXCEPTION;
1874: IF (g_debug IS NOT NULL) THEN
1875: gme_debug.log_initialize ('ReleaseStep');
1876: END IF;
1877:
1878: IF NOT gme_common_pvt.g_setup_done THEN
1879: gme_common_pvt.g_setup_done :=
1880: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1881:
1882: IF NOT gme_common_pvt.g_setup_done THEN
1875: gme_debug.log_initialize ('ReleaseStep');
1876: END IF;
1877:
1878: IF NOT gme_common_pvt.g_setup_done THEN
1879: gme_common_pvt.g_setup_done :=
1880: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1881:
1882: IF NOT gme_common_pvt.g_setup_done THEN
1883: x_return_status := fnd_api.g_ret_sts_error;
1876: END IF;
1877:
1878: IF NOT gme_common_pvt.g_setup_done THEN
1879: gme_common_pvt.g_setup_done :=
1880: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1881:
1882: IF NOT gme_common_pvt.g_setup_done THEN
1883: x_return_status := fnd_api.g_ret_sts_error;
1884: RAISE setup_failure;
1878: IF NOT gme_common_pvt.g_setup_done THEN
1879: gme_common_pvt.g_setup_done :=
1880: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1881:
1882: IF NOT gme_common_pvt.g_setup_done THEN
1883: x_return_status := fnd_api.g_ret_sts_error;
1884: RAISE setup_failure;
1885: END IF;
1886: END IF;
1890:
1891: -- Initialize message list and count if needed
1892: IF p_init_msg_list = fnd_api.g_true THEN
1893: fnd_msg_pub.initialize;
1894: gme_common_pvt.g_error_count := 0;
1895: END IF;
1896:
1897: gme_common_pvt.set_timestamp;
1898: gme_release_batch_step_pvt.release_step
1893: fnd_msg_pub.initialize;
1894: gme_common_pvt.g_error_count := 0;
1895: END IF;
1896:
1897: gme_common_pvt.set_timestamp;
1898: gme_release_batch_step_pvt.release_step
1899: (p_batch_step_rec => p_batch_step_rec
1900: ,p_batch_header_rec => p_batch_header_rec
1901: ,x_batch_step_rec => x_batch_step_rec
1901: ,x_batch_step_rec => x_batch_step_rec
1902: ,x_exception_material_tbl => x_exception_material_tbl
1903: ,x_return_status => x_return_status);
1904:
1905: IF x_return_status NOT IN (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
1906: RAISE step_release_failure;
1907: END IF; /* IF x_return_status NOT IN */
1908:
1909: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1907: END IF; /* IF x_return_status NOT IN */
1908:
1909: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1910: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1911: x_return_status = gme_common_pvt.g_exceptions_err THEN
1912: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1913: ELSE
1914: gme_common_pvt.log_message ('GME_API_STEP_RELEASED');
1915: END IF;
1908:
1909: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
1910: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1911: x_return_status = gme_common_pvt.g_exceptions_err THEN
1912: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1913: ELSE
1914: gme_common_pvt.log_message ('GME_API_STEP_RELEASED');
1915: END IF;
1916:
1910: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
1911: x_return_status = gme_common_pvt.g_exceptions_err THEN
1912: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
1913: ELSE
1914: gme_common_pvt.log_message ('GME_API_STEP_RELEASED');
1915: END IF;
1916:
1917:
1918: gme_common_pvt.count_and_get (x_count => x_message_count
1914: gme_common_pvt.log_message ('GME_API_STEP_RELEASED');
1915: END IF;
1916:
1917:
1918: gme_common_pvt.count_and_get (x_count => x_message_count
1919: ,p_encoded => fnd_api.g_false
1920: ,x_data => x_message_list);
1921:
1922: IF (g_debug IS NOT NULL) THEN
1932: EXCEPTION
1933: WHEN step_release_failure THEN
1934: ROLLBACK TO SAVEPOINT release_step;
1935: x_batch_step_rec := NULL;
1936: gme_common_pvt.count_and_get (x_count => x_message_count
1937: ,p_encoded => fnd_api.g_false
1938: ,x_data => x_message_list);
1939: WHEN setup_failure THEN
1940: ROLLBACK TO SAVEPOINT release_step;
1938: ,x_data => x_message_list);
1939: WHEN setup_failure THEN
1940: ROLLBACK TO SAVEPOINT release_step;
1941: x_batch_step_rec := NULL;
1942: gme_common_pvt.count_and_get (x_count => x_message_count
1943: ,p_encoded => fnd_api.g_false
1944: ,x_data => x_message_list);
1945: x_return_status := fnd_api.g_ret_sts_error;
1946: WHEN OTHERS THEN
1954: END IF;
1955:
1956: ROLLBACK TO SAVEPOINT release_step;
1957: x_batch_step_rec := NULL;
1958: gme_common_pvt.count_and_get (x_count => x_message_count
1959: ,p_encoded => fnd_api.g_false
1960: ,x_data => x_message_list);
1961: x_return_status := fnd_api.g_ret_sts_unexp_error;
1962: END release_step;
1963:
1964: /*************************************************************************/
1965: PROCEDURE complete_batch (
1966: p_validation_level IN NUMBER
1967: := gme_common_pvt.g_max_errors
1968: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1969: ,x_message_count OUT NOCOPY NUMBER
1970: ,x_message_list OUT NOCOPY VARCHAR2
1971: ,x_return_status OUT NOCOPY VARCHAR2
1970: ,x_message_list OUT NOCOPY VARCHAR2
1971: ,x_return_status OUT NOCOPY VARCHAR2
1972: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
1973: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
1974: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
1975: ,p_ignore_exception IN VARCHAR2 := NULL) --Bug#5186328
1976: IS
1977: l_api_name CONSTANT VARCHAR2 (30) := 'COMPLETE_BATCH';
1978: setup_failure EXCEPTION;
1989: IF (g_debug IS NOT NULL) THEN
1990: gme_debug.log_initialize ('CompleteBatch');
1991: END IF;
1992:
1993: IF NOT gme_common_pvt.g_setup_done THEN
1994: gme_common_pvt.g_setup_done :=
1995: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1996:
1997: IF NOT gme_common_pvt.g_setup_done THEN
1990: gme_debug.log_initialize ('CompleteBatch');
1991: END IF;
1992:
1993: IF NOT gme_common_pvt.g_setup_done THEN
1994: gme_common_pvt.g_setup_done :=
1995: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1996:
1997: IF NOT gme_common_pvt.g_setup_done THEN
1998: x_return_status := fnd_api.g_ret_sts_error;
1991: END IF;
1992:
1993: IF NOT gme_common_pvt.g_setup_done THEN
1994: gme_common_pvt.g_setup_done :=
1995: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1996:
1997: IF NOT gme_common_pvt.g_setup_done THEN
1998: x_return_status := fnd_api.g_ret_sts_error;
1999: RAISE setup_failure;
1993: IF NOT gme_common_pvt.g_setup_done THEN
1994: gme_common_pvt.g_setup_done :=
1995: gme_common_pvt.setup (p_batch_header_rec.organization_id);
1996:
1997: IF NOT gme_common_pvt.g_setup_done THEN
1998: x_return_status := fnd_api.g_ret_sts_error;
1999: RAISE setup_failure;
2000: END IF;
2001: END IF;
2005:
2006: -- Initialize message list and count if needed
2007: IF p_init_msg_list = fnd_api.g_true THEN
2008: fnd_msg_pub.initialize;
2009: gme_common_pvt.g_error_count := 0;
2010: END IF;
2011:
2012: gme_common_pvt.set_timestamp;
2013: gme_complete_batch_pvt.complete_batch
2008: fnd_msg_pub.initialize;
2009: gme_common_pvt.g_error_count := 0;
2010: END IF;
2011:
2012: gme_common_pvt.set_timestamp;
2013: gme_complete_batch_pvt.complete_batch
2014: (p_batch_header_rec => p_batch_header_rec
2015: ,x_exception_material_tbl => x_exception_material_tbl
2016: ,x_batch_header_rec => x_batch_header_rec
2015: ,x_exception_material_tbl => x_exception_material_tbl
2016: ,x_batch_header_rec => x_batch_header_rec
2017: ,x_return_status => x_return_status);
2018:
2019: IF x_return_status NOT IN(fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
2020: RAISE batch_complete_failure;
2021: END IF; /* IF x_return_status NOT IN */
2022:
2023: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
2021: END IF; /* IF x_return_status NOT IN */
2022:
2023: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
2024: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2025: x_return_status = gme_common_pvt.g_exceptions_err THEN
2026: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2027: ELSE
2028: gme_common_pvt.log_message ('GME_API_BATCH_COMPLETED');
2029: END IF;
2022:
2023: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
2024: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2025: x_return_status = gme_common_pvt.g_exceptions_err THEN
2026: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2027: ELSE
2028: gme_common_pvt.log_message ('GME_API_BATCH_COMPLETED');
2029: END IF;
2030:
2024: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2025: x_return_status = gme_common_pvt.g_exceptions_err THEN
2026: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2027: ELSE
2028: gme_common_pvt.log_message ('GME_API_BATCH_COMPLETED');
2029: END IF;
2030:
2031: gme_common_pvt.count_and_get (x_count => x_message_count
2032: ,p_encoded => fnd_api.g_false
2027: ELSE
2028: gme_common_pvt.log_message ('GME_API_BATCH_COMPLETED');
2029: END IF;
2030:
2031: gme_common_pvt.count_and_get (x_count => x_message_count
2032: ,p_encoded => fnd_api.g_false
2033: ,x_data => x_message_list);
2034:
2035: IF (g_debug IS NOT NULL) THEN
2045: EXCEPTION
2046: WHEN batch_complete_failure THEN
2047: ROLLBACK TO SAVEPOINT complete_batch;
2048: x_batch_header_rec := NULL;
2049: gme_common_pvt.count_and_get (x_count => x_message_count
2050: ,p_encoded => fnd_api.g_false
2051: ,x_data => x_message_list);
2052: WHEN setup_failure THEN
2053: ROLLBACK TO SAVEPOINT complete_batch;
2051: ,x_data => x_message_list);
2052: WHEN setup_failure THEN
2053: ROLLBACK TO SAVEPOINT complete_batch;
2054: x_batch_header_rec := NULL;
2055: gme_common_pvt.count_and_get (x_count => x_message_count
2056: ,p_encoded => fnd_api.g_false
2057: ,x_data => x_message_list);
2058: x_return_status := fnd_api.g_ret_sts_error;
2059: WHEN OTHERS THEN
2067: END IF;
2068:
2069: ROLLBACK TO SAVEPOINT complete_batch;
2070: x_batch_header_rec := NULL;
2071: gme_common_pvt.count_and_get (x_count => x_message_count
2072: ,p_encoded => fnd_api.g_false
2073: ,x_data => x_message_list);
2074: x_return_status := fnd_api.g_ret_sts_unexp_error;
2075: END complete_batch;
2076:
2077: /*************************************************************************/
2078: PROCEDURE complete_step (
2079: p_validation_level IN NUMBER
2080: := gme_common_pvt.g_max_errors
2081: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2082: ,x_message_count OUT NOCOPY NUMBER
2083: ,x_message_list OUT NOCOPY VARCHAR2
2084: ,x_return_status OUT NOCOPY VARCHAR2
2084: ,x_return_status OUT NOCOPY VARCHAR2
2085: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
2086: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
2087: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
2088: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab
2089: ,p_ignore_exception IN VARCHAR2 := NULL) --Bug#5186328
2090: IS
2091: l_api_name CONSTANT VARCHAR2 (30) := 'COMPLETE_STEP';
2092: setup_failure EXCEPTION;
2103: IF (g_debug IS NOT NULL) THEN
2104: gme_debug.log_initialize ('CompleteStep');
2105: END IF;
2106:
2107: IF NOT gme_common_pvt.g_setup_done THEN
2108: gme_common_pvt.g_setup_done :=
2109: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2110:
2111: IF NOT gme_common_pvt.g_setup_done THEN
2104: gme_debug.log_initialize ('CompleteStep');
2105: END IF;
2106:
2107: IF NOT gme_common_pvt.g_setup_done THEN
2108: gme_common_pvt.g_setup_done :=
2109: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2110:
2111: IF NOT gme_common_pvt.g_setup_done THEN
2112: x_return_status := fnd_api.g_ret_sts_error;
2105: END IF;
2106:
2107: IF NOT gme_common_pvt.g_setup_done THEN
2108: gme_common_pvt.g_setup_done :=
2109: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2110:
2111: IF NOT gme_common_pvt.g_setup_done THEN
2112: x_return_status := fnd_api.g_ret_sts_error;
2113: RAISE setup_failure;
2107: IF NOT gme_common_pvt.g_setup_done THEN
2108: gme_common_pvt.g_setup_done :=
2109: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2110:
2111: IF NOT gme_common_pvt.g_setup_done THEN
2112: x_return_status := fnd_api.g_ret_sts_error;
2113: RAISE setup_failure;
2114: END IF;
2115: END IF;
2119:
2120: -- Initialize message list and count if needed
2121: IF p_init_msg_list = fnd_api.g_true THEN
2122: fnd_msg_pub.initialize;
2123: gme_common_pvt.g_error_count := 0;
2124: END IF;
2125:
2126: gme_common_pvt.set_timestamp;
2127: gme_complete_batch_step_pvt.complete_step
2122: fnd_msg_pub.initialize;
2123: gme_common_pvt.g_error_count := 0;
2124: END IF;
2125:
2126: gme_common_pvt.set_timestamp;
2127: gme_complete_batch_step_pvt.complete_step
2128: (p_batch_step_rec => p_batch_step_rec
2129: ,p_batch_header_rec => p_batch_header_rec
2130: ,x_batch_step_rec => x_batch_step_rec
2130: ,x_batch_step_rec => x_batch_step_rec
2131: ,x_exception_material_tbl => x_exception_material_tbl
2132: ,x_return_status => x_return_status);
2133:
2134: IF x_return_status NOT IN (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
2135: RAISE step_complete_failure;
2136: END IF; /* IF x_return_status NOT IN */
2137:
2138:
2137:
2138:
2139: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
2140: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2141: x_return_status = gme_common_pvt.g_exceptions_err THEN
2142: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2143: ELSE
2144: gme_common_pvt.log_message ('GME_API_STEP_COMPLETED');
2145: END IF;
2138:
2139: /*Bug#5186328 rework if return status is X then log message saying batch has exceptions*/
2140: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2141: x_return_status = gme_common_pvt.g_exceptions_err THEN
2142: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2143: ELSE
2144: gme_common_pvt.log_message ('GME_API_STEP_COMPLETED');
2145: END IF;
2146:
2140: IF NVL(p_ignore_exception,fnd_api.g_false) = fnd_api.g_false AND
2141: x_return_status = gme_common_pvt.g_exceptions_err THEN
2142: gme_common_pvt.log_message('GME_MATERIAL_EXCEPTIONS');
2143: ELSE
2144: gme_common_pvt.log_message ('GME_API_STEP_COMPLETED');
2145: END IF;
2146:
2147: gme_common_pvt.count_and_get (x_count => x_message_count
2148: ,p_encoded => fnd_api.g_false
2143: ELSE
2144: gme_common_pvt.log_message ('GME_API_STEP_COMPLETED');
2145: END IF;
2146:
2147: gme_common_pvt.count_and_get (x_count => x_message_count
2148: ,p_encoded => fnd_api.g_false
2149: ,x_data => x_message_list);
2150:
2151: IF (g_debug IS NOT NULL) THEN
2161: EXCEPTION
2162: WHEN step_complete_failure THEN
2163: ROLLBACK TO SAVEPOINT complete_step;
2164: x_batch_step_rec := NULL;
2165: gme_common_pvt.count_and_get (x_count => x_message_count
2166: ,p_encoded => fnd_api.g_false
2167: ,x_data => x_message_list);
2168: WHEN setup_failure THEN
2169: ROLLBACK TO SAVEPOINT complete_step;
2167: ,x_data => x_message_list);
2168: WHEN setup_failure THEN
2169: ROLLBACK TO SAVEPOINT complete_step;
2170: x_batch_step_rec := NULL;
2171: gme_common_pvt.count_and_get (x_count => x_message_count
2172: ,p_encoded => fnd_api.g_false
2173: ,x_data => x_message_list);
2174: x_return_status := fnd_api.g_ret_sts_error;
2175: WHEN OTHERS THEN
2183: END IF;
2184:
2185: ROLLBACK TO SAVEPOINT complete_step;
2186: x_batch_step_rec := NULL;
2187: gme_common_pvt.count_and_get (x_count => x_message_count
2188: ,p_encoded => fnd_api.g_false
2189: ,x_data => x_message_list);
2190: x_return_status := fnd_api.g_ret_sts_unexp_error;
2191: END complete_step;
2192:
2193: /*************************************************************************/
2194: PROCEDURE delete_step (
2195: p_validation_level IN NUMBER
2196: := gme_common_pvt.g_max_errors
2197: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2198: ,x_message_count OUT NOCOPY NUMBER
2199: ,x_message_list OUT NOCOPY VARCHAR2
2200: ,x_return_status OUT NOCOPY VARCHAR2
2221:
2222: /* Set the return status to success initially */
2223: x_return_status := fnd_api.g_ret_sts_success;
2224:
2225: IF NOT gme_common_pvt.g_setup_done THEN
2226: gme_common_pvt.g_setup_done :=
2227: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2228:
2229: IF NOT gme_common_pvt.g_setup_done THEN
2222: /* Set the return status to success initially */
2223: x_return_status := fnd_api.g_ret_sts_success;
2224:
2225: IF NOT gme_common_pvt.g_setup_done THEN
2226: gme_common_pvt.g_setup_done :=
2227: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2228:
2229: IF NOT gme_common_pvt.g_setup_done THEN
2230: x_return_status := fnd_api.g_ret_sts_error;
2223: x_return_status := fnd_api.g_ret_sts_success;
2224:
2225: IF NOT gme_common_pvt.g_setup_done THEN
2226: gme_common_pvt.g_setup_done :=
2227: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2228:
2229: IF NOT gme_common_pvt.g_setup_done THEN
2230: x_return_status := fnd_api.g_ret_sts_error;
2231: RAISE setup_failure;
2225: IF NOT gme_common_pvt.g_setup_done THEN
2226: gme_common_pvt.g_setup_done :=
2227: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2228:
2229: IF NOT gme_common_pvt.g_setup_done THEN
2230: x_return_status := fnd_api.g_ret_sts_error;
2231: RAISE setup_failure;
2232: END IF;
2233: END IF;
2233: END IF;
2234: /* Initialize message list and count if needed */
2235: IF p_init_msg_list = fnd_api.g_true THEN
2236: fnd_msg_pub.initialize;
2237: gme_common_pvt.g_error_count := 0;
2238: END IF;
2239:
2240: /* Punit Kumar */
2241: gme_common_pvt.set_timestamp;
2237: gme_common_pvt.g_error_count := 0;
2238: END IF;
2239:
2240: /* Punit Kumar */
2241: gme_common_pvt.set_timestamp;
2242: gme_delete_batch_step_pvt.delete_step
2243: (x_return_status => x_return_status
2244: ,p_batch_step_rec => p_batch_step_rec
2245: ,p_reroute_flag => FALSE);
2249: ELSE
2250: RAISE delete_step_failed;
2251: END IF;
2252: -- NEW
2253: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHSTEP_REMOVED
2254: ,P_EVENT_KEY => p_batch_step_rec.batch_id||'-'||p_batch_step_rec.BATCHSTEP_id
2255: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_STEP_LABEL')
2256: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
2257: '-'||p_batch_header_rec.batch_no||'-'|| p_batch_step_rec.BATCHSTEP_NO
2252: -- NEW
2253: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHSTEP_REMOVED
2254: ,P_EVENT_KEY => p_batch_step_rec.batch_id||'-'||p_batch_step_rec.BATCHSTEP_id
2255: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_STEP_LABEL')
2256: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
2257: '-'||p_batch_header_rec.batch_no||'-'|| p_batch_step_rec.BATCHSTEP_NO
2258: ||'-'||GME_ERES_PKG.GET_OPRN_NO(p_batch_step_rec.OPRN_ID)
2259: ,P_POST_OP_API => 'NONE'
2260: ,P_PARENT_EVENT => NULL
2266: END IF;
2267:
2268:
2269:
2270: gme_common_pvt.log_message ('GME_API_STEP_DELETE');
2271:
2272:
2273: IF (g_debug <= gme_debug.g_log_procedure) THEN
2274: gme_debug.put_line ( 'Completed '
2276: || ' at '
2277: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2278: END IF;
2279:
2280: gme_common_pvt.count_and_get (x_count => x_message_count
2281: ,p_encoded => fnd_api.g_false
2282: ,x_data => x_message_list);
2283: EXCEPTION
2284: WHEN setup_failure THEN
2283: EXCEPTION
2284: WHEN setup_failure THEN
2285: ROLLBACK TO SAVEPOINT delete_step;
2286: x_return_status := fnd_api.g_ret_sts_error;
2287: gme_common_pvt.count_and_get (x_count => x_message_count
2288: ,p_encoded => fnd_api.g_false
2289: ,x_data => x_message_list);
2290: WHEN delete_step_failed OR batch_save_failed THEN
2291: ROLLBACK TO SAVEPOINT delete_step;
2288: ,p_encoded => fnd_api.g_false
2289: ,x_data => x_message_list);
2290: WHEN delete_step_failed OR batch_save_failed THEN
2291: ROLLBACK TO SAVEPOINT delete_step;
2292: gme_common_pvt.count_and_get (x_count => x_message_count
2293: ,p_encoded => fnd_api.g_false
2294: ,x_data => x_message_list);
2295: WHEN OTHERS THEN
2296: ROLLBACK TO SAVEPOINT delete_step;
2294: ,x_data => x_message_list);
2295: WHEN OTHERS THEN
2296: ROLLBACK TO SAVEPOINT delete_step;
2297: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2298: gme_common_pvt.count_and_get (x_count => x_message_count
2299: ,p_encoded => fnd_api.g_false
2300: ,x_data => x_message_list);
2301: x_return_status := fnd_api.g_ret_sts_unexp_error;
2302: END delete_step;
2308: Punit Kumar 07-Apr-2005 Convergence Changes
2309: /*************************************************************************/
2310: PROCEDURE insert_step (
2311: p_validation_level IN NUMBER
2312: := gme_common_pvt.g_max_errors
2313: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2314: ,x_message_count OUT NOCOPY NUMBER
2315: ,x_message_list OUT NOCOPY VARCHAR2
2316: ,x_return_status OUT NOCOPY VARCHAR2
2345:
2346: /* Set the return status to success initially */
2347: x_return_status := fnd_api.g_ret_sts_success;
2348:
2349: IF NOT gme_common_pvt.g_setup_done THEN
2350: gme_common_pvt.g_setup_done :=
2351: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2352:
2353: IF NOT gme_common_pvt.g_setup_done THEN
2346: /* Set the return status to success initially */
2347: x_return_status := fnd_api.g_ret_sts_success;
2348:
2349: IF NOT gme_common_pvt.g_setup_done THEN
2350: gme_common_pvt.g_setup_done :=
2351: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2352:
2353: IF NOT gme_common_pvt.g_setup_done THEN
2354: x_return_status := fnd_api.g_ret_sts_error;
2347: x_return_status := fnd_api.g_ret_sts_success;
2348:
2349: IF NOT gme_common_pvt.g_setup_done THEN
2350: gme_common_pvt.g_setup_done :=
2351: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2352:
2353: IF NOT gme_common_pvt.g_setup_done THEN
2354: x_return_status := fnd_api.g_ret_sts_error;
2355: RAISE setup_failure;
2349: IF NOT gme_common_pvt.g_setup_done THEN
2350: gme_common_pvt.g_setup_done :=
2351: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2352:
2353: IF NOT gme_common_pvt.g_setup_done THEN
2354: x_return_status := fnd_api.g_ret_sts_error;
2355: RAISE setup_failure;
2356: END IF;
2357: END IF;
2356: END IF;
2357: END IF;
2358: IF p_init_msg_list = fnd_api.g_true THEN
2359: fnd_msg_pub.initialize;
2360: gme_common_pvt.g_error_count := 0;
2361: END IF;
2362:
2363: /* Punit Kumar */
2364: gme_common_pvt.set_timestamp;
2360: gme_common_pvt.g_error_count := 0;
2361: END IF;
2362:
2363: /* Punit Kumar */
2364: gme_common_pvt.set_timestamp;
2365: gme_insert_step_pvt.insert_batch_step
2366: (p_gme_batch_header => p_batch_header_rec
2367: ,p_gme_batch_step => p_batch_step_rec
2368: ,x_gme_batch_step => x_batch_step
2388: END IF;
2389: -- End Bug 5903208
2390:
2391: -- NEW
2392: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHSTEP_ADDED
2393: ,P_EVENT_KEY => x_batch_step.batch_id||'-'||x_batch_step.BATCHSTEP_id
2394: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_STEP_LABEL')
2395: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
2396: '-'||p_batch_header_rec.batch_no||'-'|| x_batch_step.BATCHSTEP_NO
2391: -- NEW
2392: GME_ERES_PKG.INSERT_EVENT(P_EVENT_NAME => gme_common_pvt.G_BATCHSTEP_ADDED
2393: ,P_EVENT_KEY => x_batch_step.batch_id||'-'||x_batch_step.BATCHSTEP_id
2394: ,P_USER_KEY_LABEL => FND_MESSAGE.GET_STRING('GME','GME_PSIG_BATCH_STEP_LABEL')
2395: ,P_USER_KEY_VALUE => gme_common_pvt.g_organization_code ||
2396: '-'||p_batch_header_rec.batch_no||'-'|| x_batch_step.BATCHSTEP_NO
2397: ||'-'||GME_ERES_PKG.GET_OPRN_NO(x_batch_step.OPRN_ID)
2398: ,P_POST_OP_API => 'NONE'
2399: ,P_PARENT_EVENT => NULL
2402: ,X_STATUS => x_return_status);
2403: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2404: RAISE insert_step_failed;
2405: END IF;
2406: gme_common_pvt.log_message ('GME_INSERT_STEP');
2407: IF (g_debug <= gme_debug.g_log_procedure) THEN
2408: gme_debug.put_line ( 'Completed '
2409: || l_api_name
2410: || ' at '
2418: WHEN setup_failure THEN
2419: ROLLBACK TO SAVEPOINT insert_step;
2420: x_batch_step := NULL;
2421: x_return_status := fnd_api.g_ret_sts_error;
2422: gme_common_pvt.count_and_get (x_count => x_message_count
2423: ,p_encoded => fnd_api.g_false
2424: ,x_data => x_message_list);
2425: WHEN insert_step_failed OR batch_save_failed THEN
2426: ROLLBACK TO SAVEPOINT insert_step;
2424: ,x_data => x_message_list);
2425: WHEN insert_step_failed OR batch_save_failed THEN
2426: ROLLBACK TO SAVEPOINT insert_step;
2427: x_batch_step := NULL;
2428: gme_common_pvt.count_and_get (x_count => x_message_count
2429: ,p_encoded => fnd_api.g_false
2430: ,x_data => x_message_list);
2431: WHEN OTHERS THEN
2432: ROLLBACK TO SAVEPOINT insert_step;
2431: WHEN OTHERS THEN
2432: ROLLBACK TO SAVEPOINT insert_step;
2433: x_batch_step := NULL;
2434: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2435: gme_common_pvt.count_and_get (x_count => x_message_count
2436: ,p_encoded => fnd_api.g_false
2437: ,x_data => x_message_list);
2438: x_return_status := fnd_api.g_ret_sts_unexp_error;
2439: END insert_step;
2439: END insert_step;
2440:
2441:
2442: PROCEDURE revert_batch (
2443: p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
2444: ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
2445: ,x_message_count OUT NOCOPY NUMBER
2446: ,x_message_list OUT NOCOPY VARCHAR2
2447: ,x_return_status OUT NOCOPY VARCHAR2
2468:
2469: /* Set the return status to success initially */
2470: x_return_status := fnd_api.g_ret_sts_success;
2471:
2472: IF NOT gme_common_pvt.g_setup_done THEN
2473: gme_common_pvt.g_setup_done :=
2474: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2475:
2476: IF NOT gme_common_pvt.g_setup_done THEN
2469: /* Set the return status to success initially */
2470: x_return_status := fnd_api.g_ret_sts_success;
2471:
2472: IF NOT gme_common_pvt.g_setup_done THEN
2473: gme_common_pvt.g_setup_done :=
2474: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2475:
2476: IF NOT gme_common_pvt.g_setup_done THEN
2477: x_return_status := fnd_api.g_ret_sts_error;
2470: x_return_status := fnd_api.g_ret_sts_success;
2471:
2472: IF NOT gme_common_pvt.g_setup_done THEN
2473: gme_common_pvt.g_setup_done :=
2474: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2475:
2476: IF NOT gme_common_pvt.g_setup_done THEN
2477: x_return_status := fnd_api.g_ret_sts_error;
2478: RAISE setup_failure;
2472: IF NOT gme_common_pvt.g_setup_done THEN
2473: gme_common_pvt.g_setup_done :=
2474: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2475:
2476: IF NOT gme_common_pvt.g_setup_done THEN
2477: x_return_status := fnd_api.g_ret_sts_error;
2478: RAISE setup_failure;
2479: END IF;
2480: END IF;
2481:
2482: -- Initialize message list and count if needed
2483: IF p_init_msg_list = fnd_api.g_true THEN
2484: fnd_msg_pub.initialize;
2485: gme_common_pvt.g_error_count := 0;
2486: END IF;
2487:
2488: gme_common_pvt.set_timestamp;
2489:
2484: fnd_msg_pub.initialize;
2485: gme_common_pvt.g_error_count := 0;
2486: END IF;
2487:
2488: gme_common_pvt.set_timestamp;
2489:
2490: IF g_debug <= gme_debug.g_log_statement THEN
2491: gme_debug.put_line ( g_pkg_name
2492: || '.'
2513: RAISE batch_revert_failure;
2514: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
2515:
2516:
2517: gme_common_pvt.log_message ('GME_API_BATCH_UNCERTIFIED');
2518:
2519:
2520: gme_common_pvt.count_and_get (x_count => x_message_count,
2521: p_encoded => fnd_api.g_false,
2516:
2517: gme_common_pvt.log_message ('GME_API_BATCH_UNCERTIFIED');
2518:
2519:
2520: gme_common_pvt.count_and_get (x_count => x_message_count,
2521: p_encoded => fnd_api.g_false,
2522: x_data => x_message_list);
2523:
2524: IF (g_debug IS NOT NULL) THEN
2538: EXCEPTION
2539: WHEN batch_revert_failure THEN
2540: ROLLBACK TO SAVEPOINT revert_batch;
2541: x_batch_header_rec := NULL;
2542: gme_common_pvt.count_and_get (x_count => x_message_count,
2543: p_encoded => fnd_api.g_false,
2544: x_data => x_message_list);
2545: WHEN setup_failure THEN
2546: ROLLBACK TO SAVEPOINT revert_batch;
2544: x_data => x_message_list);
2545: WHEN setup_failure THEN
2546: ROLLBACK TO SAVEPOINT revert_batch;
2547: x_batch_header_rec := NULL;
2548: gme_common_pvt.count_and_get (x_count => x_message_count,
2549: p_encoded => fnd_api.g_false,
2550: x_data => x_message_list);
2551: x_return_status := fnd_api.g_ret_sts_error;
2552: WHEN OTHERS THEN
2560: END IF;
2561:
2562: ROLLBACK TO SAVEPOINT revert_batch;
2563: x_batch_header_rec := NULL;
2564: gme_common_pvt.count_and_get (x_count => x_message_count,
2565: p_encoded => fnd_api.g_false,
2566: x_data => x_message_list);
2567: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2568:
2569:
2570: END revert_batch;
2571:
2572: PROCEDURE revert_step (
2573: p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
2574: ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
2575: ,x_message_count OUT NOCOPY NUMBER
2576: ,x_message_list OUT NOCOPY VARCHAR2
2577: ,x_return_status OUT NOCOPY VARCHAR2
2599:
2600: /* Set the return status to success initially */
2601: x_return_status := fnd_api.g_ret_sts_success;
2602:
2603: IF NOT gme_common_pvt.g_setup_done THEN
2604: gme_common_pvt.g_setup_done :=
2605: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2606:
2607: IF NOT gme_common_pvt.g_setup_done THEN
2600: /* Set the return status to success initially */
2601: x_return_status := fnd_api.g_ret_sts_success;
2602:
2603: IF NOT gme_common_pvt.g_setup_done THEN
2604: gme_common_pvt.g_setup_done :=
2605: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2606:
2607: IF NOT gme_common_pvt.g_setup_done THEN
2608: x_return_status := fnd_api.g_ret_sts_error;
2601: x_return_status := fnd_api.g_ret_sts_success;
2602:
2603: IF NOT gme_common_pvt.g_setup_done THEN
2604: gme_common_pvt.g_setup_done :=
2605: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2606:
2607: IF NOT gme_common_pvt.g_setup_done THEN
2608: x_return_status := fnd_api.g_ret_sts_error;
2609: RAISE setup_failure;
2603: IF NOT gme_common_pvt.g_setup_done THEN
2604: gme_common_pvt.g_setup_done :=
2605: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2606:
2607: IF NOT gme_common_pvt.g_setup_done THEN
2608: x_return_status := fnd_api.g_ret_sts_error;
2609: RAISE setup_failure;
2610: END IF;
2611: END IF;
2612:
2613: -- Initialize message list and count if needed
2614: IF p_init_msg_list = fnd_api.g_true THEN
2615: fnd_msg_pub.initialize;
2616: gme_common_pvt.g_error_count := 0;
2617: END IF;
2618:
2619: gme_common_pvt.set_timestamp;
2620:
2615: fnd_msg_pub.initialize;
2616: gme_common_pvt.g_error_count := 0;
2617: END IF;
2618:
2619: gme_common_pvt.set_timestamp;
2620:
2621: IF g_debug <= gme_debug.g_log_statement THEN
2622: gme_debug.put_line ( g_pkg_name
2623: || '.'
2645: RAISE step_revert_failure;
2646: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
2647:
2648:
2649: gme_common_pvt.log_message ('GME_BATCH_STEP_UNCERTIFIED');
2650:
2651:
2652: gme_common_pvt.count_and_get (x_count => x_message_count,
2653: p_encoded => fnd_api.g_false,
2648:
2649: gme_common_pvt.log_message ('GME_BATCH_STEP_UNCERTIFIED');
2650:
2651:
2652: gme_common_pvt.count_and_get (x_count => x_message_count,
2653: p_encoded => fnd_api.g_false,
2654: x_data => x_message_list);
2655:
2656: IF (g_debug IS NOT NULL) THEN
2670: EXCEPTION
2671: WHEN step_revert_failure THEN
2672: ROLLBACK TO SAVEPOINT revert_step;
2673: x_batch_step_rec := NULL;
2674: gme_common_pvt.count_and_get (x_count => x_message_count,
2675: p_encoded => fnd_api.g_false,
2676: x_data => x_message_list);
2677: WHEN setup_failure THEN
2678: ROLLBACK TO SAVEPOINT revert_step;
2676: x_data => x_message_list);
2677: WHEN setup_failure THEN
2678: ROLLBACK TO SAVEPOINT revert_step;
2679: x_batch_step_rec := NULL;
2680: gme_common_pvt.count_and_get (x_count => x_message_count,
2681: p_encoded => fnd_api.g_false,
2682: x_data => x_message_list);
2683: x_return_status := fnd_api.g_ret_sts_error;
2684: WHEN OTHERS THEN
2692: END IF;
2693:
2694: ROLLBACK TO SAVEPOINT revert_step;
2695: x_batch_step_rec := NULL;
2696: gme_common_pvt.count_and_get (x_count => x_message_count,
2697: p_encoded => fnd_api.g_false,
2698: x_data => x_message_list);
2699: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2700: END revert_step;
2724: IF (g_debug IS NOT NULL) THEN
2725: gme_debug.log_initialize ('CloseBatch');
2726: END IF;
2727:
2728: IF NOT gme_common_pvt.g_setup_done THEN
2729: gme_common_pvt.g_setup_done :=
2730: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2731:
2732: IF NOT gme_common_pvt.g_setup_done THEN
2725: gme_debug.log_initialize ('CloseBatch');
2726: END IF;
2727:
2728: IF NOT gme_common_pvt.g_setup_done THEN
2729: gme_common_pvt.g_setup_done :=
2730: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2731:
2732: IF NOT gme_common_pvt.g_setup_done THEN
2733: x_return_status := fnd_api.g_ret_sts_error;
2726: END IF;
2727:
2728: IF NOT gme_common_pvt.g_setup_done THEN
2729: gme_common_pvt.g_setup_done :=
2730: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2731:
2732: IF NOT gme_common_pvt.g_setup_done THEN
2733: x_return_status := fnd_api.g_ret_sts_error;
2734: RAISE setup_failure;
2728: IF NOT gme_common_pvt.g_setup_done THEN
2729: gme_common_pvt.g_setup_done :=
2730: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2731:
2732: IF NOT gme_common_pvt.g_setup_done THEN
2733: x_return_status := fnd_api.g_ret_sts_error;
2734: RAISE setup_failure;
2735: END IF;
2736: END IF;
2737:
2738: /* Initialize message list and count if needed */
2739: IF p_init_msg_list = fnd_api.g_true THEN
2740: fnd_msg_pub.initialize;
2741: gme_common_pvt.g_error_count := 0;
2742: END IF;
2743:
2744: gme_common_pvt.set_timestamp;
2745:
2740: fnd_msg_pub.initialize;
2741: gme_common_pvt.g_error_count := 0;
2742: END IF;
2743:
2744: gme_common_pvt.set_timestamp;
2745:
2746: IF g_debug <= gme_debug.g_log_procedure THEN
2747: gme_debug.put_line ('Calling gme_close_batch_pvt.close_batch.');
2748: END IF;
2772: RAISE batch_close_failure;
2773: END IF;
2774:
2775:
2776: gme_common_pvt.log_message ('GME_API_BATCH_CLOSED');
2777:
2778:
2779: gme_common_pvt.count_and_get (x_count => x_message_count
2780: ,p_encoded => fnd_api.g_false
2775:
2776: gme_common_pvt.log_message ('GME_API_BATCH_CLOSED');
2777:
2778:
2779: gme_common_pvt.count_and_get (x_count => x_message_count
2780: ,p_encoded => fnd_api.g_false
2781: ,x_data => x_message_list);
2782:
2783: IF g_debug <= gme_debug.g_log_procedure THEN
2789: EXCEPTION
2790: WHEN setup_failure OR batch_close_failure OR batch_save_failed THEN
2791: ROLLBACK TO SAVEPOINT close_batch;
2792: x_batch_header_rec := NULL;
2793: gme_common_pvt.count_and_get (x_count => x_message_count
2794: ,p_encoded => fnd_api.g_false
2795: ,x_data => x_message_list);
2796: WHEN OTHERS THEN
2797: ROLLBACK TO SAVEPOINT close_batch;
2796: WHEN OTHERS THEN
2797: ROLLBACK TO SAVEPOINT close_batch;
2798: x_batch_header_rec := NULL;
2799: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2800: gme_common_pvt.count_and_get (x_count => x_message_count
2801: ,p_encoded => fnd_api.g_false
2802: ,x_data => x_message_list);
2803: x_return_status := fnd_api.g_ret_sts_unexp_error;
2804: END close_batch;
2805:
2806: /*************************************************************************/
2807: PROCEDURE close_step (
2808: p_validation_level IN NUMBER
2809: := gme_common_pvt.g_max_errors
2810: , /* Punit Kumar */
2811: p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2812: ,x_message_count OUT NOCOPY NUMBER
2813: ,x_message_list OUT NOCOPY VARCHAR2
2837:
2838: /* Set the return status to success initially */
2839: x_return_status := fnd_api.g_ret_sts_success;
2840:
2841: IF NOT gme_common_pvt.g_setup_done THEN
2842: gme_common_pvt.g_setup_done :=
2843: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2844:
2845: IF NOT gme_common_pvt.g_setup_done THEN
2838: /* Set the return status to success initially */
2839: x_return_status := fnd_api.g_ret_sts_success;
2840:
2841: IF NOT gme_common_pvt.g_setup_done THEN
2842: gme_common_pvt.g_setup_done :=
2843: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2844:
2845: IF NOT gme_common_pvt.g_setup_done THEN
2846: x_return_status := fnd_api.g_ret_sts_error;
2839: x_return_status := fnd_api.g_ret_sts_success;
2840:
2841: IF NOT gme_common_pvt.g_setup_done THEN
2842: gme_common_pvt.g_setup_done :=
2843: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2844:
2845: IF NOT gme_common_pvt.g_setup_done THEN
2846: x_return_status := fnd_api.g_ret_sts_error;
2847: RAISE setup_failure;
2841: IF NOT gme_common_pvt.g_setup_done THEN
2842: gme_common_pvt.g_setup_done :=
2843: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2844:
2845: IF NOT gme_common_pvt.g_setup_done THEN
2846: x_return_status := fnd_api.g_ret_sts_error;
2847: RAISE setup_failure;
2848: END IF;
2849: END IF;
2849: END IF;
2850: /* Initialize message list and count if needed */
2851: IF p_init_msg_list = fnd_api.g_true THEN
2852: fnd_msg_pub.initialize;
2853: gme_common_pvt.g_error_count := 0;
2854: END IF;
2855:
2856: gme_common_pvt.set_timestamp;
2857:
2852: fnd_msg_pub.initialize;
2853: gme_common_pvt.g_error_count := 0;
2854: END IF;
2855:
2856: gme_common_pvt.set_timestamp;
2857:
2858: gme_close_step_pvt.close_step (p_batch_step_rec => p_batch_step_rec
2859: ,p_delete_pending => p_delete_pending
2860: ,x_batch_step_rec => x_batch_step_rec
2873: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2874: END IF;
2875:
2876:
2877: gme_common_pvt.log_message ('GME_BATCH_STEP_CLOSED');
2878:
2879:
2880: gme_common_pvt.count_and_get (x_count => x_message_count
2881: ,p_encoded => fnd_api.g_false
2876:
2877: gme_common_pvt.log_message ('GME_BATCH_STEP_CLOSED');
2878:
2879:
2880: gme_common_pvt.count_and_get (x_count => x_message_count
2881: ,p_encoded => fnd_api.g_false
2882: ,x_data => x_message_list);
2883: EXCEPTION
2884: WHEN setup_failure OR step_close_failed OR batch_save_failed THEN
2884: WHEN setup_failure OR step_close_failed OR batch_save_failed THEN
2885: ROLLBACK TO SAVEPOINT close_batch_step;
2886: x_batch_step_rec := NULL;
2887: /*N Punit Kumar */
2888: gme_common_pvt.count_and_get (x_count => x_message_count
2889: ,p_encoded => fnd_api.g_false
2890: ,x_data => x_message_list);
2891: WHEN OTHERS THEN
2892: ROLLBACK TO SAVEPOINT close_batch_step;
2892: ROLLBACK TO SAVEPOINT close_batch_step;
2893: x_batch_step_rec := NULL;
2894: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2895: /*N Punit Kumar */
2896: gme_common_pvt.count_and_get (x_count => x_message_count
2897: ,p_encoded => fnd_api.g_false
2898: ,x_data => x_message_list);
2899: x_return_status := fnd_api.g_ret_sts_unexp_error;
2900: END close_step;
2901:
2902: /*************************************************************************/
2903: PROCEDURE reopen_batch (
2904: p_validation_level IN NUMBER
2905: := gme_common_pvt.g_max_errors
2906: ,
2907: p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2908: ,x_message_count OUT NOCOPY NUMBER
2909: ,x_message_list OUT NOCOPY VARCHAR2
2931:
2932: /* Initialize message list and count if needed*/
2933: IF p_init_msg_list = fnd_api.g_true THEN
2934: fnd_msg_pub.initialize;
2935: gme_common_pvt.g_error_count := 0;
2936: END IF;
2937:
2938: /* Set the success staus to success inititally*/
2939: x_return_status := fnd_api.g_ret_sts_success;
2938: /* Set the success staus to success inititally*/
2939: x_return_status := fnd_api.g_ret_sts_success;
2940:
2941: -- Pawan kumar added for bug 4956087
2942: IF NOT gme_common_pvt.g_setup_done THEN
2943: gme_common_pvt.g_setup_done :=
2944: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2945:
2946: IF NOT gme_common_pvt.g_setup_done THEN
2939: x_return_status := fnd_api.g_ret_sts_success;
2940:
2941: -- Pawan kumar added for bug 4956087
2942: IF NOT gme_common_pvt.g_setup_done THEN
2943: gme_common_pvt.g_setup_done :=
2944: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2945:
2946: IF NOT gme_common_pvt.g_setup_done THEN
2947: x_return_status := fnd_api.g_ret_sts_error;
2940:
2941: -- Pawan kumar added for bug 4956087
2942: IF NOT gme_common_pvt.g_setup_done THEN
2943: gme_common_pvt.g_setup_done :=
2944: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2945:
2946: IF NOT gme_common_pvt.g_setup_done THEN
2947: x_return_status := fnd_api.g_ret_sts_error;
2948: RAISE setup_failure;
2942: IF NOT gme_common_pvt.g_setup_done THEN
2943: gme_common_pvt.g_setup_done :=
2944: gme_common_pvt.setup (p_batch_header_rec.organization_id);
2945:
2946: IF NOT gme_common_pvt.g_setup_done THEN
2947: x_return_status := fnd_api.g_ret_sts_error;
2948: RAISE setup_failure;
2949: END IF;
2950: END IF;
2947: x_return_status := fnd_api.g_ret_sts_error;
2948: RAISE setup_failure;
2949: END IF;
2950: END IF;
2951: gme_common_pvt.set_timestamp;
2952:
2953: IF (g_debug <= gme_debug.g_log_procedure) THEN
2954: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
2955: || 'calling private layer');
2971: ELSE
2972: RAISE batch_reopen_failure;
2973: END IF;
2974:
2975: gme_common_pvt.log_message ('GME_API_BATCH_REOPENED');
2976:
2977:
2978: IF (g_debug <= gme_debug.g_log_procedure) THEN
2979: gme_debug.put_line ( 'Completed '
2982: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2983: END IF;
2984:
2985:
2986: gme_common_pvt.count_and_get (x_count => x_message_count
2987: ,p_encoded => fnd_api.g_false
2988: ,x_data => x_message_list);
2989:
2990:
3000: END IF;
3001:
3002: x_return_status := fnd_api.g_ret_sts_error;
3003: /*N Punit Kumar */
3004: gme_common_pvt.count_and_get (x_count => x_message_count
3005: ,p_encoded => fnd_api.g_false
3006: ,x_data => x_message_list);
3007: WHEN batch_reopen_failure OR batch_save_failed THEN
3008: ROLLBACK TO SAVEPOINT reopen_batch;
3014: );
3015: END IF;
3016:
3017: /*N Punit Kumar */
3018: gme_common_pvt.count_and_get (x_count => x_message_count
3019: ,p_encoded => fnd_api.g_false
3020: ,x_data => x_message_list);
3021: x_return_status := fnd_api.g_ret_sts_error;
3022: WHEN OTHERS THEN
3030: END IF;
3031:
3032: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
3033:
3034: gme_common_pvt.count_and_get (x_count => x_message_count
3035: ,p_encoded => fnd_api.g_false
3036: ,x_data => x_message_list);
3037: x_return_status := fnd_api.g_ret_sts_unexp_error;
3038: END reopen_batch;
3039:
3040: /*************************************************************************/
3041: PROCEDURE reopen_step (
3042: p_validation_level IN NUMBER
3043: := gme_common_pvt.g_max_errors
3044: , /* Punit Kumar */
3045: p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3046: ,x_message_count OUT NOCOPY NUMBER
3047: ,x_message_list OUT NOCOPY VARCHAR2
3061:
3062: /* Initialize message list and count if needed*/
3063: IF p_init_msg_list = fnd_api.g_true THEN
3064: fnd_msg_pub.initialize;
3065: gme_common_pvt.g_error_count := 0; /* Punit Kumar */
3066: END IF;
3067:
3068: IF (g_debug IS NOT NULL) THEN
3069: gme_debug.log_initialize ('ReopenStep');
3072: IF (g_debug <= gme_debug.g_log_procedure) THEN
3073: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
3074: || 'entering');
3075: END IF;
3076: IF NOT gme_common_pvt.g_setup_done THEN
3077: gme_common_pvt.g_setup_done :=
3078: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3079:
3080: IF NOT gme_common_pvt.g_setup_done THEN
3073: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
3074: || 'entering');
3075: END IF;
3076: IF NOT gme_common_pvt.g_setup_done THEN
3077: gme_common_pvt.g_setup_done :=
3078: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3079:
3080: IF NOT gme_common_pvt.g_setup_done THEN
3081: x_return_status := fnd_api.g_ret_sts_error;
3074: || 'entering');
3075: END IF;
3076: IF NOT gme_common_pvt.g_setup_done THEN
3077: gme_common_pvt.g_setup_done :=
3078: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3079:
3080: IF NOT gme_common_pvt.g_setup_done THEN
3081: x_return_status := fnd_api.g_ret_sts_error;
3082: RAISE setup_failure;
3076: IF NOT gme_common_pvt.g_setup_done THEN
3077: gme_common_pvt.g_setup_done :=
3078: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3079:
3080: IF NOT gme_common_pvt.g_setup_done THEN
3081: x_return_status := fnd_api.g_ret_sts_error;
3082: RAISE setup_failure;
3083: END IF;
3084: END IF;
3084: END IF;
3085: /* Set the success staus to success inititally*/
3086: x_return_status := fnd_api.g_ret_sts_success;
3087: /* Punit Kumar */
3088: gme_common_pvt.set_timestamp;
3089:
3090: IF (g_debug <= gme_debug.g_log_procedure) THEN
3091: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ':'
3092: || 'calling private layer');
3107: RAISE step_reopen_failure;
3108: END IF;
3109:
3110:
3111: gme_common_pvt.log_message ('GME_API_STEP_REOPENED');
3112:
3113:
3114: IF (g_debug <= gme_debug.g_log_procedure) THEN
3115: gme_debug.put_line ( 'Completed '
3117: || ' at '
3118: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3119: END IF;
3120:
3121: gme_common_pvt.count_and_get (x_count => x_message_count
3122: ,p_encoded => fnd_api.g_false
3123: ,x_data => x_message_list);
3124:
3125: IF (g_debug <= gme_debug.g_log_procedure) THEN
3139: END IF;
3140:
3141: x_return_status := fnd_api.g_ret_sts_error;
3142: /* Punit Kumar */
3143: gme_common_pvt.count_and_get (x_count => x_message_count
3144: ,p_encoded => fnd_api.g_false
3145: ,x_data => x_message_list);
3146: WHEN step_reopen_failure OR step_save_failed THEN
3147: ROLLBACK TO SAVEPOINT reopen_batch_step;
3154: );
3155: END IF;
3156:
3157: /* Punit Kumar */
3158: gme_common_pvt.count_and_get (x_count => x_message_count
3159: ,p_encoded => fnd_api.g_false
3160: ,x_data => x_message_list);
3161: x_return_status := fnd_api.g_ret_sts_error;
3162: WHEN OTHERS THEN
3170: END IF;
3171:
3172: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
3173: /* Punit Kumar */
3174: gme_common_pvt.count_and_get (x_count => x_message_count
3175: ,p_encoded => fnd_api.g_false
3176: ,x_data => x_message_list);
3177: x_return_status := fnd_api.g_ret_sts_unexp_error;
3178: END reopen_step;
3203:
3204: ================================================================================*/
3205: PROCEDURE incremental_backflush (
3206: p_validation_level IN NUMBER
3207: := gme_common_pvt.g_max_errors
3208: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3209: ,x_message_count OUT NOCOPY NUMBER
3210: ,x_message_list OUT NOCOPY VARCHAR2
3211: ,x_return_status OUT NOCOPY VARCHAR2
3213: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3214: ,p_qty IN NUMBER
3215: ,p_qty_type IN NUMBER
3216: ,p_trans_date IN DATE
3217: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab )
3218: IS
3219: l_api_name CONSTANT VARCHAR2 (30) := 'INCREMENTAL_BACKFLUSH';
3220: l_trans_date DATE;
3221:
3233: /* Set the return status to success initially */
3234: x_return_status := fnd_api.g_ret_sts_success;
3235:
3236: /* Setup the common constants used across the apis */
3237: IF NOT gme_common_pvt.g_setup_done THEN
3238: gme_common_pvt.g_setup_done :=
3239: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3240:
3241: IF NOT gme_common_pvt.g_setup_done THEN
3234: x_return_status := fnd_api.g_ret_sts_success;
3235:
3236: /* Setup the common constants used across the apis */
3237: IF NOT gme_common_pvt.g_setup_done THEN
3238: gme_common_pvt.g_setup_done :=
3239: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3240:
3241: IF NOT gme_common_pvt.g_setup_done THEN
3242: x_return_status := fnd_api.g_ret_sts_error;
3235:
3236: /* Setup the common constants used across the apis */
3237: IF NOT gme_common_pvt.g_setup_done THEN
3238: gme_common_pvt.g_setup_done :=
3239: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3240:
3241: IF NOT gme_common_pvt.g_setup_done THEN
3242: x_return_status := fnd_api.g_ret_sts_error;
3243: RAISE setup_failure;
3237: IF NOT gme_common_pvt.g_setup_done THEN
3238: gme_common_pvt.g_setup_done :=
3239: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3240:
3241: IF NOT gme_common_pvt.g_setup_done THEN
3242: x_return_status := fnd_api.g_ret_sts_error;
3243: RAISE setup_failure;
3244: END IF;
3245: END IF;
3246:
3247: /* Initialize message list and count if needed */
3248: IF p_init_msg_list = fnd_api.g_true THEN
3249: fnd_msg_pub.initialize;
3250: gme_common_pvt.g_error_count := 0;
3251: END IF;
3252:
3253: gme_common_pvt.set_timestamp;
3254:
3249: fnd_msg_pub.initialize;
3250: gme_common_pvt.g_error_count := 0;
3251: END IF;
3252:
3253: gme_common_pvt.set_timestamp;
3254:
3255: l_trans_date := p_trans_date;
3256:
3257: IF l_trans_date IS NULL THEN
3254:
3255: l_trans_date := p_trans_date;
3256:
3257: IF l_trans_date IS NULL THEN
3258: l_trans_date := gme_common_pvt.g_timestamp;
3259: END IF;
3260:
3261: -- does backflush resource usage need to be performed?
3262: IF (p_batch_header_rec.batch_status = gme_common_pvt.g_step_wip AND
3258: l_trans_date := gme_common_pvt.g_timestamp;
3259: END IF;
3260:
3261: -- does backflush resource usage need to be performed?
3262: IF (p_batch_header_rec.batch_status = gme_common_pvt.g_step_wip AND
3263: p_material_detail_rec.line_type = gme_common_pvt.g_line_type_prod AND
3264: gme_common_pvt.g_backflush_rsrc_usg_ind = 1) THEN
3265: l_backflush_rsrc_usg_ind := 1;
3266: ELSE
3259: END IF;
3260:
3261: -- does backflush resource usage need to be performed?
3262: IF (p_batch_header_rec.batch_status = gme_common_pvt.g_step_wip AND
3263: p_material_detail_rec.line_type = gme_common_pvt.g_line_type_prod AND
3264: gme_common_pvt.g_backflush_rsrc_usg_ind = 1) THEN
3265: l_backflush_rsrc_usg_ind := 1;
3266: ELSE
3267: l_backflush_rsrc_usg_ind := 0;
3260:
3261: -- does backflush resource usage need to be performed?
3262: IF (p_batch_header_rec.batch_status = gme_common_pvt.g_step_wip AND
3263: p_material_detail_rec.line_type = gme_common_pvt.g_line_type_prod AND
3264: gme_common_pvt.g_backflush_rsrc_usg_ind = 1) THEN
3265: l_backflush_rsrc_usg_ind := 1;
3266: ELSE
3267: l_backflush_rsrc_usg_ind := 0;
3268: END IF;
3277: ,x_exception_material_tbl => x_exception_material_tbl
3278: ,x_return_status => x_return_status);
3279:
3280: IF x_return_status NOT IN
3281: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
3282: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
3283: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' after gme_incremental_backflush_pvt.incremental_backflush; x_return_status= '||x_return_status);
3284: END IF;
3285: RAISE incremental_backflush_failed;
3286: END IF; /* IF x_return_status NOT IN */
3287:
3288: /*Bug#5277982 if there are any exceptions then we give message saying IB done with exceptions*/
3289: IF x_exception_material_tbl.COUNT > 0 THEN
3290: gme_common_pvt.log_message('GME_IB_EXCEPTIONS');
3291: ELSE
3292: gme_common_pvt.log_message ('GME_API_PARTIAL_CERTIFIED');
3293: END IF;
3294:
3288: /*Bug#5277982 if there are any exceptions then we give message saying IB done with exceptions*/
3289: IF x_exception_material_tbl.COUNT > 0 THEN
3290: gme_common_pvt.log_message('GME_IB_EXCEPTIONS');
3291: ELSE
3292: gme_common_pvt.log_message ('GME_API_PARTIAL_CERTIFIED');
3293: END IF;
3294:
3295: IF (g_debug <= gme_debug.g_log_procedure) THEN
3296: gme_debug.put_line ( 'gme_api_main: Completed '
3298: || ' at '
3299: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3300: END IF;
3301:
3302: gme_common_pvt.count_and_get (x_count => x_message_count
3303: ,p_encoded => fnd_api.g_false
3304: ,x_data => x_message_list);
3305: EXCEPTION
3306: WHEN setup_failure THEN
3305: EXCEPTION
3306: WHEN setup_failure THEN
3307: ROLLBACK TO SAVEPOINT incremental_backflush;
3308: x_return_status := fnd_api.g_ret_sts_error;
3309: gme_common_pvt.count_and_get (x_count => x_message_count
3310: ,p_encoded => fnd_api.g_false
3311: ,x_data => x_message_list);
3312: WHEN incremental_backflush_failed THEN
3313: ROLLBACK TO SAVEPOINT incremental_backflush;
3310: ,p_encoded => fnd_api.g_false
3311: ,x_data => x_message_list);
3312: WHEN incremental_backflush_failed THEN
3313: ROLLBACK TO SAVEPOINT incremental_backflush;
3314: gme_common_pvt.count_and_get (x_count => x_message_count
3315: ,p_encoded => fnd_api.g_false
3316: ,x_data => x_message_list);
3317: IF ( NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT ) THEN
3318: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' in exception block; x_return_status= '||x_return_status);
3319: END IF;
3320: WHEN OTHERS THEN
3321: ROLLBACK TO SAVEPOINT incremental_backflush;
3322: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
3323: gme_common_pvt.count_and_get (x_count => x_message_count
3324: ,p_encoded => fnd_api.g_false
3325: ,x_data => x_message_list);
3326: x_return_status := fnd_api.g_ret_sts_unexp_error;
3327: END incremental_backflush;
3346: C - No continous periods found
3347: ================================================================================*/
3348: PROCEDURE reroute_batch (
3349: p_validation_level IN NUMBER
3350: := gme_common_pvt.g_max_errors
3351: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3352: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3353: ,p_validity_rule_id IN NUMBER
3354: ,p_use_workday_cal IN VARCHAR2 DEFAULT fnd_api.g_false
3376: END IF;
3377:
3378: IF (fnd_api.to_boolean (p_init_msg_list) ) THEN
3379: fnd_msg_pub.initialize;
3380: gme_common_pvt.g_error_count := 0;
3381: END IF;
3382:
3383: /* Set the return status to success initially */
3384: x_return_status := fnd_api.g_ret_sts_success;
3382:
3383: /* Set the return status to success initially */
3384: x_return_status := fnd_api.g_ret_sts_success;
3385:
3386: IF NOT gme_common_pvt.g_setup_done THEN
3387: gme_common_pvt.g_setup_done :=
3388: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3389:
3390: IF NOT gme_common_pvt.g_setup_done THEN
3383: /* Set the return status to success initially */
3384: x_return_status := fnd_api.g_ret_sts_success;
3385:
3386: IF NOT gme_common_pvt.g_setup_done THEN
3387: gme_common_pvt.g_setup_done :=
3388: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3389:
3390: IF NOT gme_common_pvt.g_setup_done THEN
3391: x_return_status := fnd_api.g_ret_sts_error;
3384: x_return_status := fnd_api.g_ret_sts_success;
3385:
3386: IF NOT gme_common_pvt.g_setup_done THEN
3387: gme_common_pvt.g_setup_done :=
3388: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3389:
3390: IF NOT gme_common_pvt.g_setup_done THEN
3391: x_return_status := fnd_api.g_ret_sts_error;
3392: RAISE setup_failure;
3386: IF NOT gme_common_pvt.g_setup_done THEN
3387: gme_common_pvt.g_setup_done :=
3388: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3389:
3390: IF NOT gme_common_pvt.g_setup_done THEN
3391: x_return_status := fnd_api.g_ret_sts_error;
3392: RAISE setup_failure;
3393: END IF;
3394: END IF;
3392: RAISE setup_failure;
3393: END IF;
3394: END IF;
3395:
3396: gme_common_pvt.set_timestamp;
3397: gme_reroute_batch_pvt.reroute_batch
3398: (p_batch_header_rec => p_batch_header_rec
3399: ,p_validity_rule_id => p_validity_rule_id
3400: ,p_use_workday_cal => p_use_workday_cal
3414: FND_MESSAGE.SET_NAME('GME','GME_BATCH');
3415: ELSE
3416: FND_MESSAGE.SET_NAME('GME','GME_FIRM_PLAN_ORDER');
3417: END IF;
3418: gme_common_pvt.log_message ('GME_API_BATCH_REROUTED','DOC',FND_MESSAGE.GET);
3419: --FPBug#5040865 End
3420: END IF;
3421:
3422: gme_common_pvt.count_and_get (x_count => x_message_count
3418: gme_common_pvt.log_message ('GME_API_BATCH_REROUTED','DOC',FND_MESSAGE.GET);
3419: --FPBug#5040865 End
3420: END IF;
3421:
3422: gme_common_pvt.count_and_get (x_count => x_message_count
3423: ,p_encoded => fnd_api.g_false
3424: ,x_data => x_message_list);
3425:
3426: IF (NVL (g_debug, 0) IN
3435: EXCEPTION
3436: WHEN setup_failure THEN
3437: ROLLBACK TO SAVEPOINT reroute_batch_main;
3438: x_batch_header_rec := NULL;
3439: gme_common_pvt.count_and_get (x_count => x_message_count
3440: ,p_encoded => fnd_api.g_false
3441: ,x_data => x_message_list);
3442: x_return_status := fnd_api.g_ret_sts_error;
3443: WHEN no_continous_periods THEN
3440: ,p_encoded => fnd_api.g_false
3441: ,x_data => x_message_list);
3442: x_return_status := fnd_api.g_ret_sts_error;
3443: WHEN no_continous_periods THEN
3444: gme_common_pvt.count_and_get (x_count => x_message_count
3445: ,p_encoded => fnd_api.g_false
3446: ,x_data => x_message_list);
3447: WHEN fnd_api.g_exc_error THEN
3448: ROLLBACK TO SAVEPOINT reroute_batch_main;
3447: WHEN fnd_api.g_exc_error THEN
3448: ROLLBACK TO SAVEPOINT reroute_batch_main;
3449: x_batch_header_rec := NULL;
3450: x_return_status := fnd_api.g_ret_sts_error;
3451: gme_common_pvt.count_and_get (x_count => x_message_count
3452: ,p_encoded => fnd_api.g_false
3453: ,x_data => x_message_list);
3454: WHEN fnd_api.g_exc_unexpected_error THEN
3455: ROLLBACK TO SAVEPOINT reroute_batch_main;
3464: || 'UNEXPECTED:'
3465: || SQLERRM);
3466: END IF;
3467:
3468: gme_common_pvt.count_and_get (x_count => x_message_count
3469: ,p_encoded => fnd_api.g_false
3470: ,x_data => x_message_list);
3471: WHEN OTHERS THEN
3472: ROLLBACK TO SAVEPOINT reroute_batch_main;
3482: || 'OTHERS:'
3483: || SQLERRM);
3484: END IF;
3485:
3486: gme_common_pvt.count_and_get (x_count => x_message_count
3487: ,p_encoded => fnd_api.g_false
3488: ,x_data => x_message_list);
3489: END reroute_batch;
3490:
3506: U - Unexpected Error
3507: ================================================================================*/
3508: PROCEDURE cancel_batch (
3509: p_validation_level IN NUMBER
3510: := gme_common_pvt.g_max_errors
3511: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3512: ,x_message_count OUT NOCOPY NUMBER
3513: ,x_message_list OUT NOCOPY VARCHAR2
3514: ,x_return_status OUT NOCOPY VARCHAR2
3532:
3533: /* Set the return status to success initially */
3534: x_return_status := fnd_api.g_ret_sts_success;
3535:
3536: IF NOT gme_common_pvt.g_setup_done THEN
3537: gme_common_pvt.g_setup_done :=
3538: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3539:
3540: IF NOT gme_common_pvt.g_setup_done THEN
3533: /* Set the return status to success initially */
3534: x_return_status := fnd_api.g_ret_sts_success;
3535:
3536: IF NOT gme_common_pvt.g_setup_done THEN
3537: gme_common_pvt.g_setup_done :=
3538: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3539:
3540: IF NOT gme_common_pvt.g_setup_done THEN
3541: x_return_status := fnd_api.g_ret_sts_error;
3534: x_return_status := fnd_api.g_ret_sts_success;
3535:
3536: IF NOT gme_common_pvt.g_setup_done THEN
3537: gme_common_pvt.g_setup_done :=
3538: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3539:
3540: IF NOT gme_common_pvt.g_setup_done THEN
3541: x_return_status := fnd_api.g_ret_sts_error;
3542: RAISE setup_failure;
3536: IF NOT gme_common_pvt.g_setup_done THEN
3537: gme_common_pvt.g_setup_done :=
3538: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3539:
3540: IF NOT gme_common_pvt.g_setup_done THEN
3541: x_return_status := fnd_api.g_ret_sts_error;
3542: RAISE setup_failure;
3543: END IF;
3544: END IF;
3545:
3546: -- Initialize message list and count if needed
3547: IF p_init_msg_list = fnd_api.g_true THEN
3548: fnd_msg_pub.initialize;
3549: gme_common_pvt.g_error_count := 0;
3550: END IF;
3551:
3552: gme_common_pvt.set_timestamp;
3553:
3548: fnd_msg_pub.initialize;
3549: gme_common_pvt.g_error_count := 0;
3550: END IF;
3551:
3552: gme_common_pvt.set_timestamp;
3553:
3554: IF g_debug <= gme_debug.g_log_statement THEN
3555: gme_debug.put_line ( g_pkg_name
3556: || '.'
3582: FND_MESSAGE.SET_NAME('GME','GME_BATCH');
3583: ELSE
3584: FND_MESSAGE.SET_NAME('GME','GME_FIRM_PLAN_ORDER');
3585: END IF;
3586: gme_common_pvt.log_message ('GME_API_BATCH_CANCELLED','DOC',FND_MESSAGE.GET);
3587: --FPBug#5040865 End
3588:
3589: gme_common_pvt.count_and_get (x_count => x_message_count
3590: ,p_encoded => fnd_api.g_false
3585: END IF;
3586: gme_common_pvt.log_message ('GME_API_BATCH_CANCELLED','DOC',FND_MESSAGE.GET);
3587: --FPBug#5040865 End
3588:
3589: gme_common_pvt.count_and_get (x_count => x_message_count
3590: ,p_encoded => fnd_api.g_false
3591: ,x_data => x_message_list);
3592:
3593: IF (g_debug IS NOT NULL) THEN
3607: EXCEPTION
3608: WHEN batch_cancel_failure THEN
3609: ROLLBACK TO SAVEPOINT cancel_batch;
3610: x_batch_header_rec := NULL;
3611: gme_common_pvt.count_and_get (x_count => x_message_count
3612: ,p_encoded => fnd_api.g_false
3613: ,x_data => x_message_list);
3614: WHEN setup_failure THEN
3615: ROLLBACK TO SAVEPOINT cancel_batch;
3613: ,x_data => x_message_list);
3614: WHEN setup_failure THEN
3615: ROLLBACK TO SAVEPOINT cancel_batch;
3616: x_batch_header_rec := NULL;
3617: gme_common_pvt.count_and_get (x_count => x_message_count
3618: ,p_encoded => fnd_api.g_false
3619: ,x_data => x_message_list);
3620: x_return_status := fnd_api.g_ret_sts_error;
3621: WHEN OTHERS THEN
3629: END IF;
3630:
3631: ROLLBACK TO SAVEPOINT cancel_batch;
3632: x_batch_header_rec := NULL;
3633: gme_common_pvt.count_and_get (x_count => x_message_count
3634: ,p_encoded => fnd_api.g_false
3635: ,x_data => x_message_list);
3636: x_return_status := fnd_api.g_ret_sts_unexp_error;
3637: END cancel_batch;
3656: U - Unexpected Error
3657: ================================================================================*/
3658: PROCEDURE terminate_batch (
3659: p_validation_level IN NUMBER
3660: := gme_common_pvt.g_max_errors
3661: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3662: ,x_message_count OUT NOCOPY NUMBER
3663: ,x_message_list OUT NOCOPY VARCHAR2
3664: ,x_return_status OUT NOCOPY VARCHAR2
3683:
3684: /* Set the return status to success initially */
3685: x_return_status := fnd_api.g_ret_sts_success;
3686:
3687: IF NOT gme_common_pvt.g_setup_done THEN
3688: gme_common_pvt.g_setup_done :=
3689: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3690:
3691: IF NOT gme_common_pvt.g_setup_done THEN
3684: /* Set the return status to success initially */
3685: x_return_status := fnd_api.g_ret_sts_success;
3686:
3687: IF NOT gme_common_pvt.g_setup_done THEN
3688: gme_common_pvt.g_setup_done :=
3689: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3690:
3691: IF NOT gme_common_pvt.g_setup_done THEN
3692: x_return_status := fnd_api.g_ret_sts_error;
3685: x_return_status := fnd_api.g_ret_sts_success;
3686:
3687: IF NOT gme_common_pvt.g_setup_done THEN
3688: gme_common_pvt.g_setup_done :=
3689: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3690:
3691: IF NOT gme_common_pvt.g_setup_done THEN
3692: x_return_status := fnd_api.g_ret_sts_error;
3693: RAISE setup_failure;
3687: IF NOT gme_common_pvt.g_setup_done THEN
3688: gme_common_pvt.g_setup_done :=
3689: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3690:
3691: IF NOT gme_common_pvt.g_setup_done THEN
3692: x_return_status := fnd_api.g_ret_sts_error;
3693: RAISE setup_failure;
3694: END IF;
3695: END IF;
3696:
3697: -- Initialize message list and count if needed
3698: IF p_init_msg_list = fnd_api.g_true THEN
3699: fnd_msg_pub.initialize;
3700: gme_common_pvt.g_error_count := 0;
3701: END IF;
3702:
3703: gme_common_pvt.set_timestamp;
3704:
3699: fnd_msg_pub.initialize;
3700: gme_common_pvt.g_error_count := 0;
3701: END IF;
3702:
3703: gme_common_pvt.set_timestamp;
3704:
3705: IF g_debug <= gme_debug.g_log_statement THEN
3706: gme_debug.put_line ( g_pkg_name
3707: || '.'
3727: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3728: RAISE batch_terminate_failure;
3729: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
3730:
3731: gme_common_pvt.log_message ('GME_API_BATCH_TERMINATED');
3732:
3733:
3734: gme_common_pvt.count_and_get (x_count => x_message_count
3735: ,p_encoded => fnd_api.g_false
3730:
3731: gme_common_pvt.log_message ('GME_API_BATCH_TERMINATED');
3732:
3733:
3734: gme_common_pvt.count_and_get (x_count => x_message_count
3735: ,p_encoded => fnd_api.g_false
3736: ,x_data => x_message_list);
3737:
3738: IF (g_debug IS NOT NULL) THEN
3763: || 'SETUP_FAILURE.');
3764: END IF;
3765:
3766: x_return_status := fnd_api.g_ret_sts_error;
3767: gme_common_pvt.count_and_get (x_count => x_message_count
3768: ,p_encoded => fnd_api.g_false
3769: ,x_data => x_message_list);
3770: WHEN batch_terminate_failure THEN
3771: ROLLBACK TO SAVEPOINT terminate_batch;
3779: || ':'
3780: || 'BATCH_TERMINATE_FAILURE OR BATCH_SAVE_FAILED.');
3781: END IF;
3782:
3783: gme_common_pvt.count_and_get (x_count => x_message_count
3784: ,p_encoded => fnd_api.g_false
3785: ,x_data => x_message_list);
3786: WHEN OTHERS THEN
3787: ROLLBACK TO SAVEPOINT terminate_batch;
3796: || SQLERRM);
3797: END IF;
3798:
3799: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
3800: gme_common_pvt.count_and_get (x_count => x_message_count
3801: ,p_encoded => fnd_api.g_false
3802: ,x_data => x_message_list);
3803: x_return_status := fnd_api.g_ret_sts_unexp_error;
3804: END terminate_batch;
3805:
3806: /*************************************************************************/
3807: PROCEDURE unrelease_batch (
3808: p_validation_level IN NUMBER
3809: := gme_common_pvt.g_max_errors
3810: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3811: ,x_message_count OUT NOCOPY NUMBER
3812: ,x_message_list OUT NOCOPY VARCHAR2
3813: ,x_return_status OUT NOCOPY VARCHAR2
3829: IF (g_debug IS NOT NULL) THEN
3830: gme_debug.log_initialize ('UnreleaseBatch');
3831: END IF;
3832:
3833: IF NOT gme_common_pvt.g_setup_done THEN
3834: gme_common_pvt.g_setup_done :=
3835: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3836:
3837: IF NOT gme_common_pvt.g_setup_done THEN
3830: gme_debug.log_initialize ('UnreleaseBatch');
3831: END IF;
3832:
3833: IF NOT gme_common_pvt.g_setup_done THEN
3834: gme_common_pvt.g_setup_done :=
3835: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3836:
3837: IF NOT gme_common_pvt.g_setup_done THEN
3838: x_return_status := fnd_api.g_ret_sts_error;
3831: END IF;
3832:
3833: IF NOT gme_common_pvt.g_setup_done THEN
3834: gme_common_pvt.g_setup_done :=
3835: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3836:
3837: IF NOT gme_common_pvt.g_setup_done THEN
3838: x_return_status := fnd_api.g_ret_sts_error;
3839: RAISE setup_failure;
3833: IF NOT gme_common_pvt.g_setup_done THEN
3834: gme_common_pvt.g_setup_done :=
3835: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3836:
3837: IF NOT gme_common_pvt.g_setup_done THEN
3838: x_return_status := fnd_api.g_ret_sts_error;
3839: RAISE setup_failure;
3840: END IF;
3841: END IF;
3845:
3846: -- Initialize message list and count if needed
3847: IF p_init_msg_list = fnd_api.g_true THEN
3848: fnd_msg_pub.initialize;
3849: gme_common_pvt.g_error_count := 0;
3850: END IF;
3851:
3852: gme_common_pvt.set_timestamp;
3853: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3848: fnd_msg_pub.initialize;
3849: gme_common_pvt.g_error_count := 0;
3850: END IF;
3851:
3852: gme_common_pvt.set_timestamp;
3853: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3854: gme_unrelease_batch_pvt.unrelease_batch
3855: (p_batch_header_rec => p_batch_header_rec
3856: ,p_create_resv_pend_lots => p_create_resv_pend_lots
3849: gme_common_pvt.g_error_count := 0;
3850: END IF;
3851:
3852: gme_common_pvt.set_timestamp;
3853: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3854: gme_unrelease_batch_pvt.unrelease_batch
3855: (p_batch_header_rec => p_batch_header_rec
3856: ,p_create_resv_pend_lots => p_create_resv_pend_lots
3857: ,x_batch_header_rec => x_batch_header_rec
3860: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3861: RAISE batch_unrelease_failure;
3862: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
3863:
3864: gme_common_pvt.log_message ('GME_API_BATCH_UNRELEASED');
3865:
3866: gme_common_pvt.count_and_get (x_count => x_message_count
3867: ,p_encoded => fnd_api.g_false
3868: ,x_data => x_message_list);
3862: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
3863:
3864: gme_common_pvt.log_message ('GME_API_BATCH_UNRELEASED');
3865:
3866: gme_common_pvt.count_and_get (x_count => x_message_count
3867: ,p_encoded => fnd_api.g_false
3868: ,x_data => x_message_list);
3869:
3870: IF (g_debug IS NOT NULL) THEN
3880: EXCEPTION
3881: WHEN batch_unrelease_failure THEN
3882: ROLLBACK TO SAVEPOINT unrelease_batch;
3883: x_batch_header_rec := NULL;
3884: gme_common_pvt.count_and_get (x_count => x_message_count
3885: ,p_encoded => fnd_api.g_false
3886: ,x_data => x_message_list);
3887: WHEN setup_failure THEN
3888: ROLLBACK TO SAVEPOINT unrelease_batch;
3886: ,x_data => x_message_list);
3887: WHEN setup_failure THEN
3888: ROLLBACK TO SAVEPOINT unrelease_batch;
3889: x_batch_header_rec := NULL;
3890: gme_common_pvt.count_and_get (x_count => x_message_count
3891: ,p_encoded => fnd_api.g_false
3892: ,x_data => x_message_list);
3893: x_return_status := fnd_api.g_ret_sts_error;
3894: WHEN OTHERS THEN
3902: END IF;
3903:
3904: ROLLBACK TO SAVEPOINT unrelease_batch;
3905: x_batch_header_rec := NULL;
3906: gme_common_pvt.count_and_get (x_count => x_message_count
3907: ,p_encoded => fnd_api.g_false
3908: ,x_data => x_message_list);
3909: x_return_status := fnd_api.g_ret_sts_unexp_error;
3910: END unrelease_batch;
3911:
3912: /*************************************************************************/
3913: PROCEDURE unrelease_step (
3914: p_validation_level IN NUMBER
3915: := gme_common_pvt.g_max_errors
3916: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3917: ,x_message_count OUT NOCOPY NUMBER
3918: ,x_message_list OUT NOCOPY VARCHAR2
3919: ,x_return_status OUT NOCOPY VARCHAR2
3936: IF (g_debug IS NOT NULL) THEN
3937: gme_debug.log_initialize ('UnreleaseStep');
3938: END IF;
3939:
3940: IF NOT gme_common_pvt.g_setup_done THEN
3941: gme_common_pvt.g_setup_done :=
3942: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3943:
3944: IF NOT gme_common_pvt.g_setup_done THEN
3937: gme_debug.log_initialize ('UnreleaseStep');
3938: END IF;
3939:
3940: IF NOT gme_common_pvt.g_setup_done THEN
3941: gme_common_pvt.g_setup_done :=
3942: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3943:
3944: IF NOT gme_common_pvt.g_setup_done THEN
3945: x_return_status := fnd_api.g_ret_sts_error;
3938: END IF;
3939:
3940: IF NOT gme_common_pvt.g_setup_done THEN
3941: gme_common_pvt.g_setup_done :=
3942: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3943:
3944: IF NOT gme_common_pvt.g_setup_done THEN
3945: x_return_status := fnd_api.g_ret_sts_error;
3946: RAISE setup_failure;
3940: IF NOT gme_common_pvt.g_setup_done THEN
3941: gme_common_pvt.g_setup_done :=
3942: gme_common_pvt.setup (p_batch_header_rec.organization_id);
3943:
3944: IF NOT gme_common_pvt.g_setup_done THEN
3945: x_return_status := fnd_api.g_ret_sts_error;
3946: RAISE setup_failure;
3947: END IF;
3948: END IF;
3952:
3953: -- Initialize message list and count if needed
3954: IF p_init_msg_list = fnd_api.g_true THEN
3955: fnd_msg_pub.initialize;
3956: gme_common_pvt.g_error_count := 0;
3957: END IF;
3958:
3959: gme_common_pvt.set_timestamp;
3960: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3955: fnd_msg_pub.initialize;
3956: gme_common_pvt.g_error_count := 0;
3957: END IF;
3958:
3959: gme_common_pvt.set_timestamp;
3960: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3961: gme_unrelease_step_pvt.unrelease_step
3962: (p_batch_step_rec => p_batch_step_rec
3963: ,p_update_inventory_ind => p_batch_header_rec.update_inventory_ind
3956: gme_common_pvt.g_error_count := 0;
3957: END IF;
3958:
3959: gme_common_pvt.set_timestamp;
3960: gme_common_pvt.reset_txn_hdr_tbl; -- nsinghi bug#5176319
3961: gme_unrelease_step_pvt.unrelease_step
3962: (p_batch_step_rec => p_batch_step_rec
3963: ,p_update_inventory_ind => p_batch_header_rec.update_inventory_ind
3964: ,p_create_resv_pend_lots => p_create_resv_pend_lots
3970: RAISE step_unrelease_failure;
3971: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
3972:
3973:
3974: gme_common_pvt.log_message ('GME_BATCH_STEP_UNRELEASED');
3975:
3976: gme_common_pvt.count_and_get (x_count => x_message_count
3977: ,p_encoded => fnd_api.g_false
3978: ,x_data => x_message_list);
3972:
3973:
3974: gme_common_pvt.log_message ('GME_BATCH_STEP_UNRELEASED');
3975:
3976: gme_common_pvt.count_and_get (x_count => x_message_count
3977: ,p_encoded => fnd_api.g_false
3978: ,x_data => x_message_list);
3979:
3980: IF (g_debug IS NOT NULL) THEN
3990: EXCEPTION
3991: WHEN step_unrelease_failure THEN
3992: ROLLBACK TO SAVEPOINT unrelease_step;
3993: x_batch_step_rec := NULL;
3994: gme_common_pvt.count_and_get (x_count => x_message_count
3995: ,p_encoded => fnd_api.g_false
3996: ,x_data => x_message_list);
3997: WHEN setup_failure THEN
3998: ROLLBACK TO SAVEPOINT unrelease_step;
3996: ,x_data => x_message_list);
3997: WHEN setup_failure THEN
3998: ROLLBACK TO SAVEPOINT unrelease_step;
3999: x_batch_step_rec := NULL;
4000: gme_common_pvt.count_and_get (x_count => x_message_count
4001: ,p_encoded => fnd_api.g_false
4002: ,x_data => x_message_list);
4003: x_return_status := fnd_api.g_ret_sts_error;
4004: WHEN OTHERS THEN
4012: END IF;
4013:
4014: ROLLBACK TO SAVEPOINT unrelease_step;
4015: x_batch_step_rec := NULL;
4016: gme_common_pvt.count_and_get (x_count => x_message_count
4017: ,p_encoded => fnd_api.g_false
4018: ,x_data => x_message_list);
4019: x_return_status := fnd_api.g_ret_sts_unexp_error;
4020: END unrelease_step;
4042: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4043: || l_api_name);
4044: END IF;
4045:
4046: IF NOT gme_common_pvt.g_setup_done THEN
4047: gme_common_pvt.g_setup_done :=
4048: gme_common_pvt.setup (p_material_detail_rec.organization_id);
4049:
4050: IF NOT gme_common_pvt.g_setup_done THEN
4043: || l_api_name);
4044: END IF;
4045:
4046: IF NOT gme_common_pvt.g_setup_done THEN
4047: gme_common_pvt.g_setup_done :=
4048: gme_common_pvt.setup (p_material_detail_rec.organization_id);
4049:
4050: IF NOT gme_common_pvt.g_setup_done THEN
4051: x_return_status := fnd_api.g_ret_sts_error;
4044: END IF;
4045:
4046: IF NOT gme_common_pvt.g_setup_done THEN
4047: gme_common_pvt.g_setup_done :=
4048: gme_common_pvt.setup (p_material_detail_rec.organization_id);
4049:
4050: IF NOT gme_common_pvt.g_setup_done THEN
4051: x_return_status := fnd_api.g_ret_sts_error;
4052: RAISE setup_failure;
4046: IF NOT gme_common_pvt.g_setup_done THEN
4047: gme_common_pvt.g_setup_done :=
4048: gme_common_pvt.setup (p_material_detail_rec.organization_id);
4049:
4050: IF NOT gme_common_pvt.g_setup_done THEN
4051: x_return_status := fnd_api.g_ret_sts_error;
4052: RAISE setup_failure;
4053: END IF;
4054: END IF;
4055:
4056: -- Initialize message list and count if needed
4057: IF p_init_msg_list = fnd_api.g_true THEN
4058: fnd_msg_pub.initialize;
4059: gme_common_pvt.g_error_count := 0;
4060: END IF;
4061:
4062: /* Set the return status to success initially */
4063: x_return_status := fnd_api.g_ret_sts_success;
4061:
4062: /* Set the return status to success initially */
4063: x_return_status := fnd_api.g_ret_sts_success;
4064: /* Set the timestamp */
4065: gme_common_pvt.set_timestamp;
4066: gme_reservations_pvt.auto_detail_line
4067: (p_material_details_rec => p_material_detail_rec
4068: ,x_return_status => x_return_status);
4069:
4070: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4071: RAISE auto_detail_failure;
4072: END IF;
4073:
4074: gme_common_pvt.log_message ('GME_BATCH_AUTO_DETAIL_LINE');
4075:
4076: IF (g_debug <= gme_debug.g_log_procedure) THEN
4077: gme_debug.put_line ( 'Completed '
4078: || l_api_name
4081: END IF;
4082: EXCEPTION
4083: WHEN auto_detail_failure OR setup_failure THEN
4084: ROLLBACK TO SAVEPOINT auto_detail_line;
4085: gme_common_pvt.count_and_get (x_count => x_message_count
4086: ,p_encoded => fnd_api.g_false
4087: ,x_data => x_message_list);
4088: WHEN OTHERS THEN
4089: IF g_debug <= gme_debug.g_log_unexpected THEN
4096: END IF;
4097:
4098: ROLLBACK TO SAVEPOINT auto_detail_line;
4099: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4100: gme_common_pvt.count_and_get (x_count => x_message_count
4101: ,p_encoded => fnd_api.g_false
4102: ,x_data => x_message_list);
4103: x_return_status := fnd_api.g_ret_sts_unexp_error;
4104: END auto_detail_line;
4126: IF g_debug <= gme_debug.g_log_procedure THEN
4127: gme_debug.put_line ('Entering api ' || g_pkg_name || '.' || l_api_name);
4128: END IF;
4129:
4130: IF NOT gme_common_pvt.g_setup_done THEN
4131: gme_common_pvt.g_setup_done :=
4132: gme_common_pvt.setup (p_batch_rec.organization_id);
4133:
4134: IF NOT gme_common_pvt.g_setup_done THEN
4127: gme_debug.put_line ('Entering api ' || g_pkg_name || '.' || l_api_name);
4128: END IF;
4129:
4130: IF NOT gme_common_pvt.g_setup_done THEN
4131: gme_common_pvt.g_setup_done :=
4132: gme_common_pvt.setup (p_batch_rec.organization_id);
4133:
4134: IF NOT gme_common_pvt.g_setup_done THEN
4135: x_return_status := fnd_api.g_ret_sts_error;
4128: END IF;
4129:
4130: IF NOT gme_common_pvt.g_setup_done THEN
4131: gme_common_pvt.g_setup_done :=
4132: gme_common_pvt.setup (p_batch_rec.organization_id);
4133:
4134: IF NOT gme_common_pvt.g_setup_done THEN
4135: x_return_status := fnd_api.g_ret_sts_error;
4136: RAISE setup_failure;
4130: IF NOT gme_common_pvt.g_setup_done THEN
4131: gme_common_pvt.g_setup_done :=
4132: gme_common_pvt.setup (p_batch_rec.organization_id);
4133:
4134: IF NOT gme_common_pvt.g_setup_done THEN
4135: x_return_status := fnd_api.g_ret_sts_error;
4136: RAISE setup_failure;
4137: END IF;
4138: END IF;
4139:
4140: -- Initialize message list and count if needed
4141: IF p_init_msg_list = fnd_api.g_true THEN
4142: fnd_msg_pub.initialize;
4143: gme_common_pvt.g_error_count := 0;
4144: END IF;
4145:
4146: /* Set the return status to success initially */
4147: x_return_status := fnd_api.g_ret_sts_success;
4146: /* Set the return status to success initially */
4147: x_return_status := fnd_api.g_ret_sts_success;
4148:
4149: /* Set the timestamp */
4150: gme_common_pvt.set_timestamp;
4151:
4152: gme_reservations_pvt.auto_detail_batch(p_batch_rec => p_batch_rec
4153: ,x_return_status => x_return_status);
4154:
4154:
4155: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4156: RAISE auto_detail_failure;
4157: END IF;
4158: gme_common_pvt.log_message ('GME_BATCH_AUTO_DETAIL_BATCH');
4159: IF (g_debug <= gme_debug.g_log_procedure) THEN
4160: gme_debug.put_line ( 'Completed '
4161: || l_api_name
4162: || ' at '
4164: END IF;
4165: EXCEPTION
4166: WHEN auto_detail_failure OR setup_failure THEN
4167: ROLLBACK TO SAVEPOINT auto_detail_batch;
4168: gme_common_pvt.count_and_get (x_count => x_message_count,
4169: p_encoded => fnd_api.g_false,
4170: x_data => x_message_list);
4171: WHEN OTHERS THEN
4172: IF g_debug <= gme_debug.g_log_unexpected THEN
4179: END IF;
4180:
4181: ROLLBACK TO SAVEPOINT auto_detail_batch;
4182: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4183: gme_common_pvt.count_and_get (x_count => x_message_count,
4184: p_encoded => fnd_api.g_false,
4185: x_data => x_message_list);
4186: x_return_status := fnd_api.g_ret_sts_unexp_error;
4187: END auto_detail_batch;
4188:
4189: /*************************************************************************/
4190: PROCEDURE create_pending_product_lot (
4191: p_validation_level IN NUMBER
4192: := gme_common_pvt.g_max_errors
4193: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4194: ,x_message_count OUT NOCOPY NUMBER
4195: ,x_message_list OUT NOCOPY VARCHAR2
4196: ,x_return_status OUT NOCOPY VARCHAR2
4212: IF (g_debug IS NOT NULL) THEN
4213: gme_debug.log_initialize ('CreatePendingProdLot');
4214: END IF;
4215:
4216: IF NOT gme_common_pvt.g_setup_done THEN
4217: gme_common_pvt.g_setup_done :=
4218: gme_common_pvt.setup (p_org_id);
4219:
4220: IF NOT gme_common_pvt.g_setup_done THEN
4213: gme_debug.log_initialize ('CreatePendingProdLot');
4214: END IF;
4215:
4216: IF NOT gme_common_pvt.g_setup_done THEN
4217: gme_common_pvt.g_setup_done :=
4218: gme_common_pvt.setup (p_org_id);
4219:
4220: IF NOT gme_common_pvt.g_setup_done THEN
4221: x_return_status := fnd_api.g_ret_sts_error;
4214: END IF;
4215:
4216: IF NOT gme_common_pvt.g_setup_done THEN
4217: gme_common_pvt.g_setup_done :=
4218: gme_common_pvt.setup (p_org_id);
4219:
4220: IF NOT gme_common_pvt.g_setup_done THEN
4221: x_return_status := fnd_api.g_ret_sts_error;
4222: RAISE setup_failure;
4216: IF NOT gme_common_pvt.g_setup_done THEN
4217: gme_common_pvt.g_setup_done :=
4218: gme_common_pvt.setup (p_org_id);
4219:
4220: IF NOT gme_common_pvt.g_setup_done THEN
4221: x_return_status := fnd_api.g_ret_sts_error;
4222: RAISE setup_failure;
4223: END IF;
4224: END IF;
4228:
4229: -- Initialize message list and count if needed
4230: IF p_init_msg_list = fnd_api.g_true THEN
4231: fnd_msg_pub.initialize;
4232: gme_common_pvt.g_error_count := 0;
4233: END IF;
4234:
4235: gme_common_pvt.set_timestamp;
4236: gme_pending_product_lots_pvt.create_pending_product_lot
4231: fnd_msg_pub.initialize;
4232: gme_common_pvt.g_error_count := 0;
4233: END IF;
4234:
4235: gme_common_pvt.set_timestamp;
4236: gme_pending_product_lots_pvt.create_pending_product_lot
4237: (p_pending_product_lots_rec => p_pending_product_lots_rec
4238: ,x_pending_product_lots_rec => x_pending_product_lots_rec
4239: ,x_return_status => x_return_status);
4242: RAISE create_pp_lot_failure;
4243: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
4244:
4245:
4246: gme_common_pvt.log_message ('GME_API_PP_LOT_CREATED');
4247:
4248: gme_common_pvt.count_and_get (x_count => x_message_count
4249: ,p_encoded => fnd_api.g_false
4250: ,x_data => x_message_list);
4244:
4245:
4246: gme_common_pvt.log_message ('GME_API_PP_LOT_CREATED');
4247:
4248: gme_common_pvt.count_and_get (x_count => x_message_count
4249: ,p_encoded => fnd_api.g_false
4250: ,x_data => x_message_list);
4251:
4252: IF (g_debug IS NOT NULL) THEN
4262: EXCEPTION
4263: WHEN create_pp_lot_failure THEN
4264: ROLLBACK TO SAVEPOINT create_pp_lot;
4265: x_pending_product_lots_rec := NULL;
4266: gme_common_pvt.count_and_get (x_count => x_message_count
4267: ,p_encoded => fnd_api.g_false
4268: ,x_data => x_message_list);
4269: WHEN setup_failure THEN
4270: ROLLBACK TO SAVEPOINT create_pp_lot;
4268: ,x_data => x_message_list);
4269: WHEN setup_failure THEN
4270: ROLLBACK TO SAVEPOINT create_pp_lot;
4271: x_pending_product_lots_rec := NULL;
4272: gme_common_pvt.count_and_get (x_count => x_message_count
4273: ,p_encoded => fnd_api.g_false
4274: ,x_data => x_message_list);
4275: x_return_status := fnd_api.g_ret_sts_error;
4276: WHEN OTHERS THEN
4284: END IF;
4285:
4286: ROLLBACK TO SAVEPOINT create_pp_lot;
4287: x_pending_product_lots_rec := NULL;
4288: gme_common_pvt.count_and_get (x_count => x_message_count
4289: ,p_encoded => fnd_api.g_false
4290: ,x_data => x_message_list);
4291: x_return_status := fnd_api.g_ret_sts_unexp_error;
4292: END create_pending_product_lot;
4292: END create_pending_product_lot;
4293:
4294: PROCEDURE update_pending_product_lot (
4295: p_validation_level IN NUMBER
4296: := gme_common_pvt.g_max_errors
4297: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4298: ,x_message_count OUT NOCOPY NUMBER
4299: ,x_message_list OUT NOCOPY VARCHAR2
4300: ,x_return_status OUT NOCOPY VARCHAR2
4316: IF (g_debug IS NOT NULL) THEN
4317: gme_debug.log_initialize ('UpdatePendingProdLot');
4318: END IF;
4319:
4320: IF NOT gme_common_pvt.g_setup_done THEN
4321: gme_common_pvt.g_setup_done :=
4322: gme_common_pvt.setup (p_org_id);
4323:
4324: IF NOT gme_common_pvt.g_setup_done THEN
4317: gme_debug.log_initialize ('UpdatePendingProdLot');
4318: END IF;
4319:
4320: IF NOT gme_common_pvt.g_setup_done THEN
4321: gme_common_pvt.g_setup_done :=
4322: gme_common_pvt.setup (p_org_id);
4323:
4324: IF NOT gme_common_pvt.g_setup_done THEN
4325: x_return_status := fnd_api.g_ret_sts_error;
4318: END IF;
4319:
4320: IF NOT gme_common_pvt.g_setup_done THEN
4321: gme_common_pvt.g_setup_done :=
4322: gme_common_pvt.setup (p_org_id);
4323:
4324: IF NOT gme_common_pvt.g_setup_done THEN
4325: x_return_status := fnd_api.g_ret_sts_error;
4326: RAISE setup_failure;
4320: IF NOT gme_common_pvt.g_setup_done THEN
4321: gme_common_pvt.g_setup_done :=
4322: gme_common_pvt.setup (p_org_id);
4323:
4324: IF NOT gme_common_pvt.g_setup_done THEN
4325: x_return_status := fnd_api.g_ret_sts_error;
4326: RAISE setup_failure;
4327: END IF;
4328: END IF;
4332:
4333: -- Initialize message list and count if needed
4334: IF p_init_msg_list = fnd_api.g_true THEN
4335: fnd_msg_pub.initialize;
4336: gme_common_pvt.g_error_count := 0;
4337: END IF;
4338:
4339: gme_common_pvt.set_timestamp;
4340: gme_pending_product_lots_pvt.update_pending_product_lot
4335: fnd_msg_pub.initialize;
4336: gme_common_pvt.g_error_count := 0;
4337: END IF;
4338:
4339: gme_common_pvt.set_timestamp;
4340: gme_pending_product_lots_pvt.update_pending_product_lot
4341: (p_pending_product_lots_rec => p_pending_product_lots_rec
4342: ,x_pending_product_lots_rec => x_pending_product_lots_rec
4343: ,x_return_status => x_return_status);
4346: RAISE update_pp_lot_failure;
4347: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
4348:
4349:
4350: gme_common_pvt.log_message ('GME_API_PP_LOT_UPDATED');
4351:
4352:
4353: gme_common_pvt.count_and_get (x_count => x_message_count
4354: ,p_encoded => fnd_api.g_false
4349:
4350: gme_common_pvt.log_message ('GME_API_PP_LOT_UPDATED');
4351:
4352:
4353: gme_common_pvt.count_and_get (x_count => x_message_count
4354: ,p_encoded => fnd_api.g_false
4355: ,x_data => x_message_list);
4356:
4357: IF (g_debug IS NOT NULL) THEN
4367: EXCEPTION
4368: WHEN update_pp_lot_failure THEN
4369: ROLLBACK TO SAVEPOINT update_pp_lot;
4370: x_pending_product_lots_rec := NULL;
4371: gme_common_pvt.count_and_get (x_count => x_message_count
4372: ,p_encoded => fnd_api.g_false
4373: ,x_data => x_message_list);
4374: WHEN setup_failure THEN
4375: ROLLBACK TO SAVEPOINT update_pp_lot;
4373: ,x_data => x_message_list);
4374: WHEN setup_failure THEN
4375: ROLLBACK TO SAVEPOINT update_pp_lot;
4376: x_pending_product_lots_rec := NULL;
4377: gme_common_pvt.count_and_get (x_count => x_message_count
4378: ,p_encoded => fnd_api.g_false
4379: ,x_data => x_message_list);
4380: x_return_status := fnd_api.g_ret_sts_error;
4381: WHEN OTHERS THEN
4389: END IF;
4390:
4391: ROLLBACK TO SAVEPOINT update_pp_lot;
4392: x_pending_product_lots_rec := NULL;
4393: gme_common_pvt.count_and_get (x_count => x_message_count
4394: ,p_encoded => fnd_api.g_false
4395: ,x_data => x_message_list);
4396: x_return_status := fnd_api.g_ret_sts_unexp_error;
4397: END update_pending_product_lot;
4397: END update_pending_product_lot;
4398:
4399: PROCEDURE delete_pending_product_lot (
4400: p_validation_level IN NUMBER
4401: := gme_common_pvt.g_max_errors
4402: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4403: ,x_message_count OUT NOCOPY NUMBER
4404: ,x_message_list OUT NOCOPY VARCHAR2
4405: ,x_return_status OUT NOCOPY VARCHAR2
4420: IF (g_debug IS NOT NULL) THEN
4421: gme_debug.log_initialize ('DeletePendingProdLot');
4422: END IF;
4423:
4424: IF NOT gme_common_pvt.g_setup_done THEN
4425: gme_common_pvt.g_setup_done :=
4426: gme_common_pvt.setup (p_org_id);
4427:
4428: IF NOT gme_common_pvt.g_setup_done THEN
4421: gme_debug.log_initialize ('DeletePendingProdLot');
4422: END IF;
4423:
4424: IF NOT gme_common_pvt.g_setup_done THEN
4425: gme_common_pvt.g_setup_done :=
4426: gme_common_pvt.setup (p_org_id);
4427:
4428: IF NOT gme_common_pvt.g_setup_done THEN
4429: x_return_status := fnd_api.g_ret_sts_error;
4422: END IF;
4423:
4424: IF NOT gme_common_pvt.g_setup_done THEN
4425: gme_common_pvt.g_setup_done :=
4426: gme_common_pvt.setup (p_org_id);
4427:
4428: IF NOT gme_common_pvt.g_setup_done THEN
4429: x_return_status := fnd_api.g_ret_sts_error;
4430: RAISE setup_failure;
4424: IF NOT gme_common_pvt.g_setup_done THEN
4425: gme_common_pvt.g_setup_done :=
4426: gme_common_pvt.setup (p_org_id);
4427:
4428: IF NOT gme_common_pvt.g_setup_done THEN
4429: x_return_status := fnd_api.g_ret_sts_error;
4430: RAISE setup_failure;
4431: END IF;
4432: END IF;
4436:
4437: -- Initialize message list and count if needed
4438: IF p_init_msg_list = fnd_api.g_true THEN
4439: fnd_msg_pub.initialize;
4440: gme_common_pvt.g_error_count := 0;
4441: END IF;
4442:
4443: gme_common_pvt.set_timestamp;
4444: gme_pending_product_lots_pvt.delete_pending_product_lot
4439: fnd_msg_pub.initialize;
4440: gme_common_pvt.g_error_count := 0;
4441: END IF;
4442:
4443: gme_common_pvt.set_timestamp;
4444: gme_pending_product_lots_pvt.delete_pending_product_lot
4445: (p_pending_product_lots_rec => p_pending_product_lots_rec
4446: ,x_return_status => x_return_status);
4447:
4448: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4449: RAISE delete_pp_lot_failure;
4450: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
4451:
4452: gme_common_pvt.log_message ('GME_API_PP_LOT_DELETED');
4453:
4454:
4455: gme_common_pvt.count_and_get (x_count => x_message_count
4456: ,p_encoded => fnd_api.g_false
4451:
4452: gme_common_pvt.log_message ('GME_API_PP_LOT_DELETED');
4453:
4454:
4455: gme_common_pvt.count_and_get (x_count => x_message_count
4456: ,p_encoded => fnd_api.g_false
4457: ,x_data => x_message_list);
4458:
4459: IF (g_debug IS NOT NULL) THEN
4468: END IF;
4469: EXCEPTION
4470: WHEN delete_pp_lot_failure THEN
4471: ROLLBACK TO SAVEPOINT delete_pp_lot;
4472: gme_common_pvt.count_and_get (x_count => x_message_count
4473: ,p_encoded => fnd_api.g_false
4474: ,x_data => x_message_list);
4475: WHEN setup_failure THEN
4476: ROLLBACK TO SAVEPOINT delete_pp_lot;
4473: ,p_encoded => fnd_api.g_false
4474: ,x_data => x_message_list);
4475: WHEN setup_failure THEN
4476: ROLLBACK TO SAVEPOINT delete_pp_lot;
4477: gme_common_pvt.count_and_get (x_count => x_message_count
4478: ,p_encoded => fnd_api.g_false
4479: ,x_data => x_message_list);
4480: x_return_status := fnd_api.g_ret_sts_error;
4481: WHEN OTHERS THEN
4488: || SQLERRM);
4489: END IF;
4490:
4491: ROLLBACK TO SAVEPOINT delete_pp_lot;
4492: gme_common_pvt.count_and_get (x_count => x_message_count
4493: ,p_encoded => fnd_api.g_false
4494: ,x_data => x_message_list);
4495: x_return_status := fnd_api.g_ret_sts_unexp_error;
4496: END delete_pending_product_lot;