20: gme_debug.put_line(g_pkg_name||'.'||p_api_name||':'||'When others exception:'||SQLERRM);
21: END IF;
22: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
23: gme_common_pvt.count_and_get (x_count => x_message_count
24: ,p_encoded => fnd_api.g_false
25: ,x_data => x_message_list);
26: x_return_status := fnd_api.g_ret_sts_unexp_error;
27:
28: END gme_when_others ;
22: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
23: gme_common_pvt.count_and_get (x_count => x_message_count
24: ,p_encoded => fnd_api.g_false
25: ,x_data => x_message_list);
26: x_return_status := fnd_api.g_ret_sts_unexp_error;
27:
28: END gme_when_others ;
29:
30: /*================================================================================
54: /* Bug 5255959 added p_clear_qty_cache parameter */
55: PROCEDURE save_batch (
56: p_header_id IN NUMBER DEFAULT NULL
57: ,p_table IN NUMBER DEFAULT NULL
58: ,p_commit IN VARCHAR2 := fnd_api.g_false
59: ,x_return_status OUT NOCOPY VARCHAR2
60: --Bug#5584699 Changed variable from boolean to varchar2
61: ,p_clear_qty_cache IN VARCHAR2 := FND_API.g_true)
62: --,p_clear_qty_cache IN BOOLEAN DEFAULT TRUE)
57: ,p_table IN NUMBER DEFAULT NULL
58: ,p_commit IN VARCHAR2 := fnd_api.g_false
59: ,x_return_status OUT NOCOPY VARCHAR2
60: --Bug#5584699 Changed variable from boolean to varchar2
61: ,p_clear_qty_cache IN VARCHAR2 := FND_API.g_true)
62: --,p_clear_qty_cache IN BOOLEAN DEFAULT TRUE)
63: IS
64: l_api_name CONSTANT VARCHAR2 (30) := 'SAVE_BATCH';
65: l_header_id NUMBER;
84: gme_debug.put_line ('p_header_id = ' || p_header_id);
85: gme_debug.put_line ('p_table = ' || p_table);
86: END IF;
87:
88: x_return_status := fnd_api.g_ret_sts_success;
89:
90: --
91: -- bug 13256866
92: -- Reiniitalizaing the timestamp before saving
95:
96: FOR header_row IN header_cursor LOOP
97: -- Check that there is one and only one primary resource
98: IF gme_common_pvt.g_check_primary_rsrc = 1
99: AND p_commit = fnd_api.g_true THEN
100: gme_resource_engine_pvt.check_primary_resource
101: (p_batch_id => header_row.batch_id
102: ,p_batchstep_id => NULL
103: ,x_return_status => x_return_status);
101: (p_batch_id => header_row.batch_id
102: ,p_batchstep_id => NULL
103: ,x_return_status => x_return_status);
104:
105: IF x_return_status <> fnd_api.g_ret_sts_success THEN
106: RAISE error_save_batch;
107: END IF;
108: END IF; -- IF gme_common_pvt.g_check_primary_rsrc = 1 THEN
109:
110: gme_resource_engine_pvt.consolidate_batch_resources
111: (header_row.batch_id
112: ,x_return_status);
113:
114: IF x_return_status <> fnd_api.g_ret_sts_success THEN
115: RAISE error_save_batch;
116: END IF;
117:
118: -- Bug 14685438 - Remove processed data.
115: RAISE error_save_batch;
116: END IF;
117:
118: -- Bug 14685438 - Remove processed data.
119: IF p_commit = fnd_api.g_false THEN
120: delete from gme_resource_txns_gtmp
121: where doc_id = header_row.batch_id;
122: END IF;
123:
129: IF (NVL (l_header_id, 0) <> 0) THEN
130: /* Bug 5255959 added p_clear_qty_cache parameter */
131: gme_transactions_pvt.process_transactions
132: (p_api_version => 2.0
133: ,p_init_msg_list => fnd_api.g_false
134: ,p_commit => fnd_api.g_false
135: ,p_validation_level => fnd_api.g_valid_level_full
136: ,p_table => p_table
137: ,p_header_id => l_header_id
130: /* Bug 5255959 added p_clear_qty_cache parameter */
131: gme_transactions_pvt.process_transactions
132: (p_api_version => 2.0
133: ,p_init_msg_list => fnd_api.g_false
134: ,p_commit => fnd_api.g_false
135: ,p_validation_level => fnd_api.g_valid_level_full
136: ,p_table => p_table
137: ,p_header_id => l_header_id
138: ,x_return_status => x_return_status
131: gme_transactions_pvt.process_transactions
132: (p_api_version => 2.0
133: ,p_init_msg_list => fnd_api.g_false
134: ,p_commit => fnd_api.g_false
135: ,p_validation_level => fnd_api.g_valid_level_full
136: ,p_table => p_table
137: ,p_header_id => l_header_id
138: ,x_return_status => x_return_status
139: ,x_msg_count => l_msg_count
140: ,x_msg_data => l_msg_data
141: ,x_trans_count => l_trans_count
142: ,p_clear_qty_cache => p_clear_qty_cache);
143:
144: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
145: IF g_debug <= gme_debug.g_log_statement THEN
146: gme_debug.put_line( g_pkg_name
147: || '.'
148: || l_api_name
154: RAISE error_save_batch;
155: END IF;
156: END IF; /* IF (NVL (l_header_id, 0) <> 0) */
157:
158: IF p_commit = fnd_api.g_true THEN
159: COMMIT;
160: END IF;
161:
162: IF g_debug <= gme_debug.g_log_procedure THEN
164: END IF;
165: EXCEPTION
166: WHEN error_save_batch THEN
167: gme_common_pvt.count_and_get (x_count => l_msg_count
168: ,p_encoded => fnd_api.g_false
169: ,x_data => l_msg_data);
170: WHEN OTHERS THEN
171: gme_when_others ( p_api_name => l_api_name
172: ,x_message_count => l_msg_count
178: PROCEDURE create_batch (
179: p_api_version IN NUMBER
180: ,p_validation_level IN NUMBER
181: := gme_common_pvt.g_max_errors
182: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
183: ,p_commit IN VARCHAR2 := fnd_api.g_false
184: ,x_message_count OUT NOCOPY NUMBER
185: ,x_message_list OUT NOCOPY VARCHAR2
186: ,x_return_status OUT NOCOPY VARCHAR2
179: p_api_version IN NUMBER
180: ,p_validation_level IN NUMBER
181: := gme_common_pvt.g_max_errors
182: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
183: ,p_commit IN VARCHAR2 := fnd_api.g_false
184: ,x_message_count OUT NOCOPY NUMBER
185: ,x_message_list OUT NOCOPY VARCHAR2
186: ,x_return_status OUT NOCOPY VARCHAR2
187: ,p_org_code IN VARCHAR2 := NULL
196: ,p_product_no IN VARCHAR2 := NULL
197: ,p_item_revision IN VARCHAR2 := NULL
198: ,p_product_id IN NUMBER := NULL
199: ,p_sum_all_prod_lines IN VARCHAR2 := 'A'
200: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
201: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
202: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
203: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
204: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
197: ,p_item_revision IN VARCHAR2 := NULL
198: ,p_product_id IN NUMBER := NULL
199: ,p_sum_all_prod_lines IN VARCHAR2 := 'A'
200: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
201: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
202: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
203: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
204: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
205: IS
198: ,p_product_id IN NUMBER := NULL
199: ,p_sum_all_prod_lines IN VARCHAR2 := 'A'
200: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
201: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
202: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
203: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
204: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
205: IS
206: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_BATCH';
199: ,p_sum_all_prod_lines IN VARCHAR2 := 'A'
200: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_true
201: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
202: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
203: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
204: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
205: IS
206: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_BATCH';
207: l_batch_header gme_batch_header%ROWTYPE;
252: || l_api_name);
253: END IF;
254:
255: /* Set the return status to success initially */
256: x_return_status := fnd_api.g_ret_sts_success;
257:
258: IF p_init_msg_list = fnd_api.g_true THEN
259: fnd_msg_pub.initialize;
260: END IF;
254:
255: /* Set the return status to success initially */
256: x_return_status := fnd_api.g_ret_sts_success;
257:
258: IF p_init_msg_list = fnd_api.g_true THEN
259: fnd_msg_pub.initialize;
260: END IF;
261:
262: IF NOT fnd_api.compatible_api_call (2.0
258: IF p_init_msg_list = fnd_api.g_true THEN
259: fnd_msg_pub.initialize;
260: END IF;
261:
262: IF NOT fnd_api.compatible_api_call (2.0
263: ,p_api_version
264: ,'create_batch'
265: ,g_pkg_name) THEN
266: RAISE fnd_api.g_exc_error;
262: IF NOT fnd_api.compatible_api_call (2.0
263: ,p_api_version
264: ,'create_batch'
265: ,g_pkg_name) THEN
266: RAISE fnd_api.g_exc_error;
267: END IF;
268:
269: l_batch_header := p_batch_header_rec;
270:
270:
271: IF (l_batch_header.organization_id IS NULL AND p_org_code IS NULL) THEN
272: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
273: fnd_msg_pub.ADD;
274: RAISE fnd_api.g_exc_error;
275: END IF;
276:
277: IF (l_batch_header.batch_type NOT IN
278: (gme_common_pvt.g_doc_type_batch, gme_common_pvt.g_doc_type_fpo) ) THEN
276:
277: IF (l_batch_header.batch_type NOT IN
278: (gme_common_pvt.g_doc_type_batch, gme_common_pvt.g_doc_type_fpo) ) THEN
279: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
280: RAISE fnd_api.g_exc_error;
281: END IF;
282:
283: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
284: gme_common_pvt.log_message ('GME_INVALID_FIELD'
279: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
280: RAISE fnd_api.g_exc_error;
281: END IF;
282:
283: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
284: gme_common_pvt.log_message ('GME_INVALID_FIELD'
285: ,'FIELD'
286: ,'p_contiguity_override');
287: RAISE fnd_api.g_exc_error;
283: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
284: gme_common_pvt.log_message ('GME_INVALID_FIELD'
285: ,'FIELD'
286: ,'p_contiguity_override');
287: RAISE fnd_api.g_exc_error;
288: ELSE
289: l_contiguity_override := p_contiguity_override;
290: END IF;
291:
288: ELSE
289: l_contiguity_override := p_contiguity_override;
290: END IF;
291:
292: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
293: gme_common_pvt.log_message ('GME_INVALID_FIELD'
294: ,'FIELD'
295: ,'p_use_workday_cal');
296: RAISE fnd_api.g_exc_error;
292: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
293: gme_common_pvt.log_message ('GME_INVALID_FIELD'
294: ,'FIELD'
295: ,'p_use_workday_cal');
296: RAISE fnd_api.g_exc_error;
297: END IF;
298:
299: IF (p_ignore_qty_below_cap NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
300: gme_common_pvt.log_message ('GME_INVALID_FIELD'
295: ,'p_use_workday_cal');
296: RAISE fnd_api.g_exc_error;
297: END IF;
298:
299: IF (p_ignore_qty_below_cap NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
300: gme_common_pvt.log_message ('GME_INVALID_FIELD'
301: ,'FIELD'
302: ,'p_ignore_qty_below_cap');
303: RAISE fnd_api.g_exc_error;
299: IF (p_ignore_qty_below_cap NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
300: gme_common_pvt.log_message ('GME_INVALID_FIELD'
301: ,'FIELD'
302: ,'p_ignore_qty_below_cap');
303: RAISE fnd_api.g_exc_error;
304: END IF;
305:
306: IF (p_creation_mode NOT IN ('INPUT', 'OUTPUT', 'RECIPE', 'PRODUCT') ) THEN
307: gme_common_pvt.log_message ('GME_API_UNSUPPORTED_MODE'
306: IF (p_creation_mode NOT IN ('INPUT', 'OUTPUT', 'RECIPE', 'PRODUCT') ) THEN
307: gme_common_pvt.log_message ('GME_API_UNSUPPORTED_MODE'
308: ,'MODE'
309: ,p_creation_mode);
310: RAISE fnd_api.g_exc_error;
311: ELSIF (p_creation_mode IN ('INPUT', 'OUTPUT', 'PRODUCT') ) THEN
312: IF (p_batch_size IS NULL) THEN
313: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
314: ,'FIELD_NAME'
312: IF (p_batch_size IS NULL) THEN
313: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
314: ,'FIELD_NAME'
315: ,'p_batch_size');
316: RAISE fnd_api.g_exc_error;
317: ELSIF (p_batch_size < 0) THEN
318: gme_common_pvt.log_message ('GME_INVALID_FIELD'
319: ,'FIELD'
320: ,'p_batch_size');
317: ELSIF (p_batch_size < 0) THEN
318: gme_common_pvt.log_message ('GME_INVALID_FIELD'
319: ,'FIELD'
320: ,'p_batch_size');
321: RAISE fnd_api.g_exc_error;
322: END IF;
323:
324: IF (p_batch_size_uom IS NULL) THEN
325: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
324: IF (p_batch_size_uom IS NULL) THEN
325: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
326: ,'FIELD_NAME'
327: ,'p_batch_size_uom');
328: RAISE fnd_api.g_exc_error;
329: ELSE
330: --added by qzeng no need to check if done in bulk validation
331: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
332: OPEN cur_validate_uom (p_batch_size_uom);
338: gme_common_pvt.log_message ('GME_INVALID_FIELD'
339: ,'FIELD'
340: ,'p_batch_size_uom');
341: CLOSE cur_validate_uom;
342: RAISE fnd_api.g_exc_error;
343: END IF;
344:
345: CLOSE cur_validate_uom;
346: END IF;
356: gme_common_pvt.setup (p_org_id => l_batch_header.organization_id
357: ,p_org_code => p_org_code);
358:
359: IF NOT gme_common_pvt.g_setup_done THEN
360: RAISE fnd_api.g_exc_error;
361: ELSE
362: l_batch_header.organization_id := gme_common_pvt.g_organization_id;
363: END IF;
364:
367: END IF;
368:
369: IF (gme_common_pvt.g_lab_ind = 0 AND l_batch_header.laboratory_ind = 1) THEN
370: gme_common_pvt.log_message ('GME_NOT_LAB_ORG');
371: RAISE fnd_api.g_exc_error;
372: END IF;
373:
374: IF (gme_common_pvt.g_plant_ind = 0 AND l_batch_header.batch_type = 10) THEN
375: gme_common_pvt.log_message ('GME_FPO_NO_CREATE');
372: END IF;
373:
374: IF (gme_common_pvt.g_plant_ind = 0 AND l_batch_header.batch_type = 10) THEN
375: gme_common_pvt.log_message ('GME_FPO_NO_CREATE');
376: RAISE fnd_api.g_exc_error;
377: END IF;
378:
379: IF (gme_common_pvt.g_lab_ind = 1 AND gme_common_pvt.g_plant_ind = 1) THEN
380: IF (l_batch_header.laboratory_ind = 1) THEN
380: IF (l_batch_header.laboratory_ind = 1) THEN
381: l_object_type := 'L';
382: ELSE
383: IF (l_batch_header.batch_type = gme_common_pvt.g_doc_type_fpo) THEN
384: l_object_type := fnd_api.g_false;
385: ELSE
386: l_object_type := 'P';
387: END IF;
388: END IF;
389: ELSIF (gme_common_pvt.g_lab_ind = 1) THEN
390: l_object_type := 'L';
391: ELSIF (gme_common_pvt.g_plant_ind = 1) THEN
392: IF (l_batch_header.batch_type = 10) THEN
393: l_object_type := fnd_api.g_false;
394: ELSE
395: l_object_type := 'P';
396: END IF;
397: END IF;
420: ELSE
421: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
422: ,'FIELD_NAME'
423: ,'p_product_no or p_product_id');
424: RAISE fnd_api.g_exc_error;
425: END IF;
426: --All error messages will be logged in this procedure itself..
427: gme_material_detail_pvt.validate_item_id(
428: p_org_id => l_batch_header.organization_id
429: ,p_item_id => l_item_id
430: ,x_item_rec => l_item_rec
431: ,x_return_status => l_return_status);
432:
433: IF l_return_status <> fnd_api.g_ret_sts_success THEN
434: RAISE fnd_api.g_exc_error;
435: END IF;
436: --Bug#5256138 End
437: ELSIF p_creation_mode = 'OUTPUT' THEN
430: ,x_item_rec => l_item_rec
431: ,x_return_status => l_return_status);
432:
433: IF l_return_status <> fnd_api.g_ret_sts_success THEN
434: RAISE fnd_api.g_exc_error;
435: END IF;
436: --Bug#5256138 End
437: ELSIF p_creation_mode = 'OUTPUT' THEN
438: l_total_output := p_batch_size;
464: ,x_msg_data => l_msg_list
465: ,x_return_code => l_return_code
466: ,x_recipe_validity_out => l_validity_tbl);
467:
468: IF l_return_status <> fnd_api.g_ret_sts_success THEN
469: RAISE fnd_api.g_exc_error;
470: ELSIF l_validity_tbl.COUNT = 0 THEN
471: fnd_message.set_name ('GMD', 'GMD_NO_VLDTY_RLE_CRIT');
472: fnd_msg_pub.ADD;
465: ,x_return_code => l_return_code
466: ,x_recipe_validity_out => l_validity_tbl);
467:
468: IF l_return_status <> fnd_api.g_ret_sts_success THEN
469: RAISE fnd_api.g_exc_error;
470: ELSIF l_validity_tbl.COUNT = 0 THEN
471: fnd_message.set_name ('GMD', 'GMD_NO_VLDTY_RLE_CRIT');
472: fnd_msg_pub.ADD;
473: RAISE fnd_api.g_exc_error;
469: RAISE fnd_api.g_exc_error;
470: ELSIF l_validity_tbl.COUNT = 0 THEN
471: fnd_message.set_name ('GMD', 'GMD_NO_VLDTY_RLE_CRIT');
472: fnd_msg_pub.ADD;
473: RAISE fnd_api.g_exc_error;
474: ELSE
475: l_batch_header.recipe_validity_rule_id :=
476: l_validity_tbl (1).recipe_validity_rule_id;
477: END IF;
497: ,p_object_type => l_object_type
498: ,p_start_date => p_batch_header_rec.plan_start_date
499: ,p_cmplt_date => p_batch_header_rec.plan_cmplt_date
500: ,p_creation_mode => p_creation_mode) ) THEN
501: RAISE fnd_api.g_exc_error;
502: END IF;
503: END IF;
504:
505: IF g_debug <= gme_debug.g_log_statement THEN
508:
509: IF p_use_workday_cal IS NOT NULL THEN
510: l_use := p_use_workday_cal;
511:
512: IF l_use = fnd_api.g_true THEN
513: IF (gme_common_pvt.g_calendar_code IS NOT NULL) THEN
514: IF (p_batch_header_rec.plan_start_date IS NOT NULL) THEN
515: IF NOT gmp_calendar_api.is_working_daytime
516: (1.0
523: ('GME_NON_WORKING_TIME'
524: ,'PDATE'
525: ,fnd_date.date_to_displaydt
526: (p_batch_header_rec.plan_start_date) );
527: RAISE fnd_api.g_exc_error;
528: END IF;
529: END IF;
530:
531: IF (p_batch_header_rec.plan_cmplt_date IS NOT NULL) THEN
540: ('GME_NON_WORKING_TIME'
541: ,'PDATE'
542: ,TO_CHAR (p_batch_header_rec.plan_cmplt_date
543: ,'DD-MON-YYYY HH24:MI:SS') );
544: RAISE fnd_api.g_exc_error;
545: END IF;
546: END IF;
547:
548: IF p_batch_header_rec.plan_cmplt_date IS NULL
558: ('GME_NON_WORKING_TIME'
559: ,'PDATE'
560: ,TO_CHAR (SYSDATE
561: ,'DD-MON-YYYY HH24:MI:SS') );
562: RAISE fnd_api.g_exc_error;
563: END IF;
564: END IF;
565: END IF;
566: END IF;
571: END IF;
572:
573: gme_api_main.create_batch
574: (p_validation_level => p_validation_level
575: ,p_init_msg_list => fnd_api.g_false
576: ,x_message_count => x_message_count
577: ,x_message_list => x_message_list
578: ,x_return_status => x_return_status
579: ,p_batch_header_rec => l_batch_header
592: ,p_contiguity_override => l_contiguity_override
593: ,p_use_least_cost_validity_rule => p_use_least_cost_validity_rule
594: ,x_exception_material_tbl => x_exception_material_tbl);
595:
596: IF ( x_return_status <> fnd_api.g_ret_sts_success
597: AND x_return_status <> gme_common_pvt.g_inv_short_err) THEN
598: RAISE fnd_api.g_exc_error;
599: END IF;
600:
594: ,x_exception_material_tbl => x_exception_material_tbl);
595:
596: IF ( x_return_status <> fnd_api.g_ret_sts_success
597: AND x_return_status <> gme_common_pvt.g_inv_short_err) THEN
598: RAISE fnd_api.g_exc_error;
599: END IF;
600:
601: IF (p_commit = fnd_api.g_true) THEN
602: COMMIT;
597: AND x_return_status <> gme_common_pvt.g_inv_short_err) THEN
598: RAISE fnd_api.g_exc_error;
599: END IF;
600:
601: IF (p_commit = fnd_api.g_true) THEN
602: COMMIT;
603: END IF;
604:
605: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
603: END IF;
604:
605: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
606: gme_common_pvt.count_and_get (x_count => x_message_count
607: ,p_encoded => fnd_api.g_false
608: ,x_data => x_message_list);
609:
610: IF g_debug <= gme_debug.g_log_procedure THEN
611: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
611: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
612: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
613: END IF;
614: EXCEPTION
615: WHEN fnd_api.g_exc_error THEN
616: x_batch_header_rec := NULL;
617: x_return_status := fnd_api.g_ret_sts_error;
618: gme_common_pvt.count_and_get (x_count => x_message_count
619: ,p_encoded => fnd_api.g_false
613: END IF;
614: EXCEPTION
615: WHEN fnd_api.g_exc_error THEN
616: x_batch_header_rec := NULL;
617: x_return_status := fnd_api.g_ret_sts_error;
618: gme_common_pvt.count_and_get (x_count => x_message_count
619: ,p_encoded => fnd_api.g_false
620: ,x_data => x_message_list);
621: WHEN OTHERS THEN
615: WHEN fnd_api.g_exc_error THEN
616: x_batch_header_rec := NULL;
617: x_return_status := fnd_api.g_ret_sts_error;
618: gme_common_pvt.count_and_get (x_count => x_message_count
619: ,p_encoded => fnd_api.g_false
620: ,x_data => x_message_list);
621: WHEN OTHERS THEN
622: x_batch_header_rec := NULL;
623: gme_when_others ( p_api_name => l_api_name
630: PROCEDURE create_phantom (
631: p_api_version IN NUMBER
632: ,p_validation_level IN NUMBER
633: := gme_common_pvt.g_max_errors
634: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
635: ,p_commit IN VARCHAR2 := fnd_api.g_false
636: ,x_message_count OUT NOCOPY NUMBER
637: ,x_message_list OUT NOCOPY VARCHAR2
638: ,x_return_status OUT NOCOPY VARCHAR2
631: p_api_version IN NUMBER
632: ,p_validation_level IN NUMBER
633: := gme_common_pvt.g_max_errors
634: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
635: ,p_commit IN VARCHAR2 := fnd_api.g_false
636: ,x_message_count OUT NOCOPY NUMBER
637: ,x_message_list OUT NOCOPY VARCHAR2
638: ,x_return_status OUT NOCOPY VARCHAR2
639: ,p_material_detail_rec IN gme_material_details%ROWTYPE
641: ,p_org_code IN VARCHAR2
642: ,p_batch_no IN VARCHAR2 DEFAULT NULL
643: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
644: ,p_validity_rule_id IN NUMBER
645: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
646: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
647: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
648: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
649: IS
642: ,p_batch_no IN VARCHAR2 DEFAULT NULL
643: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
644: ,p_validity_rule_id IN NUMBER
645: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
646: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
647: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
648: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
649: IS
650: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_PHANTOM';
643: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
644: ,p_validity_rule_id IN NUMBER
645: ,p_use_workday_cal IN VARCHAR2 := fnd_api.g_true
646: ,p_contiguity_override IN VARCHAR2 := fnd_api.g_true
647: ,p_use_least_cost_validity_rule IN VARCHAR2 := fnd_api.g_false
648: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
649: IS
650: l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_PHANTOM';
651: phantom_creation_failure EXCEPTION;
660: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
661: || l_api_name);
662: END IF;
663:
664: x_return_status := fnd_api.g_ret_sts_success;
665:
666: /* Set savepoint here */
667: SAVEPOINT create_phantom;
668:
665:
666: /* Set savepoint here */
667: SAVEPOINT create_phantom;
668:
669: IF p_init_msg_list = fnd_api.g_true THEN
670: fnd_msg_pub.initialize;
671: gme_common_pvt.g_error_count := 0;
672: END IF;
673:
670: fnd_msg_pub.initialize;
671: gme_common_pvt.g_error_count := 0;
672: END IF;
673:
674: IF NOT fnd_api.compatible_api_call (2.0
675: ,p_api_version
676: ,'create_phantom'
677: ,g_pkg_name) THEN
678: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
675: ,p_api_version
676: ,'create_phantom'
677: ,g_pkg_name) THEN
678: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
679: RAISE fnd_api.g_exc_error;
680: END IF;
681:
682: IF (p_material_detail_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
683: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
681:
682: IF (p_material_detail_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
683: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
684: fnd_msg_pub.ADD;
685: RAISE fnd_api.g_exc_error;
686: END IF;
687:
688: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
689: gme_common_pvt.log_message ('GME_INVALID_FIELD'
684: fnd_msg_pub.ADD;
685: RAISE fnd_api.g_exc_error;
686: END IF;
687:
688: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
689: gme_common_pvt.log_message ('GME_INVALID_FIELD'
690: ,'FIELD'
691: ,'p_contiguity_override');
692: RAISE fnd_api.g_exc_error;
688: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
689: gme_common_pvt.log_message ('GME_INVALID_FIELD'
690: ,'FIELD'
691: ,'p_contiguity_override');
692: RAISE fnd_api.g_exc_error;
693: END IF;
694:
695: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
696: gme_common_pvt.log_message ('GME_INVALID_FIELD'
691: ,'p_contiguity_override');
692: RAISE fnd_api.g_exc_error;
693: END IF;
694:
695: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
696: gme_common_pvt.log_message ('GME_INVALID_FIELD'
697: ,'FIELD'
698: ,'p_use_workday_cal');
699: RAISE fnd_api.g_exc_error;
695: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
696: gme_common_pvt.log_message ('GME_INVALID_FIELD'
697: ,'FIELD'
698: ,'p_use_workday_cal');
699: RAISE fnd_api.g_exc_error;
700: END IF;
701:
702: l_material_detail := p_material_detail_rec;
703: gme_common_pvt.g_setup_done :=
704: gme_common_pvt.setup (p_material_detail_rec.organization_id
705: ,p_org_code);
706:
707: IF NOT gme_common_pvt.g_setup_done THEN
708: RAISE fnd_api.g_exc_error;
709: ELSE
710: l_material_detail.organization_id :=
711: gme_common_pvt.g_organization_id;
712: END IF;
712: END IF;
713:
714: gme_api_main.create_phantom
715: (p_validation_level => p_validation_level
716: ,p_init_msg_list => fnd_api.g_false
717: ,x_message_count => x_message_count
718: ,x_message_list => x_message_list
719: ,x_return_status => x_return_status
720: ,p_material_detail_rec => l_material_detail
726: ,p_contiguity_override => p_contiguity_override
727: ,p_use_least_cost_validity_rule => p_use_least_cost_validity_rule
728: ,x_exception_material_tbl => x_exception_material_tbl);
729:
730: IF x_return_status <> fnd_api.g_ret_sts_success THEN
731: RAISE phantom_creation_failure;
732: END IF;
733:
734: IF (p_commit = fnd_api.g_true) THEN
730: IF x_return_status <> fnd_api.g_ret_sts_success THEN
731: RAISE phantom_creation_failure;
732: END IF;
733:
734: IF (p_commit = fnd_api.g_true) THEN
735: COMMIT;
736: END IF;
737:
738: IF g_debug <= gme_debug.g_log_procedure THEN
743: WHEN phantom_creation_failure THEN
744: ROLLBACK TO SAVEPOINT create_phantom;
745: x_material_detail_rec := NULL;
746: gme_common_pvt.count_and_get (x_count => x_message_count
747: ,p_encoded => fnd_api.g_false
748: ,x_data => x_message_list);
749: WHEN fnd_api.g_exc_error THEN
750: ROLLBACK TO SAVEPOINT create_phantom;
751: x_material_detail_rec := NULL;
745: x_material_detail_rec := NULL;
746: gme_common_pvt.count_and_get (x_count => x_message_count
747: ,p_encoded => fnd_api.g_false
748: ,x_data => x_message_list);
749: WHEN fnd_api.g_exc_error THEN
750: ROLLBACK TO SAVEPOINT create_phantom;
751: x_material_detail_rec := NULL;
752: x_return_status := fnd_api.g_ret_sts_error;
753: gme_common_pvt.count_and_get (x_count => x_message_count
748: ,x_data => x_message_list);
749: WHEN fnd_api.g_exc_error THEN
750: ROLLBACK TO SAVEPOINT create_phantom;
751: x_material_detail_rec := NULL;
752: x_return_status := fnd_api.g_ret_sts_error;
753: gme_common_pvt.count_and_get (x_count => x_message_count
754: ,p_encoded => fnd_api.g_false
755: ,x_data => x_message_list);
756: WHEN OTHERS THEN
750: ROLLBACK TO SAVEPOINT create_phantom;
751: x_material_detail_rec := NULL;
752: x_return_status := fnd_api.g_ret_sts_error;
753: gme_common_pvt.count_and_get (x_count => x_message_count
754: ,p_encoded => fnd_api.g_false
755: ,x_data => x_message_list);
756: WHEN OTHERS THEN
757: ROLLBACK TO SAVEPOINT create_phantom;
758: x_material_detail_rec := NULL;
798: || l_api_name);
799: END IF;
800:
801: /* Set the return status to success initially */
802: x_return_status := fnd_api.g_ret_sts_success;
803:
804: /* Set savepoint here */
805: SAVEPOINT scale_batch;
806:
804: /* Set savepoint here */
805: SAVEPOINT scale_batch;
806:
807: -- Initialize message list and count if needed
808: IF p_init_msg_list = fnd_api.g_true THEN
809: fnd_msg_pub.initialize;
810: END IF;
811:
812: /* Make sure we are call compatible */
809: fnd_msg_pub.initialize;
810: END IF;
811:
812: /* Make sure we are call compatible */
813: IF NOT fnd_api.compatible_api_call (2.0
814: ,p_api_version
815: ,'scale_batch'
816: ,g_pkg_name) THEN
817: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
814: ,p_api_version
815: ,'scale_batch'
816: ,g_pkg_name) THEN
817: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
818: RAISE fnd_api.g_exc_error;
819: END IF;
820: gme_common_pvt.validate_batch
821: (p_batch_header_rec => p_batch_header_rec
822: ,p_org_code => p_org_code
825: ,x_message_count => x_message_count
826: ,x_message_list => x_message_list
827: ,x_return_status => x_return_status );
828:
829: IF x_return_status <> fnd_api.g_ret_sts_success THEN
830: IF (g_debug = gme_debug.g_log_statement) THEN
831: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
832: || ': batch validate error ');
833: END IF;
830: IF (g_debug = gme_debug.g_log_statement) THEN
831: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
832: || ': batch validate error ');
833: END IF;
834: RAISE fnd_api.g_exc_error;
835: END IF;
836:
837: /* Check for p_qty_type */
838: IF (p_qty_type NOT IN (0, 1) ) THEN
836:
837: /* Check for p_qty_type */
838: IF (p_qty_type NOT IN (0, 1) ) THEN
839: gme_common_pvt.log_message ('GME_INVALID_QUANTITY_TYPE');
840: RAISE fnd_api.g_exc_error;
841: END IF;
842:
843: /* Check for p_recalc_dates */
844: IF (p_recalc_dates NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
840: RAISE fnd_api.g_exc_error;
841: END IF;
842:
843: /* Check for p_recalc_dates */
844: IF (p_recalc_dates NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
845: gme_common_pvt.log_message ('GME_INVALID_FIELD'
846: ,'FIELD'
847: ,'p_recalc_dates');
848: RAISE fnd_api.g_exc_error;
844: IF (p_recalc_dates NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
845: gme_common_pvt.log_message ('GME_INVALID_FIELD'
846: ,'FIELD'
847: ,'p_recalc_dates');
848: RAISE fnd_api.g_exc_error;
849: END IF;
850:
851: /* Check for p_use_workday_cal */
852: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
848: RAISE fnd_api.g_exc_error;
849: END IF;
850:
851: /* Check for p_use_workday_cal */
852: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
853: gme_common_pvt.log_message ('GME_INVALID_FIELD'
854: ,'FIELD'
855: ,'p_use_workday_cal');
856: RAISE fnd_api.g_exc_error;
852: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
853: gme_common_pvt.log_message ('GME_INVALID_FIELD'
854: ,'FIELD'
855: ,'p_use_workday_cal');
856: RAISE fnd_api.g_exc_error;
857: END IF;
858:
859: /* Check for p_contiguity_override */
860: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
856: RAISE fnd_api.g_exc_error;
857: END IF;
858:
859: /* Check for p_contiguity_override */
860: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
861: gme_common_pvt.log_message ('GME_INVALID_FIELD'
862: ,'FIELD'
863: ,'p_contiguity_override');
864: RAISE fnd_api.g_exc_error;
860: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
861: gme_common_pvt.log_message ('GME_INVALID_FIELD'
862: ,'FIELD'
863: ,'p_contiguity_override');
864: RAISE fnd_api.g_exc_error;
865: END IF;
866:
867: x_batch_header_rec := l_batch_header_rec;
868: gme_api_main.scale_batch
866:
867: x_batch_header_rec := l_batch_header_rec;
868: gme_api_main.scale_batch
869: (p_validation_level => p_validation_level
870: ,p_init_msg_list => fnd_api.g_false
871: ,x_message_count => x_message_count
872: ,x_message_list => x_message_list
873: ,x_return_status => x_return_status
874: ,p_batch_header_rec => l_batch_header_rec
882: ,x_exception_material_tbl => x_exception_material_tbl);
883: x_message_count := 0;
884:
885: --Bug#5459105 Begin
886: IF x_return_status = fnd_api.g_ret_sts_success THEN
887: IF p_commit = fnd_api.g_true THEN
888: gme_api_pub.save_batch (p_header_id => NULL
889: ,p_table => NULL
890: ,p_commit => fnd_api.g_false
883: x_message_count := 0;
884:
885: --Bug#5459105 Begin
886: IF x_return_status = fnd_api.g_ret_sts_success THEN
887: IF p_commit = fnd_api.g_true THEN
888: gme_api_pub.save_batch (p_header_id => NULL
889: ,p_table => NULL
890: ,p_commit => fnd_api.g_false
891: ,x_return_status => x_return_status);
886: IF x_return_status = fnd_api.g_ret_sts_success THEN
887: IF p_commit = fnd_api.g_true THEN
888: gme_api_pub.save_batch (p_header_id => NULL
889: ,p_table => NULL
890: ,p_commit => fnd_api.g_false
891: ,x_return_status => x_return_status);
892:
893: IF x_return_status = fnd_api.g_ret_sts_success THEN
894: COMMIT;
889: ,p_table => NULL
890: ,p_commit => fnd_api.g_false
891: ,x_return_status => x_return_status);
892:
893: IF x_return_status = fnd_api.g_ret_sts_success THEN
894: COMMIT;
895: ELSE
896: RAISE fnd_api.g_exc_error;
897: END IF;
892:
893: IF x_return_status = fnd_api.g_ret_sts_success THEN
894: COMMIT;
895: ELSE
896: RAISE fnd_api.g_exc_error;
897: END IF;
898: END IF;
899: ELSE
900: RAISE scale_batch_failed;
902: --Bug#5459105 End
903:
904: gme_common_pvt.log_message ('GME_SCALE_SUCCESS');
905: gme_common_pvt.count_and_get (x_count => x_message_count
906: ,p_encoded => fnd_api.g_false
907: ,x_data => x_message_list);
908:
909: IF g_debug <= gme_debug.g_log_procedure THEN
910: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
914: WHEN scale_batch_failed THEN
915: ROLLBACK TO SAVEPOINT scale_batch;
916: x_batch_header_rec := NULL;
917: gme_common_pvt.count_and_get (x_count => x_message_count
918: ,p_encoded => fnd_api.g_false
919: ,x_data => x_message_list);
920: WHEN fnd_api.g_exc_error THEN
921: ROLLBACK TO SAVEPOINT scale_batch;
922: x_batch_header_rec := NULL;
916: x_batch_header_rec := NULL;
917: gme_common_pvt.count_and_get (x_count => x_message_count
918: ,p_encoded => fnd_api.g_false
919: ,x_data => x_message_list);
920: WHEN fnd_api.g_exc_error THEN
921: ROLLBACK TO SAVEPOINT scale_batch;
922: x_batch_header_rec := NULL;
923: x_return_status := fnd_api.g_ret_sts_error;
924: gme_common_pvt.count_and_get (x_count => x_message_count
919: ,x_data => x_message_list);
920: WHEN fnd_api.g_exc_error THEN
921: ROLLBACK TO SAVEPOINT scale_batch;
922: x_batch_header_rec := NULL;
923: x_return_status := fnd_api.g_ret_sts_error;
924: gme_common_pvt.count_and_get (x_count => x_message_count
925: ,p_encoded => fnd_api.g_false
926: ,x_data => x_message_list);
927: WHEN OTHERS THEN
921: ROLLBACK TO SAVEPOINT scale_batch;
922: x_batch_header_rec := NULL;
923: x_return_status := fnd_api.g_ret_sts_error;
924: gme_common_pvt.count_and_get (x_count => x_message_count
925: ,p_encoded => fnd_api.g_false
926: ,x_data => x_message_list);
927: WHEN OTHERS THEN
928: ROLLBACK TO SAVEPOINT scale_batch;
929: x_batch_header_rec := NULL;
961: || l_api_name);
962: END IF;
963:
964: /* Set the return status to success initially */
965: x_return_status := fnd_api.g_ret_sts_success;
966:
967: /* Set savepoint here */
968: SAVEPOINT theoretical_yield_batch;
969:
967: /* Set savepoint here */
968: SAVEPOINT theoretical_yield_batch;
969:
970: /* Initialize message list and count if needed */
971: IF p_init_msg_list = fnd_api.g_true THEN
972: fnd_msg_pub.initialize;
973: END IF;
974:
975: /* Make sure we are call compatible */
972: fnd_msg_pub.initialize;
973: END IF;
974:
975: /* Make sure we are call compatible */
976: IF NOT fnd_api.compatible_api_call (2.0
977: ,p_api_version
978: ,'theoretical_yield_batch'
979: ,g_pkg_name) THEN
980: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
977: ,p_api_version
978: ,'theoretical_yield_batch'
979: ,g_pkg_name) THEN
980: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
981: RAISE fnd_api.g_exc_error;
982: END IF;
983: gme_common_pvt.validate_batch
984: (p_batch_header_rec => p_batch_header_rec
985: ,p_org_code => p_org_code
988: ,x_message_count => x_message_count
989: ,x_message_list => x_message_list
990: ,x_return_status => x_return_status );
991:
992: IF x_return_status <> fnd_api.g_ret_sts_success THEN
993: IF (g_debug = gme_debug.g_log_statement) THEN
994: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
995: || ': batch validate error ');
996: END IF;
993: IF (g_debug = gme_debug.g_log_statement) THEN
994: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
995: || ': batch validate error ');
996: END IF;
997: RAISE fnd_api.g_exc_error;
998: END IF;
999: gme_api_main.theoretical_yield_batch
1000: (p_validation_level => p_validation_level
1001: ,p_init_msg_list => fnd_api.g_false
997: RAISE fnd_api.g_exc_error;
998: END IF;
999: gme_api_main.theoretical_yield_batch
1000: (p_validation_level => p_validation_level
1001: ,p_init_msg_list => fnd_api.g_false
1002: ,x_message_count => x_message_count
1003: ,x_message_list => x_message_list
1004: ,p_batch_header_rec => l_batch_header_rec
1005: ,p_scale_factor => p_scale_factor
1005: ,p_scale_factor => p_scale_factor
1006: ,x_return_status => x_return_status);
1007:
1008: --Bug#5459105 Begin
1009: IF x_return_status = fnd_api.g_ret_sts_success THEN
1010: IF p_commit = fnd_api.g_true THEN
1011: gme_api_pub.save_batch (p_header_id => NULL
1012: ,p_table => NULL
1013: ,p_commit => fnd_api.g_false
1006: ,x_return_status => x_return_status);
1007:
1008: --Bug#5459105 Begin
1009: IF x_return_status = fnd_api.g_ret_sts_success THEN
1010: IF p_commit = fnd_api.g_true THEN
1011: gme_api_pub.save_batch (p_header_id => NULL
1012: ,p_table => NULL
1013: ,p_commit => fnd_api.g_false
1014: ,x_return_status => x_return_status);
1009: IF x_return_status = fnd_api.g_ret_sts_success THEN
1010: IF p_commit = fnd_api.g_true THEN
1011: gme_api_pub.save_batch (p_header_id => NULL
1012: ,p_table => NULL
1013: ,p_commit => fnd_api.g_false
1014: ,x_return_status => x_return_status);
1015:
1016: IF x_return_status = fnd_api.g_ret_sts_success THEN
1017: COMMIT;
1012: ,p_table => NULL
1013: ,p_commit => fnd_api.g_false
1014: ,x_return_status => x_return_status);
1015:
1016: IF x_return_status = fnd_api.g_ret_sts_success THEN
1017: COMMIT;
1018: ELSE
1019: RAISE fnd_api.g_exc_error;
1020: END IF;
1015:
1016: IF x_return_status = fnd_api.g_ret_sts_success THEN
1017: COMMIT;
1018: ELSE
1019: RAISE fnd_api.g_exc_error;
1020: END IF;
1021: END IF;
1022: ELSE
1023: RAISE theoretical_yield_failed;
1028: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
1029: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
1030: END IF;
1031: EXCEPTION
1032: WHEN fnd_api.g_exc_error THEN
1033: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1034: x_return_status := fnd_api.g_ret_sts_error;
1035: gme_common_pvt.count_and_get (x_count => x_message_count
1036: ,p_encoded => fnd_api.g_false
1030: END IF;
1031: EXCEPTION
1032: WHEN fnd_api.g_exc_error THEN
1033: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1034: x_return_status := fnd_api.g_ret_sts_error;
1035: gme_common_pvt.count_and_get (x_count => x_message_count
1036: ,p_encoded => fnd_api.g_false
1037: ,x_data => x_message_list);
1038: WHEN theoretical_yield_failed THEN
1032: WHEN fnd_api.g_exc_error THEN
1033: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1034: x_return_status := fnd_api.g_ret_sts_error;
1035: gme_common_pvt.count_and_get (x_count => x_message_count
1036: ,p_encoded => fnd_api.g_false
1037: ,x_data => x_message_list);
1038: WHEN theoretical_yield_failed THEN
1039: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1040: gme_common_pvt.count_and_get (x_count => x_message_count
1037: ,x_data => x_message_list);
1038: WHEN theoretical_yield_failed THEN
1039: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1040: gme_common_pvt.count_and_get (x_count => x_message_count
1041: ,p_encoded => fnd_api.g_false
1042: ,x_data => x_message_list);
1043: WHEN OTHERS THEN
1044: ROLLBACK TO SAVEPOINT theoretical_yield_batch;
1045: gme_when_others ( p_api_name => l_api_name
1058: #########################################################################*/
1059: PROCEDURE update_actual_rsrc_usage (
1060: p_api_version IN NUMBER := 2.0
1061: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1062: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1063: ,p_commit IN VARCHAR2 := fnd_api.g_false
1064: ,p_org_code IN VARCHAR2
1065: ,p_batch_no IN VARCHAR2 := NULL
1066: ,p_batchstep_no IN NUMBER := NULL
1059: PROCEDURE update_actual_rsrc_usage (
1060: p_api_version IN NUMBER := 2.0
1061: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1062: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1063: ,p_commit IN VARCHAR2 := fnd_api.g_false
1064: ,p_org_code IN VARCHAR2
1065: ,p_batch_no IN VARCHAR2 := NULL
1066: ,p_batchstep_no IN NUMBER := NULL
1067: ,p_activity IN VARCHAR2 := NULL
1068: ,p_resource IN VARCHAR2 := NULL
1069: ,p_instance_no IN NUMBER := NULL
1070: ,p_reason_name IN VARCHAR2 := NULL
1071: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1072: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1073: ,x_rsrc_txn_rec IN OUT NOCOPY gme_resource_txns%ROWTYPE
1074: ,x_message_count OUT NOCOPY NUMBER
1075: ,x_message_list OUT NOCOPY VARCHAR2
1076: ,x_return_status OUT NOCOPY VARCHAR2)
1101: IF g_debug <> -1 THEN
1102: gme_debug.log_initialize ('UpdateResource');
1103: END IF;
1104: /* Set the return status to success initially */
1105: x_return_status := fnd_api.g_ret_sts_success;
1106: /* Initialize message list and count if needed */
1107: IF p_init_msg_list = fnd_api.g_true THEN
1108: fnd_msg_pub.initialize;
1109: gme_common_pvt.g_error_count := 0;
1103: END IF;
1104: /* Set the return status to success initially */
1105: x_return_status := fnd_api.g_ret_sts_success;
1106: /* Initialize message list and count if needed */
1107: IF p_init_msg_list = fnd_api.g_true THEN
1108: fnd_msg_pub.initialize;
1109: gme_common_pvt.g_error_count := 0;
1110: END IF;
1111:
1112: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1113: IF (l_rsrc_txn_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
1114: gme_common_pvt.log_message(p_product_code => 'INV'
1115: ,p_message_code => 'INV_ORG_REQUIRED');
1116: RAISE fnd_api.g_exc_error;
1117: END IF;
1118: /* Setup the common constants used accross the apis */
1119: gme_common_pvt.g_setup_done :=
1120: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1120: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1121: ,p_org_code => p_org_code);
1122:
1123: IF NOT gme_common_pvt.g_setup_done THEN
1124: RAISE fnd_api.g_exc_error;
1125: ELSE
1126: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1127: END IF;
1128:
1126: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1127: END IF;
1128:
1129: /* Make sure we are call compatible */
1130: IF NOT fnd_api.compatible_api_call (2.0
1131: ,p_api_version
1132: ,'update_actual_resource_usage'
1133: ,g_pkg_name) THEN
1134: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1131: ,p_api_version
1132: ,'update_actual_resource_usage'
1133: ,g_pkg_name) THEN
1134: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1135: RAISE fnd_api.g_exc_error;
1136: END IF;
1137:
1138: IF p_validate_flexfields = 'T' THEN
1139: gme_common_pvt.g_flex_validate_prof := 1;
1162: gme_common_pvt.g_flex_validate_prof := 0;
1163:
1164: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1165:
1166: IF x_return_status = fnd_api.g_ret_sts_success THEN
1167: IF p_commit = fnd_api.g_true THEN
1168: gme_api_pub.save_batch (p_header_id => NULL
1169: ,p_table => NULL
1170: ,p_commit => fnd_api.g_false
1163:
1164: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1165:
1166: IF x_return_status = fnd_api.g_ret_sts_success THEN
1167: IF p_commit = fnd_api.g_true THEN
1168: gme_api_pub.save_batch (p_header_id => NULL
1169: ,p_table => NULL
1170: ,p_commit => fnd_api.g_false
1171: ,x_return_status => x_return_status);
1166: IF x_return_status = fnd_api.g_ret_sts_success THEN
1167: IF p_commit = fnd_api.g_true THEN
1168: gme_api_pub.save_batch (p_header_id => NULL
1169: ,p_table => NULL
1170: ,p_commit => fnd_api.g_false
1171: ,x_return_status => x_return_status);
1172:
1173: IF x_return_status = fnd_api.g_ret_sts_success THEN
1174: COMMIT;
1169: ,p_table => NULL
1170: ,p_commit => fnd_api.g_false
1171: ,x_return_status => x_return_status);
1172:
1173: IF x_return_status = fnd_api.g_ret_sts_success THEN
1174: COMMIT;
1175: ELSE
1176: RAISE fnd_api.g_exc_error;
1177: END IF;
1172:
1173: IF x_return_status = fnd_api.g_ret_sts_success THEN
1174: COMMIT;
1175: ELSE
1176: RAISE fnd_api.g_exc_error;
1177: END IF;
1178: END IF;
1179: ELSE
1180: RAISE update_rsrc_usage;
1181: END IF;
1182:
1183: /* In order to get the poc_trans_id */
1184: /* Lets now load the transactions associated with the batch into the temporary table */
1185: IF p_commit = fnd_api.g_true THEN
1186: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header
1187: ,l_batch_header) ) THEN
1188: RAISE fnd_api.g_exc_error;
1189: END IF;
1184: /* Lets now load the transactions associated with the batch into the temporary table */
1185: IF p_commit = fnd_api.g_true THEN
1186: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header
1187: ,l_batch_header) ) THEN
1188: RAISE fnd_api.g_exc_error;
1189: END IF;
1190: gme_trans_engine_util.load_rsrc_trans
1191: (p_batch_row => l_batch_header
1192: ,x_rsc_row_count => l_rsrc_trans_count
1191: (p_batch_row => l_batch_header
1192: ,x_rsc_row_count => l_rsrc_trans_count
1193: ,x_return_status => x_return_status);
1194:
1195: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1196: RAISE fnd_api.g_exc_error;
1197: END IF;
1198:
1199: OPEN cur_get_trans_id (x_rsrc_txn_rec.line_id);
1192: ,x_rsc_row_count => l_rsrc_trans_count
1193: ,x_return_status => x_return_status);
1194:
1195: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1196: RAISE fnd_api.g_exc_error;
1197: END IF;
1198:
1199: OPEN cur_get_trans_id (x_rsrc_txn_rec.line_id);
1200: FETCH cur_get_trans_id INTO x_rsrc_txn_rec;
1207: END IF;
1208:
1209: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
1210: gme_common_pvt.count_and_get (x_count => x_message_count
1211: ,p_encoded => fnd_api.g_false
1212: ,x_data => x_message_list);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1215: x_return_status := fnd_api.g_ret_sts_error;
1210: gme_common_pvt.count_and_get (x_count => x_message_count
1211: ,p_encoded => fnd_api.g_false
1212: ,x_data => x_message_list);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1215: x_return_status := fnd_api.g_ret_sts_error;
1216: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
1217: gme_common_pvt.count_and_get (x_count => x_message_count
1218: ,p_encoded => fnd_api.g_false
1211: ,p_encoded => fnd_api.g_false
1212: ,x_data => x_message_list);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1215: x_return_status := fnd_api.g_ret_sts_error;
1216: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
1217: gme_common_pvt.count_and_get (x_count => x_message_count
1218: ,p_encoded => fnd_api.g_false
1219: ,x_data => x_message_list);
1214: WHEN fnd_api.g_exc_error THEN
1215: x_return_status := fnd_api.g_ret_sts_error;
1216: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
1217: gme_common_pvt.count_and_get (x_count => x_message_count
1218: ,p_encoded => fnd_api.g_false
1219: ,x_data => x_message_list);
1220: WHEN update_rsrc_usage THEN
1221: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
1222: gme_common_pvt.count_and_get (x_count => x_message_count
1219: ,x_data => x_message_list);
1220: WHEN update_rsrc_usage THEN
1221: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
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: WHEN OTHERS THEN
1226: ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
1227: gme_when_others ( p_api_name => l_api_name
1240: #########################################################################*/
1241: PROCEDURE insert_incr_actual_rsrc_txn (
1242: p_api_version IN NUMBER := 2.0
1243: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1244: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1245: ,p_commit IN VARCHAR2 := fnd_api.g_false
1246: ,p_org_code IN VARCHAR2
1247: ,p_batch_no IN VARCHAR2 := NULL
1248: ,p_batchstep_no IN NUMBER := NULL
1241: PROCEDURE insert_incr_actual_rsrc_txn (
1242: p_api_version IN NUMBER := 2.0
1243: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1244: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1245: ,p_commit IN VARCHAR2 := fnd_api.g_false
1246: ,p_org_code IN VARCHAR2
1247: ,p_batch_no IN VARCHAR2 := NULL
1248: ,p_batchstep_no IN NUMBER := NULL
1249: ,p_activity IN VARCHAR2 := NULL
1250: ,p_resource IN VARCHAR2 := NULL
1251: ,p_instance_no IN NUMBER := NULL
1252: ,p_reason_name IN VARCHAR2 := NULL
1253: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1254: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1255: ,x_rsrc_txn_rec IN OUT NOCOPY gme_resource_txns%ROWTYPE
1256: ,x_message_count OUT NOCOPY NUMBER
1257: ,x_message_list OUT NOCOPY VARCHAR2
1258: ,x_return_status OUT NOCOPY VARCHAR2)
1267: IF g_debug <> -1 THEN
1268: gme_debug.log_initialize ('InsertIncr');
1269: END IF;
1270: /* Set the return status to success initially */
1271: x_return_status := fnd_api.g_ret_sts_success;
1272: /* Initialize message list and count if needed */
1273: IF p_init_msg_list = fnd_api.g_true THEN
1274: fnd_msg_pub.initialize;
1275: gme_common_pvt.g_error_count := 0;
1269: END IF;
1270: /* Set the return status to success initially */
1271: x_return_status := fnd_api.g_ret_sts_success;
1272: /* Initialize message list and count if needed */
1273: IF p_init_msg_list = fnd_api.g_true THEN
1274: fnd_msg_pub.initialize;
1275: gme_common_pvt.g_error_count := 0;
1276: END IF;
1277:
1278: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1279: IF (l_rsrc_txn_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
1280: gme_common_pvt.log_message(p_product_code => 'INV'
1281: ,p_message_code => 'INV_ORG_REQUIRED');
1282: RAISE fnd_api.g_exc_error;
1283: END IF;
1284: gme_common_pvt.g_setup_done :=
1285: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1286: ,p_org_code => p_org_code);
1285: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1286: ,p_org_code => p_org_code);
1287:
1288: IF NOT gme_common_pvt.g_setup_done THEN
1289: RAISE fnd_api.g_exc_error;
1290: ELSE
1291: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1292: END IF;
1293:
1291: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1292: END IF;
1293:
1294: /* Make sure we are call compatible */
1295: IF NOT fnd_api.compatible_api_call (2.0
1296: ,p_api_version
1297: ,'insert_incr_actual_rsrc_txn'
1298: ,g_pkg_name) THEN
1299: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1296: ,p_api_version
1297: ,'insert_incr_actual_rsrc_txn'
1298: ,g_pkg_name) THEN
1299: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1300: RAISE fnd_api.g_exc_error;
1301: END IF;
1302:
1303: /*Validate if org_code or organization_id is passed, or give error.*/
1304: IF p_validate_flexfields = 'T' THEN
1325: --Reset flex global
1326: gme_common_pvt.g_flex_validate_prof := 0;
1327: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1328:
1329: IF x_return_status = fnd_api.g_ret_sts_success THEN
1330: IF p_commit = fnd_api.g_true THEN
1331: gme_api_pub.save_batch (p_header_id => NULL
1332: ,p_table => NULL
1333: ,p_commit => fnd_api.g_false
1326: gme_common_pvt.g_flex_validate_prof := 0;
1327: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1328:
1329: IF x_return_status = fnd_api.g_ret_sts_success THEN
1330: IF p_commit = fnd_api.g_true THEN
1331: gme_api_pub.save_batch (p_header_id => NULL
1332: ,p_table => NULL
1333: ,p_commit => fnd_api.g_false
1334: ,x_return_status => x_return_status);
1329: IF x_return_status = fnd_api.g_ret_sts_success THEN
1330: IF p_commit = fnd_api.g_true THEN
1331: gme_api_pub.save_batch (p_header_id => NULL
1332: ,p_table => NULL
1333: ,p_commit => fnd_api.g_false
1334: ,x_return_status => x_return_status);
1335:
1336: IF x_return_status = fnd_api.g_ret_sts_success THEN
1337: COMMIT;
1332: ,p_table => NULL
1333: ,p_commit => fnd_api.g_false
1334: ,x_return_status => x_return_status);
1335:
1336: IF x_return_status = fnd_api.g_ret_sts_success THEN
1337: COMMIT;
1338: ELSE
1339: RAISE fnd_api.g_exc_error;
1340: END IF;
1335:
1336: IF x_return_status = fnd_api.g_ret_sts_success THEN
1337: COMMIT;
1338: ELSE
1339: RAISE fnd_api.g_exc_error;
1340: END IF;
1341: END IF;
1342: ELSE
1343: RAISE fnd_api.g_exc_error;
1339: RAISE fnd_api.g_exc_error;
1340: END IF;
1341: END IF;
1342: ELSE
1343: RAISE fnd_api.g_exc_error;
1344: END IF;
1345:
1346: IF g_debug <= gme_debug.g_log_procedure THEN
1347: gme_debug.put_line ( 'Insert Incr Actual rsrc usage at '
1349: END IF;
1350:
1351: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
1352: gme_common_pvt.count_and_get (x_count => x_message_count
1353: ,p_encoded => fnd_api.g_false
1354: ,x_data => x_message_list);
1355: EXCEPTION
1356: WHEN fnd_api.g_exc_error THEN
1357: x_return_status := fnd_api.g_ret_sts_error;
1352: gme_common_pvt.count_and_get (x_count => x_message_count
1353: ,p_encoded => fnd_api.g_false
1354: ,x_data => x_message_list);
1355: EXCEPTION
1356: WHEN fnd_api.g_exc_error THEN
1357: x_return_status := fnd_api.g_ret_sts_error;
1358: ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
1359: gme_common_pvt.count_and_get (x_count => x_message_count
1360: ,p_encoded => fnd_api.g_false
1353: ,p_encoded => fnd_api.g_false
1354: ,x_data => x_message_list);
1355: EXCEPTION
1356: WHEN fnd_api.g_exc_error THEN
1357: x_return_status := fnd_api.g_ret_sts_error;
1358: ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
1359: gme_common_pvt.count_and_get (x_count => x_message_count
1360: ,p_encoded => fnd_api.g_false
1361: ,x_data => x_message_list);
1356: WHEN fnd_api.g_exc_error THEN
1357: x_return_status := fnd_api.g_ret_sts_error;
1358: ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
1359: gme_common_pvt.count_and_get (x_count => x_message_count
1360: ,p_encoded => fnd_api.g_false
1361: ,x_data => x_message_list);
1362: WHEN OTHERS THEN
1363: ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
1364: gme_when_others ( p_api_name => l_api_name
1379: #########################################################################*/
1380: PROCEDURE insert_timed_actual_rsrc_txn (
1381: p_api_version IN NUMBER := 2.0
1382: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1383: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1384: ,p_commit IN VARCHAR2 := fnd_api.g_false
1385: ,p_org_code IN VARCHAR2
1386: ,p_batch_no IN VARCHAR2 := NULL
1387: ,p_batchstep_no IN NUMBER := NULL
1380: PROCEDURE insert_timed_actual_rsrc_txn (
1381: p_api_version IN NUMBER := 2.0
1382: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1383: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1384: ,p_commit IN VARCHAR2 := fnd_api.g_false
1385: ,p_org_code IN VARCHAR2
1386: ,p_batch_no IN VARCHAR2 := NULL
1387: ,p_batchstep_no IN NUMBER := NULL
1388: ,p_activity IN VARCHAR2 := NULL
1389: ,p_resource IN VARCHAR2 := NULL
1390: ,p_instance_no IN NUMBER := NULL
1391: ,p_reason_name IN VARCHAR2 := NULL
1392: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1393: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1394: ,x_rsrc_txn_rec IN OUT NOCOPY gme_resource_txns%ROWTYPE
1395: ,x_message_count OUT NOCOPY NUMBER
1396: ,x_message_list OUT NOCOPY VARCHAR2
1397: ,x_return_status OUT NOCOPY VARCHAR2)
1403: BEGIN
1404: /* Set the savepoint */
1405: SAVEPOINT insert_timed_actual_rsrc_txn;
1406: /* Set the return status to success initially */
1407: x_return_status := fnd_api.g_ret_sts_success;
1408: IF g_debug <> -1 THEN
1409: gme_debug.log_initialize ('InsertTimed');
1410: END IF;
1411:
1409: gme_debug.log_initialize ('InsertTimed');
1410: END IF;
1411:
1412: /* Initialize message list and count if needed */
1413: IF p_init_msg_list = fnd_api.g_true THEN
1414: fnd_msg_pub.initialize;
1415: gme_common_pvt.g_error_count := 0;
1416: END IF;
1417: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1417: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1418: IF (l_rsrc_txn_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
1419: gme_common_pvt.log_message(p_product_code => 'INV'
1420: ,p_message_code => 'INV_ORG_REQUIRED');
1421: RAISE fnd_api.g_exc_error;
1422: END IF;
1423:
1424: gme_common_pvt.g_setup_done :=
1425: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1425: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1426: ,p_org_code => p_org_code);
1427:
1428: IF NOT gme_common_pvt.g_setup_done THEN
1429: RAISE fnd_api.g_exc_error;
1430: ELSE
1431: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1432: END IF;
1433:
1431: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1432: END IF;
1433:
1434: /* Make sure we are call compatible */
1435: IF NOT fnd_api.compatible_api_call (2.0
1436: ,p_api_version
1437: ,'insert_timed_actual_rsrc_txn'
1438: ,g_pkg_name) THEN
1439: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1436: ,p_api_version
1437: ,'insert_timed_actual_rsrc_txn'
1438: ,g_pkg_name) THEN
1439: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1440: RAISE fnd_api.g_exc_error;
1441: END IF;
1442:
1443: gme_common_pvt.set_timestamp;
1444:
1467: --Reset flex global
1468: gme_common_pvt.g_flex_validate_prof := 0;
1469: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1470:
1471: IF x_return_status = fnd_api.g_ret_sts_success THEN
1472: IF p_commit = fnd_api.g_true THEN
1473: gme_api_pub.save_batch (p_header_id => NULL
1474: ,p_table => NULL
1475: ,p_commit => fnd_api.g_false
1468: gme_common_pvt.g_flex_validate_prof := 0;
1469: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1470:
1471: IF x_return_status = fnd_api.g_ret_sts_success THEN
1472: IF p_commit = fnd_api.g_true THEN
1473: gme_api_pub.save_batch (p_header_id => NULL
1474: ,p_table => NULL
1475: ,p_commit => fnd_api.g_false
1476: ,x_return_status => x_return_status);
1471: IF x_return_status = fnd_api.g_ret_sts_success THEN
1472: IF p_commit = fnd_api.g_true THEN
1473: gme_api_pub.save_batch (p_header_id => NULL
1474: ,p_table => NULL
1475: ,p_commit => fnd_api.g_false
1476: ,x_return_status => x_return_status);
1477:
1478: IF x_return_status = fnd_api.g_ret_sts_success THEN
1479: COMMIT;
1474: ,p_table => NULL
1475: ,p_commit => fnd_api.g_false
1476: ,x_return_status => x_return_status);
1477:
1478: IF x_return_status = fnd_api.g_ret_sts_success THEN
1479: COMMIT;
1480: ELSE
1481: RAISE fnd_api.g_exc_error;
1482: END IF;
1477:
1478: IF x_return_status = fnd_api.g_ret_sts_success THEN
1479: COMMIT;
1480: ELSE
1481: RAISE fnd_api.g_exc_error;
1482: END IF;
1483: END IF;
1484: ELSE
1485: RAISE fnd_api.g_exc_error;
1481: RAISE fnd_api.g_exc_error;
1482: END IF;
1483: END IF;
1484: ELSE
1485: RAISE fnd_api.g_exc_error;
1486: END IF;
1487:
1488: IF g_debug <= gme_debug.g_log_procedure THEN
1489: gme_debug.put_line ( 'Insert timed Actual rsrc usage at '
1491: END IF;
1492:
1493: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
1494: gme_common_pvt.count_and_get (x_count => x_message_count
1495: ,p_encoded => fnd_api.g_false
1496: ,x_data => x_message_list);
1497: EXCEPTION
1498: WHEN fnd_api.g_exc_error THEN
1499: x_return_status := fnd_api.g_ret_sts_error;
1494: gme_common_pvt.count_and_get (x_count => x_message_count
1495: ,p_encoded => fnd_api.g_false
1496: ,x_data => x_message_list);
1497: EXCEPTION
1498: WHEN fnd_api.g_exc_error THEN
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
1501: gme_common_pvt.count_and_get (x_count => x_message_count
1502: ,p_encoded => fnd_api.g_false
1495: ,p_encoded => fnd_api.g_false
1496: ,x_data => x_message_list);
1497: EXCEPTION
1498: WHEN fnd_api.g_exc_error THEN
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
1501: gme_common_pvt.count_and_get (x_count => x_message_count
1502: ,p_encoded => fnd_api.g_false
1503: ,x_data => x_message_list);
1498: WHEN fnd_api.g_exc_error THEN
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
1501: gme_common_pvt.count_and_get (x_count => x_message_count
1502: ,p_encoded => fnd_api.g_false
1503: ,x_data => x_message_list);
1504: WHEN OTHERS THEN
1505: ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
1506: gme_when_others ( p_api_name => l_api_name
1527: PROCEDURE start_cmplt_actual_rsrc_txn (
1528: p_api_version IN NUMBER := 2.0
1529: ,p_validation_level IN NUMBER
1530: := gme_common_pvt.g_max_errors
1531: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1532: ,p_commit IN VARCHAR2 := fnd_api.g_false
1533: ,p_org_code IN VARCHAR2
1534: ,p_batch_no IN VARCHAR2 := NULL
1535: ,p_batchstep_no IN NUMBER := NULL
1528: p_api_version IN NUMBER := 2.0
1529: ,p_validation_level IN NUMBER
1530: := gme_common_pvt.g_max_errors
1531: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1532: ,p_commit IN VARCHAR2 := fnd_api.g_false
1533: ,p_org_code IN VARCHAR2
1534: ,p_batch_no IN VARCHAR2 := NULL
1535: ,p_batchstep_no IN NUMBER := NULL
1536: ,p_activity IN VARCHAR2 := NULL
1537: ,p_resource IN VARCHAR2 := NULL
1538: ,p_instance_no IN NUMBER
1539: ,p_reason_name IN VARCHAR2 := NULL
1540: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1541: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1542: ,x_rsrc_txn_rec IN OUT NOCOPY gme_resource_txns%ROWTYPE
1543: ,x_message_count OUT NOCOPY NUMBER
1544: ,x_message_list OUT NOCOPY VARCHAR2
1545: ,x_return_status OUT NOCOPY VARCHAR2)
1551: BEGIN
1552: /* Set the savepoint */
1553: SAVEPOINT start_cmplt_actual_rsrc_txn;
1554: /* Set the return status to success initially */
1555: x_return_status := fnd_api.g_ret_sts_success;
1556: IF g_debug <> -1 THEN
1557: gme_debug.log_initialize ('StartCmplt');
1558: END IF;
1559:
1557: gme_debug.log_initialize ('StartCmplt');
1558: END IF;
1559:
1560: /* Initialize message list and count if needed */
1561: IF p_init_msg_list = fnd_api.g_true THEN
1562: fnd_msg_pub.initialize;
1563: gme_common_pvt.g_error_count := 0;
1564: END IF;
1565: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1565: l_rsrc_txn_rec := p_rsrc_txn_rec ;
1566: IF (l_rsrc_txn_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
1567: gme_common_pvt.log_message(p_product_code => 'INV'
1568: ,p_message_code => 'INV_ORG_REQUIRED');
1569: RAISE fnd_api.g_exc_error;
1570: END IF;
1571: gme_common_pvt.g_setup_done :=
1572: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1573: ,p_org_code => p_org_code);
1571: gme_common_pvt.g_setup_done :=
1572: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1573: ,p_org_code => p_org_code);
1574: IF NOT gme_common_pvt.g_setup_done THEN
1575: RAISE fnd_api.g_exc_error;
1576: ELSE
1577: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1578: END IF;
1579:
1577: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1578: END IF;
1579:
1580: /* Make sure we are call compatible */
1581: IF NOT fnd_api.compatible_api_call (2.0,p_api_version,
1582: 'start_cmplt_actual_rsrc_txn',g_pkg_name) THEN
1583: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1584: RAISE fnd_api.g_exc_error;
1585: END IF;
1580: /* Make sure we are call compatible */
1581: IF NOT fnd_api.compatible_api_call (2.0,p_api_version,
1582: 'start_cmplt_actual_rsrc_txn',g_pkg_name) THEN
1583: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1584: RAISE fnd_api.g_exc_error;
1585: END IF;
1586: gme_common_pvt.set_timestamp;
1587: IF p_validate_flexfields = 'T' THEN
1588: gme_common_pvt.g_flex_validate_prof := 1;
1610: gme_common_pvt.g_flex_validate_prof := 0;
1611: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1612:
1613: /*end */
1614: IF x_return_status = fnd_api.g_ret_sts_success THEN
1615: IF p_commit = fnd_api.g_true THEN
1616: gme_api_pub.save_batch (p_header_id => NULL
1617: ,p_table => NULL
1618: ,p_commit => fnd_api.g_false
1611: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1612:
1613: /*end */
1614: IF x_return_status = fnd_api.g_ret_sts_success THEN
1615: IF p_commit = fnd_api.g_true THEN
1616: gme_api_pub.save_batch (p_header_id => NULL
1617: ,p_table => NULL
1618: ,p_commit => fnd_api.g_false
1619: ,x_return_status => x_return_status);
1614: IF x_return_status = fnd_api.g_ret_sts_success THEN
1615: IF p_commit = fnd_api.g_true THEN
1616: gme_api_pub.save_batch (p_header_id => NULL
1617: ,p_table => NULL
1618: ,p_commit => fnd_api.g_false
1619: ,x_return_status => x_return_status);
1620:
1621: IF x_return_status = fnd_api.g_ret_sts_success THEN
1622: COMMIT;
1617: ,p_table => NULL
1618: ,p_commit => fnd_api.g_false
1619: ,x_return_status => x_return_status);
1620:
1621: IF x_return_status = fnd_api.g_ret_sts_success THEN
1622: COMMIT;
1623: ELSE
1624: RAISE fnd_api.g_exc_error;
1625: END IF;
1620:
1621: IF x_return_status = fnd_api.g_ret_sts_success THEN
1622: COMMIT;
1623: ELSE
1624: RAISE fnd_api.g_exc_error;
1625: END IF;
1626: END IF;
1627: ELSE
1628: RAISE fnd_api.g_exc_error;
1624: RAISE fnd_api.g_exc_error;
1625: END IF;
1626: END IF;
1627: ELSE
1628: RAISE fnd_api.g_exc_error;
1629: END IF;
1630:
1631: IF g_debug <= gme_debug.g_log_procedure THEN
1632: gme_debug.put_line ( 'start Actual rsrc txn at '
1634: END IF;
1635:
1636: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
1637: gme_common_pvt.count_and_get (x_count => x_message_count
1638: ,p_encoded => fnd_api.g_false
1639: ,x_data => x_message_list);
1640: EXCEPTION
1641: WHEN fnd_api.g_exc_error THEN
1642: x_return_status := fnd_api.g_ret_sts_error;
1637: gme_common_pvt.count_and_get (x_count => x_message_count
1638: ,p_encoded => fnd_api.g_false
1639: ,x_data => x_message_list);
1640: EXCEPTION
1641: WHEN fnd_api.g_exc_error THEN
1642: x_return_status := fnd_api.g_ret_sts_error;
1643: ROLLBACK TO SAVEPOINT start_cmplt_actual_rsrc_txn;
1644: gme_common_pvt.count_and_get (x_count => x_message_count
1645: ,p_encoded => fnd_api.g_false
1638: ,p_encoded => fnd_api.g_false
1639: ,x_data => x_message_list);
1640: EXCEPTION
1641: WHEN fnd_api.g_exc_error THEN
1642: x_return_status := fnd_api.g_ret_sts_error;
1643: ROLLBACK TO SAVEPOINT start_cmplt_actual_rsrc_txn;
1644: gme_common_pvt.count_and_get (x_count => x_message_count
1645: ,p_encoded => fnd_api.g_false
1646: ,x_data => x_message_list);
1641: WHEN fnd_api.g_exc_error THEN
1642: x_return_status := fnd_api.g_ret_sts_error;
1643: ROLLBACK TO SAVEPOINT start_cmplt_actual_rsrc_txn;
1644: gme_common_pvt.count_and_get (x_count => x_message_count
1645: ,p_encoded => fnd_api.g_false
1646: ,x_data => x_message_list);
1647: WHEN OTHERS THEN
1648: ROLLBACK TO SAVEPOINT start_cmplt_actual_rsrc_txn;
1649: gme_when_others ( p_api_name => l_api_name
1665: #########################################################################*/
1666: PROCEDURE end_cmplt_actual_rsrc_txn (
1667: p_api_version IN NUMBER := 2.0
1668: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1669: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1670: ,p_commit IN VARCHAR2 := fnd_api.g_false
1671: ,p_instance_no IN NUMBER := NULL
1672: ,p_reason_name IN VARCHAR2 := NULL
1673: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1666: PROCEDURE end_cmplt_actual_rsrc_txn (
1667: p_api_version IN NUMBER := 2.0
1668: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
1669: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1670: ,p_commit IN VARCHAR2 := fnd_api.g_false
1671: ,p_instance_no IN NUMBER := NULL
1672: ,p_reason_name IN VARCHAR2 := NULL
1673: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1674: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1670: ,p_commit IN VARCHAR2 := fnd_api.g_false
1671: ,p_instance_no IN NUMBER := NULL
1672: ,p_reason_name IN VARCHAR2 := NULL
1673: ,p_rsrc_txn_rec IN gme_resource_txns%ROWTYPE
1674: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
1675: ,x_rsrc_txn_rec IN OUT NOCOPY gme_resource_txns%ROWTYPE
1676: ,x_message_count OUT NOCOPY NUMBER
1677: ,x_message_list OUT NOCOPY VARCHAR2
1678: ,x_return_status OUT NOCOPY VARCHAR2)
1688: gme_debug.log_initialize ('EndCmplt');
1689: END IF;
1690:
1691: /* Initialize message list and count if needed */
1692: IF p_init_msg_list = fnd_api.g_true THEN
1693: fnd_msg_pub.initialize;
1694: gme_common_pvt.g_error_count := 0;
1695: END IF;
1696: /* Set the return status to success initially */
1693: fnd_msg_pub.initialize;
1694: gme_common_pvt.g_error_count := 0;
1695: END IF;
1696: /* Set the return status to success initially */
1697: x_return_status := fnd_api.g_ret_sts_success;
1698: l_rsrc_txn_rec := p_rsrc_txn_rec;
1699: IF (l_rsrc_txn_rec.organization_id IS NULL ) THEN
1700: gme_common_pvt.log_message(p_product_code => 'INV'
1701: ,p_message_code => 'INV_ORG_REQUIRED');
1698: l_rsrc_txn_rec := p_rsrc_txn_rec;
1699: IF (l_rsrc_txn_rec.organization_id IS NULL ) THEN
1700: gme_common_pvt.log_message(p_product_code => 'INV'
1701: ,p_message_code => 'INV_ORG_REQUIRED');
1702: RAISE fnd_api.g_exc_error;
1703: END IF;
1704: /* Setup the common constants used accross the apis */
1705: gme_common_pvt.g_setup_done :=
1706: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1706: gme_common_pvt.setup (p_org_id => l_rsrc_txn_rec.organization_id
1707: ,p_org_code => null);
1708:
1709: IF NOT gme_common_pvt.g_setup_done THEN
1710: RAISE fnd_api.g_exc_error;
1711: ELSE
1712: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1713: END IF;
1714:
1712: l_rsrc_txn_rec.organization_id := gme_common_pvt.g_organization_id;
1713: END IF;
1714:
1715: /* Make sure we are call compatible */
1716: IF NOT fnd_api.compatible_api_call (2.0
1717: ,p_api_version
1718: ,'end_cmplt_actual_rsrc_txn'
1719: ,g_pkg_name) THEN
1720: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1717: ,p_api_version
1718: ,'end_cmplt_actual_rsrc_txn'
1719: ,g_pkg_name) THEN
1720: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1721: RAISE fnd_api.g_exc_error;
1722: END IF;
1723: gme_common_pvt.set_timestamp;
1724: IF p_validate_flexfields = 'T' THEN
1725: gme_common_pvt.g_flex_validate_prof := 1;
1742: gme_common_pvt.g_flex_validate_prof := 0;
1743: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1744:
1745: /* end */
1746: IF x_return_status = fnd_api.g_ret_sts_success THEN
1747: IF p_commit = fnd_api.g_true THEN
1748: gme_api_pub.save_batch (p_header_id => NULL
1749: ,p_table => NULL
1750: ,p_commit => fnd_api.g_false
1743: l_batch_header.batch_id := x_rsrc_txn_rec.doc_id;
1744:
1745: /* end */
1746: IF x_return_status = fnd_api.g_ret_sts_success THEN
1747: IF p_commit = fnd_api.g_true THEN
1748: gme_api_pub.save_batch (p_header_id => NULL
1749: ,p_table => NULL
1750: ,p_commit => fnd_api.g_false
1751: ,x_return_status => x_return_status);
1746: IF x_return_status = fnd_api.g_ret_sts_success THEN
1747: IF p_commit = fnd_api.g_true THEN
1748: gme_api_pub.save_batch (p_header_id => NULL
1749: ,p_table => NULL
1750: ,p_commit => fnd_api.g_false
1751: ,x_return_status => x_return_status);
1752:
1753: IF x_return_status = fnd_api.g_ret_sts_success THEN
1754: COMMIT;
1749: ,p_table => NULL
1750: ,p_commit => fnd_api.g_false
1751: ,x_return_status => x_return_status);
1752:
1753: IF x_return_status = fnd_api.g_ret_sts_success THEN
1754: COMMIT;
1755: ELSE
1756: RAISE fnd_api.g_exc_error;
1757: END IF;
1752:
1753: IF x_return_status = fnd_api.g_ret_sts_success THEN
1754: COMMIT;
1755: ELSE
1756: RAISE fnd_api.g_exc_error;
1757: END IF;
1758: END IF;
1759: ELSE
1760: RAISE fnd_api.g_exc_error;
1756: RAISE fnd_api.g_exc_error;
1757: END IF;
1758: END IF;
1759: ELSE
1760: RAISE fnd_api.g_exc_error;
1761: END IF;
1762:
1763: IF g_debug <= gme_debug.g_log_procedure THEN
1764: gme_debug.put_line ( 'Insert Incr Actual rsrc usage at '
1766: END IF;
1767:
1768: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
1769: gme_common_pvt.count_and_get (x_count => x_message_count
1770: ,p_encoded => fnd_api.g_false
1771: ,x_data => x_message_list);
1772: EXCEPTION
1773: WHEN fnd_api.g_exc_error THEN
1774: x_return_status := fnd_api.g_ret_sts_error;
1769: gme_common_pvt.count_and_get (x_count => x_message_count
1770: ,p_encoded => fnd_api.g_false
1771: ,x_data => x_message_list);
1772: EXCEPTION
1773: WHEN fnd_api.g_exc_error THEN
1774: x_return_status := fnd_api.g_ret_sts_error;
1775: ROLLBACK TO SAVEPOINT end_cmplt_actual_rsrc_txn;
1776: gme_common_pvt.count_and_get (x_count => x_message_count
1777: ,p_encoded => fnd_api.g_false
1770: ,p_encoded => fnd_api.g_false
1771: ,x_data => x_message_list);
1772: EXCEPTION
1773: WHEN fnd_api.g_exc_error THEN
1774: x_return_status := fnd_api.g_ret_sts_error;
1775: ROLLBACK TO SAVEPOINT end_cmplt_actual_rsrc_txn;
1776: gme_common_pvt.count_and_get (x_count => x_message_count
1777: ,p_encoded => fnd_api.g_false
1778: ,x_data => x_message_list);
1773: WHEN fnd_api.g_exc_error THEN
1774: x_return_status := fnd_api.g_ret_sts_error;
1775: ROLLBACK TO SAVEPOINT end_cmplt_actual_rsrc_txn;
1776: gme_common_pvt.count_and_get (x_count => x_message_count
1777: ,p_encoded => fnd_api.g_false
1778: ,x_data => x_message_list);
1779: WHEN OTHERS THEN
1780: ROLLBACK TO SAVEPOINT end_cmplt_actual_rsrc_txn;
1781: gme_when_others ( p_api_name => l_api_name
1815: || 'Entering');
1816: END IF;
1817:
1818: /* Set the return status to success initially */
1819: x_return_status := fnd_api.g_ret_sts_success;
1820:
1821: /* Set savepoint here */
1822: SAVEPOINT reschedule_batch;
1823:
1821: /* Set savepoint here */
1822: SAVEPOINT reschedule_batch;
1823:
1824: /* Initialize message list and count if needed */
1825: IF p_init_msg_list = fnd_api.g_true THEN
1826: fnd_msg_pub.initialize;
1827: END IF;
1828: gme_common_pvt.validate_batch
1829: (p_batch_header_rec => p_batch_header_rec
1833: ,x_message_count => x_message_count
1834: ,x_message_list => x_message_list
1835: ,x_return_status => x_return_status );
1836:
1837: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1838: IF (g_debug = gme_debug.g_log_statement) THEN
1839: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
1840: || ': batch validate error ');
1841: END IF;
1838: IF (g_debug = gme_debug.g_log_statement) THEN
1839: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
1840: || ': batch validate error ');
1841: END IF;
1842: RAISE fnd_api.g_exc_error;
1843: END IF;
1844:
1845: /* Make sure we are call compatible */
1846: IF NOT fnd_api.compatible_api_call (2.0
1842: RAISE fnd_api.g_exc_error;
1843: END IF;
1844:
1845: /* Make sure we are call compatible */
1846: IF NOT fnd_api.compatible_api_call (2.0
1847: ,p_api_version
1848: ,'reschedule_batch'
1849: ,g_pkg_name) THEN
1850: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1847: ,p_api_version
1848: ,'reschedule_batch'
1849: ,g_pkg_name) THEN
1850: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
1851: RAISE fnd_api.g_exc_error;
1852: END IF;
1853:
1854: -- Bug 8218955 - Note: l_batch_header_rec is the record stored in the database not what was passed in.
1855: -- Reworked debug logging messages so we can see all the values.
1880: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1881: IF p_batch_header_rec.plan_start_date IS NULL
1882: AND p_batch_header_rec.plan_cmplt_date IS NULL THEN
1883: gme_common_pvt.log_message ('GME_NO_NULL_DATES');
1884: RAISE fnd_api.g_exc_error;
1885: END IF;
1886:
1887: /* Check plan_start_date > plan_cmplt_date if batch_status = pending */
1888: IF (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending) THEN
1892: AND p_batch_header_rec.plan_start_date >
1893: p_batch_header_rec.plan_cmplt_date THEN
1894: --Bug#5439736 replaced the message
1895: gme_common_pvt.log_message ('GME_CMPLT_START_DT');
1896: RAISE fnd_api.g_exc_error;
1897: END IF;
1898: ELSIF (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_wip) THEN
1899: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1900: IF p_batch_header_rec.plan_cmplt_date IS NULL THEN
1898: ELSIF (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_wip) THEN
1899: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1900: IF p_batch_header_rec.plan_cmplt_date IS NULL THEN
1901: gme_common_pvt.log_message ('GME_NO_CMPLTDATE_FOR_WIP');
1902: RAISE fnd_api.g_exc_error;
1903: ELSE
1904: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1905: IF NVL (p_batch_header_rec.plan_start_date
1906: ,l_batch_header_rec.plan_start_date) <>
1905: IF NVL (p_batch_header_rec.plan_start_date
1906: ,l_batch_header_rec.plan_start_date) <>
1907: l_batch_header_rec.plan_start_date THEN
1908: gme_common_pvt.log_message ('GME_NO_PLAN_DT_UPD');
1909: RAISE fnd_api.g_exc_error;
1910: END IF;
1911:
1912: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1913: IF p_batch_header_rec.plan_cmplt_date <
1912: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1913: IF p_batch_header_rec.plan_cmplt_date <
1914: l_batch_header_rec.plan_start_date THEN
1915: gme_common_pvt.log_message ('GME_CMPLT_START_DT');
1916: RAISE fnd_api.g_exc_error;
1917: END IF;
1918: END IF;
1919: ELSE /* batch status other than pending, WIP */
1920: -- Batch cannot be rescheduled. Batch must have a status of pending or WIP to be rescheduled.
1918: END IF;
1919: ELSE /* batch status other than pending, WIP */
1920: -- Batch cannot be rescheduled. Batch must have a status of pending or WIP to be rescheduled.
1921: gme_common_pvt.log_message ('GME_API_INV_BATCH_RESCHED');
1922: RAISE fnd_api.g_exc_error;
1923: END IF;
1924:
1925: IF p_use_workday_cal IS NOT NULL THEN
1926: IF p_use_workday_cal IN (fnd_api.g_true, fnd_api.g_false) THEN
1922: RAISE fnd_api.g_exc_error;
1923: END IF;
1924:
1925: IF p_use_workday_cal IS NOT NULL THEN
1926: IF p_use_workday_cal IN (fnd_api.g_true, fnd_api.g_false) THEN
1927: l_use := p_use_workday_cal;
1928: ELSE
1929: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
1930: ,'FIELD_NAME'
1928: ELSE
1929: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
1930: ,'FIELD_NAME'
1931: ,'p_use_workday_cal');
1932: RAISE fnd_api.g_exc_error;
1933: END IF;
1934: IF p_contiguity_override IS NOT NULL THEN
1935: IF p_contiguity_override NOT IN
1936: (fnd_api.g_true, fnd_api.g_false) THEN
1932: RAISE fnd_api.g_exc_error;
1933: END IF;
1934: IF p_contiguity_override IS NOT NULL THEN
1935: IF p_contiguity_override NOT IN
1936: (fnd_api.g_true, fnd_api.g_false) THEN
1937: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
1938: ,'FIELD_NAME'
1939: ,'p_contiguity_override');
1940: RAISE fnd_api.g_exc_error;
1936: (fnd_api.g_true, fnd_api.g_false) THEN
1937: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
1938: ,'FIELD_NAME'
1939: ,'p_contiguity_override');
1940: RAISE fnd_api.g_exc_error;
1941: END IF;
1942: END IF;
1943: ELSE
1944: l_use := fnd_api.g_false;
1940: RAISE fnd_api.g_exc_error;
1941: END IF;
1942: END IF;
1943: ELSE
1944: l_use := fnd_api.g_false;
1945: END IF; /* p_use_workday_cal IS NOT NULL */
1946:
1947: IF l_use = fnd_api.g_true THEN
1948: IF (gme_common_pvt.g_calendar_code IS NOT NULL) THEN
1943: ELSE
1944: l_use := fnd_api.g_false;
1945: END IF; /* p_use_workday_cal IS NOT NULL */
1946:
1947: IF l_use = fnd_api.g_true THEN
1948: IF (gme_common_pvt.g_calendar_code IS NOT NULL) THEN
1949: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
1950: -- Check if plan_start_date falls on non working day for pending batch.
1951: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending AND
1961: ('GME_NON_WORKING_TIME'
1962: ,'PDATE'
1963: ,TO_CHAR (p_batch_header_rec.plan_start_date
1964: ,'DD-MON-YYYY HH24:MI:SS') );
1965: RAISE fnd_api.g_exc_error;
1966: END IF;
1967: END IF;
1968:
1969: /* l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending */
1985: ('GME_NON_WORKING_TIME'
1986: ,'PDATE'
1987: ,TO_CHAR (p_batch_header_rec.plan_cmplt_date
1988: ,'DD-MON-YYYY HH24:MI:SS') );
1989: RAISE fnd_api.g_exc_error;
1990: END IF;
1991: END IF;
1992:
1993: -- Bug 8218955 - Change l_batch_header_rec to p_batch_header_rec so we can validate what was passed in.
2002: ,0
2003: ,l_return_status) THEN
2004: gme_common_pvt.log_message ('GME_NON_WORKING_TIME' ,'PDATE'
2005: ,TO_CHAR (SYSDATE,'DD-MON-YYYY HH24:MI:SS') );
2006: RAISE fnd_api.g_exc_error;
2007: END IF;
2008: END IF; /* p_batch_header_rec.plan_cmplt_date IS NULL */
2009: END IF; /* (gme_common_pvt.g_calendar_code IS NOT NULL) */
2010: END IF; /* l_use = FND_API.G_TRUE */
2006: RAISE fnd_api.g_exc_error;
2007: END IF;
2008: END IF; /* p_batch_header_rec.plan_cmplt_date IS NULL */
2009: END IF; /* (gme_common_pvt.g_calendar_code IS NOT NULL) */
2010: END IF; /* l_use = FND_API.G_TRUE */
2011:
2012: IF (g_debug = gme_debug.g_log_statement) THEN
2013: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ':'
2014: || 'Calling Main Reschedule Batch');
2019: l_batch_header_rec.plan_cmplt_date := p_batch_header_rec.plan_cmplt_date;
2020:
2021: gme_api_main.reschedule_batch
2022: (p_validation_level => p_validation_level
2023: ,p_init_msg_list => fnd_api.g_false
2024: ,p_batch_header_rec => l_batch_header_rec
2025: ,p_use_workday_cal => l_use
2026: ,p_contiguity_override => p_contiguity_override
2027: ,x_message_count => x_message_count
2034: ( 'Came back from Main Reschedule Batch with status '
2035: || x_return_status);
2036: END IF;
2037:
2038: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2039: RAISE reschedule_batch_failed;
2040: ELSE
2041: IF p_commit = fnd_api.g_true THEN
2042: gme_api_pub.save_batch (p_header_id => NULL
2037:
2038: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2039: RAISE reschedule_batch_failed;
2040: ELSE
2041: IF p_commit = fnd_api.g_true THEN
2042: gme_api_pub.save_batch (p_header_id => NULL
2043: ,p_table => NULL
2044: ,p_commit => fnd_api.g_false
2045: ,x_return_status => x_return_status);
2040: ELSE
2041: IF p_commit = fnd_api.g_true THEN
2042: gme_api_pub.save_batch (p_header_id => NULL
2043: ,p_table => NULL
2044: ,p_commit => fnd_api.g_false
2045: ,x_return_status => x_return_status);
2046:
2047: IF x_return_status = fnd_api.g_ret_sts_success THEN
2048: COMMIT;
2043: ,p_table => NULL
2044: ,p_commit => fnd_api.g_false
2045: ,x_return_status => x_return_status);
2046:
2047: IF x_return_status = fnd_api.g_ret_sts_success THEN
2048: COMMIT;
2049: ELSE
2050: RAISE fnd_api.g_exc_error;
2051: END IF;
2046:
2047: IF x_return_status = fnd_api.g_ret_sts_success THEN
2048: COMMIT;
2049: ELSE
2050: RAISE fnd_api.g_exc_error;
2051: END IF;
2052: END IF;
2053: END IF;
2054:
2057: 'Exiting with ' || x_return_status || ' at '
2058: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2059: END IF;
2060: EXCEPTION
2061: WHEN fnd_api.g_exc_error THEN
2062: ROLLBACK TO SAVEPOINT reschedule_batch;
2063: x_batch_header_rec := NULL;
2064: x_return_status := fnd_api.g_ret_sts_error;
2065: gme_common_pvt.count_and_get (x_count => x_message_count
2060: EXCEPTION
2061: WHEN fnd_api.g_exc_error THEN
2062: ROLLBACK TO SAVEPOINT reschedule_batch;
2063: x_batch_header_rec := NULL;
2064: x_return_status := fnd_api.g_ret_sts_error;
2065: gme_common_pvt.count_and_get (x_count => x_message_count
2066: ,p_encoded => fnd_api.g_false
2067: ,x_data => x_message_list);
2068: WHEN reschedule_batch_failed THEN
2062: ROLLBACK TO SAVEPOINT reschedule_batch;
2063: x_batch_header_rec := NULL;
2064: x_return_status := fnd_api.g_ret_sts_error;
2065: gme_common_pvt.count_and_get (x_count => x_message_count
2066: ,p_encoded => fnd_api.g_false
2067: ,x_data => x_message_list);
2068: WHEN reschedule_batch_failed THEN
2069: ROLLBACK TO SAVEPOINT reschedule_batch;
2070: x_batch_header_rec := NULL;
2068: WHEN reschedule_batch_failed THEN
2069: ROLLBACK TO SAVEPOINT reschedule_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: WHEN OTHERS THEN
2075: ROLLBACK TO SAVEPOINT reschedule_batch;
2076: x_batch_header_rec := NULL;
2120: || 'Entering');
2121: END IF;
2122:
2123: /* Set the return status to success initially */
2124: x_return_status := fnd_api.g_ret_sts_success;
2125:
2126: /* Set savepoint here */
2127: SAVEPOINT reschedule_step;
2128:
2126: /* Set savepoint here */
2127: SAVEPOINT reschedule_step;
2128:
2129: /* Initialize message list and count if needed */
2130: IF p_init_msg_list = fnd_api.g_true THEN
2131: fnd_msg_pub.initialize;
2132: END IF;
2133:
2134: /* Validate Input parameters */
2141: ,x_message_count => x_message_count
2142: ,x_message_list => x_message_list
2143: ,x_return_status => x_return_status) ;
2144:
2145: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2146: IF (g_debug = gme_debug.g_log_statement) THEN
2147: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2148: || ': batch step validate error ');
2149: END IF;
2146: IF (g_debug = gme_debug.g_log_statement) THEN
2147: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2148: || ': batch step validate error ');
2149: END IF;
2150: RAISE fnd_api.g_exc_error;
2151: END IF;
2152:
2153: /* Make sure we are call compatible */
2154: IF NOT fnd_api.compatible_api_call (2.0
2150: RAISE fnd_api.g_exc_error;
2151: END IF;
2152:
2153: /* Make sure we are call compatible */
2154: IF NOT fnd_api.compatible_api_call (2.0
2155: ,p_api_version
2156: ,'reschedule_batch_step'
2157: ,g_pkg_name) THEN
2158: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2155: ,p_api_version
2156: ,'reschedule_batch_step'
2157: ,g_pkg_name) THEN
2158: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2159: RAISE fnd_api.g_exc_error;
2160: END IF;
2161:
2162: /* Navin: Check whether both l_batch_step_rec.plan_start_date, l_batch_step_rec.plan_cmplt_date are null. If so, RAISE error; */
2163: IF p_batch_step_rec.plan_start_date IS NULL
2163: IF p_batch_step_rec.plan_start_date IS NULL
2164: AND p_batch_step_rec.plan_cmplt_date IS NULL THEN
2165: -- Both planned start and planned completion dates cannot be null.
2166: gme_common_pvt.log_message ('GME_NO_NULL_DATES');
2167: RAISE fnd_api.g_exc_error;
2168: END IF;
2169:
2170: IF p_batch_type = gme_common_pvt.g_doc_type_fpo THEN
2171: -- You cannot reschedule steps for firm planned orders.
2170: IF p_batch_type = gme_common_pvt.g_doc_type_fpo THEN
2171: -- You cannot reschedule steps for firm planned orders.
2172: gme_common_pvt.log_message ('GME_FPO_STEP_RESCH_ERR');
2173: -- Navin: PENDING: New Message
2174: RAISE fnd_api.g_exc_error;
2175: END IF;
2176:
2177: IF p_reschedule_preceding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2178: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2173: -- Navin: PENDING: New Message
2174: RAISE fnd_api.g_exc_error;
2175: END IF;
2176:
2177: IF p_reschedule_preceding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2178: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2179: ,'FIELD_NAME'
2180: ,'p_reschedule_preceding');
2181: RAISE fnd_api.g_exc_error;
2177: IF p_reschedule_preceding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2178: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2179: ,'FIELD_NAME'
2180: ,'p_reschedule_preceding');
2181: RAISE fnd_api.g_exc_error;
2182: END IF;
2183:
2184: IF p_reschedule_succeeding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2185: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2180: ,'p_reschedule_preceding');
2181: RAISE fnd_api.g_exc_error;
2182: END IF;
2183:
2184: IF p_reschedule_succeeding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2185: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2186: ,'FIELD_NAME'
2187: ,'p_reschedule_succeeding');
2188: RAISE fnd_api.g_exc_error;
2184: IF p_reschedule_succeeding NOT IN (fnd_api.g_true, fnd_api.g_false) THEN
2185: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2186: ,'FIELD_NAME'
2187: ,'p_reschedule_succeeding');
2188: RAISE fnd_api.g_exc_error;
2189: END IF;
2190:
2191: l_batch_step_rec.plan_start_date := p_batch_step_rec.plan_start_date;
2192: l_batch_step_rec.plan_cmplt_date := p_batch_step_rec.plan_cmplt_date;
2198: l_batch_step_rec.plan_cmplt_date THEN
2199: -- The planned start cannot be greater than the planned completion date.
2200: gme_common_pvt.log_message ('GME_CMPLT_START_DT');
2201: -- Navin: PENDING: New Message
2202: RAISE fnd_api.g_exc_error;
2203: END IF;
2204: ELSIF (l_batch_step_rec.step_status = gme_common_pvt.g_batch_wip) THEN
2205: IF l_batch_step_rec.plan_cmplt_date IS NULL THEN
2206: -- Planned completion dates cannot be null for a batch with status of WIP.
2205: IF l_batch_step_rec.plan_cmplt_date IS NULL THEN
2206: -- Planned completion dates cannot be null for a batch with status of WIP.
2207: gme_common_pvt.log_message ('GME_NO_CMPLTDATE_FOR_WIP');
2208: -- Navin: PENDING: New Message
2209: RAISE fnd_api.g_exc_error;
2210: ELSE
2211: IF NVL (l_batch_step_rec.plan_start_date
2212: ,l_batch_step_rec.plan_start_date) <>
2213: l_batch_step_rec.plan_start_date THEN
2213: l_batch_step_rec.plan_start_date THEN
2214: -- Cannot update planned start date.
2215: gme_common_pvt.log_message ('GME_NO_PLAN_DT_UPD');
2216: -- Navin: PENDING: New Message
2217: RAISE fnd_api.g_exc_error;
2218: END IF;
2219:
2220: IF l_batch_step_rec.plan_cmplt_date <
2221: l_batch_step_rec.plan_start_date THEN
2221: l_batch_step_rec.plan_start_date THEN
2222: -- Planned completion date cannot be earlier than the planned start date.
2223: gme_common_pvt.log_message ('GME_CMPLT_START_DT');
2224: -- Navin: PENDING: New Message
2225: RAISE fnd_api.g_exc_error;
2226: END IF;
2227: END IF;
2228: ELSE /*step status other than pending, WIP */
2229: --Bug#5439736
2227: END IF;
2228: ELSE /*step status other than pending, WIP */
2229: --Bug#5439736
2230: gme_common_pvt.log_message ('GME_API_INV_STEP_STAT_RESCH');
2231: RAISE fnd_api.g_exc_error;
2232: END IF;
2233:
2234: -- When enforce_step_dependency option is enforced then override Reschedule_preceding, Reschedule_succeeding fields.
2235: IF l_batch_header_rec.enforce_step_dependency = 1 THEN
2232: END IF;
2233:
2234: -- When enforce_step_dependency option is enforced then override Reschedule_preceding, Reschedule_succeeding fields.
2235: IF l_batch_header_rec.enforce_step_dependency = 1 THEN
2236: l_reschedule_preceding := fnd_api.g_true;
2237: l_reschedule_succeeding := fnd_api.g_true;
2238: ELSE
2239: l_reschedule_preceding := p_reschedule_preceding;
2240: l_reschedule_succeeding := p_reschedule_succeeding;
2233:
2234: -- When enforce_step_dependency option is enforced then override Reschedule_preceding, Reschedule_succeeding fields.
2235: IF l_batch_header_rec.enforce_step_dependency = 1 THEN
2236: l_reschedule_preceding := fnd_api.g_true;
2237: l_reschedule_succeeding := fnd_api.g_true;
2238: ELSE
2239: l_reschedule_preceding := p_reschedule_preceding;
2240: l_reschedule_succeeding := p_reschedule_succeeding;
2241: END IF;
2240: l_reschedule_succeeding := p_reschedule_succeeding;
2241: END IF;
2242:
2243: IF p_use_workday_cal IS NOT NULL THEN
2244: IF p_use_workday_cal IN (fnd_api.g_true, fnd_api.g_false) THEN
2245: l_use := p_use_workday_cal;
2246: ELSE
2247: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2248: ,'FIELD_NAME'
2246: ELSE
2247: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2248: ,'FIELD_NAME'
2249: ,'p_use_workday_cal');
2250: RAISE fnd_api.g_exc_error;
2251: END IF;
2252:
2253: IF p_contiguity_override IS NOT NULL THEN
2254: IF p_contiguity_override NOT IN
2251: END IF;
2252:
2253: IF p_contiguity_override IS NOT NULL THEN
2254: IF p_contiguity_override NOT IN
2255: (fnd_api.g_true, fnd_api.g_false) THEN
2256: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2257: ,'FIELD_NAME'
2258: ,'p_contiguity_override');
2259: RAISE fnd_api.g_exc_error;
2255: (fnd_api.g_true, fnd_api.g_false) THEN
2256: gme_common_pvt.log_message ('GME_INVALID_VALUE_SPECIFIED'
2257: ,'FIELD_NAME'
2258: ,'p_contiguity_override');
2259: RAISE fnd_api.g_exc_error;
2260: END IF;
2261: END IF; /* p_contiguity_override */
2262: ELSE
2263: l_use := fnd_api.g_false;
2259: RAISE fnd_api.g_exc_error;
2260: END IF;
2261: END IF; /* p_contiguity_override */
2262: ELSE
2263: l_use := fnd_api.g_false;
2264: END IF; /* p_use_workday_cal IS NOT NULL */
2265:
2266: IF l_use = fnd_api.g_true THEN
2267: IF (gme_common_pvt.g_calendar_code IS NOT NULL) THEN
2262: ELSE
2263: l_use := fnd_api.g_false;
2264: END IF; /* p_use_workday_cal IS NOT NULL */
2265:
2266: IF l_use = fnd_api.g_true THEN
2267: IF (gme_common_pvt.g_calendar_code IS NOT NULL) THEN
2268: -- Check if plan_start_date falls on non working day for pending batch step.
2269: IF l_batch_step_rec.step_status =
2270: gme_common_pvt.g_step_pending
2280: ('GME_NON_WORKING_TIME'
2281: ,'PDATE'
2282: ,TO_CHAR (l_batch_step_rec.plan_start_date
2283: ,'DD-MON-YYYY HH24:MI:SS') );
2284: RAISE fnd_api.g_exc_error;
2285: END IF;
2286: END IF;
2287:
2288: -- Check if plan_cmplt_date falls on non working day for pending and WIP batch step.
2303: ('GME_NON_WORKING_TIME'
2304: ,'PDATE'
2305: ,TO_CHAR (l_batch_step_rec.plan_cmplt_date
2306: ,'DD-MON-YYYY HH24:MI:SS') );
2307: RAISE fnd_api.g_exc_error;
2308: END IF;
2309: END IF;
2310:
2311: IF l_batch_step_rec.plan_cmplt_date IS NULL
2321: ('GME_NON_WORKING_TIME'
2322: ,'PDATE'
2323: ,TO_CHAR (SYSDATE
2324: ,'DD-MON-YYYY HH24:MI:SS') );
2325: RAISE fnd_api.g_exc_error;
2326: END IF;
2327: END IF; /* l_batch_step_rec.plan_cmplt_date IS NULL */
2328: END IF; /* (gme_common_pvt.g_calendar_code IS NOT NULL) */
2329: END IF; /* l_use = FND_API.G_TRUE */
2325: RAISE fnd_api.g_exc_error;
2326: END IF;
2327: END IF; /* l_batch_step_rec.plan_cmplt_date IS NULL */
2328: END IF; /* (gme_common_pvt.g_calendar_code IS NOT NULL) */
2329: END IF; /* l_use = FND_API.G_TRUE */
2330:
2331: IF (g_debug = gme_debug.g_log_statement) THEN
2332: gme_debug.put_line ( g_pkg_name
2333: || '.'
2337: END IF;
2338:
2339: gme_api_main.reschedule_step
2340: (p_validation_level => p_validation_level
2341: ,p_init_msg_list => fnd_api.g_false
2342: ,p_batch_header_rec => l_batch_header_rec
2343: ,p_batch_step_rec => l_batch_step_rec
2344: ,p_reschedule_preceding => p_reschedule_preceding
2345: ,p_reschedule_succeeding => p_reschedule_succeeding
2355: ( 'Came back from Main Reschedule Step with status '
2356: || x_return_status);
2357: END IF;
2358:
2359: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2360: RAISE reschedule_step_failed;
2361: ELSE
2362: IF p_commit = fnd_api.g_true THEN
2363: gme_api_pub.save_batch (p_header_id => NULL
2358:
2359: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2360: RAISE reschedule_step_failed;
2361: ELSE
2362: IF p_commit = fnd_api.g_true THEN
2363: gme_api_pub.save_batch (p_header_id => NULL
2364: ,p_table => NULL
2365: ,p_commit => fnd_api.g_false
2366: ,x_return_status => x_return_status);
2361: ELSE
2362: IF p_commit = fnd_api.g_true THEN
2363: gme_api_pub.save_batch (p_header_id => NULL
2364: ,p_table => NULL
2365: ,p_commit => fnd_api.g_false
2366: ,x_return_status => x_return_status);
2367:
2368: IF x_return_status = fnd_api.g_ret_sts_success THEN
2369: COMMIT;
2364: ,p_table => NULL
2365: ,p_commit => fnd_api.g_false
2366: ,x_return_status => x_return_status);
2367:
2368: IF x_return_status = fnd_api.g_ret_sts_success THEN
2369: COMMIT;
2370: ELSE
2371: RAISE fnd_api.g_exc_error;
2372: END IF;
2367:
2368: IF x_return_status = fnd_api.g_ret_sts_success THEN
2369: COMMIT;
2370: ELSE
2371: RAISE fnd_api.g_exc_error;
2372: END IF;
2373: END IF;
2374: END IF;
2375:
2387: WHEN reschedule_step_failed THEN
2388: ROLLBACK TO SAVEPOINT reschedule_step;
2389: x_batch_step_rec := NULL;
2390: gme_common_pvt.count_and_get (x_count => x_message_count
2391: ,p_encoded => fnd_api.g_false
2392: ,x_data => x_message_list);
2393: WHEN fnd_api.g_exc_error THEN
2394: ROLLBACK TO SAVEPOINT reschedule_step;
2395: x_return_status := fnd_api.g_ret_sts_error;
2389: x_batch_step_rec := NULL;
2390: gme_common_pvt.count_and_get (x_count => x_message_count
2391: ,p_encoded => fnd_api.g_false
2392: ,x_data => x_message_list);
2393: WHEN fnd_api.g_exc_error THEN
2394: ROLLBACK TO SAVEPOINT reschedule_step;
2395: x_return_status := fnd_api.g_ret_sts_error;
2396: gme_common_pvt.count_and_get (x_count => x_message_count
2397: ,p_encoded => fnd_api.g_false
2391: ,p_encoded => fnd_api.g_false
2392: ,x_data => x_message_list);
2393: WHEN fnd_api.g_exc_error THEN
2394: ROLLBACK TO SAVEPOINT reschedule_step;
2395: x_return_status := fnd_api.g_ret_sts_error;
2396: gme_common_pvt.count_and_get (x_count => x_message_count
2397: ,p_encoded => fnd_api.g_false
2398: ,x_data => x_message_list);
2399: WHEN OTHERS THEN
2393: WHEN fnd_api.g_exc_error THEN
2394: ROLLBACK TO SAVEPOINT reschedule_step;
2395: x_return_status := fnd_api.g_ret_sts_error;
2396: gme_common_pvt.count_and_get (x_count => x_message_count
2397: ,p_encoded => fnd_api.g_false
2398: ,x_data => x_message_list);
2399: WHEN OTHERS THEN
2400: ROLLBACK TO SAVEPOINT reschedule_step;
2401: x_batch_step_rec := NULL;
2409: PROCEDURE create_batch_reservations (
2410: p_api_version IN NUMBER := 2.0
2411: ,p_validation_level IN NUMBER
2412: := gme_common_pvt.g_max_errors
2413: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2414: ,p_commit IN VARCHAR2 := fnd_api.g_false
2415: ,p_batch_rec IN gme_batch_header%ROWTYPE
2416: ,p_org_code IN VARCHAR2
2417: ,x_message_count OUT NOCOPY NUMBER
2410: p_api_version IN NUMBER := 2.0
2411: ,p_validation_level IN NUMBER
2412: := gme_common_pvt.g_max_errors
2413: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2414: ,p_commit IN VARCHAR2 := fnd_api.g_false
2415: ,p_batch_rec IN gme_batch_header%ROWTYPE
2416: ,p_org_code IN VARCHAR2
2417: ,x_message_count OUT NOCOPY NUMBER
2418: ,x_message_list OUT NOCOPY VARCHAR2
2428:
2429: /* Set the savepoint */
2430: SAVEPOINT create_batch_reservations;
2431: /* Set the return status to success initially */
2432: x_return_status := fnd_api.g_ret_sts_success;
2433:
2434: IF g_debug <> -1 THEN
2435: gme_debug.log_initialize ('CreateBatchReservations');
2436: END IF;
2435: gme_debug.log_initialize ('CreateBatchReservations');
2436: END IF;
2437:
2438: /* Make sure we are call compatible */
2439: IF NOT fnd_api.compatible_api_call (2.0
2440: ,p_api_version
2441: ,'insert_batchstep_resource'
2442: ,g_pkg_name) THEN
2443: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2440: ,p_api_version
2441: ,'insert_batchstep_resource'
2442: ,g_pkg_name) THEN
2443: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2444: RAISE fnd_api.g_exc_error;
2445: END IF;
2446:
2447: /* Initialize message list and count if needed */
2448: IF p_init_msg_list = fnd_api.g_true THEN
2444: RAISE fnd_api.g_exc_error;
2445: END IF;
2446:
2447: /* Initialize message list and count if needed */
2448: IF p_init_msg_list = fnd_api.g_true THEN
2449: fnd_msg_pub.initialize;
2450: END IF;
2451:
2452: gme_common_pvt.set_timestamp;
2452: gme_common_pvt.set_timestamp;
2453:
2454: /* IF p_batch_rec.batch_no IS NULL AND p_batch_rec.batch_id IS NULL THEN
2455: gme_common_pvt.log_message ('GME_MISSING_BATCH_IDENTIFIER');
2456: RAISE fnd_api.g_exc_error;
2457: END IF; */
2458: gme_common_pvt.validate_batch
2459: (p_batch_header_rec => p_batch_rec
2460: ,p_org_code => p_org_code
2463: ,x_message_count => x_message_count
2464: ,x_message_list => x_message_list
2465: ,x_return_status => x_return_status );
2466:
2467: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2468: IF (g_debug = gme_debug.g_log_statement) THEN
2469: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2470: || ': batch validate error ');
2471: END IF;
2468: IF (g_debug = gme_debug.g_log_statement) THEN
2469: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2470: || ': batch validate error ');
2471: END IF;
2472: RAISE fnd_api.g_exc_error;
2473: END IF;
2474:
2475: /* Verify Batch to be in pending or WIP status */
2476: IF l_batch_header_rec.batch_status NOT IN
2477: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
2478: gme_common_pvt.log_message ('GME_INVALID_BATCH_STATUS'
2479: ,'PROCESS'
2480: ,'CREATE_LINE_RESERVATIONS');
2481: RAISE fnd_api.g_exc_error;
2482: END IF;
2483:
2484: gme_api_main.create_batch_reservations
2485: (p_init_msg_list => p_init_msg_list
2492: gme_debug.put_line ( 'create batch reservations returns '
2493: || x_return_status);
2494: END IF;
2495:
2496: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2497: RAISE fnd_api.g_exc_error;
2498: END IF;
2499:
2500: IF p_commit = fnd_api.g_true THEN
2493: || x_return_status);
2494: END IF;
2495:
2496: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2497: RAISE fnd_api.g_exc_error;
2498: END IF;
2499:
2500: IF p_commit = fnd_api.g_true THEN
2501: COMMIT;
2496: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2497: RAISE fnd_api.g_exc_error;
2498: END IF;
2499:
2500: IF p_commit = fnd_api.g_true THEN
2501: COMMIT;
2502: END IF;
2503:
2504: gme_debug.put_line ( 'End of Create_Batch_Reservations at '
2504: gme_debug.put_line ( 'End of Create_Batch_Reservations at '
2505: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2506: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2507: EXCEPTION
2508: WHEN fnd_api.g_exc_error THEN
2509: x_return_status := fnd_api.g_ret_sts_error;
2510: ROLLBACK TO SAVEPOINT create_batch_reservations;
2511: gme_common_pvt.count_and_get(x_count => x_message_count
2512: ,p_encoded => fnd_api.g_false
2505: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2506: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2507: EXCEPTION
2508: WHEN fnd_api.g_exc_error THEN
2509: x_return_status := fnd_api.g_ret_sts_error;
2510: ROLLBACK TO SAVEPOINT create_batch_reservations;
2511: gme_common_pvt.count_and_get(x_count => x_message_count
2512: ,p_encoded => fnd_api.g_false
2513: ,x_data => x_message_list);
2508: WHEN fnd_api.g_exc_error THEN
2509: x_return_status := fnd_api.g_ret_sts_error;
2510: ROLLBACK TO SAVEPOINT create_batch_reservations;
2511: gme_common_pvt.count_and_get(x_count => x_message_count
2512: ,p_encoded => fnd_api.g_false
2513: ,x_data => x_message_list);
2514: WHEN OTHERS THEN
2515: ROLLBACK TO SAVEPOINT create_batch_reservations;
2516: gme_when_others ( p_api_name => l_api_name
2522: PROCEDURE create_line_reservations (
2523: p_api_version IN NUMBER := 2.0
2524: ,p_validation_level IN NUMBER
2525: := gme_common_pvt.g_max_errors
2526: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2527: ,p_commit IN VARCHAR2 := fnd_api.g_false
2528: ,p_material_detail_id IN NUMBER
2529: ,p_org_code IN VARCHAR2
2530: ,p_batch_no IN VARCHAR2
2523: p_api_version IN NUMBER := 2.0
2524: ,p_validation_level IN NUMBER
2525: := gme_common_pvt.g_max_errors
2526: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
2527: ,p_commit IN VARCHAR2 := fnd_api.g_false
2528: ,p_material_detail_id IN NUMBER
2529: ,p_org_code IN VARCHAR2
2530: ,p_batch_no IN VARCHAR2
2531: ,p_line_no IN NUMBER
2546:
2547: /* Set the savepoint */
2548: SAVEPOINT create_line_reservations;
2549: /* Set the return status to success initially */
2550: x_return_status := fnd_api.g_ret_sts_success;
2551:
2552: IF g_debug <> -1 THEN
2553: gme_debug.log_initialize ('CreateLineReservations');
2554: END IF;
2553: gme_debug.log_initialize ('CreateLineReservations');
2554: END IF;
2555:
2556: /* Make sure we are call compatible */
2557: IF NOT fnd_api.compatible_api_call (2.0
2558: ,p_api_version
2559: ,'insert_batchstep_resource'
2560: ,g_pkg_name) THEN
2561: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2558: ,p_api_version
2559: ,'insert_batchstep_resource'
2560: ,g_pkg_name) THEN
2561: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2562: RAISE fnd_api.g_exc_error;
2563: END IF;
2564:
2565: /* Initialize message list and count if needed */
2566: IF p_init_msg_list = fnd_api.g_true THEN
2562: RAISE fnd_api.g_exc_error;
2563: END IF;
2564:
2565: /* Initialize message list and count if needed */
2566: IF p_init_msg_list = fnd_api.g_true THEN
2567: fnd_msg_pub.initialize;
2568: END IF;
2569:
2570: gme_common_pvt.set_timestamp;
2583: ,x_material_detail_rec => l_material_details_rec_out
2584: ,x_message_count => x_message_count
2585: ,x_message_list => x_message_list
2586: ,x_return_status => x_return_status );
2587: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2588: IF (g_debug = gme_debug.g_log_statement) THEN
2589: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2590: || ': batch mateiral validate error ');
2591: END IF;
2588: IF (g_debug = gme_debug.g_log_statement) THEN
2589: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
2590: || ': batch mateiral validate error ');
2591: END IF;
2592: RAISE fnd_api.g_exc_error;
2593: END IF;
2594: l_material_details_rec := l_material_details_rec_out;
2595:
2596: /* Reservation cannot be against a phantom */
2595:
2596: /* Reservation cannot be against a phantom */
2597: IF l_material_details_rec.phantom_type IN (1, 2) THEN
2598: gme_common_pvt.log_message ('GME_INVALID_RSV_FOR_PHANTOM');
2599: RAISE fnd_api.g_exc_error;
2600: END IF;
2601:
2602: /* Reservation cannot be against a phantom */
2603: IF l_material_details_rec.line_type <> -1 THEN
2601:
2602: /* Reservation cannot be against a phantom */
2603: IF l_material_details_rec.line_type <> -1 THEN
2604: gme_common_pvt.log_message ('GME_INVALID_LINE_FOR_RSV');
2605: RAISE fnd_api.g_exc_error;
2606: END IF;
2607:
2608: /* Verify that update_inventory is permitted for this batch */
2609: IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
2607:
2608: /* Verify that update_inventory is permitted for this batch */
2609: IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
2610: gme_common_pvt.log_message ('GME_INVENTORY_UPDATE_BLOCKED');
2611: RAISE fnd_api.g_exc_error;
2612: END IF;
2613:
2614: -- gme_debug.put_line(l_batch_header_rec.batch_status);
2615:
2618: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
2619: gme_common_pvt.log_message ('GME_INVALID_BATCH_STATUS'
2620: ,'PROCESS'
2621: ,'CREATE_RESERVATION');
2622: RAISE fnd_api.g_exc_error;
2623: END IF;
2624:
2625: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
2626: gme_common_pvt.log_message ('GME_FPO_RESERVATION_ERROR');
2623: END IF;
2624:
2625: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
2626: gme_common_pvt.log_message ('GME_FPO_RESERVATION_ERROR');
2627: RAISE fnd_api.g_exc_error;
2628: END IF;
2629: gme_api_main.create_line_reservations
2630: (p_init_msg_list => p_init_msg_list
2631: ,p_matl_dtl_rec => l_material_details_rec
2637: gme_debug.put_line ( 'create line reservation returns '
2638: || x_return_status);
2639: END IF;
2640:
2641: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2642: RAISE fnd_api.g_exc_error;
2643: END IF;
2644:
2645: IF p_commit = fnd_api.g_true THEN
2638: || x_return_status);
2639: END IF;
2640:
2641: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2642: RAISE fnd_api.g_exc_error;
2643: END IF;
2644:
2645: IF p_commit = fnd_api.g_true THEN
2646: COMMIT;
2641: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2642: RAISE fnd_api.g_exc_error;
2643: END IF;
2644:
2645: IF p_commit = fnd_api.g_true THEN
2646: COMMIT;
2647: END IF;
2648:
2649: gme_debug.put_line ( 'End of Create_Line_Reservations at '
2649: gme_debug.put_line ( 'End of Create_Line_Reservations at '
2650: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2651: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2652: EXCEPTION
2653: WHEN fnd_api.g_exc_error THEN
2654: x_return_status := fnd_api.g_ret_sts_error;
2655: ROLLBACK TO SAVEPOINT create_line_reservations;
2656: gme_common_pvt.count_and_get(x_count => x_message_count
2657: ,p_encoded => fnd_api.g_false
2650: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2651: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2652: EXCEPTION
2653: WHEN fnd_api.g_exc_error THEN
2654: x_return_status := fnd_api.g_ret_sts_error;
2655: ROLLBACK TO SAVEPOINT create_line_reservations;
2656: gme_common_pvt.count_and_get(x_count => x_message_count
2657: ,p_encoded => fnd_api.g_false
2658: ,x_data => x_message_list);
2653: WHEN fnd_api.g_exc_error THEN
2654: x_return_status := fnd_api.g_ret_sts_error;
2655: ROLLBACK TO SAVEPOINT create_line_reservations;
2656: gme_common_pvt.count_and_get(x_count => x_message_count
2657: ,p_encoded => fnd_api.g_false
2658: ,x_data => x_message_list);
2659: WHEN OTHERS THEN
2660: ROLLBACK TO SAVEPOINT create_line_reservations;
2661: gme_when_others ( p_api_name => l_api_name
2697: gme_debug.log_initialize ('InsertProcessParameters');
2698: END IF;
2699:
2700: /* Set the return status to success initially */
2701: x_return_status := fnd_api.g_ret_sts_success;
2702:
2703: IF p_init_msg_list = fnd_api.g_true THEN
2704: fnd_msg_pub.initialize;
2705: END IF;
2699:
2700: /* Set the return status to success initially */
2701: x_return_status := fnd_api.g_ret_sts_success;
2702:
2703: IF p_init_msg_list = fnd_api.g_true THEN
2704: fnd_msg_pub.initialize;
2705: END IF;
2706: -- Make sure we are call compatible
2707: IF NOT fnd_api.compatible_api_call (2.0
2703: IF p_init_msg_list = fnd_api.g_true THEN
2704: fnd_msg_pub.initialize;
2705: END IF;
2706: -- Make sure we are call compatible
2707: IF NOT fnd_api.compatible_api_call (2.0
2708: ,p_api_version
2709: ,'Insert_process_parameter'
2710: ,g_pkg_name) THEN
2711: x_return_status := fnd_api.g_ret_sts_error;
2707: IF NOT fnd_api.compatible_api_call (2.0
2708: ,p_api_version
2709: ,'Insert_process_parameter'
2710: ,g_pkg_name) THEN
2711: x_return_status := fnd_api.g_ret_sts_error;
2712: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
2713: RAISE fnd_api.g_exc_error;
2714: END IF;
2715: --added by qzeng no need to check if done in bulk validation
2709: ,'Insert_process_parameter'
2710: ,g_pkg_name) THEN
2711: x_return_status := fnd_api.g_ret_sts_error;
2712: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
2713: RAISE fnd_api.g_exc_error;
2714: END IF;
2715: --added by qzeng no need to check if done in bulk validation
2716: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
2717: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2719: IF NOT gme_common_pvt.g_setup_done THEN
2720: IF (g_debug = gme_debug.g_log_statement) THEN
2721: gme_debug.put_line (g_pkg_name||'.'||l_api_name|| ':set up problem ');
2722: END IF;
2723: RAISE fnd_api.g_exc_error;
2724: END IF;
2725: END IF;
2726: IF (g_debug <= gme_debug.g_log_procedure) THEN
2727: gme_debug.put_line ('Calling Insert process parameters');
2744: ( 'Came back from Pvt insert process parameter with status '
2745: || x_return_status);
2746: END IF;
2747:
2748: IF x_return_status = fnd_api.g_ret_sts_success THEN
2749: IF p_commit = fnd_api.g_true THEN
2750: COMMIT;
2751: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2752: END IF;
2745: || x_return_status);
2746: END IF;
2747:
2748: IF x_return_status = fnd_api.g_ret_sts_success THEN
2749: IF p_commit = fnd_api.g_true THEN
2750: COMMIT;
2751: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2752: END IF;
2753: ELSE
2763: || ' at '
2764: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2765: END IF;
2766: EXCEPTION
2767: WHEN fnd_api.g_exc_error THEN
2768: x_return_status := fnd_api.g_ret_sts_error;
2769: ROLLBACK TO SAVEPOINT insert_process_parameter;
2770: gme_common_pvt.count_and_get (x_count => x_message_count
2771: ,p_encoded => fnd_api.g_false
2764: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2765: END IF;
2766: EXCEPTION
2767: WHEN fnd_api.g_exc_error THEN
2768: x_return_status := fnd_api.g_ret_sts_error;
2769: ROLLBACK TO SAVEPOINT insert_process_parameter;
2770: gme_common_pvt.count_and_get (x_count => x_message_count
2771: ,p_encoded => fnd_api.g_false
2772: ,x_data => x_message_list);
2767: WHEN fnd_api.g_exc_error THEN
2768: x_return_status := fnd_api.g_ret_sts_error;
2769: ROLLBACK TO SAVEPOINT insert_process_parameter;
2770: gme_common_pvt.count_and_get (x_count => x_message_count
2771: ,p_encoded => fnd_api.g_false
2772: ,x_data => x_message_list);
2773: WHEN insert_parameter_failed THEN
2774: ROLLBACK TO SAVEPOINT insert_process_parameter;
2775: gme_common_pvt.count_and_get (x_count => x_message_count
2772: ,x_data => x_message_list);
2773: WHEN insert_parameter_failed THEN
2774: ROLLBACK TO SAVEPOINT insert_process_parameter;
2775: gme_common_pvt.count_and_get (x_count => x_message_count
2776: ,p_encoded => fnd_api.g_false
2777: ,x_data => x_message_list);
2778: WHEN OTHERS THEN
2779: ROLLBACK TO SAVEPOINT insert_process_parameter;
2780: gme_when_others ( p_api_name => l_api_name
2816: gme_debug.log_initialize ('UpdateProcessParameter');
2817: END IF;
2818:
2819: /* Initially let us assign the return status to success */
2820: x_return_status := fnd_api.g_ret_sts_success;
2821:
2822: IF p_init_msg_list = fnd_api.g_true THEN
2823: fnd_msg_pub.initialize;
2824: gme_common_pvt.g_error_count := 0;
2818:
2819: /* Initially let us assign the return status to success */
2820: x_return_status := fnd_api.g_ret_sts_success;
2821:
2822: IF p_init_msg_list = fnd_api.g_true THEN
2823: fnd_msg_pub.initialize;
2824: gme_common_pvt.g_error_count := 0;
2825: END IF;
2826:
2824: gme_common_pvt.g_error_count := 0;
2825: END IF;
2826:
2827: -- Make sure we are call compatible
2828: IF NOT fnd_api.compatible_api_call (2.0
2829: ,p_api_version
2830: ,'Insert_process_parameter'
2831: ,g_pkg_name) THEN
2832: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2829: ,p_api_version
2830: ,'Insert_process_parameter'
2831: ,g_pkg_name) THEN
2832: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2833: RAISE fnd_api.g_exc_error;
2834: END IF;
2835: --added by qzeng no need to check if done in bulk validation
2836: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
2837: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2836: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
2837: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2838:
2839: IF NOT gme_common_pvt.g_setup_done THEN
2840: x_return_status := fnd_api.g_ret_sts_error;
2841: RAISE fnd_api.g_exc_error;
2842: END IF;
2843: END IF;
2844: gme_common_pvt.set_timestamp;
2837: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2838:
2839: IF NOT gme_common_pvt.g_setup_done THEN
2840: x_return_status := fnd_api.g_ret_sts_error;
2841: RAISE fnd_api.g_exc_error;
2842: END IF;
2843: END IF;
2844: gme_common_pvt.set_timestamp;
2845: gme_process_parameters_pvt.update_process_parameter
2858: ( 'Came back from Pvt update process parameter with status '
2859: || x_return_status);
2860: END IF;
2861:
2862: IF x_return_status = fnd_api.g_ret_sts_success THEN
2863: IF p_commit = fnd_api.g_true THEN
2864: COMMIT;
2865: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2866: END IF;
2859: || x_return_status);
2860: END IF;
2861:
2862: IF x_return_status = fnd_api.g_ret_sts_success THEN
2863: IF p_commit = fnd_api.g_true THEN
2864: COMMIT;
2865: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2866: END IF;
2867: ELSE
2878: || ' at '
2879: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2880: END IF;
2881: EXCEPTION
2882: WHEN fnd_api.g_exc_error THEN
2883: x_return_status := fnd_api.g_ret_sts_error;
2884: ROLLBACK TO SAVEPOINT update_process_parameter;
2885: gme_common_pvt.count_and_get (x_count => x_message_count
2886: ,p_encoded => fnd_api.g_false
2879: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2880: END IF;
2881: EXCEPTION
2882: WHEN fnd_api.g_exc_error THEN
2883: x_return_status := fnd_api.g_ret_sts_error;
2884: ROLLBACK TO SAVEPOINT update_process_parameter;
2885: gme_common_pvt.count_and_get (x_count => x_message_count
2886: ,p_encoded => fnd_api.g_false
2887: ,x_data => x_message_list);
2882: WHEN fnd_api.g_exc_error THEN
2883: x_return_status := fnd_api.g_ret_sts_error;
2884: ROLLBACK TO SAVEPOINT update_process_parameter;
2885: gme_common_pvt.count_and_get (x_count => x_message_count
2886: ,p_encoded => fnd_api.g_false
2887: ,x_data => x_message_list);
2888: WHEN update_parameter_failed THEN
2889: ROLLBACK TO SAVEPOINT update_process_parameter;
2890: gme_common_pvt.count_and_get (x_count => x_message_count
2887: ,x_data => x_message_list);
2888: WHEN update_parameter_failed THEN
2889: ROLLBACK TO SAVEPOINT update_process_parameter;
2890: gme_common_pvt.count_and_get (x_count => x_message_count
2891: ,p_encoded => fnd_api.g_false
2892: ,x_data => x_message_list);
2893: WHEN OTHERS THEN
2894: ROLLBACK TO SAVEPOINT update_process_parameter;
2895: gme_when_others ( p_api_name => l_api_name
2929: gme_debug.log_initialize ('DeleteProcessParameter');
2930: END IF;
2931:
2932: /* Set the return status to success initially */
2933: x_return_status := fnd_api.g_ret_sts_success;
2934:
2935: IF p_init_msg_list = fnd_api.g_true THEN
2936: fnd_msg_pub.initialize;
2937: gme_common_pvt.g_error_count := 0;
2931:
2932: /* Set the return status to success initially */
2933: x_return_status := fnd_api.g_ret_sts_success;
2934:
2935: IF p_init_msg_list = fnd_api.g_true THEN
2936: fnd_msg_pub.initialize;
2937: gme_common_pvt.g_error_count := 0;
2938: END IF;
2939:
2937: gme_common_pvt.g_error_count := 0;
2938: END IF;
2939:
2940: -- Make sure we are call compatible
2941: IF NOT fnd_api.compatible_api_call (2.0
2942: ,p_api_version
2943: ,'Insert_process_parameter'
2944: ,g_pkg_name) THEN
2945: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2942: ,p_api_version
2943: ,'Insert_process_parameter'
2944: ,g_pkg_name) THEN
2945: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
2946: RAISE fnd_api.g_exc_error;
2947: END IF;
2948:
2949: --added by qzeng no need to check if done in bulk validation
2950: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
2950: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
2951: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2952:
2953: IF NOT gme_common_pvt.g_setup_done THEN
2954: x_return_status := fnd_api.g_ret_sts_error;
2955: RAISE fnd_api.g_exc_error;
2956: END IF;
2957: END IF;
2958:
2951: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
2952:
2953: IF NOT gme_common_pvt.g_setup_done THEN
2954: x_return_status := fnd_api.g_ret_sts_error;
2955: RAISE fnd_api.g_exc_error;
2956: END IF;
2957: END IF;
2958:
2959: IF (g_debug <= gme_debug.g_log_procedure) THEN
2975: ( 'Came back from Pvt delete process parameter with status '
2976: || x_return_status);
2977: END IF;
2978:
2979: IF x_return_status = fnd_api.g_ret_sts_success THEN
2980: IF p_commit = fnd_api.g_true THEN
2981: COMMIT;
2982: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2983: END IF;
2976: || x_return_status);
2977: END IF;
2978:
2979: IF x_return_status = fnd_api.g_ret_sts_success THEN
2980: IF p_commit = fnd_api.g_true THEN
2981: COMMIT;
2982: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
2983: END IF;
2984: ELSE
2990: 'Exiting with ' || x_return_status || ' at '
2991: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2992: END IF;
2993: EXCEPTION
2994: WHEN fnd_api.g_exc_error THEN
2995: x_return_status := fnd_api.g_ret_sts_error;
2996: ROLLBACK TO SAVEPOINT delete_process_parameter;
2997: gme_common_pvt.count_and_get (x_count => x_message_count
2998: ,p_encoded => fnd_api.g_false
2991: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
2992: END IF;
2993: EXCEPTION
2994: WHEN fnd_api.g_exc_error THEN
2995: x_return_status := fnd_api.g_ret_sts_error;
2996: ROLLBACK TO SAVEPOINT delete_process_parameter;
2997: gme_common_pvt.count_and_get (x_count => x_message_count
2998: ,p_encoded => fnd_api.g_false
2999: ,x_data => x_message_list);
2994: WHEN fnd_api.g_exc_error THEN
2995: x_return_status := fnd_api.g_ret_sts_error;
2996: ROLLBACK TO SAVEPOINT delete_process_parameter;
2997: gme_common_pvt.count_and_get (x_count => x_message_count
2998: ,p_encoded => fnd_api.g_false
2999: ,x_data => x_message_list);
3000: WHEN delete_parameter_failed THEN
3001: ROLLBACK TO SAVEPOINT delete_process_parameter;
3002: gme_common_pvt.count_and_get (x_count => x_message_count
2999: ,x_data => x_message_list);
3000: WHEN delete_parameter_failed THEN
3001: ROLLBACK TO SAVEPOINT delete_process_parameter;
3002: gme_common_pvt.count_and_get (x_count => x_message_count
3003: ,p_encoded => fnd_api.g_false
3004: ,x_data => x_message_list);
3005: WHEN OTHERS THEN
3006: ROLLBACK TO SAVEPOINT delete_process_parameter;
3007: gme_when_others ( p_api_name => l_api_name
3014: PROCEDURE delete_step (
3015: p_api_version IN NUMBER := 2.0
3016: ,p_validation_level IN NUMBER
3017: := gme_common_pvt.g_max_errors
3018: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3019: ,p_commit IN VARCHAR2
3020: ,p_org_code IN VARCHAR2
3021: ,p_batch_no IN VARCHAR2
3022: ,x_message_count OUT NOCOPY NUMBER
3028: l_batch_header_rec gme_batch_header%rowtype;
3029: delete_step_failed EXCEPTION;
3030: BEGIN
3031: /* Set the return status to success initially */
3032: x_return_status := fnd_api.g_ret_sts_success;
3033:
3034: /* Set savepoint here */
3035: SAVEPOINT delete_step;
3036:
3034: /* Set savepoint here */
3035: SAVEPOINT delete_step;
3036:
3037: /* Initialize message list and count if needed */
3038: IF p_init_msg_list = fnd_api.g_true THEN
3039: fnd_msg_pub.initialize;
3040: gme_common_pvt.g_error_count := 0;
3041: END IF;
3042:
3045: /* Setup the common constants used accross the apis */
3046: gme_common_pvt.g_setup_done := gme_common_pvt.setup (p_org_code => p_org_code);
3047:
3048: IF NOT gme_common_pvt.g_setup_done THEN
3049: RAISE fnd_api.g_exc_error;
3050: END IF;
3051: END IF;
3052: /* Make sure we are call compatible */
3053: IF NOT fnd_api.compatible_api_call (2
3049: RAISE fnd_api.g_exc_error;
3050: END IF;
3051: END IF;
3052: /* Make sure we are call compatible */
3053: IF NOT fnd_api.compatible_api_call (2
3054: ,p_api_version
3055: ,'delete_step'
3056: ,g_pkg_name) THEN
3057: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3054: ,p_api_version
3055: ,'delete_step'
3056: ,g_pkg_name) THEN
3057: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3058: RAISE fnd_api.g_exc_error;
3059: END IF;
3060: gme_api_main.delete_step (p_validation_level => p_validation_level
3061: ,p_init_msg_list => fnd_api.g_false
3062: ,x_message_count => x_message_count
3057: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3058: RAISE fnd_api.g_exc_error;
3059: END IF;
3060: gme_api_main.delete_step (p_validation_level => p_validation_level
3061: ,p_init_msg_list => fnd_api.g_false
3062: ,x_message_count => x_message_count
3063: ,x_message_list => x_message_list
3064: ,x_return_status => x_return_status
3065: ,p_batch_header_rec => l_batch_header_rec
3064: ,x_return_status => x_return_status
3065: ,p_batch_header_rec => l_batch_header_rec
3066: ,p_batch_step_rec => p_batch_step_rec);
3067:
3068: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3069: RAISE delete_step_failed;
3070: ELSE
3071: IF p_commit = fnd_api.g_true THEN
3072: gme_api_pub.save_batch (p_header_id => null
3067:
3068: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3069: RAISE delete_step_failed;
3070: ELSE
3071: IF p_commit = fnd_api.g_true THEN
3072: gme_api_pub.save_batch (p_header_id => null
3073: ,p_table => 1
3074: ,p_commit => fnd_api.g_false
3075: ,x_return_status => x_return_status);
3070: ELSE
3071: IF p_commit = fnd_api.g_true THEN
3072: gme_api_pub.save_batch (p_header_id => null
3073: ,p_table => 1
3074: ,p_commit => fnd_api.g_false
3075: ,x_return_status => x_return_status);
3076:
3077: IF x_return_status = fnd_api.g_ret_sts_success THEN
3078: COMMIT;
3073: ,p_table => 1
3074: ,p_commit => fnd_api.g_false
3075: ,x_return_status => x_return_status);
3076:
3077: IF x_return_status = fnd_api.g_ret_sts_success THEN
3078: COMMIT;
3079: ELSE
3080: RAISE fnd_api.g_exc_error;
3081: END IF;
3076:
3077: IF x_return_status = fnd_api.g_ret_sts_success THEN
3078: COMMIT;
3079: ELSE
3080: RAISE fnd_api.g_exc_error;
3081: END IF;
3082: END IF;
3083: END IF;
3084:
3086: gme_debug.put_line ( 'Completed ' || l_api_name || ' at ' || TO_CHAR
3087: (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3088: END IF;
3089: EXCEPTION
3090: WHEN fnd_api.g_exc_error THEN
3091: ROLLBACK TO SAVEPOINT delete_step;
3092: x_return_status := fnd_api.g_ret_sts_error;
3093: gme_common_pvt.count_and_get (x_count => x_message_count
3094: ,p_encoded => fnd_api.g_false
3088: END IF;
3089: EXCEPTION
3090: WHEN fnd_api.g_exc_error THEN
3091: ROLLBACK TO SAVEPOINT delete_step;
3092: x_return_status := fnd_api.g_ret_sts_error;
3093: gme_common_pvt.count_and_get (x_count => x_message_count
3094: ,p_encoded => fnd_api.g_false
3095: ,x_data => x_message_list);
3096: WHEN delete_step_failed THEN
3090: WHEN fnd_api.g_exc_error THEN
3091: ROLLBACK TO SAVEPOINT delete_step;
3092: x_return_status := fnd_api.g_ret_sts_error;
3093: gme_common_pvt.count_and_get (x_count => x_message_count
3094: ,p_encoded => fnd_api.g_false
3095: ,x_data => x_message_list);
3096: WHEN delete_step_failed THEN
3097: ROLLBACK TO SAVEPOINT delete_step;
3098: gme_common_pvt.count_and_get (x_count => x_message_count
3095: ,x_data => x_message_list);
3096: WHEN delete_step_failed THEN
3097: ROLLBACK TO SAVEPOINT delete_step;
3098: gme_common_pvt.count_and_get (x_count => x_message_count
3099: ,p_encoded => fnd_api.g_false
3100: ,x_data => x_message_list);
3101: WHEN OTHERS THEN
3102: ROLLBACK TO SAVEPOINT delete_step;
3103: gme_when_others ( p_api_name => l_api_name
3117: /*************************************************************************/
3118: PROCEDURE insert_step (
3119: p_api_version IN NUMBER := 2.0
3120: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3121: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3122: ,p_commit IN VARCHAR2
3123: ,p_org_code IN VARCHAR2
3124: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
3125: ,p_oprn_no IN VARCHAR2
3120: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3121: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3122: ,p_commit IN VARCHAR2
3123: ,p_org_code IN VARCHAR2
3124: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
3125: ,p_oprn_no IN VARCHAR2
3126: ,p_oprn_vers IN NUMBER
3127: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3128: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
3161: AND oprn_vers = l_oprn_vers
3162: AND owner_organization_id = l_org_id);
3163: BEGIN
3164: /* Set the return status to success initially */
3165: x_return_status := fnd_api.g_ret_sts_success;
3166:
3167: /* Set savepoint here */
3168: SAVEPOINT insert_step;
3169:
3167: /* Set savepoint here */
3168: SAVEPOINT insert_step;
3169:
3170: /* Initialize message list and count if needed */
3171: IF p_init_msg_list = fnd_api.g_true THEN
3172: fnd_msg_pub.initialize;
3173: gme_common_pvt.g_error_count := 0;
3174: END IF;
3175: gme_common_pvt.g_setup_done :=
3176: gme_common_pvt.setup (p_org_id => p_batch_header_rec.organization_id
3177: ,p_org_code => p_org_code);
3178:
3179: IF NOT gme_common_pvt.g_setup_done THEN
3180: RAISE fnd_api.g_exc_error;
3181: END IF;
3182:
3183: /* Make sure we are call compatible */
3184: IF NOT fnd_api.compatible_api_call (2
3180: RAISE fnd_api.g_exc_error;
3181: END IF;
3182:
3183: /* Make sure we are call compatible */
3184: IF NOT fnd_api.compatible_api_call (2
3185: ,p_api_version
3186: ,'insert_step'
3187: ,g_pkg_name) THEN
3188: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3185: ,p_api_version
3186: ,'insert_step'
3187: ,g_pkg_name) THEN
3188: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3189: RAISE fnd_api.g_exc_error;
3190: END IF;
3191:
3192: IF (p_batch_step_rec.batch_id IS NOT NULL) THEN
3193: l_batch_header_rec.batch_id := p_batch_step_rec.batch_id;
3193: l_batch_header_rec.batch_id := p_batch_step_rec.batch_id;
3194:
3195: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
3196: ,l_batch_header_rec) ) THEN
3197: RAISE fnd_api.g_exc_error;
3198: END IF;
3199: ELSE
3200: IF NOT (gme_batch_header_dbl.fetch_row (p_batch_header_rec
3201: ,l_batch_header_rec) ) THEN
3198: END IF;
3199: ELSE
3200: IF NOT (gme_batch_header_dbl.fetch_row (p_batch_header_rec
3201: ,l_batch_header_rec) ) THEN
3202: RAISE fnd_api.g_exc_error;
3203: END IF;
3204: END IF;
3205:
3206: /* Bug 2766460 Added check not to allow insert step if batch is completed/closed or cancelled */
3207: IF (l_batch_header_rec.batch_status IN (gme_common_pvt.g_batch_cancelled,
3208: gme_common_pvt.g_batch_completed,
3209: gme_common_pvt.g_batch_closed) ) THEN
3210: gme_common_pvt.log_message ('GME_INV_STATUS_INSERT_STEP');
3211: RAISE fnd_api.g_exc_error;
3212: END IF;
3213:
3214: -- Bug 2979072 Stop insert if there is no routing associated with this batch.
3215: IF (l_batch_header_rec.routing_id IS NULL) THEN
3214: -- Bug 2979072 Stop insert if there is no routing associated with this batch.
3215: IF (l_batch_header_rec.routing_id IS NULL) THEN
3216: gme_common_pvt.log_message
3217: (p_message_code => 'GME_API_NO_ROUTING_ASSOCIATED');
3218: RAISE fnd_api.g_exc_error;
3219: END IF;
3220:
3221: /* Punit Kumar , bringing this code from GMEVINSB.pls*/
3222: IF (p_batch_step_rec.steprelease_type NOT IN (1, 2) ) THEN
3220:
3221: /* Punit Kumar , bringing this code from GMEVINSB.pls*/
3222: IF (p_batch_step_rec.steprelease_type NOT IN (1, 2) ) THEN
3223: gme_common_pvt.log_message ('GME_INVALID_STEPRELEASE');
3224: RAISE fnd_api.g_exc_error;
3225: END IF;
3226:
3227: /* End Bug 2397077 */
3228: IF (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_closed)
3228: IF (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_closed)
3229: OR (l_batch_header_rec.batch_status = gme_common_pvt.g_batch_cancelled) THEN
3230: -- Closed or cancelled batch not valid for step insert...
3231: gme_common_pvt.log_message ('GME_INV_STATUS_INSERT_STEP');
3232: RAISE fnd_api.g_exc_error;
3233: END IF;
3234:
3235: IF p_batch_step_rec.oprn_id IS NOT NULL THEN
3236: --added by qzeng no need to check if done in bulk validation
3283: RAISE insert_step_failed;
3284: END IF;
3285: END IF;
3286:
3287: IF p_validate_flexfields = fnd_api.g_true THEN
3288: gme_common_pvt.g_flex_validate_prof := 1;
3289: ELSE
3290: gme_common_pvt.g_flex_validate_prof := 0;
3291: END IF;
3289: ELSE
3290: gme_common_pvt.g_flex_validate_prof := 0;
3291: END IF;
3292: gme_api_main.insert_step (p_validation_level => p_validation_level
3293: ,p_init_msg_list => fnd_api.g_false
3294: ,x_message_count => x_message_count
3295: ,x_message_list => x_message_list
3296: ,x_return_status => x_return_status
3297: ,p_batch_header_rec => l_batch_header_rec
3299: ,x_batch_step => x_batch_step_rec);
3300:
3301: gme_common_pvt.g_flex_validate_prof := 0;
3302:
3303: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3304: RAISE insert_step_failed;
3305: ELSE
3306: IF p_commit = fnd_api.g_true THEN
3307: gme_api_pub.save_batch (p_header_id => null
3302:
3303: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3304: RAISE insert_step_failed;
3305: ELSE
3306: IF p_commit = fnd_api.g_true THEN
3307: gme_api_pub.save_batch (p_header_id => null
3308: ,p_table => 1
3309: ,p_commit => fnd_api.g_false
3310: ,x_return_status => x_return_status);
3305: ELSE
3306: IF p_commit = fnd_api.g_true THEN
3307: gme_api_pub.save_batch (p_header_id => null
3308: ,p_table => 1
3309: ,p_commit => fnd_api.g_false
3310: ,x_return_status => x_return_status);
3311:
3312: IF x_return_status = fnd_api.g_ret_sts_success THEN
3313: COMMIT;
3308: ,p_table => 1
3309: ,p_commit => fnd_api.g_false
3310: ,x_return_status => x_return_status);
3311:
3312: IF x_return_status = fnd_api.g_ret_sts_success THEN
3313: COMMIT;
3314: ELSE
3315: RAISE fnd_api.g_exc_error;
3316: END IF;
3311:
3312: IF x_return_status = fnd_api.g_ret_sts_success THEN
3313: COMMIT;
3314: ELSE
3315: RAISE fnd_api.g_exc_error;
3316: END IF;
3317: END IF;
3318: END IF;
3319:
3317: END IF;
3318: END IF;
3319:
3320: gme_common_pvt.count_and_get (x_count => x_message_count
3321: ,p_encoded => fnd_api.g_false
3322: ,x_data => x_message_list);
3323:
3324: IF g_debug <= gme_debug.g_log_procedure THEN
3325: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
3325: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
3326: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3327: END IF;
3328: EXCEPTION
3329: WHEN fnd_api.g_exc_error THEN
3330: ROLLBACK TO SAVEPOINT insert_step;
3331: x_return_status := fnd_api.g_ret_sts_error;
3332: gme_common_pvt.count_and_get (x_count => x_message_count
3333: ,p_encoded => fnd_api.g_false
3327: END IF;
3328: EXCEPTION
3329: WHEN fnd_api.g_exc_error THEN
3330: ROLLBACK TO SAVEPOINT insert_step;
3331: x_return_status := fnd_api.g_ret_sts_error;
3332: gme_common_pvt.count_and_get (x_count => x_message_count
3333: ,p_encoded => fnd_api.g_false
3334: ,x_data => x_message_list);
3335: WHEN insert_step_failed THEN
3329: WHEN fnd_api.g_exc_error THEN
3330: ROLLBACK TO SAVEPOINT insert_step;
3331: x_return_status := fnd_api.g_ret_sts_error;
3332: gme_common_pvt.count_and_get (x_count => x_message_count
3333: ,p_encoded => fnd_api.g_false
3334: ,x_data => x_message_list);
3335: WHEN insert_step_failed THEN
3336: ROLLBACK TO SAVEPOINT insert_step;
3337: x_batch_step_rec := NULL;
3335: WHEN insert_step_failed THEN
3336: ROLLBACK TO SAVEPOINT insert_step;
3337: x_batch_step_rec := NULL;
3338: gme_common_pvt.count_and_get (x_count => x_message_count
3339: ,p_encoded => fnd_api.g_false
3340: ,x_data => x_message_list);
3341: WHEN OTHERS THEN
3342: ROLLBACK TO SAVEPOINT insert_step;
3343: x_batch_step_rec := NULL;
3375: ================================================================================*/
3376: PROCEDURE insert_material_line (
3377: p_api_version IN NUMBER := 2.0
3378: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3379: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3380: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3381: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3382: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3383: ,p_locator_code IN VARCHAR2
3376: PROCEDURE insert_material_line (
3377: p_api_version IN NUMBER := 2.0
3378: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3379: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3380: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3381: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3382: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3383: ,p_locator_code IN VARCHAR2
3384: ,p_org_code IN VARCHAR2
3382: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3383: ,p_locator_code IN VARCHAR2
3384: ,p_org_code IN VARCHAR2
3385: ,p_batchstep_no IN NUMBER := NULL
3386: ,p_validate_flexfields IN VARCHAR2 DEFAULT fnd_api.g_false
3387: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
3388: ,x_message_count OUT NOCOPY NUMBER
3389: ,x_message_list OUT NOCOPY VARCHAR2
3390: ,x_return_status OUT NOCOPY VARCHAR2 )
3416: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
3417: END IF;
3418:
3419: /* Set the return status to success initially */
3420: x_return_status := fnd_api.g_ret_sts_success;
3421:
3422: /* Set savepoint here */
3423: SAVEPOINT insert_material_line;
3424:
3422: /* Set savepoint here */
3423: SAVEPOINT insert_material_line;
3424:
3425: /* Make sure we are call compatible */
3426: IF NOT fnd_api.compatible_api_call (2.0
3427: ,p_api_version
3428: ,'insert_material_line'
3429: ,g_pkg_name) THEN
3430: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3427: ,p_api_version
3428: ,'insert_material_line'
3429: ,g_pkg_name) THEN
3430: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3431: RAISE fnd_api.g_exc_error;
3432: END IF;
3433:
3434: /* Initialize message list and count if needed */
3435: IF p_init_msg_list = fnd_api.g_true THEN
3431: RAISE fnd_api.g_exc_error;
3432: END IF;
3433:
3434: /* Initialize message list and count if needed */
3435: IF p_init_msg_list = fnd_api.g_true THEN
3436: fnd_msg_pub.initialize;
3437: END IF;
3438:
3439: /* intialize local variable */
3448: ,x_message_count => x_message_count
3449: ,x_message_list => x_message_list
3450: ,x_return_status => x_return_status );
3451:
3452: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3453: IF (g_debug = gme_debug.g_log_statement) THEN
3454: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3455: || ': batch validate error ');
3456: END IF;
3453: IF (g_debug = gme_debug.g_log_statement) THEN
3454: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3455: || ': batch validate error ');
3456: END IF;
3457: RAISE fnd_api.g_exc_error;
3458: END IF;
3459:
3460: /*for ASQC batches batchstep_no is required */
3461: IF l_batch_header_rec.automatic_step_calculation <> 0 AND
3460: /*for ASQC batches batchstep_no is required */
3461: IF l_batch_header_rec.automatic_step_calculation <> 0 AND
3462: p_batchstep_no IS NULL THEN
3463: gme_common_pvt.log_message('GME_ASQC_STEP_REQUIRED');
3464: RAISE fnd_api.g_exc_error;
3465: END IF;
3466:
3467: IF l_batch_header_rec.poc_ind = 'Y' AND
3468: p_batchstep_no IS NOT NULL THEN
3468: p_batchstep_no IS NOT NULL THEN
3469: l_batch_step_rec.batch_id := l_batch_header_rec.batch_id;
3470: l_batch_step_rec.batchstep_no := p_batchstep_no;
3471: IF NOT gme_batch_steps_dbl.fetch_row(l_batch_step_rec, l_batch_step_rec) THEN
3472: RAISE fnd_api.g_exc_error;
3473: END IF;
3474: END IF;
3475:
3476: --validate batch for insertion of material line
3478: (p_batch_header_rec => l_batch_header_rec
3479: ,p_batch_step_rec => l_batch_step_rec
3480: ,x_return_status => x_return_status );
3481:
3482: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3483: RAISE fnd_api.g_exc_error;
3484: END IF;
3485:
3486: /* getting the locator for entered subinventory */
3479: ,p_batch_step_rec => l_batch_step_rec
3480: ,x_return_status => x_return_status );
3481:
3482: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3483: RAISE fnd_api.g_exc_error;
3484: END IF;
3485:
3486: /* getting the locator for entered subinventory */
3487: IF l_material_detail_rec.subinventory IS NOT NULL AND
3485:
3486: /* getting the locator for entered subinventory */
3487: IF l_material_detail_rec.subinventory IS NOT NULL AND
3488: p_locator_code IS NOT NULL THEN
3489: IF p_locator_code = fnd_api.g_miss_char THEN
3490: l_material_detail_rec.locator_id := fnd_api.g_miss_num;
3491: ELSE
3492: OPEN c_get_locator(l_batch_header_rec.organization_id, l_material_detail_rec.subinventory);
3493: FETCH c_get_locator INTO l_locator_id;
3486: /* getting the locator for entered subinventory */
3487: IF l_material_detail_rec.subinventory IS NOT NULL AND
3488: p_locator_code IS NOT NULL THEN
3489: IF p_locator_code = fnd_api.g_miss_char THEN
3490: l_material_detail_rec.locator_id := fnd_api.g_miss_num;
3491: ELSE
3492: OPEN c_get_locator(l_batch_header_rec.organization_id, l_material_detail_rec.subinventory);
3493: FETCH c_get_locator INTO l_locator_id;
3494: IF c_get_locator%NOTFOUND THEN
3494: IF c_get_locator%NOTFOUND THEN
3495: CLOSE c_get_locator;
3496: gme_common_pvt.log_message(p_product_code => 'INV'
3497: ,p_message_code => 'INV_INVALID_LOCATION');
3498: RAISE fnd_api.g_exc_error;
3499: END IF;
3500: CLOSE c_get_locator;
3501: l_material_detail_rec.locator_id := l_locator_id;
3502: END IF;
3502: END IF;
3503: END IF;
3504:
3505: --setting global flex validate
3506: IF p_validate_flexfields = FND_API.G_TRUE THEN
3507: gme_common_pvt.g_flex_validate_prof := 1;
3508: ELSE
3509: gme_common_pvt.g_flex_validate_prof := 0;
3510: END IF;
3516: ,p_batch_step_rec => l_batch_step_rec
3517: ,x_material_detail_rec => x_material_detail_rec
3518: ,x_return_status => x_return_status);
3519:
3520: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3521: RAISE fnd_api.g_exc_error;
3522: END IF;
3523: gme_common_pvt.g_flex_validate_prof := 0;
3524: gme_common_pvt.set_timestamp;
3517: ,x_material_detail_rec => x_material_detail_rec
3518: ,x_return_status => x_return_status);
3519:
3520: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3521: RAISE fnd_api.g_exc_error;
3522: END IF;
3523: gme_common_pvt.g_flex_validate_prof := 0;
3524: gme_common_pvt.set_timestamp;
3525: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3521: RAISE fnd_api.g_exc_error;
3522: END IF;
3523: gme_common_pvt.g_flex_validate_prof := 0;
3524: gme_common_pvt.set_timestamp;
3525: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3526: --calling insert material line new API
3527: l_material_detail_rec := x_material_detail_rec;
3528:
3529: gme_api_main.insert_material_line (
3538: ,p_trans_id => NULL
3539: ,x_transacted => x_transacted
3540: ,x_material_detail_rec => x_material_detail_rec);
3541:
3542: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3543: RAISE fnd_api.g_exc_error;
3544: ELSE
3545: IF p_commit = fnd_api.g_true THEN
3546: gme_api_pub.save_batch (p_header_id => NULL
3539: ,x_transacted => x_transacted
3540: ,x_material_detail_rec => x_material_detail_rec);
3541:
3542: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3543: RAISE fnd_api.g_exc_error;
3544: ELSE
3545: IF p_commit = fnd_api.g_true THEN
3546: gme_api_pub.save_batch (p_header_id => NULL
3547: ,p_table => 1
3541:
3542: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3543: RAISE fnd_api.g_exc_error;
3544: ELSE
3545: IF p_commit = fnd_api.g_true THEN
3546: gme_api_pub.save_batch (p_header_id => NULL
3547: ,p_table => 1
3548: ,p_commit => fnd_api.g_false
3549: ,x_return_status => x_return_status);
3544: ELSE
3545: IF p_commit = fnd_api.g_true THEN
3546: gme_api_pub.save_batch (p_header_id => NULL
3547: ,p_table => 1
3548: ,p_commit => fnd_api.g_false
3549: ,x_return_status => x_return_status);
3550:
3551: IF x_return_status = fnd_api.g_ret_sts_success THEN
3552: COMMIT;
3547: ,p_table => 1
3548: ,p_commit => fnd_api.g_false
3549: ,x_return_status => x_return_status);
3550:
3551: IF x_return_status = fnd_api.g_ret_sts_success THEN
3552: COMMIT;
3553: ELSE
3554: RAISE fnd_api.g_exc_error;
3555: END IF;
3550:
3551: IF x_return_status = fnd_api.g_ret_sts_success THEN
3552: COMMIT;
3553: ELSE
3554: RAISE fnd_api.g_exc_error;
3555: END IF;
3556: END IF;
3557: NULL;
3558: END IF;
3562: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3563: END IF;
3564:
3565: EXCEPTION
3566: WHEN fnd_api.g_exc_error THEN
3567: ROLLBACK TO SAVEPOINT insert_material_line;
3568: x_return_status := fnd_api.g_ret_sts_error;
3569: x_material_detail_rec := NULL;
3570: gme_common_pvt.count_and_get (x_count => x_message_count
3564:
3565: EXCEPTION
3566: WHEN fnd_api.g_exc_error THEN
3567: ROLLBACK TO SAVEPOINT insert_material_line;
3568: x_return_status := fnd_api.g_ret_sts_error;
3569: x_material_detail_rec := NULL;
3570: gme_common_pvt.count_and_get (x_count => x_message_count
3571: ,p_encoded => fnd_api.g_false
3572: ,x_data => x_message_list);
3567: ROLLBACK TO SAVEPOINT insert_material_line;
3568: x_return_status := fnd_api.g_ret_sts_error;
3569: x_material_detail_rec := NULL;
3570: gme_common_pvt.count_and_get (x_count => x_message_count
3571: ,p_encoded => fnd_api.g_false
3572: ,x_data => x_message_list);
3573: WHEN OTHERS THEN
3574: ROLLBACK TO SAVEPOINT insert_material_line;
3575: x_material_detail_rec := NULL;
3603: ================================================================================*/
3604: PROCEDURE update_material_line (
3605: p_api_version IN NUMBER := 2.0
3606: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3607: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3608: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3609: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3610: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3611: ,p_locator_code IN VARCHAR2
3604: PROCEDURE update_material_line (
3605: p_api_version IN NUMBER := 2.0
3606: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3607: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3608: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3609: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3610: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3611: ,p_locator_code IN VARCHAR2
3612: ,p_org_code IN VARCHAR2
3609: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3610: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3611: ,p_locator_code IN VARCHAR2
3612: ,p_org_code IN VARCHAR2
3613: ,p_scale_phantom IN VARCHAR2 DEFAULT fnd_api.g_false
3614: ,p_validate_flexfields IN VARCHAR2 DEFAULT fnd_api.g_false
3615: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
3616: ,x_message_count OUT NOCOPY NUMBER
3617: ,x_message_list OUT NOCOPY VARCHAR2
3610: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3611: ,p_locator_code IN VARCHAR2
3612: ,p_org_code IN VARCHAR2
3613: ,p_scale_phantom IN VARCHAR2 DEFAULT fnd_api.g_false
3614: ,p_validate_flexfields IN VARCHAR2 DEFAULT fnd_api.g_false
3615: ,x_material_detail_rec OUT NOCOPY gme_material_details%ROWTYPE
3616: ,x_message_count OUT NOCOPY NUMBER
3617: ,x_message_list OUT NOCOPY VARCHAR2
3618: ,x_return_status OUT NOCOPY VARCHAR2 )
3654: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
3655: END IF;
3656:
3657: /* Set the return status to success initially */
3658: x_return_status := fnd_api.g_ret_sts_success;
3659:
3660: /* Set savepoint here */
3661: SAVEPOINT update_material_line;
3662:
3660: /* Set savepoint here */
3661: SAVEPOINT update_material_line;
3662:
3663: /* Make sure we are call compatible */
3664: IF NOT fnd_api.compatible_api_call (2.0
3665: ,p_api_version
3666: ,'update_material_line'
3667: ,g_pkg_name) THEN
3668: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3665: ,p_api_version
3666: ,'update_material_line'
3667: ,g_pkg_name) THEN
3668: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3669: RAISE fnd_api.g_exc_error;
3670: END IF;
3671:
3672: /* Initialize message list and count if needed */
3673: IF p_init_msg_list = fnd_api.g_true THEN
3669: RAISE fnd_api.g_exc_error;
3670: END IF;
3671:
3672: /* Initialize message list and count if needed */
3673: IF p_init_msg_list = fnd_api.g_true THEN
3674: fnd_msg_pub.initialize;
3675: END IF;
3676:
3677: /*validatep p_scale_phantom procedure */
3674: fnd_msg_pub.initialize;
3675: END IF;
3676:
3677: /*validatep p_scale_phantom procedure */
3678: IF (p_scale_phantom NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
3679: gme_common_pvt.log_message ('GME_INVALID_FIELD'
3680: ,'FIELD'
3681: ,'p_scale_phantom');
3682: RAISE fnd_api.g_exc_error;
3678: IF (p_scale_phantom NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
3679: gme_common_pvt.log_message ('GME_INVALID_FIELD'
3680: ,'FIELD'
3681: ,'p_scale_phantom');
3682: RAISE fnd_api.g_exc_error;
3683: END IF;
3684:
3685: /* assigning local variables */
3686: l_material_detail_rec := p_material_detail_rec;
3693: ,x_material_detail_rec => l_stored_material_detail_rec
3694: ,x_message_count => x_message_count
3695: ,x_message_list => x_message_list
3696: ,x_return_status => x_return_status );
3697: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3698: IF (g_debug = gme_debug.g_log_statement) THEN
3699: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3700: || ': batch mateiral validate error ');
3701: END IF;
3698: IF (g_debug = gme_debug.g_log_statement) THEN
3699: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3700: || ': batch mateiral validate error ');
3701: END IF;
3702: RAISE fnd_api.g_exc_error;
3703: END IF;
3704:
3705: /* get the batch step record if the material line is associated to step*/
3706: IF l_batch_header_rec.poc_ind = 'Y' THEN --routing is there
3710: l_batch_step_rec.batchstep_id := l_batchstep_id;
3711:
3712: IF NOT gme_batch_steps_dbl.fetch_row(l_batch_step_rec, l_batch_step_rec) THEN
3713: CLOSE c_get_step_id;
3714: RAISE fnd_api.g_exc_error;
3715: END IF;
3716: END IF;
3717: CLOSE c_get_step_id;
3718: END IF;
3723: (p_batch_header_rec => l_batch_header_rec
3724: ,p_batch_step_rec => l_batch_step_rec
3725: ,x_return_status => l_return_status );
3726:
3727: IF l_return_status <> fnd_api.g_ret_sts_success THEN
3728: RAISE fnd_api.g_exc_error;
3729: END IF;
3730:
3731: /*updating the locator will have meaning only sub inv is existing already */
3724: ,p_batch_step_rec => l_batch_step_rec
3725: ,x_return_status => l_return_status );
3726:
3727: IF l_return_status <> fnd_api.g_ret_sts_success THEN
3728: RAISE fnd_api.g_exc_error;
3729: END IF;
3730:
3731: /*updating the locator will have meaning only sub inv is existing already */
3732: l_subinventory := NVL(l_material_detail_rec.subinventory, l_stored_material_detail_rec.subinventory);
3730:
3731: /*updating the locator will have meaning only sub inv is existing already */
3732: l_subinventory := NVL(l_material_detail_rec.subinventory, l_stored_material_detail_rec.subinventory);
3733: IF l_subinventory IS NOT NULL AND p_locator_code IS NOT NULL THEN
3734: IF p_locator_code = fnd_api.g_miss_char THEN
3735: l_material_detail_rec.locator_id := fnd_api.g_miss_num;
3736: ELSE
3737: OPEN c_get_locator(l_stored_material_detail_rec.organization_id, l_subinventory,p_locator_code);
3738: FETCH c_get_locator INTO l_locator_id;
3731: /*updating the locator will have meaning only sub inv is existing already */
3732: l_subinventory := NVL(l_material_detail_rec.subinventory, l_stored_material_detail_rec.subinventory);
3733: IF l_subinventory IS NOT NULL AND p_locator_code IS NOT NULL THEN
3734: IF p_locator_code = fnd_api.g_miss_char THEN
3735: l_material_detail_rec.locator_id := fnd_api.g_miss_num;
3736: ELSE
3737: OPEN c_get_locator(l_stored_material_detail_rec.organization_id, l_subinventory,p_locator_code);
3738: FETCH c_get_locator INTO l_locator_id;
3739: IF c_get_locator%NOTFOUND THEN
3739: IF c_get_locator%NOTFOUND THEN
3740: CLOSE c_get_locator;
3741: gme_common_pvt.log_message(p_product_code => 'INV'
3742: ,p_message_code => 'INV_INVALID_LOCATION');
3743: RAISE fnd_api.g_exc_error;
3744: END IF;
3745: CLOSE c_get_locator;
3746: l_material_detail_rec.locator_id := l_locator_id;
3747: END IF;
3747: END IF;
3748: END IF;
3749:
3750: --setting global flex validate
3751: IF p_validate_flexfields = FND_API.G_TRUE THEN
3752: gme_common_pvt.g_flex_validate_prof := 1;
3753: ELSE
3754: gme_common_pvt.g_flex_validate_prof := 0;
3755: END IF;
3765:
3766: --resetting global flex validate after validating
3767: gme_common_pvt.g_flex_validate_prof := 0;
3768:
3769: IF l_return_status <> fnd_api.g_ret_sts_success THEN
3770: RAISE fnd_api.g_exc_error;
3771: END IF;
3772: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3773: gme_common_pvt.set_timestamp;
3766: --resetting global flex validate after validating
3767: gme_common_pvt.g_flex_validate_prof := 0;
3768:
3769: IF l_return_status <> fnd_api.g_ret_sts_success THEN
3770: RAISE fnd_api.g_exc_error;
3771: END IF;
3772: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3773: gme_common_pvt.set_timestamp;
3774: --calling update material line new API
3768:
3769: IF l_return_status <> fnd_api.g_ret_sts_success THEN
3770: RAISE fnd_api.g_exc_error;
3771: END IF;
3772: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3773: gme_common_pvt.set_timestamp;
3774: --calling update material line new API
3775: l_material_detail_rec := x_material_detail_rec;
3776:
3790: ,x_material_detail_rec => x_material_detail_rec);
3791:
3792:
3793:
3794: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3795: RAISE fnd_api.g_exc_error;
3796: ELSE
3797: IF p_commit = fnd_api.g_true THEN
3798: gme_api_pub.save_batch (p_header_id => NULL
3791:
3792:
3793:
3794: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3795: RAISE fnd_api.g_exc_error;
3796: ELSE
3797: IF p_commit = fnd_api.g_true THEN
3798: gme_api_pub.save_batch (p_header_id => NULL
3799: ,p_table => 1
3793:
3794: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3795: RAISE fnd_api.g_exc_error;
3796: ELSE
3797: IF p_commit = fnd_api.g_true THEN
3798: gme_api_pub.save_batch (p_header_id => NULL
3799: ,p_table => 1
3800: ,p_commit => fnd_api.g_false
3801: ,x_return_status => x_return_status);
3796: ELSE
3797: IF p_commit = fnd_api.g_true THEN
3798: gme_api_pub.save_batch (p_header_id => NULL
3799: ,p_table => 1
3800: ,p_commit => fnd_api.g_false
3801: ,x_return_status => x_return_status);
3802:
3803: IF x_return_status = fnd_api.g_ret_sts_success THEN
3804: COMMIT;
3799: ,p_table => 1
3800: ,p_commit => fnd_api.g_false
3801: ,x_return_status => x_return_status);
3802:
3803: IF x_return_status = fnd_api.g_ret_sts_success THEN
3804: COMMIT;
3805: ELSE
3806: RAISE fnd_api.g_exc_error;
3807: END IF;
3802:
3803: IF x_return_status = fnd_api.g_ret_sts_success THEN
3804: COMMIT;
3805: ELSE
3806: RAISE fnd_api.g_exc_error;
3807: END IF;
3808: END IF;
3809: NULL;
3810: END IF;
3814: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3815: END IF;
3816:
3817: EXCEPTION
3818: WHEN fnd_api.g_exc_error THEN
3819: ROLLBACK TO SAVEPOINT update_material_line;
3820: x_return_status := fnd_api.g_ret_sts_error;
3821: x_material_detail_rec := NULL;
3822: gme_common_pvt.count_and_get (x_count => x_message_count
3816:
3817: EXCEPTION
3818: WHEN fnd_api.g_exc_error THEN
3819: ROLLBACK TO SAVEPOINT update_material_line;
3820: x_return_status := fnd_api.g_ret_sts_error;
3821: x_material_detail_rec := NULL;
3822: gme_common_pvt.count_and_get (x_count => x_message_count
3823: ,p_encoded => fnd_api.g_false
3824: ,x_data => x_message_list);
3819: ROLLBACK TO SAVEPOINT update_material_line;
3820: x_return_status := fnd_api.g_ret_sts_error;
3821: x_material_detail_rec := NULL;
3822: gme_common_pvt.count_and_get (x_count => x_message_count
3823: ,p_encoded => fnd_api.g_false
3824: ,x_data => x_message_list);
3825: WHEN OTHERS THEN
3826: ROLLBACK TO SAVEPOINT update_material_line;
3827: x_material_detail_rec := NULL;
3851: ================================================================================*/
3852: PROCEDURE delete_material_line (
3853: p_api_version IN NUMBER := 2.0
3854: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3855: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3856: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3857: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3858: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3859: ,p_org_code IN VARCHAR2
3852: PROCEDURE delete_material_line (
3853: p_api_version IN NUMBER := 2.0
3854: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
3855: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3856: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3857: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
3858: ,p_material_detail_rec IN gme_material_details%ROWTYPE
3859: ,p_org_code IN VARCHAR2
3860: ,x_message_count OUT NOCOPY NUMBER
3884: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
3885: END IF;
3886:
3887: /* Set the return status to success initially */
3888: x_return_status := fnd_api.g_ret_sts_success;
3889:
3890: /* Set savepoint here */
3891: SAVEPOINT delete_material_line;
3892:
3890: /* Set savepoint here */
3891: SAVEPOINT delete_material_line;
3892:
3893: /* Make sure we are call compatible */
3894: IF NOT fnd_api.compatible_api_call (2.0
3895: ,p_api_version
3896: ,'delete_material_line'
3897: ,g_pkg_name) THEN
3898: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3895: ,p_api_version
3896: ,'delete_material_line'
3897: ,g_pkg_name) THEN
3898: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
3899: RAISE fnd_api.g_exc_error;
3900: END IF;
3901:
3902: /* Initialize message list and count if needed */
3903: IF p_init_msg_list = fnd_api.g_true THEN
3899: RAISE fnd_api.g_exc_error;
3900: END IF;
3901:
3902: /* Initialize message list and count if needed */
3903: IF p_init_msg_list = fnd_api.g_true THEN
3904: fnd_msg_pub.initialize;
3905: END IF;
3906:
3907: gme_common_pvt.Validate_material_detail
3913: ,x_material_detail_rec => l_material_detail_rec
3914: ,x_message_count => x_message_count
3915: ,x_message_list => x_message_list
3916: ,x_return_status => x_return_status );
3917: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3918: IF (g_debug = gme_debug.g_log_statement) THEN
3919: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3920: || ': batch mateiral validate error ');
3921: END IF;
3918: IF (g_debug = gme_debug.g_log_statement) THEN
3919: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
3920: || ': batch mateiral validate error ');
3921: END IF;
3922: RAISE fnd_api.g_exc_error;
3923: END IF;
3924:
3925: /* get the batch step record if the material line is associated to step*/
3926: IF l_batch_header_rec.poc_ind = 'Y' THEN --routing is there
3930: l_batch_step_rec.batchstep_id := l_batchstep_id;
3931:
3932: IF NOT gme_batch_steps_dbl.fetch_row(l_batch_step_rec, l_batch_step_rec) THEN
3933: CLOSE c_get_step_id;
3934: RAISE fnd_api.g_exc_error;
3935: END IF;
3936: END IF;
3937: CLOSE c_get_step_id;
3938: END IF;
3943: ,p_material_detail_rec => l_material_detail_rec
3944: ,p_batch_step_rec => l_batch_step_rec
3945: ,x_return_status => x_return_status);
3946:
3947: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3948: RAISE fnd_api.g_exc_error;
3949: END IF;
3950: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3951: --calling delete material line
3944: ,p_batch_step_rec => l_batch_step_rec
3945: ,x_return_status => x_return_status);
3946:
3947: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3948: RAISE fnd_api.g_exc_error;
3949: END IF;
3950: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3951: --calling delete material line
3952: gme_api_main.delete_material_line (
3946:
3947: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3948: RAISE fnd_api.g_exc_error;
3949: END IF;
3950: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
3951: --calling delete material line
3952: gme_api_main.delete_material_line (
3953: p_validation_level => p_validation_level
3954: ,p_init_msg_list => p_init_msg_list
3959: ,p_material_detail_rec => l_material_detail_rec
3960: ,p_batch_step_rec => l_batch_step_rec
3961: ,x_transacted => x_transacted );
3962:
3963: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3964: RAISE fnd_api.g_exc_error;
3965: END IF;
3966:
3967: IF g_debug <= gme_debug.g_log_procedure THEN
3960: ,p_batch_step_rec => l_batch_step_rec
3961: ,x_transacted => x_transacted );
3962:
3963: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3964: RAISE fnd_api.g_exc_error;
3965: END IF;
3966:
3967: IF g_debug <= gme_debug.g_log_procedure THEN
3968: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
3969: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
3970: END IF;
3971:
3972: EXCEPTION
3973: WHEN fnd_api.g_exc_error THEN
3974: ROLLBACK TO SAVEPOINT delete_material_line;
3975: x_return_status := fnd_api.g_ret_sts_error;
3976: gme_common_pvt.count_and_get (x_count => x_message_count
3977: ,p_encoded => fnd_api.g_false
3971:
3972: EXCEPTION
3973: WHEN fnd_api.g_exc_error THEN
3974: ROLLBACK TO SAVEPOINT delete_material_line;
3975: x_return_status := fnd_api.g_ret_sts_error;
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: WHEN OTHERS THEN
3973: WHEN fnd_api.g_exc_error THEN
3974: ROLLBACK TO SAVEPOINT delete_material_line;
3975: x_return_status := fnd_api.g_ret_sts_error;
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: WHEN OTHERS THEN
3980: ROLLBACK TO SAVEPOINT delete_material_line;
3981: gme_when_others ( p_api_name => l_api_name
4046: IF g_debug <= gme_debug.g_log_procedure THEN
4047: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
4048: END IF;
4049: /* Set the return status to success initially */
4050: x_return_status := FND_API.G_RET_STS_SUCCESS;
4051:
4052: IF p_init_msg_list = FND_API.G_TRUE THEN
4053: fnd_msg_pub.initialize;
4054: END IF;
4048: END IF;
4049: /* Set the return status to success initially */
4050: x_return_status := FND_API.G_RET_STS_SUCCESS;
4051:
4052: IF p_init_msg_list = FND_API.G_TRUE THEN
4053: fnd_msg_pub.initialize;
4054: END IF;
4055:
4056: /* Set savepoint here */
4055:
4056: /* Set savepoint here */
4057: SAVEPOINT revert_batch;
4058:
4059: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_to_wip_batch', g_pkg_name ) THEN
4060: x_return_status := FND_API.G_RET_STS_ERROR;
4061: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4062: RAISE FND_API.g_exc_error;
4063: END IF;
4056: /* Set savepoint here */
4057: SAVEPOINT revert_batch;
4058:
4059: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_to_wip_batch', g_pkg_name ) THEN
4060: x_return_status := FND_API.G_RET_STS_ERROR;
4061: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4062: RAISE FND_API.g_exc_error;
4063: END IF;
4064: -- fetch and validate the batch
4058:
4059: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_to_wip_batch', g_pkg_name ) THEN
4060: x_return_status := FND_API.G_RET_STS_ERROR;
4061: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4062: RAISE FND_API.g_exc_error;
4063: END IF;
4064: -- fetch and validate the batch
4065: gme_common_pvt.validate_batch
4066: (p_batch_header_rec => p_batch_header_rec
4070: ,x_message_count => x_message_count
4071: ,x_message_list => x_message_list
4072: ,x_return_status => x_return_status );
4073:
4074: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4075: IF (g_debug = gme_debug.g_log_statement) THEN
4076: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4077: || ': batch validate error ');
4078: END IF;
4075: IF (g_debug = gme_debug.g_log_statement) THEN
4076: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4077: || ': batch validate error ');
4078: END IF;
4079: RAISE fnd_api.g_exc_error;
4080: END IF;
4081:
4082: IF (l_batch_header_rec.batch_type <> gme_common_pvt.g_doc_type_batch) THEN
4083: gme_common_pvt.log_message('GME_INVALID_BATCH_TYPE');
4080: END IF;
4081:
4082: IF (l_batch_header_rec.batch_type <> gme_common_pvt.g_doc_type_batch) THEN
4083: gme_common_pvt.log_message('GME_INVALID_BATCH_TYPE');
4084: RAISE fnd_api.g_exc_error;
4085: END IF;
4086: IF (l_batch_header_rec.batch_status <> gme_common_pvt.g_batch_completed) THEN
4087: gme_common_pvt.log_message('GME_API_INVALID_BATCH_UNCERT');
4088: RAISE fnd_api.g_exc_error;
4084: RAISE fnd_api.g_exc_error;
4085: END IF;
4086: IF (l_batch_header_rec.batch_status <> gme_common_pvt.g_batch_completed) THEN
4087: gme_common_pvt.log_message('GME_API_INVALID_BATCH_UNCERT');
4088: RAISE fnd_api.g_exc_error;
4089: END IF;
4090: IF (NVL(l_batch_header_rec.terminated_ind, 0) = 1) THEN
4091: gme_common_pvt.log_message('GME_API_REV_WIP_TERM_ERROR');
4092: RAISE fnd_api.g_exc_error;
4088: RAISE fnd_api.g_exc_error;
4089: END IF;
4090: IF (NVL(l_batch_header_rec.terminated_ind, 0) = 1) THEN
4091: gme_common_pvt.log_message('GME_API_REV_WIP_TERM_ERROR');
4092: RAISE fnd_api.g_exc_error;
4093: END IF;
4094:
4095: IF g_debug <= gme_debug.g_log_statement THEN
4096: gme_debug.put_line('calling main revert');
4095: IF g_debug <= gme_debug.g_log_statement THEN
4096: gme_debug.put_line('calling main revert');
4097: END IF;
4098: --Bug#5327296
4099: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4100: /* Bug 6437252 Check for LPN txns */
4101: /*Added by Shalchen 02/28/2013
4102: Add IF condition to bypass LPN
4103: validition for batch open interface project*/
4108:
4109: IF ( NVL(x_lpn_txns, 0) > 0) THEN
4110: IF p_continue_lpn_txn = 'N' THEN
4111: gme_common_pvt.log_message ('GME_LPN_TRANS_EXISTS');
4112: RAISE fnd_api.g_exc_error;
4113: END IF;
4114: END IF;
4115: END IF;
4116: gme_api_main.revert_batch
4114: END IF;
4115: END IF;
4116: gme_api_main.revert_batch
4117: (p_validation_level => p_validation_level,
4118: p_init_msg_list => FND_API.G_FALSE,
4119: x_message_count => x_message_count,
4120: x_message_list => x_message_list,
4121: x_return_status => x_return_status,
4122: p_batch_header_rec => l_batch_header_rec,
4128: gme_debug.put_line(g_pkg_name|| '.'|| l_api_name||
4129: ':'||'return_status from main'||x_return_status );
4130: END IF;
4131:
4132: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4133: RAISE batch_revert_failure;
4134: END IF;
4135:
4136: -- Bug 10002243 - Restructure so that we always call save batch regardless of p_commit value.
4150: ' Return status from gme_api_pub.save_batch is ' || x_return_status);
4151: END IF;
4152:
4153:
4154: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4155: IF p_commit = FND_API.G_TRUE THEN
4156: COMMIT;
4157: END IF;
4158: ELSE
4151: END IF;
4152:
4153:
4154: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4155: IF p_commit = FND_API.G_TRUE THEN
4156: COMMIT;
4157: END IF;
4158: ELSE
4159: RAISE fnd_api.g_exc_error;
4155: IF p_commit = FND_API.G_TRUE THEN
4156: COMMIT;
4157: END IF;
4158: ELSE
4159: RAISE fnd_api.g_exc_error;
4160: END IF;
4161:
4162: gme_common_pvt.count_and_get (
4163: x_count => x_message_count,
4160: END IF;
4161:
4162: gme_common_pvt.count_and_get (
4163: x_count => x_message_count,
4164: p_encoded => FND_API.g_false,
4165: x_data => x_message_list
4166: );
4167:
4168: IF g_debug <= gme_debug.g_log_procedure THEN
4174: WHEN batch_revert_failure THEN
4175: ROLLBACK TO SAVEPOINT revert_batch;
4176: x_batch_header_rec := NULL;
4177: gme_common_pvt.count_and_get(x_count => x_message_count,
4178: p_encoded => FND_API.g_false,
4179: x_data => x_message_list);
4180: WHEN FND_API.g_exc_error THEN
4181: ROLLBACK TO SAVEPOINT revert_batch;
4182: x_return_status := fnd_api.g_ret_sts_error;
4176: x_batch_header_rec := NULL;
4177: gme_common_pvt.count_and_get(x_count => x_message_count,
4178: p_encoded => FND_API.g_false,
4179: x_data => x_message_list);
4180: WHEN FND_API.g_exc_error THEN
4181: ROLLBACK TO SAVEPOINT revert_batch;
4182: x_return_status := fnd_api.g_ret_sts_error;
4183: x_batch_header_rec := NULL;
4184: gme_common_pvt.count_and_get (x_count => x_message_count
4178: p_encoded => FND_API.g_false,
4179: x_data => x_message_list);
4180: WHEN FND_API.g_exc_error THEN
4181: ROLLBACK TO SAVEPOINT revert_batch;
4182: x_return_status := fnd_api.g_ret_sts_error;
4183: x_batch_header_rec := NULL;
4184: gme_common_pvt.count_and_get (x_count => x_message_count
4185: ,p_encoded => fnd_api.g_false
4186: ,x_data => x_message_list);
4181: ROLLBACK TO SAVEPOINT revert_batch;
4182: x_return_status := fnd_api.g_ret_sts_error;
4183: x_batch_header_rec := NULL;
4184: gme_common_pvt.count_and_get (x_count => x_message_count
4185: ,p_encoded => fnd_api.g_false
4186: ,x_data => x_message_list);
4187: WHEN OTHERS THEN
4188: ROLLBACK TO SAVEPOINT revert_batch;
4189: x_batch_header_rec := NULL;
4240: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
4241: END IF;
4242:
4243: /* Set the return status to success initially */
4244: x_return_status := FND_API.G_RET_STS_SUCCESS;
4245:
4246: /* Set savepoint here */
4247: SAVEPOINT revert_step;
4248:
4245:
4246: /* Set savepoint here */
4247: SAVEPOINT revert_step;
4248:
4249: IF p_init_msg_list = FND_API.G_TRUE THEN
4250: fnd_msg_pub.initialize;
4251: END IF;
4252:
4253: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_step', g_pkg_name ) THEN
4249: IF p_init_msg_list = FND_API.G_TRUE THEN
4250: fnd_msg_pub.initialize;
4251: END IF;
4252:
4253: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_step', g_pkg_name ) THEN
4254: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4255: RAISE fnd_api.g_exc_error;
4256: END IF;
4257:
4251: END IF;
4252:
4253: IF NOT FND_API.compatible_api_call(2.0, p_api_version, 'revert_step', g_pkg_name ) THEN
4254: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4255: RAISE fnd_api.g_exc_error;
4256: END IF;
4257:
4258: /* Validate Input parameters */
4259: gme_common_pvt.Validate_batch_step (
4265: ,x_message_count => x_message_count
4266: ,x_message_list => x_message_list
4267: ,x_return_status => x_return_status );
4268:
4269: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4270: IF (g_debug = gme_debug.g_log_statement) THEN
4271: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4272: || ': batch step validate error ');
4273: END IF;
4270: IF (g_debug = gme_debug.g_log_statement) THEN
4271: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4272: || ': batch step validate error ');
4273: END IF;
4274: RAISE fnd_api.g_exc_error;
4275: END IF;
4276:
4277: IF (l_batch_header_rec.batch_status <> 2) THEN
4278: gme_common_pvt.log_message ('GME_API_INV_BATCH_UNCERT_STEP');
4275: END IF;
4276:
4277: IF (l_batch_header_rec.batch_status <> 2) THEN
4278: gme_common_pvt.log_message ('GME_API_INV_BATCH_UNCERT_STEP');
4279: RAISE fnd_api.g_exc_error;
4280: END IF;
4281:
4282: IF (l_batch_step_rec.step_status <> 3) THEN
4283: gme_common_pvt.log_message ('GME_API_INV_STEP_STAT_UNCERT');
4280: END IF;
4281:
4282: IF (l_batch_step_rec.step_status <> 3) THEN
4283: gme_common_pvt.log_message ('GME_API_INV_STEP_STAT_UNCERT');
4284: RAISE fnd_api.g_exc_error;
4285: END IF;
4286:
4287: --Bug#5327296
4288: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4284: RAISE fnd_api.g_exc_error;
4285: END IF;
4286:
4287: --Bug#5327296
4288: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4289: gme_api_main.revert_step
4290: (p_validation_level => p_validation_level,
4291: p_init_msg_list => FND_API.G_FALSE,
4292: x_message_count => x_message_count,
4287: --Bug#5327296
4288: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4289: gme_api_main.revert_step
4290: (p_validation_level => p_validation_level,
4291: p_init_msg_list => FND_API.G_FALSE,
4292: x_message_count => x_message_count,
4293: x_message_list => x_message_list,
4294: x_return_status => x_return_status,
4295: p_batch_step_rec => l_batch_step_rec,
4300: IF g_debug <= gme_debug.g_log_statement THEN
4301: gme_debug.put_line(g_pkg_name|| '.'|| l_api_name|| ':'||'return_status from main'||x_return_status );
4302: END IF;
4303:
4304: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4305: IF p_commit = FND_API.G_TRUE THEN
4306: gme_api_pub.save_batch (p_header_id => NULL,
4307: p_table => gme_common_pvt.g_interface_table,
4308: p_commit => FND_API.G_FALSE,
4301: gme_debug.put_line(g_pkg_name|| '.'|| l_api_name|| ':'||'return_status from main'||x_return_status );
4302: END IF;
4303:
4304: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4305: IF p_commit = FND_API.G_TRUE THEN
4306: gme_api_pub.save_batch (p_header_id => NULL,
4307: p_table => gme_common_pvt.g_interface_table,
4308: p_commit => FND_API.G_FALSE,
4309: x_return_status => x_return_status);
4304: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4305: IF p_commit = FND_API.G_TRUE THEN
4306: gme_api_pub.save_batch (p_header_id => NULL,
4307: p_table => gme_common_pvt.g_interface_table,
4308: p_commit => FND_API.G_FALSE,
4309: x_return_status => x_return_status);
4310: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4311: COMMIT;
4312: ELSE
4306: gme_api_pub.save_batch (p_header_id => NULL,
4307: p_table => gme_common_pvt.g_interface_table,
4308: p_commit => FND_API.G_FALSE,
4309: x_return_status => x_return_status);
4310: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4311: COMMIT;
4312: ELSE
4313: RAISE fnd_api.g_exc_error;
4314: END IF;
4309: x_return_status => x_return_status);
4310: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
4311: COMMIT;
4312: ELSE
4313: RAISE fnd_api.g_exc_error;
4314: END IF;
4315: END IF;
4316: ELSE
4317: RAISE step_revert_failure;
4318: END IF;
4319:
4320: gme_common_pvt.count_and_get (
4321: x_count => x_message_count,
4322: p_encoded => FND_API.g_false,
4323: x_data => x_message_list
4324: );
4325:
4326: IF g_debug <= gme_debug.g_log_procedure THEN
4331: WHEN step_revert_failure THEN
4332: ROLLBACK TO SAVEPOINT revert_step;
4333: x_batch_step_rec := NULL;
4334: gme_common_pvt.count_and_get(x_count => x_message_count,
4335: p_encoded => FND_API.g_false,
4336: x_data => x_message_list);
4337: WHEN FND_API.g_exc_error THEN
4338: ROLLBACK TO SAVEPOINT revert_step;
4339: x_batch_step_rec := NULL;
4333: x_batch_step_rec := NULL;
4334: gme_common_pvt.count_and_get(x_count => x_message_count,
4335: p_encoded => FND_API.g_false,
4336: x_data => x_message_list);
4337: WHEN FND_API.g_exc_error THEN
4338: ROLLBACK TO SAVEPOINT revert_step;
4339: x_batch_step_rec := NULL;
4340: x_return_status := fnd_api.g_ret_sts_error;
4341: gme_common_pvt.count_and_get (x_count => x_message_count
4336: x_data => x_message_list);
4337: WHEN FND_API.g_exc_error THEN
4338: ROLLBACK TO SAVEPOINT revert_step;
4339: x_batch_step_rec := NULL;
4340: x_return_status := fnd_api.g_ret_sts_error;
4341: gme_common_pvt.count_and_get (x_count => x_message_count
4342: ,p_encoded => fnd_api.g_false
4343: ,x_data => x_message_list);
4344: WHEN OTHERS THEN
4338: ROLLBACK TO SAVEPOINT revert_step;
4339: x_batch_step_rec := NULL;
4340: x_return_status := fnd_api.g_ret_sts_error;
4341: gme_common_pvt.count_and_get (x_count => x_message_count
4342: ,p_encoded => fnd_api.g_false
4343: ,x_data => x_message_list);
4344: WHEN OTHERS THEN
4345: ROLLBACK TO SAVEPOINT revert_step;
4346: x_batch_step_rec := NULL;
4372: || l_api_name);
4373: END IF;
4374:
4375: /* Set the return status to success initially */
4376: x_return_status := fnd_api.g_ret_sts_success;
4377:
4378: /* Set savepoint here */
4379: SAVEPOINT close_batch_pub;
4380:
4378: /* Set savepoint here */
4379: SAVEPOINT close_batch_pub;
4380:
4381: /* Initialize message list and count if needed */
4382: IF p_init_msg_list = fnd_api.g_true THEN
4383: fnd_msg_pub.initialize;
4384: END IF;
4385:
4386: /* Make sure we are call compatible */
4383: fnd_msg_pub.initialize;
4384: END IF;
4385:
4386: /* Make sure we are call compatible */
4387: IF NOT fnd_api.compatible_api_call (2
4388: ,p_api_version
4389: ,'close_batch'
4390: ,g_pkg_name) THEN
4391: x_return_status := fnd_api.g_ret_sts_error;
4387: IF NOT fnd_api.compatible_api_call (2
4388: ,p_api_version
4389: ,'close_batch'
4390: ,g_pkg_name) THEN
4391: x_return_status := fnd_api.g_ret_sts_error;
4392: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4393: RAISE fnd_api.g_exc_error;
4394: END IF;
4395: gme_common_pvt.validate_batch
4389: ,'close_batch'
4390: ,g_pkg_name) THEN
4391: x_return_status := fnd_api.g_ret_sts_error;
4392: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4393: RAISE fnd_api.g_exc_error;
4394: END IF;
4395: gme_common_pvt.validate_batch
4396: (p_batch_header_rec => p_batch_header_rec
4397: ,p_org_code => p_org_code
4400: ,x_message_count => x_message_count
4401: ,x_message_list => x_message_list
4402: ,x_return_status => x_return_status );
4403:
4404: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4405: IF (g_debug = gme_debug.g_log_statement) THEN
4406: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4407: || ': batch validate error ');
4408: END IF;
4405: IF (g_debug = gme_debug.g_log_statement) THEN
4406: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4407: || ': batch validate error ');
4408: END IF;
4409: RAISE fnd_api.g_exc_error;
4410: END IF;
4411:
4412:
4413: IF (l_batch_header_rec.batch_status <> gme_common_pvt.g_batch_completed) THEN
4411:
4412:
4413: IF (l_batch_header_rec.batch_status <> gme_common_pvt.g_batch_completed) THEN
4414: gme_common_pvt.log_message ('GME_CLOSE_STATUS_ERR');
4415: RAISE fnd_api.g_exc_error;
4416: END IF;
4417:
4418: IF (p_batch_header_rec.batch_close_date IS NULL) THEN
4419: l_batch_header_rec.batch_close_date := SYSDATE;
4420: ELSIF (p_batch_header_rec.batch_close_date <
4421: l_batch_header_rec.actual_cmplt_date) THEN
4422: gme_common_pvt.log_message ('GME_INVALID_DATE_RANGE' ,'DATE1' ,'Close
4423: date' ,'DATE2','completion date');
4424: RAISE fnd_api.g_exc_error;
4425: ELSIF (p_batch_header_rec.batch_close_date > SYSDATE) THEN
4426: gme_common_pvt.log_message(p_product_code => 'GMA'
4427: ,p_message_code => 'SY_NOFUTUREDATE');
4428: RAISE fnd_api.g_exc_error;
4424: RAISE fnd_api.g_exc_error;
4425: ELSIF (p_batch_header_rec.batch_close_date > SYSDATE) THEN
4426: gme_common_pvt.log_message(p_product_code => 'GMA'
4427: ,p_message_code => 'SY_NOFUTUREDATE');
4428: RAISE fnd_api.g_exc_error;
4429: ELSE
4430: l_batch_header_rec.batch_close_date :=
4431: p_batch_header_rec.batch_close_date;
4432: END IF;
4435: gme_debug.put_line ('Calling gme_api_main.close_batch.');
4436: END IF;
4437:
4438: gme_api_main.close_batch (p_validation_level => p_validation_level
4439: ,p_init_msg_list => fnd_api.g_false
4440: ,x_message_count => x_message_count
4441: ,x_message_list => x_message_list
4442: ,x_return_status => x_return_status
4443: ,p_batch_header_rec => l_batch_header_rec
4447: gme_debug.put_line('Came back from Main Close Batch with status '
4448: || x_return_status);
4449: END IF;
4450:
4451: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4452: RAISE batch_close_failure;
4453: ELSE
4454: IF (g_debug = gme_debug.g_log_statement) THEN
4455: gme_debug.put_line ('Calling save_batch.');
4456: END IF;
4457:
4458: gme_api_pub.save_batch (p_header_id => null
4459: ,p_table => 1
4460: ,p_commit => fnd_api.g_false
4461: ,x_return_status => x_return_status);
4462:
4463: IF (g_debug = gme_debug.g_log_statement) THEN
4464: gme_debug.put_line ( 'Came back from save_batch with status '
4464: gme_debug.put_line ( 'Came back from save_batch with status '
4465: || x_return_status);
4466: END IF;
4467:
4468: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4469: RAISE fnd_api.g_exc_error;
4470: END IF;
4471:
4472: IF p_commit = fnd_api.g_true THEN
4465: || x_return_status);
4466: END IF;
4467:
4468: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4469: RAISE fnd_api.g_exc_error;
4470: END IF;
4471:
4472: IF p_commit = fnd_api.g_true THEN
4473: COMMIT;
4468: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4469: RAISE fnd_api.g_exc_error;
4470: END IF;
4471:
4472: IF p_commit = fnd_api.g_true THEN
4473: COMMIT;
4474: END IF;
4475: END IF;
4476:
4482: WHEN batch_close_failure THEN
4483: ROLLBACK TO SAVEPOINT close_batch_pub;
4484: x_batch_header_rec := NULL;
4485: gme_common_pvt.count_and_get (x_count => x_message_count
4486: ,p_encoded => fnd_api.g_false
4487: ,x_data => x_message_list);
4488: WHEN FND_API.g_exc_error THEN
4489: ROLLBACK TO SAVEPOINT close_batch_pub;
4490: x_batch_header_rec := NULL;
4484: x_batch_header_rec := NULL;
4485: gme_common_pvt.count_and_get (x_count => x_message_count
4486: ,p_encoded => fnd_api.g_false
4487: ,x_data => x_message_list);
4488: WHEN FND_API.g_exc_error THEN
4489: ROLLBACK TO SAVEPOINT close_batch_pub;
4490: x_batch_header_rec := NULL;
4491: x_return_status := fnd_api.g_ret_sts_error;
4492: gme_common_pvt.count_and_get (x_count => x_message_count
4487: ,x_data => x_message_list);
4488: WHEN FND_API.g_exc_error THEN
4489: ROLLBACK TO SAVEPOINT close_batch_pub;
4490: x_batch_header_rec := NULL;
4491: x_return_status := fnd_api.g_ret_sts_error;
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: WHEN OTHERS THEN
4489: ROLLBACK TO SAVEPOINT close_batch_pub;
4490: x_batch_header_rec := NULL;
4491: x_return_status := fnd_api.g_ret_sts_error;
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: WHEN OTHERS THEN
4496: ROLLBACK TO SAVEPOINT close_batch_pub;
4497: x_batch_header_rec := NULL;
4504: PROCEDURE close_step (
4505: p_api_version IN NUMBER := 2
4506: /* Punit Kumar */
4507: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
4508: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4509: ,p_commit IN VARCHAR2
4510: ,x_message_count OUT NOCOPY NUMBER
4511: ,x_message_list OUT NOCOPY VARCHAR2
4512: ,x_return_status OUT NOCOPY VARCHAR2
4510: ,x_message_count OUT NOCOPY NUMBER
4511: ,x_message_list OUT NOCOPY VARCHAR2
4512: ,x_return_status OUT NOCOPY VARCHAR2
4513: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
4514: ,p_delete_pending IN VARCHAR2 := fnd_api.g_false
4515: ,p_org_code IN VARCHAR2
4516: ,p_batch_no IN VARCHAR2
4517: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE)
4518: IS
4527: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4528: || l_api_name);
4529: END IF;
4530: /* Set the return status to success initially */
4531: x_return_status := fnd_api.g_ret_sts_success;
4532:
4533: /* Set savepoint here */
4534: SAVEPOINT close_step_pub;
4535:
4533: /* Set savepoint here */
4534: SAVEPOINT close_step_pub;
4535:
4536: /* Initialize message list and count if needed */
4537: IF p_init_msg_list = fnd_api.g_true THEN
4538: fnd_msg_pub.initialize;
4539: END IF;
4540:
4541: /* Make sure we are call compatible */
4538: fnd_msg_pub.initialize;
4539: END IF;
4540:
4541: /* Make sure we are call compatible */
4542: IF NOT fnd_api.compatible_api_call (2
4543: ,p_api_version
4544: ,'close_batch_step'
4545: ,g_pkg_name) THEN
4546: x_return_status := fnd_api.g_ret_sts_error;
4542: IF NOT fnd_api.compatible_api_call (2
4543: ,p_api_version
4544: ,'close_batch_step'
4545: ,g_pkg_name) THEN
4546: x_return_status := fnd_api.g_ret_sts_error;
4547: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4548: RAISE fnd_api.g_exc_error;
4549: END IF;
4550:
4544: ,'close_batch_step'
4545: ,g_pkg_name) THEN
4546: x_return_status := fnd_api.g_ret_sts_error;
4547: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4548: RAISE fnd_api.g_exc_error;
4549: END IF;
4550:
4551: /* Validate Input parameters */
4552: gme_common_pvt.Validate_batch_step (
4558: ,x_message_count => x_message_count
4559: ,x_message_list => x_message_list
4560: ,x_return_status => x_return_status );
4561:
4562: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4563: IF (g_debug = gme_debug.g_log_statement) THEN
4564: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4565: || ': batch step validate error ');
4566: END IF;
4563: IF (g_debug = gme_debug.g_log_statement) THEN
4564: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4565: || ': batch step validate error ');
4566: END IF;
4567: RAISE fnd_api.g_exc_error;
4568: END IF;
4569:
4570: /* Bug 2404169 all date and status checks */
4571: IF (p_batch_step_rec.step_close_date IS NULL) THEN
4577: ,'DATE1'
4578: ,'Close date'
4579: ,'DATE2'
4580: ,'completion date');
4581: RAISE fnd_api.g_exc_error;
4582: ELSIF (p_batch_step_rec.step_close_date > SYSDATE) THEN
4583: gme_common_pvt.log_message(p_product_code => 'GMA'
4584: ,p_message_code => 'SY_NOFUTUREDATE');
4585: RAISE fnd_api.g_exc_error;
4581: RAISE fnd_api.g_exc_error;
4582: ELSIF (p_batch_step_rec.step_close_date > SYSDATE) THEN
4583: gme_common_pvt.log_message(p_product_code => 'GMA'
4584: ,p_message_code => 'SY_NOFUTUREDATE');
4585: RAISE fnd_api.g_exc_error;
4586: ELSE
4587: l_batch_step_rec.step_close_date := p_batch_step_rec.step_close_date;
4588: END IF;
4589:
4588: END IF;
4589:
4590: IF (l_batch_step_rec.step_status <> 3) THEN
4591: gme_common_pvt.log_message ('PC_STEP_STATUS_ERR');
4592: RAISE fnd_api.g_exc_error;
4593: END IF;
4594:
4595: gme_api_main.close_step (p_validation_level => p_validation_level
4596: ,p_init_msg_list => fnd_api.g_false
4592: RAISE fnd_api.g_exc_error;
4593: END IF;
4594:
4595: gme_api_main.close_step (p_validation_level => p_validation_level
4596: ,p_init_msg_list => fnd_api.g_false
4597: ,x_message_count => x_message_count
4598: ,x_message_list => x_message_list
4599: ,x_return_status => x_return_status
4600: ,p_batch_header_rec => l_batch_header_rec
4601: ,p_batch_step_rec => l_batch_step_rec
4602: ,p_delete_pending => p_delete_pending
4603: ,x_batch_step_rec => x_batch_step_rec);
4604:
4605: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4606: RAISE step_close_failed;
4607: ELSE
4608: IF p_commit = fnd_api.g_true THEN
4609: gme_api_pub.save_batch (p_header_id => null
4604:
4605: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4606: RAISE step_close_failed;
4607: ELSE
4608: IF p_commit = fnd_api.g_true THEN
4609: gme_api_pub.save_batch (p_header_id => null
4610: ,p_table => 1
4611: ,p_commit => fnd_api.g_false
4612: ,x_return_status => x_return_status);
4607: ELSE
4608: IF p_commit = fnd_api.g_true THEN
4609: gme_api_pub.save_batch (p_header_id => null
4610: ,p_table => 1
4611: ,p_commit => fnd_api.g_false
4612: ,x_return_status => x_return_status);
4613:
4614: IF x_return_status = fnd_api.g_ret_sts_success THEN
4615: COMMIT;
4610: ,p_table => 1
4611: ,p_commit => fnd_api.g_false
4612: ,x_return_status => x_return_status);
4613:
4614: IF x_return_status = fnd_api.g_ret_sts_success THEN
4615: COMMIT;
4616: ELSE
4617: RAISE fnd_api.g_exc_error;
4618: END IF;
4613:
4614: IF x_return_status = fnd_api.g_ret_sts_success THEN
4615: COMMIT;
4616: ELSE
4617: RAISE fnd_api.g_exc_error;
4618: END IF;
4619: END IF;
4620: END IF;
4621:
4627: WHEN step_close_failed THEN
4628: ROLLBACK TO SAVEPOINT close_step_pub;
4629: x_batch_step_rec := NULL;
4630: gme_common_pvt.count_and_get (x_count => x_message_count
4631: ,p_encoded => fnd_api.g_false
4632: ,x_data => x_message_list);
4633: WHEN fnd_api.g_exc_error THEN
4634: ROLLBACK TO SAVEPOINT close_step_pub;
4635: x_batch_step_rec := NULL;
4629: x_batch_step_rec := NULL;
4630: gme_common_pvt.count_and_get (x_count => x_message_count
4631: ,p_encoded => fnd_api.g_false
4632: ,x_data => x_message_list);
4633: WHEN fnd_api.g_exc_error THEN
4634: ROLLBACK TO SAVEPOINT close_step_pub;
4635: x_batch_step_rec := NULL;
4636: x_return_status := fnd_api.g_ret_sts_error;
4637: gme_common_pvt.count_and_get (x_count => x_message_count
4632: ,x_data => x_message_list);
4633: WHEN fnd_api.g_exc_error THEN
4634: ROLLBACK TO SAVEPOINT close_step_pub;
4635: x_batch_step_rec := NULL;
4636: x_return_status := fnd_api.g_ret_sts_error;
4637: gme_common_pvt.count_and_get (x_count => x_message_count
4638: ,p_encoded => fnd_api.g_false
4639: ,x_data => x_message_list);
4640: WHEN OTHERS THEN
4634: ROLLBACK TO SAVEPOINT close_step_pub;
4635: x_batch_step_rec := NULL;
4636: x_return_status := fnd_api.g_ret_sts_error;
4637: gme_common_pvt.count_and_get (x_count => x_message_count
4638: ,p_encoded => fnd_api.g_false
4639: ,x_data => x_message_list);
4640: WHEN OTHERS THEN
4641: ROLLBACK TO SAVEPOINT close_step_pub;
4642: x_batch_step_rec := NULL;
4650: PROCEDURE reopen_batch (
4651: p_api_version IN NUMBER := 2
4652: ,p_validation_level IN NUMBER
4653: := gme_common_pvt.g_max_errors
4654: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4655: ,p_commit IN VARCHAR2
4656: ,x_message_count OUT NOCOPY NUMBER
4657: ,x_message_list OUT NOCOPY VARCHAR2
4658: ,x_return_status OUT NOCOPY VARCHAR2
4657: ,x_message_list OUT NOCOPY VARCHAR2
4658: ,x_return_status OUT NOCOPY VARCHAR2
4659: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
4660: ,p_org_code IN VARCHAR2
4661: ,p_reopen_steps IN VARCHAR2 := fnd_api.g_false
4662: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE)
4663: IS
4664: l_api_name CONSTANT VARCHAR2 (30) := 'REOPEN_BATCH';
4665: l_batch_header_rec gme_batch_header%ROWTYPE;
4669: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4670: || l_api_name);
4671: END IF;
4672: /* Set the success staus to success inititally*/
4673: x_return_status := fnd_api.g_ret_sts_success;
4674: /* Initialize message list and count if needed*/
4675: IF p_init_msg_list = fnd_api.g_true THEN
4676: fnd_msg_pub.initialize;
4677: END IF;
4671: END IF;
4672: /* Set the success staus to success inititally*/
4673: x_return_status := fnd_api.g_ret_sts_success;
4674: /* Initialize message list and count if needed*/
4675: IF p_init_msg_list = fnd_api.g_true THEN
4676: fnd_msg_pub.initialize;
4677: END IF;
4678:
4679: /* Make sure we are call compatible */
4676: fnd_msg_pub.initialize;
4677: END IF;
4678:
4679: /* Make sure we are call compatible */
4680: IF NOT fnd_api.compatible_api_call (2.0 /* Punit Kumar */
4681: ,p_api_version
4682: ,'reopen_batch'
4683: ,g_pkg_name) THEN
4684: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4681: ,p_api_version
4682: ,'reopen_batch'
4683: ,g_pkg_name) THEN
4684: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4685: RAISE fnd_api.g_exc_error;
4686: END IF;
4687: gme_common_pvt.validate_batch
4688: (p_batch_header_rec => p_batch_header_rec
4689: ,p_org_code => p_org_code
4692: ,x_message_count => x_message_count
4693: ,x_message_list => x_message_list
4694: ,x_return_status => x_return_status );
4695:
4696: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4697: IF (g_debug = gme_debug.g_log_statement) THEN
4698: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4699: || ': batch validate error ');
4700: END IF;
4697: IF (g_debug = gme_debug.g_log_statement) THEN
4698: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4699: || ': batch validate error ');
4700: END IF;
4701: RAISE fnd_api.g_exc_error;
4702: END IF;
4703: gme_api_main.reopen_batch (p_validation_level => p_validation_level
4704: ,p_init_msg_list => fnd_api.g_false
4705: ,x_message_count => x_message_count
4700: END IF;
4701: RAISE fnd_api.g_exc_error;
4702: END IF;
4703: gme_api_main.reopen_batch (p_validation_level => p_validation_level
4704: ,p_init_msg_list => fnd_api.g_false
4705: ,x_message_count => x_message_count
4706: ,x_message_list => x_message_list
4707: ,x_return_status => x_return_status
4708: ,p_batch_header_rec => l_batch_header_rec
4708: ,p_batch_header_rec => l_batch_header_rec
4709: ,p_reopen_steps => p_reopen_steps
4710: ,x_batch_header_rec => x_batch_header_rec);
4711:
4712: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4713: RAISE batch_reopen_failure;
4714: ELSE
4715: IF p_commit = fnd_api.g_true THEN
4716: gme_api_pub.save_batch
4711:
4712: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4713: RAISE batch_reopen_failure;
4714: ELSE
4715: IF p_commit = fnd_api.g_true THEN
4716: gme_api_pub.save_batch
4717: (p_header_id => null
4718: ,p_table => 1
4719: ,p_commit => fnd_api.g_false
4715: IF p_commit = fnd_api.g_true THEN
4716: gme_api_pub.save_batch
4717: (p_header_id => null
4718: ,p_table => 1
4719: ,p_commit => fnd_api.g_false
4720: ,x_return_status => x_return_status);
4721:
4722: IF x_return_status = fnd_api.g_ret_sts_success THEN
4723: COMMIT;
4718: ,p_table => 1
4719: ,p_commit => fnd_api.g_false
4720: ,x_return_status => x_return_status);
4721:
4722: IF x_return_status = fnd_api.g_ret_sts_success THEN
4723: COMMIT;
4724: ELSE
4725: RAISE fnd_api.g_exc_error;
4726: END IF;
4721:
4722: IF x_return_status = fnd_api.g_ret_sts_success THEN
4723: COMMIT;
4724: ELSE
4725: RAISE fnd_api.g_exc_error;
4726: END IF;
4727: END IF;
4728: END IF;
4729:
4734: EXCEPTION
4735: WHEN batch_reopen_failure THEN
4736: x_batch_header_rec := NULL;
4737: gme_common_pvt.count_and_get (x_count => x_message_count
4738: ,p_encoded => fnd_api.g_false
4739: ,x_data => x_message_list);
4740: x_return_status := fnd_api.g_ret_sts_error;
4741: WHEN fnd_api.g_exc_error THEN
4742: x_batch_header_rec := NULL;
4736: x_batch_header_rec := NULL;
4737: gme_common_pvt.count_and_get (x_count => x_message_count
4738: ,p_encoded => fnd_api.g_false
4739: ,x_data => x_message_list);
4740: x_return_status := fnd_api.g_ret_sts_error;
4741: WHEN fnd_api.g_exc_error THEN
4742: x_batch_header_rec := NULL;
4743: x_return_status := fnd_api.g_ret_sts_error;
4744: gme_common_pvt.count_and_get (x_count => x_message_count
4737: gme_common_pvt.count_and_get (x_count => x_message_count
4738: ,p_encoded => fnd_api.g_false
4739: ,x_data => x_message_list);
4740: x_return_status := fnd_api.g_ret_sts_error;
4741: WHEN fnd_api.g_exc_error THEN
4742: x_batch_header_rec := NULL;
4743: x_return_status := fnd_api.g_ret_sts_error;
4744: gme_common_pvt.count_and_get (x_count => x_message_count
4745: ,p_encoded => fnd_api.g_false
4739: ,x_data => x_message_list);
4740: x_return_status := fnd_api.g_ret_sts_error;
4741: WHEN fnd_api.g_exc_error THEN
4742: x_batch_header_rec := NULL;
4743: x_return_status := fnd_api.g_ret_sts_error;
4744: gme_common_pvt.count_and_get (x_count => x_message_count
4745: ,p_encoded => fnd_api.g_false
4746: ,x_data => x_message_list);
4747: WHEN OTHERS THEN
4741: WHEN fnd_api.g_exc_error THEN
4742: x_batch_header_rec := NULL;
4743: x_return_status := fnd_api.g_ret_sts_error;
4744: gme_common_pvt.count_and_get (x_count => x_message_count
4745: ,p_encoded => fnd_api.g_false
4746: ,x_data => x_message_list);
4747: WHEN OTHERS THEN
4748: x_batch_header_rec := NULL;
4749: gme_when_others ( p_api_name => l_api_name
4755: /*************************************************************************/
4756: PROCEDURE reopen_step (
4757: p_api_version IN NUMBER := 2
4758: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
4759: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4760: ,p_commit IN VARCHAR2
4761: ,x_message_count OUT NOCOPY NUMBER
4762: ,x_message_list OUT NOCOPY VARCHAR2
4763: ,x_return_status OUT NOCOPY VARCHAR2
4775: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4776: || l_api_name);
4777: END IF;
4778: /* Initialize message list and count if needed*/
4779: IF p_init_msg_list = fnd_api.g_true THEN
4780: fnd_msg_pub.initialize;
4781: END IF;
4782:
4783: /* Make sure we are call compatible */
4780: fnd_msg_pub.initialize;
4781: END IF;
4782:
4783: /* Make sure we are call compatible */
4784: IF NOT fnd_api.compatible_api_call (2
4785: ,p_api_version
4786: ,'reopen_step'
4787: ,g_pkg_name) THEN
4788: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4785: ,p_api_version
4786: ,'reopen_step'
4787: ,g_pkg_name) THEN
4788: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4789: RAISE fnd_api.g_exc_error;
4790: END IF;
4791:
4792: /* Set the success staus to success inititally*/
4793: x_return_status := fnd_api.g_ret_sts_success;
4789: RAISE fnd_api.g_exc_error;
4790: END IF;
4791:
4792: /* Set the success staus to success inititally*/
4793: x_return_status := fnd_api.g_ret_sts_success;
4794: gme_common_pvt.Validate_batch_step (
4795: p_batch_step_rec => p_batch_step_rec
4796: ,p_org_code => p_org_code
4797: ,p_batch_no => p_batch_header_rec.batch_no
4800: ,x_message_count => x_message_count
4801: ,x_message_list => x_message_list
4802: ,x_return_status => x_return_status );
4803:
4804: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4805: IF (g_debug = gme_debug.g_log_statement) THEN
4806: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4807: || ': batch step validate error ');
4808: END IF;
4805: IF (g_debug = gme_debug.g_log_statement) THEN
4806: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4807: || ': batch step validate error ');
4808: END IF;
4809: RAISE fnd_api.g_exc_error;
4810: END IF;
4811: gme_api_main.reopen_step (p_validation_level => p_validation_level
4812: ,p_init_msg_list => fnd_api.g_false
4813: ,x_message_count => x_message_count
4808: END IF;
4809: RAISE fnd_api.g_exc_error;
4810: END IF;
4811: gme_api_main.reopen_step (p_validation_level => p_validation_level
4812: ,p_init_msg_list => fnd_api.g_false
4813: ,x_message_count => x_message_count
4814: ,x_message_list => x_message_list
4815: ,x_return_status => x_return_status
4816: ,p_batch_header_rec => l_batch_header_rec
4816: ,p_batch_header_rec => l_batch_header_rec
4817: ,p_batch_step_rec => l_batch_step_rec
4818: ,x_batch_step_rec => x_batch_step_rec);
4819:
4820: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4821: RAISE step_reopen_failure;
4822: ELSE
4823: IF p_commit = fnd_api.g_true THEN
4824: gme_api_pub.save_batch (p_header_id => null
4819:
4820: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4821: RAISE step_reopen_failure;
4822: ELSE
4823: IF p_commit = fnd_api.g_true THEN
4824: gme_api_pub.save_batch (p_header_id => null
4825: ,p_table => 1
4826: ,p_commit => fnd_api.g_false
4827: ,x_return_status => x_return_status);
4822: ELSE
4823: IF p_commit = fnd_api.g_true THEN
4824: gme_api_pub.save_batch (p_header_id => null
4825: ,p_table => 1
4826: ,p_commit => fnd_api.g_false
4827: ,x_return_status => x_return_status);
4828: IF x_return_status = fnd_api.g_ret_sts_success THEN
4829: COMMIT;
4830: ELSE
4824: gme_api_pub.save_batch (p_header_id => null
4825: ,p_table => 1
4826: ,p_commit => fnd_api.g_false
4827: ,x_return_status => x_return_status);
4828: IF x_return_status = fnd_api.g_ret_sts_success THEN
4829: COMMIT;
4830: ELSE
4831: RAISE fnd_api.g_exc_error;
4832: END IF;
4827: ,x_return_status => x_return_status);
4828: IF x_return_status = fnd_api.g_ret_sts_success THEN
4829: COMMIT;
4830: ELSE
4831: RAISE fnd_api.g_exc_error;
4832: END IF;
4833: END IF;
4834: END IF;
4835:
4840: EXCEPTION
4841: WHEN step_reopen_failure THEN
4842: x_batch_step_rec := NULL;
4843: gme_common_pvt.count_and_get (x_count => x_message_count
4844: ,p_encoded => fnd_api.g_false
4845: ,x_data => x_message_list);
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: WHEN fnd_api.g_exc_error THEN
4848: x_batch_step_rec := NULL;
4842: x_batch_step_rec := NULL;
4843: gme_common_pvt.count_and_get (x_count => x_message_count
4844: ,p_encoded => fnd_api.g_false
4845: ,x_data => x_message_list);
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: WHEN fnd_api.g_exc_error THEN
4848: x_batch_step_rec := NULL;
4849: x_return_status := fnd_api.g_ret_sts_error;
4850: gme_common_pvt.count_and_get (x_count => x_message_count
4843: gme_common_pvt.count_and_get (x_count => x_message_count
4844: ,p_encoded => fnd_api.g_false
4845: ,x_data => x_message_list);
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: WHEN fnd_api.g_exc_error THEN
4848: x_batch_step_rec := NULL;
4849: x_return_status := fnd_api.g_ret_sts_error;
4850: gme_common_pvt.count_and_get (x_count => x_message_count
4851: ,p_encoded => fnd_api.g_false
4845: ,x_data => x_message_list);
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: WHEN fnd_api.g_exc_error THEN
4848: x_batch_step_rec := NULL;
4849: x_return_status := fnd_api.g_ret_sts_error;
4850: gme_common_pvt.count_and_get (x_count => x_message_count
4851: ,p_encoded => fnd_api.g_false
4852: ,x_data => x_message_list);
4853: WHEN OTHERS THEN
4847: WHEN fnd_api.g_exc_error THEN
4848: x_batch_step_rec := NULL;
4849: x_return_status := fnd_api.g_ret_sts_error;
4850: gme_common_pvt.count_and_get (x_count => x_message_count
4851: ,p_encoded => fnd_api.g_false
4852: ,x_data => x_message_list);
4853: WHEN OTHERS THEN
4854: x_batch_step_rec := NULL;
4855: gme_when_others ( p_api_name => l_api_name
4861: /*************************************************************************/
4862: PROCEDURE incremental_backflush
4863: (p_api_version IN NUMBER
4864: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
4865: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4866: ,p_commit IN VARCHAR2 := fnd_api.g_false
4867: ,x_message_count OUT NOCOPY NUMBER
4868: ,x_message_list OUT NOCOPY VARCHAR2
4869: ,x_return_status OUT NOCOPY VARCHAR2
4862: PROCEDURE incremental_backflush
4863: (p_api_version IN NUMBER
4864: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
4865: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4866: ,p_commit IN VARCHAR2 := fnd_api.g_false
4867: ,x_message_count OUT NOCOPY NUMBER
4868: ,x_message_list OUT NOCOPY VARCHAR2
4869: ,x_return_status OUT NOCOPY VARCHAR2
4870: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
4872: ,p_material_detail_rec IN gme_material_details%ROWTYPE
4873: ,p_qty IN NUMBER
4874: ,p_qty_type IN NUMBER
4875: ,p_trans_date IN DATE
4876: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
4877: ,p_adjust_cmplt IN VARCHAR2 := fnd_api.g_true
4878: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
4879: IS
4880: l_api_name CONSTANT VARCHAR2 (30) := 'INCREMENTAL_BACKFLUSH';
4873: ,p_qty IN NUMBER
4874: ,p_qty_type IN NUMBER
4875: ,p_trans_date IN DATE
4876: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
4877: ,p_adjust_cmplt IN VARCHAR2 := fnd_api.g_true
4878: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
4879: IS
4880: l_api_name CONSTANT VARCHAR2 (30) := 'INCREMENTAL_BACKFLUSH';
4881: l_material_detail_rec gme_material_details%ROWTYPE;
4893: || l_api_name);
4894: END IF;
4895:
4896: /* Set the return status to success initially */
4897: x_return_status := fnd_api.g_ret_sts_success;
4898:
4899: IF p_init_msg_list = fnd_api.g_true THEN
4900: fnd_msg_pub.initialize;
4901: END IF;
4895:
4896: /* Set the return status to success initially */
4897: x_return_status := fnd_api.g_ret_sts_success;
4898:
4899: IF p_init_msg_list = fnd_api.g_true THEN
4900: fnd_msg_pub.initialize;
4901: END IF;
4902: IF NOT fnd_api.compatible_api_call (2.0
4903: ,p_api_version
4898:
4899: IF p_init_msg_list = fnd_api.g_true THEN
4900: fnd_msg_pub.initialize;
4901: END IF;
4902: IF NOT fnd_api.compatible_api_call (2.0
4903: ,p_api_version
4904: ,'incremental_backflush'
4905: ,g_pkg_name) THEN
4906: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4903: ,p_api_version
4904: ,'incremental_backflush'
4905: ,g_pkg_name) THEN
4906: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
4907: RAISE fnd_api.g_exc_error;
4908: END IF;
4909:
4910: /* Retrieve Batch Header and Material Detail Record */
4911: gme_common_pvt.Validate_material_detail
4917: ,x_material_detail_rec => l_material_detail_rec
4918: ,x_message_count => x_message_count
4919: ,x_message_list => x_message_list
4920: ,x_return_status => x_return_status );
4921: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4922: IF (g_debug = gme_debug.g_log_statement) THEN
4923: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4924: || ': batch mateiral validate error ');
4925: END IF;
4922: IF (g_debug = gme_debug.g_log_statement) THEN
4923: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
4924: || ': batch mateiral validate error ');
4925: END IF;
4926: RAISE fnd_api.g_exc_error;
4927: END IF;
4928: -- Validations
4929: IF p_trans_date IS NOT NULL THEN
4930: IF p_trans_date > SYSDATE THEN
4929: IF p_trans_date IS NOT NULL THEN
4930: IF p_trans_date > SYSDATE THEN
4931: gme_common_pvt.log_message(p_product_code => 'GMA'
4932: ,p_message_code => 'SY_NOFUTUREDATE');
4933: RAISE fnd_api.g_exc_error;
4934: END IF;
4935: END IF;
4936:
4937: /*Bug#5277982 if the batch is completed then we should not allow +veIB through API. so restricting this in public layer.
4942: IF (p_qty_type = 0 AND p_qty > 0) OR
4943: (p_qty_type = 1 AND p_qty > l_material_detail_rec.actual_qty) OR
4944: (p_qty_type = 2 AND (l_material_detail_rec.wip_plan_qty *p_qty/100) > l_material_detail_rec.actual_qty) THEN
4945: gme_common_pvt.log_message('GME_IB_NOT_ALLOWED');
4946: RAISE fnd_api.g_exc_error;
4947: END IF;
4948: END IF;
4949:
4950: gme_incremental_backflush_pvt.validate_material_for_IB
4952: ,p_batch_header_rec => l_batch_header_rec
4953: ,p_adjust_cmplt => p_adjust_cmplt
4954: ,x_return_status => x_return_status);
4955:
4956: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4957: RAISE fnd_api.g_exc_error;
4958: END IF;
4959:
4960: gme_incremental_backflush_pvt.validate_qty_for_IB
4953: ,p_adjust_cmplt => p_adjust_cmplt
4954: ,x_return_status => x_return_status);
4955:
4956: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4957: RAISE fnd_api.g_exc_error;
4958: END IF;
4959:
4960: gme_incremental_backflush_pvt.validate_qty_for_IB
4961: (p_qty_type => p_qty_type
4962: ,p_qty => p_qty
4963: ,p_actual_qty => l_material_detail_rec.actual_qty
4964: ,x_return_status => x_return_status);
4965:
4966: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4967: RAISE fnd_api.g_exc_error;
4968: END IF;
4969:
4970: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4963: ,p_actual_qty => l_material_detail_rec.actual_qty
4964: ,x_return_status => x_return_status);
4965:
4966: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4967: RAISE fnd_api.g_exc_error;
4968: END IF;
4969:
4970: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4971:
4966: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4967: RAISE fnd_api.g_exc_error;
4968: END IF;
4969:
4970: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
4971:
4972: /* Invoke main */
4973: gme_api_main.incremental_backflush
4974: (p_validation_level => p_validation_level
4971:
4972: /* Invoke main */
4973: gme_api_main.incremental_backflush
4974: (p_validation_level => p_validation_level
4975: ,p_init_msg_list => fnd_api.g_false
4976: ,x_message_count => x_message_count
4977: ,x_message_list => x_message_list
4978: ,x_return_status => x_return_status
4979: ,p_batch_header_rec => l_batch_header_rec
4982: ,p_qty_type => p_qty_type
4983: ,p_trans_date => p_trans_date
4984: ,x_exception_material_tbl => l_exception_material_tbl);
4985:
4986: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
4987: x_return_status := fnd_api.g_ret_sts_success;
4988: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
4989: x_exception_material_tbl := l_exception_material_tbl;
4990: END IF;
4983: ,p_trans_date => p_trans_date
4984: ,x_exception_material_tbl => l_exception_material_tbl);
4985:
4986: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
4987: x_return_status := fnd_api.g_ret_sts_success;
4988: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
4989: x_exception_material_tbl := l_exception_material_tbl;
4990: END IF;
4991:
4988: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
4989: x_exception_material_tbl := l_exception_material_tbl;
4990: END IF;
4991:
4992: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4993: RAISE error_incr_backflush;
4994: END IF;
4995:
4996: /* Invoke save_batch */
4999: ,p_table => 1
5000: ,p_commit => p_commit
5001: ,x_return_status => x_return_status);
5002:
5003: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5004: RAISE fnd_api.g_exc_error;
5005: END IF;
5006:
5007: IF g_debug <= gme_debug.g_log_procedure THEN
5000: ,p_commit => p_commit
5001: ,x_return_status => x_return_status);
5002:
5003: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5004: RAISE fnd_api.g_exc_error;
5005: END IF;
5006:
5007: IF g_debug <= gme_debug.g_log_procedure THEN
5008: gme_debug.put_line ( ' Completed '
5012: END IF;
5013: EXCEPTION
5014: WHEN error_incr_backflush THEN
5015: gme_common_pvt.count_and_get (x_count => x_message_count
5016: ,p_encoded => fnd_api.g_false
5017: ,x_data => x_message_list);
5018: WHEN fnd_api.g_exc_error THEN
5019: x_return_status := fnd_api.g_ret_sts_error;
5020: fnd_msg_pub.count_and_get (p_count => x_message_count
5014: WHEN error_incr_backflush THEN
5015: gme_common_pvt.count_and_get (x_count => x_message_count
5016: ,p_encoded => fnd_api.g_false
5017: ,x_data => x_message_list);
5018: WHEN fnd_api.g_exc_error THEN
5019: x_return_status := fnd_api.g_ret_sts_error;
5020: fnd_msg_pub.count_and_get (p_count => x_message_count
5021: ,p_encoded => fnd_api.g_false
5022: ,p_data => x_message_list);
5015: gme_common_pvt.count_and_get (x_count => x_message_count
5016: ,p_encoded => fnd_api.g_false
5017: ,x_data => x_message_list);
5018: WHEN fnd_api.g_exc_error THEN
5019: x_return_status := fnd_api.g_ret_sts_error;
5020: fnd_msg_pub.count_and_get (p_count => x_message_count
5021: ,p_encoded => fnd_api.g_false
5022: ,p_data => x_message_list);
5023: WHEN OTHERS THEN
5017: ,x_data => x_message_list);
5018: WHEN fnd_api.g_exc_error THEN
5019: x_return_status := fnd_api.g_ret_sts_error;
5020: fnd_msg_pub.count_and_get (p_count => x_message_count
5021: ,p_encoded => fnd_api.g_false
5022: ,p_data => x_message_list);
5023: WHEN OTHERS THEN
5024: gme_when_others ( p_api_name => l_api_name
5025: ,x_message_count => x_message_count
5031: PROCEDURE create_material_txn (
5032: p_api_version IN NUMBER := 2.0
5033: ,p_validation_level IN NUMBER
5034: := gme_common_pvt.g_max_errors
5035: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5036: ,p_commit IN VARCHAR2 := fnd_api.g_false
5037: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 14685438
5038: ,x_message_count OUT NOCOPY NUMBER
5039: ,x_message_list OUT NOCOPY VARCHAR2
5032: p_api_version IN NUMBER := 2.0
5033: ,p_validation_level IN NUMBER
5034: := gme_common_pvt.g_max_errors
5035: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5036: ,p_commit IN VARCHAR2 := fnd_api.g_false
5037: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 14685438
5038: ,x_message_count OUT NOCOPY NUMBER
5039: ,x_message_list OUT NOCOPY VARCHAR2
5040: ,x_return_status OUT NOCOPY VARCHAR2
5033: ,p_validation_level IN NUMBER
5034: := gme_common_pvt.g_max_errors
5035: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5036: ,p_commit IN VARCHAR2 := fnd_api.g_false
5037: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 14685438
5038: ,x_message_count OUT NOCOPY NUMBER
5039: ,x_message_list OUT NOCOPY VARCHAR2
5040: ,x_return_status OUT NOCOPY VARCHAR2
5041: ,p_org_code IN VARCHAR2 := NULL
5108: || l_api_name);
5109: END IF;
5110:
5111: /* Set the return status to success initially */
5112: x_return_status := fnd_api.g_ret_sts_success;
5113:
5114: /* Set savepoint here */
5115: SAVEPOINT create_material_txn;
5116:
5113:
5114: /* Set savepoint here */
5115: SAVEPOINT create_material_txn;
5116:
5117: IF p_init_msg_list = fnd_api.g_true THEN
5118: fnd_msg_pub.initialize;
5119: END IF;
5120:
5121: IF NOT fnd_api.compatible_api_call (2.0
5117: IF p_init_msg_list = fnd_api.g_true THEN
5118: fnd_msg_pub.initialize;
5119: END IF;
5120:
5121: IF NOT fnd_api.compatible_api_call (2.0
5122: ,p_api_version
5123: ,'create_material_txn'
5124: ,g_pkg_name) THEN
5125: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5122: ,p_api_version
5123: ,'create_material_txn'
5124: ,g_pkg_name) THEN
5125: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5126: RAISE fnd_api.g_exc_error;
5127: END IF;
5128:
5129: l_mmti_rec := p_mmti_rec;
5130: l_mmli_tbl := p_mmli_tbl;
5131:
5132: IF (l_mmti_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
5133: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
5134: fnd_msg_pub.ADD;
5135: RAISE fnd_api.g_exc_error;
5136: END IF;
5137:
5138: /* gme_common_pvt.g_error_count := 0;
5139: gme_common_pvt.g_setup_done :=
5140: gme_common_pvt.setup (p_org_id => l_mmti_rec.organization_id
5141: ,p_org_code => p_org_code);
5142:
5143: IF NOT gme_common_pvt.g_setup_done THEN
5144: RAISE fnd_api.g_exc_error;
5145: ELSE
5146: l_mmti_rec.organization_id := gme_common_pvt.g_organization_id;
5147: END IF;*/
5148: gme_common_pvt.set_timestamp;
5160: ,x_message_count => x_message_count
5161: ,x_message_list => x_message_list
5162: ,x_return_status => x_return_status );
5163:
5164: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5165: IF (g_debug = gme_debug.g_log_statement) THEN
5166: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
5167: || ': batch mateiral validate error ');
5168: END IF;
5165: IF (g_debug = gme_debug.g_log_statement) THEN
5166: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
5167: || ': batch mateiral validate error ');
5168: END IF;
5169: RAISE fnd_api.g_exc_error;
5170: ELSE
5171: l_mat_dtl_rec := l_mat_dtl_rec_out;
5172: l_mmti_rec.trx_source_line_id := l_mat_dtl_rec.material_detail_id;
5173: l_mmti_rec.transaction_source_id := l_batch_header_rec.batch_id;
5182: gme_debug.put_line('Item cursor fetch no record in mtl_system_items_b: ');
5183: gme_debug.put_line('inventory_item_id = '|| TO_CHAR (l_mmti_rec.inventory_item_id) );
5184: gme_debug.put_line('organization_id = '|| TO_CHAR (l_mmti_rec.organization_id) );
5185: END IF;
5186: RAISE fnd_api.g_exc_error;
5187: END IF;
5188: CLOSE cur_get_item_rec;
5189:
5190: /*Bug#5394232 Begin
5195: ,p_invoke_mode => 'T'
5196: ,x_trans_date => l_trans_date
5197: ,x_return_status => l_return_status );
5198:
5199: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5200: RAISE fnd_api.g_exc_error;
5201: END IF;
5202: --initializing the transaction date according to default rules
5203: l_mmti_rec.transaction_date := l_trans_date;
5196: ,x_trans_date => l_trans_date
5197: ,x_return_status => l_return_status );
5198:
5199: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5200: RAISE fnd_api.g_exc_error;
5201: END IF;
5202: --initializing the transaction date according to default rules
5203: l_mmti_rec.transaction_date := l_trans_date;
5204: ELSE
5205: /* transaction date can't be in future and should not be less than actual start date of the batch*/
5206: IF l_mmti_rec.transaction_date < l_batch_header_rec.actual_start_date OR
5207: l_mmti_rec.transaction_date > SYSDATE THEN
5208: gme_common_pvt.log_message('GME_NOT_VALID_TRANS_DATE');
5209: RAISE fnd_api.g_exc_error;
5210: END IF;
5211: END IF;
5212: --Bug#5394232 End
5213:
5223: ,p_to_um => l_mat_dtl_rec.dtl_um
5224: ,x_conv_qty => l_conv_tot_qty
5225: ,x_return_status => l_return_status);
5226:
5227: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5228: RAISE um_convert_error;
5229: END IF;
5230: ELSE
5231: l_conv_tot_qty := 0;
5239: ,p_to_um => l_mat_dtl_rec.dtl_um
5240: ,x_conv_qty => l_conv_qty
5241: ,x_return_status => l_return_status);
5242:
5243: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5244: RAISE um_convert_error;
5245: END IF;
5246:
5247: l_mmli_tbl(i).transaction_quantity := l_conv_qty;
5319: , p_uom_code2 => l_item_rec.secondary_uom_code);
5320:
5321: -- Check to see if quantities are in deviation range.
5322: IF (l_deviation_is_valid = 0) THEN
5323: l_return_status := FND_API.G_RET_STS_ERROR;
5324: RAISE deviation_fail;
5325: END IF;
5326: END IF;
5327: ELSE
5364: , p_uom_code2 => l_item_rec.secondary_uom_code);
5365:
5366: -- Check to see if quantities are in deviation range.
5367: IF (l_deviation_is_valid = 0) THEN
5368: l_return_status := FND_API.G_RET_STS_ERROR;
5369: RAISE deviation_fail;
5370: END IF;
5371: END IF;
5372: END LOOP;
5376: -- code for lot creation
5377: IF l_mat_dtl_rec.line_type IN (1, 2) THEN
5378: -- code for lot creation
5379: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5380: IF p_generate_lot = fnd_api.g_true AND
5381: p_create_lot = fnd_api.g_false THEN
5382: RAISE fnd_api.g_exc_error;
5383: END IF;
5384:
5377: IF l_mat_dtl_rec.line_type IN (1, 2) THEN
5378: -- code for lot creation
5379: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5380: IF p_generate_lot = fnd_api.g_true AND
5381: p_create_lot = fnd_api.g_false THEN
5382: RAISE fnd_api.g_exc_error;
5383: END IF;
5384:
5385: IF p_generate_parent_lot = fnd_api.g_true THEN
5378: -- code for lot creation
5379: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5380: IF p_generate_lot = fnd_api.g_true AND
5381: p_create_lot = fnd_api.g_false THEN
5382: RAISE fnd_api.g_exc_error;
5383: END IF;
5384:
5385: IF p_generate_parent_lot = fnd_api.g_true THEN
5386: l_parent_gen_lot :=
5381: p_create_lot = fnd_api.g_false THEN
5382: RAISE fnd_api.g_exc_error;
5383: END IF;
5384:
5385: IF p_generate_parent_lot = fnd_api.g_true THEN
5386: l_parent_gen_lot :=
5387: inv_lot_api_pub.auto_gen_lot
5388: (p_org_id => l_mmti_rec.organization_id
5389: ,p_inventory_item_id => l_mmti_rec.inventory_item_id
5400: ,p_transaction_action_id => NULL
5401: ,p_transaction_source_type_id => NULL
5402: ,p_lot_number => NULL
5403: ,p_api_version => 1.0
5404: ,p_init_msg_list => fnd_api.g_false
5405: ,p_commit => fnd_api.g_false
5406: ,p_validation_level => NULL
5407: ,p_parent_lot_number => NULL
5408: ,x_return_status => l_return_status
5401: ,p_transaction_source_type_id => NULL
5402: ,p_lot_number => NULL
5403: ,p_api_version => 1.0
5404: ,p_init_msg_list => fnd_api.g_false
5405: ,p_commit => fnd_api.g_false
5406: ,p_validation_level => NULL
5407: ,p_parent_lot_number => NULL
5408: ,x_return_status => l_return_status
5409: ,x_msg_count => l_msg_count
5408: ,x_return_status => l_return_status
5409: ,x_msg_count => l_msg_count
5410: ,x_msg_data => l_msg_data);
5411:
5412: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5413: RAISE fnd_api.g_exc_error;
5414: END IF;
5415:
5416: IF (g_debug = gme_debug.g_log_statement) THEN
5409: ,x_msg_count => l_msg_count
5410: ,x_msg_data => l_msg_data);
5411:
5412: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5413: RAISE fnd_api.g_exc_error;
5414: END IF;
5415:
5416: IF (g_debug = gme_debug.g_log_statement) THEN
5417: gme_debug.put_line ( 'lot_gen'
5421: END IF;
5422: END IF; -- p_generate_parent_lot
5423:
5424: FOR i IN 1 .. l_mmli_tbl.COUNT LOOP
5425: IF p_create_lot = fnd_api.g_true
5426: AND l_mmli_tbl (i).lot_number IS NULL THEN
5427: IF p_generate_lot = fnd_api.g_true THEN
5428: l_gen_lot :=
5429: inv_lot_api_pub.auto_gen_lot
5423:
5424: FOR i IN 1 .. l_mmli_tbl.COUNT LOOP
5425: IF p_create_lot = fnd_api.g_true
5426: AND l_mmli_tbl (i).lot_number IS NULL THEN
5427: IF p_generate_lot = fnd_api.g_true THEN
5428: l_gen_lot :=
5429: inv_lot_api_pub.auto_gen_lot
5430: (p_org_id => l_mmti_rec.organization_id
5431: ,p_inventory_item_id => l_mmti_rec.inventory_item_id
5442: ,p_transaction_action_id => NULL
5443: ,p_transaction_source_type_id => NULL
5444: ,p_lot_number => NULL
5445: ,p_api_version => 1.0
5446: ,p_init_msg_list => fnd_api.g_false
5447: ,p_commit => fnd_api.g_false
5448: ,p_validation_level => NULL
5449: ,p_parent_lot_number => l_parent_gen_lot
5450: ,x_return_status => l_return_status
5443: ,p_transaction_source_type_id => NULL
5444: ,p_lot_number => NULL
5445: ,p_api_version => 1.0
5446: ,p_init_msg_list => fnd_api.g_false
5447: ,p_commit => fnd_api.g_false
5448: ,p_validation_level => NULL
5449: ,p_parent_lot_number => l_parent_gen_lot
5450: ,x_return_status => l_return_status
5451: ,x_msg_count => l_msg_count
5450: ,x_return_status => l_return_status
5451: ,x_msg_count => l_msg_count
5452: ,x_msg_data => l_msg_data);
5453:
5454: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5455: RAISE fnd_api.g_exc_error;
5456: END IF;
5457:
5458: IF (g_debug = gme_debug.g_log_statement) THEN
5451: ,x_msg_count => l_msg_count
5452: ,x_msg_data => l_msg_data);
5453:
5454: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5455: RAISE fnd_api.g_exc_error;
5456: END IF;
5457:
5458: IF (g_debug = gme_debug.g_log_statement) THEN
5459: gme_debug.put_line ( 'lot_gen'
5478: ,x_lot_rec => x_lot_rec
5479: ,p_lot_rec => l_lot_rec
5480: ,p_source => l_source
5481: ,p_api_version => l_api_version
5482: ,p_init_msg_list => fnd_api.g_true
5483: ,p_commit => fnd_api.g_false
5484: ,p_validation_level => fnd_api.g_valid_level_full
5485: ,p_origin_txn_id => 1);
5486:
5479: ,p_lot_rec => l_lot_rec
5480: ,p_source => l_source
5481: ,p_api_version => l_api_version
5482: ,p_init_msg_list => fnd_api.g_true
5483: ,p_commit => fnd_api.g_false
5484: ,p_validation_level => fnd_api.g_valid_level_full
5485: ,p_origin_txn_id => 1);
5486:
5487: IF l_return_status = fnd_api.g_ret_sts_error THEN
5480: ,p_source => l_source
5481: ,p_api_version => l_api_version
5482: ,p_init_msg_list => fnd_api.g_true
5483: ,p_commit => fnd_api.g_false
5484: ,p_validation_level => fnd_api.g_valid_level_full
5485: ,p_origin_txn_id => 1);
5486:
5487: IF l_return_status = fnd_api.g_ret_sts_error THEN
5488: RAISE fnd_api.g_exc_error;
5483: ,p_commit => fnd_api.g_false
5484: ,p_validation_level => fnd_api.g_valid_level_full
5485: ,p_origin_txn_id => 1);
5486:
5487: IF l_return_status = fnd_api.g_ret_sts_error THEN
5488: RAISE fnd_api.g_exc_error;
5489: END IF;
5490:
5491: l_mmli_tbl (i).lot_number := x_lot_rec.lot_number;
5484: ,p_validation_level => fnd_api.g_valid_level_full
5485: ,p_origin_txn_id => 1);
5486:
5487: IF l_return_status = fnd_api.g_ret_sts_error THEN
5488: RAISE fnd_api.g_exc_error;
5489: END IF;
5490:
5491: l_mmli_tbl (i).lot_number := x_lot_rec.lot_number;
5492: END IF; -- p_create_lot
5493: END LOOP;
5494: END IF; -- for lot_control
5495: END IF; -- for line_type
5496:
5497: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
5498: /* Bug 5554841 Migration will call this with existing header ID*/
5499: --gme_common_pvt.g_transaction_header_id := NULL;
5500: gme_transactions_pvt.create_material_txn
5501: (p_mmti_rec => l_mmti_rec
5501: (p_mmti_rec => l_mmti_rec
5502: ,p_mmli_tbl => l_mmli_tbl
5503: ,x_return_status => l_return_status);
5504:
5505: IF l_return_status = fnd_api.g_ret_sts_success THEN
5506: IF g_debug <= gme_debug.g_log_procedure THEN
5507: gme_debug.put_line ( 'before save batch'
5508: || gme_common_pvt.g_transaction_header_id);
5509: END IF;
5510:
5511: l_header_id := gme_common_pvt.g_transaction_header_id;
5512:
5513: -- Bug 14685438 - Conditionalize call to save_batch based on p_save_batch.
5514: IF (p_save_batch = fnd_api.g_true) THEN
5515: gme_api_pub.save_batch
5516: (p_header_id => gme_common_pvt.g_transaction_header_id
5517: ,p_table => 1
5518: ,p_commit => p_commit
5522: gme_debug.put_line ( 'return from save batch with'
5523: || x_return_status);
5524: END IF;
5525:
5526: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5527: RAISE fnd_api.g_exc_error;
5528: END IF;
5529: END IF;
5530: ELSE
5523: || x_return_status);
5524: END IF;
5525:
5526: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5527: RAISE fnd_api.g_exc_error;
5528: END IF;
5529: END IF;
5530: ELSE
5531: RAISE create_txn_fail;
5535: || l_header_id);
5536: END IF;
5537:
5538: -- Bug 14685438 - Conditionalize data fetch from mmt based on p_save_batch.
5539: IF (p_save_batch = fnd_api.g_true) THEN
5540: -- get all the transactions from the mmt
5541: OPEN cur_get_trans (l_header_id);
5542:
5543: FETCH cur_get_trans
5559: EXCEPTION
5560: WHEN create_txn_fail OR deviation_fail THEN
5561: ROLLBACK TO SAVEPOINT create_material_txn;
5562: gme_common_pvt.count_and_get (x_count => x_message_count
5563: ,p_encoded => fnd_api.g_false
5564: ,x_data => x_message_list);
5565: /* Bug 5554841 have to set x_return_status*/
5566: x_return_status := l_return_status;
5567: WHEN um_convert_error THEN
5567: WHEN um_convert_error THEN
5568: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
5569: FND_MESSAGE.SET_TOKEN('PGM_NAME',g_pkg_name||'.'||l_api_name);
5570: fnd_msg_pub.ADD;
5571: x_return_status := fnd_api.g_ret_sts_error;
5572: WHEN fnd_api.g_exc_error THEN
5573: ROLLBACK TO SAVEPOINT create_material_txn;
5574: x_return_status := fnd_api.g_ret_sts_error;
5575: gme_common_pvt.count_and_get (x_count => x_message_count
5568: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
5569: FND_MESSAGE.SET_TOKEN('PGM_NAME',g_pkg_name||'.'||l_api_name);
5570: fnd_msg_pub.ADD;
5571: x_return_status := fnd_api.g_ret_sts_error;
5572: WHEN fnd_api.g_exc_error THEN
5573: ROLLBACK TO SAVEPOINT create_material_txn;
5574: x_return_status := fnd_api.g_ret_sts_error;
5575: gme_common_pvt.count_and_get (x_count => x_message_count
5576: ,p_encoded => fnd_api.g_false
5570: fnd_msg_pub.ADD;
5571: x_return_status := fnd_api.g_ret_sts_error;
5572: WHEN fnd_api.g_exc_error THEN
5573: ROLLBACK TO SAVEPOINT create_material_txn;
5574: x_return_status := fnd_api.g_ret_sts_error;
5575: gme_common_pvt.count_and_get (x_count => x_message_count
5576: ,p_encoded => fnd_api.g_false
5577: ,x_data => x_message_list);
5578: WHEN OTHERS THEN
5572: WHEN fnd_api.g_exc_error THEN
5573: ROLLBACK TO SAVEPOINT create_material_txn;
5574: x_return_status := fnd_api.g_ret_sts_error;
5575: gme_common_pvt.count_and_get (x_count => x_message_count
5576: ,p_encoded => fnd_api.g_false
5577: ,x_data => x_message_list);
5578: WHEN OTHERS THEN
5579: ROLLBACK TO SAVEPOINT create_material_txn;
5580: gme_when_others ( p_api_name => l_api_name
5587: PROCEDURE update_material_txn (
5588: p_api_version IN NUMBER := 2.0
5589: ,p_validation_level IN NUMBER
5590: := gme_common_pvt.g_max_errors
5591: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5592: ,p_commit IN VARCHAR2 := fnd_api.g_false
5593: ,x_message_count OUT NOCOPY NUMBER
5594: ,x_message_list OUT NOCOPY VARCHAR2
5595: ,x_return_status OUT NOCOPY VARCHAR2
5588: p_api_version IN NUMBER := 2.0
5589: ,p_validation_level IN NUMBER
5590: := gme_common_pvt.g_max_errors
5591: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5592: ,p_commit IN VARCHAR2 := fnd_api.g_false
5593: ,x_message_count OUT NOCOPY NUMBER
5594: ,x_message_list OUT NOCOPY VARCHAR2
5595: ,x_return_status OUT NOCOPY VARCHAR2
5596: ,p_transaction_id IN NUMBER
5659:
5660: /* Set the savepoint */
5661: SAVEPOINT update_transaction;
5662: /* Set the return status to success initially */
5663: x_return_status := fnd_api.g_ret_sts_success;
5664:
5665: IF p_init_msg_list = fnd_api.g_true THEN
5666: fnd_msg_pub.initialize;
5667: END IF;
5661: SAVEPOINT update_transaction;
5662: /* Set the return status to success initially */
5663: x_return_status := fnd_api.g_ret_sts_success;
5664:
5665: IF p_init_msg_list = fnd_api.g_true THEN
5666: fnd_msg_pub.initialize;
5667: END IF;
5668:
5669: IF NOT fnd_api.compatible_api_call (2.0
5665: IF p_init_msg_list = fnd_api.g_true THEN
5666: fnd_msg_pub.initialize;
5667: END IF;
5668:
5669: IF NOT fnd_api.compatible_api_call (2.0
5670: ,p_api_version
5671: ,'update_material_txn'
5672: ,g_pkg_name) THEN
5673: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5670: ,p_api_version
5671: ,'update_material_txn'
5672: ,g_pkg_name) THEN
5673: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5674: RAISE fnd_api.g_exc_error;
5675: END IF;
5676:
5677: IF (p_transaction_id IS NULL) THEN
5678: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
5677: IF (p_transaction_id IS NULL) THEN
5678: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
5679: ,'FIELD_NAME'
5680: ,'p_transaction_id');
5681: RAISE fnd_api.g_exc_error;
5682: END IF;
5683:
5684: OPEN cur_trans_org (p_transaction_id);
5685: FETCH cur_trans_org INTO l_orgn_id, l_batch_id, l_material_detail_id, l_txn_type_id;
5690: gme_common_pvt.g_error_count := 0;
5691: gme_common_pvt.g_setup_done := gme_common_pvt.setup(p_org_id => l_orgn_id);
5692:
5693: IF NOT gme_common_pvt.g_setup_done THEN
5694: RAISE fnd_api.g_exc_error;
5695: ELSE
5696: l_orgn_id := gme_common_pvt.g_organization_id;
5697: END IF;
5698:
5701:
5702: IF NOT gme_material_details_dbl.fetch_row
5703: (p_material_detail => l_mat_dtl_rec
5704: ,x_material_detail => l_mat_dtl_rec) THEN
5705: RAISE fnd_api.g_exc_error;
5706: END IF;
5707: /* Added for bug 5597385 */
5708: IF (l_mat_dtl_rec.organization_id <> l_orgn_id
5709: OR l_mat_dtl_rec.batch_id <> l_batch_id
5728: || TO_CHAR (l_mmti_rec.inventory_item_id) );
5729: gme_debug.put_line ( 'organization_id = '
5730: || TO_CHAR (l_mmti_rec.organization_id) );
5731: END IF;
5732: RAISE fnd_api.g_exc_error;
5733: END IF;
5734: CLOSE cur_get_item_rec;
5735:
5736: -- code for lot creation
5734: CLOSE cur_get_item_rec;
5735:
5736: -- code for lot creation
5737: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5738: IF p_generate_lot = fnd_api.g_true
5739: AND p_create_lot = fnd_api.g_false THEN
5740: RAISE fnd_api.g_exc_error;
5741: END IF;
5742:
5735:
5736: -- code for lot creation
5737: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5738: IF p_generate_lot = fnd_api.g_true
5739: AND p_create_lot = fnd_api.g_false THEN
5740: RAISE fnd_api.g_exc_error;
5741: END IF;
5742:
5743: IF p_generate_parent_lot = fnd_api.g_true THEN
5736: -- code for lot creation
5737: IF l_item_rec.lot_control_code = 2 THEN -- lot control
5738: IF p_generate_lot = fnd_api.g_true
5739: AND p_create_lot = fnd_api.g_false THEN
5740: RAISE fnd_api.g_exc_error;
5741: END IF;
5742:
5743: IF p_generate_parent_lot = fnd_api.g_true THEN
5744: l_parent_gen_lot :=
5739: AND p_create_lot = fnd_api.g_false THEN
5740: RAISE fnd_api.g_exc_error;
5741: END IF;
5742:
5743: IF p_generate_parent_lot = fnd_api.g_true THEN
5744: l_parent_gen_lot :=
5745: inv_lot_api_pub.auto_gen_lot
5746: (p_org_id => l_mmti_rec.organization_id
5747: ,p_inventory_item_id => l_mmti_rec.inventory_item_id
5758: ,p_transaction_action_id => NULL
5759: ,p_transaction_source_type_id => NULL
5760: ,p_lot_number => NULL
5761: ,p_api_version => 1.0
5762: ,p_init_msg_list => fnd_api.g_false
5763: ,p_commit => fnd_api.g_false
5764: ,p_validation_level => NULL
5765: ,p_parent_lot_number => NULL
5766: ,x_return_status => l_return_status
5759: ,p_transaction_source_type_id => NULL
5760: ,p_lot_number => NULL
5761: ,p_api_version => 1.0
5762: ,p_init_msg_list => fnd_api.g_false
5763: ,p_commit => fnd_api.g_false
5764: ,p_validation_level => NULL
5765: ,p_parent_lot_number => NULL
5766: ,x_return_status => l_return_status
5767: ,x_msg_count => l_msg_count
5766: ,x_return_status => l_return_status
5767: ,x_msg_count => l_msg_count
5768: ,x_msg_data => l_msg_data);
5769:
5770: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5771: RAISE fnd_api.g_exc_error;
5772: END IF;
5773:
5774: IF (g_debug = gme_debug.g_log_statement) THEN
5767: ,x_msg_count => l_msg_count
5768: ,x_msg_data => l_msg_data);
5769:
5770: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5771: RAISE fnd_api.g_exc_error;
5772: END IF;
5773:
5774: IF (g_debug = gme_debug.g_log_statement) THEN
5775: gme_debug.put_line ( 'lot_gen'
5779: END IF;
5780: END IF; -- p_generate_parent_lot
5781:
5782: FOR i IN 1 .. l_mmli_tbl.COUNT LOOP
5783: IF p_create_lot = fnd_api.g_true
5784: AND l_mmli_tbl (i).lot_number IS NULL THEN
5785: IF p_generate_lot = fnd_api.g_true THEN
5786: l_gen_lot :=
5787: inv_lot_api_pub.auto_gen_lot
5781:
5782: FOR i IN 1 .. l_mmli_tbl.COUNT LOOP
5783: IF p_create_lot = fnd_api.g_true
5784: AND l_mmli_tbl (i).lot_number IS NULL THEN
5785: IF p_generate_lot = fnd_api.g_true THEN
5786: l_gen_lot :=
5787: inv_lot_api_pub.auto_gen_lot
5788: (p_org_id => l_mmti_rec.organization_id
5789: ,p_inventory_item_id => l_mmti_rec.inventory_item_id
5800: ,p_transaction_action_id => NULL
5801: ,p_transaction_source_type_id => NULL
5802: ,p_lot_number => NULL
5803: ,p_api_version => 1.0
5804: ,p_init_msg_list => fnd_api.g_false
5805: ,p_commit => fnd_api.g_false
5806: ,p_validation_level => NULL
5807: ,p_parent_lot_number => l_parent_gen_lot
5808: ,x_return_status => l_return_status
5801: ,p_transaction_source_type_id => NULL
5802: ,p_lot_number => NULL
5803: ,p_api_version => 1.0
5804: ,p_init_msg_list => fnd_api.g_false
5805: ,p_commit => fnd_api.g_false
5806: ,p_validation_level => NULL
5807: ,p_parent_lot_number => l_parent_gen_lot
5808: ,x_return_status => l_return_status
5809: ,x_msg_count => l_msg_count
5808: ,x_return_status => l_return_status
5809: ,x_msg_count => l_msg_count
5810: ,x_msg_data => l_msg_data);
5811:
5812: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5813: RAISE fnd_api.g_exc_error;
5814: END IF;
5815:
5816: IF (g_debug = gme_debug.g_log_statement) THEN
5809: ,x_msg_count => l_msg_count
5810: ,x_msg_data => l_msg_data);
5811:
5812: IF l_return_status <> fnd_api.g_ret_sts_success THEN
5813: RAISE fnd_api.g_exc_error;
5814: END IF;
5815:
5816: IF (g_debug = gme_debug.g_log_statement) THEN
5817: gme_debug.put_line ( 'lot_gen'
5836: ,x_lot_rec => x_lot_rec
5837: ,p_lot_rec => l_lot_rec
5838: ,p_source => l_source
5839: ,p_api_version => l_api_version
5840: ,p_init_msg_list => fnd_api.g_true
5841: ,p_commit => fnd_api.g_false
5842: ,p_validation_level => fnd_api.g_valid_level_full
5843: ,p_origin_txn_id => 1);
5844:
5837: ,p_lot_rec => l_lot_rec
5838: ,p_source => l_source
5839: ,p_api_version => l_api_version
5840: ,p_init_msg_list => fnd_api.g_true
5841: ,p_commit => fnd_api.g_false
5842: ,p_validation_level => fnd_api.g_valid_level_full
5843: ,p_origin_txn_id => 1);
5844:
5845: IF l_return_status = fnd_api.g_ret_sts_error THEN
5838: ,p_source => l_source
5839: ,p_api_version => l_api_version
5840: ,p_init_msg_list => fnd_api.g_true
5841: ,p_commit => fnd_api.g_false
5842: ,p_validation_level => fnd_api.g_valid_level_full
5843: ,p_origin_txn_id => 1);
5844:
5845: IF l_return_status = fnd_api.g_ret_sts_error THEN
5846: RAISE fnd_api.g_exc_error;
5841: ,p_commit => fnd_api.g_false
5842: ,p_validation_level => fnd_api.g_valid_level_full
5843: ,p_origin_txn_id => 1);
5844:
5845: IF l_return_status = fnd_api.g_ret_sts_error THEN
5846: RAISE fnd_api.g_exc_error;
5847: END IF;
5848:
5849: l_mmli_tbl (i).lot_number := x_lot_rec.lot_number;
5842: ,p_validation_level => fnd_api.g_valid_level_full
5843: ,p_origin_txn_id => 1);
5844:
5845: IF l_return_status = fnd_api.g_ret_sts_error THEN
5846: RAISE fnd_api.g_exc_error;
5847: END IF;
5848:
5849: l_mmli_tbl (i).lot_number := x_lot_rec.lot_number;
5850: END IF; -- p_create_lot
5851: END LOOP;
5852: END IF; -- for lot_control
5853: END IF; -- for line_type
5854:
5855: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
5856: gme_common_pvt.g_transaction_header_id := NULL;
5857: gme_transactions_pvt.update_material_txn
5858: (p_transaction_id => p_transaction_id
5859: ,p_mmti_rec => l_mmti_rec
5859: ,p_mmti_rec => l_mmti_rec
5860: ,p_mmli_tbl => l_mmli_tbl
5861: ,x_return_status => l_return_status);
5862:
5863: IF l_return_status = fnd_api.g_ret_sts_success THEN
5864: IF g_debug <= gme_debug.g_log_procedure THEN
5865: gme_debug.put_line ( 'before save batch'
5866: || gme_common_pvt.g_transaction_header_id);
5867: END IF;
5876: gme_debug.put_line ( 'return from save batch with'
5877: || x_return_status);
5878: END IF;
5879:
5880: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5881: RAISE fnd_api.g_exc_error;
5882: END IF;
5883: ELSE
5884: RAISE update_txn_fail;
5877: || x_return_status);
5878: END IF;
5879:
5880: IF x_return_status <> fnd_api.g_ret_sts_success THEN
5881: RAISE fnd_api.g_exc_error;
5882: END IF;
5883: ELSE
5884: RAISE update_txn_fail;
5885: END IF;
5909: EXCEPTION
5910: WHEN update_txn_mismatch THEN
5911: ROLLBACK TO SAVEPOINT update_transaction;
5912: gme_common_pvt.log_message('GME_TXN_UPDATE_MISMATCH');
5913: x_return_status := fnd_api.g_ret_sts_error;
5914: gme_common_pvt.count_and_get (x_count => x_message_count
5915: ,p_encoded => fnd_api.g_false
5916: ,x_data => x_message_list);
5917: WHEN update_txn_fail THEN
5911: ROLLBACK TO SAVEPOINT update_transaction;
5912: gme_common_pvt.log_message('GME_TXN_UPDATE_MISMATCH');
5913: x_return_status := fnd_api.g_ret_sts_error;
5914: gme_common_pvt.count_and_get (x_count => x_message_count
5915: ,p_encoded => fnd_api.g_false
5916: ,x_data => x_message_list);
5917: WHEN update_txn_fail THEN
5918: ROLLBACK TO SAVEPOINT update_transaction;
5919: gme_common_pvt.count_and_get (x_count => x_message_count
5916: ,x_data => x_message_list);
5917: WHEN update_txn_fail THEN
5918: ROLLBACK TO SAVEPOINT update_transaction;
5919: gme_common_pvt.count_and_get (x_count => x_message_count
5920: ,p_encoded => fnd_api.g_false
5921: ,x_data => x_message_list);
5922: WHEN fnd_api.g_exc_error THEN
5923: ROLLBACK TO SAVEPOINT update_transaction;
5924: x_return_status := fnd_api.g_ret_sts_error;
5918: ROLLBACK TO SAVEPOINT update_transaction;
5919: gme_common_pvt.count_and_get (x_count => x_message_count
5920: ,p_encoded => fnd_api.g_false
5921: ,x_data => x_message_list);
5922: WHEN fnd_api.g_exc_error THEN
5923: ROLLBACK TO SAVEPOINT update_transaction;
5924: x_return_status := fnd_api.g_ret_sts_error;
5925: gme_common_pvt.count_and_get (x_count => x_message_count
5926: ,p_encoded => fnd_api.g_false
5920: ,p_encoded => fnd_api.g_false
5921: ,x_data => x_message_list);
5922: WHEN fnd_api.g_exc_error THEN
5923: ROLLBACK TO SAVEPOINT update_transaction;
5924: x_return_status := fnd_api.g_ret_sts_error;
5925: gme_common_pvt.count_and_get (x_count => x_message_count
5926: ,p_encoded => fnd_api.g_false
5927: ,x_data => x_message_list);
5928: WHEN OTHERS THEN
5922: WHEN fnd_api.g_exc_error THEN
5923: ROLLBACK TO SAVEPOINT update_transaction;
5924: x_return_status := fnd_api.g_ret_sts_error;
5925: gme_common_pvt.count_and_get (x_count => x_message_count
5926: ,p_encoded => fnd_api.g_false
5927: ,x_data => x_message_list);
5928: WHEN OTHERS THEN
5929: gme_when_others ( p_api_name => l_api_name
5930: ,x_message_count => x_message_count
5936: PROCEDURE delete_material_txn (
5937: p_api_version IN NUMBER := 2.0
5938: ,p_validation_level IN NUMBER
5939: := gme_common_pvt.g_max_errors
5940: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5941: ,p_commit IN VARCHAR2 := fnd_api.g_false
5942: ,x_message_count OUT NOCOPY NUMBER
5943: ,x_message_list OUT NOCOPY VARCHAR2
5944: ,x_return_status OUT NOCOPY VARCHAR2
5937: p_api_version IN NUMBER := 2.0
5938: ,p_validation_level IN NUMBER
5939: := gme_common_pvt.g_max_errors
5940: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
5941: ,p_commit IN VARCHAR2 := fnd_api.g_false
5942: ,x_message_count OUT NOCOPY NUMBER
5943: ,x_message_list OUT NOCOPY VARCHAR2
5944: ,x_return_status OUT NOCOPY VARCHAR2
5945: ,p_transaction_id IN NUMBER)
5949: l_msg_count NUMBER;
5950: l_msg_data VARCHAR2 (2000);
5951: l_msg_index NUMBER (5);
5952: l_txn_count NUMBER;
5953: l_return_status VARCHAR2 (1) := fnd_api.g_ret_sts_success;
5954: l_orgn_id NUMBER;
5955:
5956: setup_failure EXCEPTION;
5957: error_condition EXCEPTION;
5978: /* Set the savepoint */
5979: SAVEPOINT delete_transaction;
5980:
5981: /* Set the return status to success initially */
5982: x_return_status := fnd_api.g_ret_sts_success;
5983:
5984: IF p_init_msg_list = fnd_api.g_true THEN
5985: fnd_msg_pub.initialize;
5986: END IF;
5980:
5981: /* Set the return status to success initially */
5982: x_return_status := fnd_api.g_ret_sts_success;
5983:
5984: IF p_init_msg_list = fnd_api.g_true THEN
5985: fnd_msg_pub.initialize;
5986: END IF;
5987:
5988: IF NOT fnd_api.compatible_api_call (2.0
5984: IF p_init_msg_list = fnd_api.g_true THEN
5985: fnd_msg_pub.initialize;
5986: END IF;
5987:
5988: IF NOT fnd_api.compatible_api_call (2.0
5989: ,p_api_version
5990: ,'delete_material_txn'
5991: ,g_pkg_name) THEN
5992: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5989: ,p_api_version
5990: ,'delete_material_txn'
5991: ,g_pkg_name) THEN
5992: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
5993: RAISE fnd_api.g_exc_error;
5994: END IF;
5995:
5996: IF (p_transaction_id IS NULL) THEN
5997: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
5996: IF (p_transaction_id IS NULL) THEN
5997: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
5998: ,'FIELD_NAME'
5999: ,'p_transaction_id');
6000: RAISE fnd_api.g_exc_error;
6001: END IF;
6002:
6003: OPEN cur_trans_org (p_transaction_id);
6004: FETCH cur_trans_org INTO l_orgn_id;
6009: gme_common_pvt.g_setup_done :=
6010: gme_common_pvt.setup (p_org_id => l_orgn_id);
6011:
6012: IF NOT gme_common_pvt.g_setup_done THEN
6013: RAISE fnd_api.g_exc_error;
6014: ELSE
6015: l_orgn_id := gme_common_pvt.g_organization_id;
6016: END IF;
6017:
6015: l_orgn_id := gme_common_pvt.g_organization_id;
6016: END IF;
6017:
6018: gme_common_pvt.set_timestamp;
6019: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
6020: gme_common_pvt.g_transaction_header_id := NULL;
6021: l_transaction_id := p_transaction_id;
6022: gme_transactions_pvt.delete_material_txn
6023: (p_transaction_id => l_transaction_id
6022: gme_transactions_pvt.delete_material_txn
6023: (p_transaction_id => l_transaction_id
6024: ,x_return_status => x_return_status);
6025:
6026: IF x_return_status = fnd_api.g_ret_sts_success THEN
6027: IF (p_commit = fnd_api.g_true) THEN
6028: gme_api_pub.save_batch
6029: (p_header_id => gme_common_pvt.get_txn_header_id
6030: ,p_table => 1
6023: (p_transaction_id => l_transaction_id
6024: ,x_return_status => x_return_status);
6025:
6026: IF x_return_status = fnd_api.g_ret_sts_success THEN
6027: IF (p_commit = fnd_api.g_true) THEN
6028: gme_api_pub.save_batch
6029: (p_header_id => gme_common_pvt.get_txn_header_id
6030: ,p_table => 1
6031: ,p_commit => p_commit
6030: ,p_table => 1
6031: ,p_commit => p_commit
6032: ,x_return_status => x_return_status);
6033:
6034: IF x_return_status = fnd_api.g_ret_sts_success THEN
6035: COMMIT;
6036: ELSE
6037: RAISE fnd_api.g_exc_error;
6038: END IF;
6033:
6034: IF x_return_status = fnd_api.g_ret_sts_success THEN
6035: COMMIT;
6036: ELSE
6037: RAISE fnd_api.g_exc_error;
6038: END IF;
6039: END IF;
6040: ELSE
6041: RAISE delete_txn_fail;
6048: EXCEPTION
6049: WHEN delete_txn_fail THEN
6050: ROLLBACK TO SAVEPOINT delete_transaction;
6051: gme_common_pvt.count_and_get (x_count => x_message_count
6052: ,p_encoded => fnd_api.g_false
6053: ,x_data => x_message_list);
6054: WHEN fnd_api.g_exc_error THEN
6055: ROLLBACK TO SAVEPOINT delete_transaction;
6056: x_return_status := fnd_api.g_ret_sts_error;
6050: ROLLBACK TO SAVEPOINT delete_transaction;
6051: gme_common_pvt.count_and_get (x_count => x_message_count
6052: ,p_encoded => fnd_api.g_false
6053: ,x_data => x_message_list);
6054: WHEN fnd_api.g_exc_error THEN
6055: ROLLBACK TO SAVEPOINT delete_transaction;
6056: x_return_status := fnd_api.g_ret_sts_error;
6057: gme_common_pvt.count_and_get (x_count => x_message_count
6058: ,p_encoded => fnd_api.g_false
6052: ,p_encoded => fnd_api.g_false
6053: ,x_data => x_message_list);
6054: WHEN fnd_api.g_exc_error THEN
6055: ROLLBACK TO SAVEPOINT delete_transaction;
6056: x_return_status := fnd_api.g_ret_sts_error;
6057: gme_common_pvt.count_and_get (x_count => x_message_count
6058: ,p_encoded => fnd_api.g_false
6059: ,x_data => x_message_list);
6060: WHEN OTHERS THEN
6054: WHEN fnd_api.g_exc_error THEN
6055: ROLLBACK TO SAVEPOINT delete_transaction;
6056: x_return_status := fnd_api.g_ret_sts_error;
6057: gme_common_pvt.count_and_get (x_count => x_message_count
6058: ,p_encoded => fnd_api.g_false
6059: ,x_data => x_message_list);
6060: WHEN OTHERS THEN
6061: gme_when_others ( p_api_name => l_api_name
6062: ,x_message_count => x_message_count
6085: PROCEDURE reroute_batch (
6086: p_api_version IN NUMBER := 2.0
6087: ,p_validation_level IN NUMBER
6088: := gme_common_pvt.g_max_errors
6089: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
6090: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
6091: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
6092: ,p_validity_rule_id IN NUMBER
6093: ,p_org_code IN VARCHAR2
6086: p_api_version IN NUMBER := 2.0
6087: ,p_validation_level IN NUMBER
6088: := gme_common_pvt.g_max_errors
6089: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
6090: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
6091: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
6092: ,p_validity_rule_id IN NUMBER
6093: ,p_org_code IN VARCHAR2
6094: ,p_use_workday_cal IN VARCHAR2 DEFAULT fnd_api.g_false
6090: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
6091: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
6092: ,p_validity_rule_id IN NUMBER
6093: ,p_org_code IN VARCHAR2
6094: ,p_use_workday_cal IN VARCHAR2 DEFAULT fnd_api.g_false
6095: ,p_contiguity_override IN VARCHAR2 DEFAULT fnd_api.g_false
6096: ,x_message_count OUT NOCOPY NUMBER
6097: ,x_message_list OUT NOCOPY VARCHAR2
6098: ,x_return_status OUT NOCOPY VARCHAR2
6091: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
6092: ,p_validity_rule_id IN NUMBER
6093: ,p_org_code IN VARCHAR2
6094: ,p_use_workday_cal IN VARCHAR2 DEFAULT fnd_api.g_false
6095: ,p_contiguity_override IN VARCHAR2 DEFAULT fnd_api.g_false
6096: ,x_message_count OUT NOCOPY NUMBER
6097: ,x_message_list OUT NOCOPY VARCHAR2
6098: ,x_return_status OUT NOCOPY VARCHAR2
6099: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE)
6111: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
6112: || l_api_name);
6113: END IF;
6114: /* Set the return status to success initially */
6115: x_return_status := fnd_api.g_ret_sts_success;
6116:
6117: /* Set savepoint here */
6118: SAVEPOINT reroute_batch_pub;
6119:
6116:
6117: /* Set savepoint here */
6118: SAVEPOINT reroute_batch_pub;
6119:
6120: IF (fnd_api.to_boolean (p_init_msg_list) ) THEN
6121: fnd_msg_pub.initialize;
6122: gme_common_pvt.g_error_count := 0;
6123: END IF;
6124:
6122: gme_common_pvt.g_error_count := 0;
6123: END IF;
6124:
6125: -- Standard call to check for call compatibility.
6126: IF NOT fnd_api.compatible_api_call (2.0
6127: ,p_api_version
6128: ,l_api_name
6129: ,g_pkg_name) THEN
6130: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6127: ,p_api_version
6128: ,l_api_name
6129: ,g_pkg_name) THEN
6130: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6131: RAISE fnd_api.g_exc_error;
6132: END IF;
6133:
6134: --FPBug#4585491 Begin
6135: /* Check for p_use_workday_cal */
6132: END IF;
6133:
6134: --FPBug#4585491 Begin
6135: /* Check for p_use_workday_cal */
6136: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
6137: gme_common_pvt.log_message ('GME_INVALID_FIELD'
6138: ,'FIELD'
6139: ,'p_use_workday_cal');
6140: RAISE fnd_api.g_exc_error;
6136: IF (p_use_workday_cal NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
6137: gme_common_pvt.log_message ('GME_INVALID_FIELD'
6138: ,'FIELD'
6139: ,'p_use_workday_cal');
6140: RAISE fnd_api.g_exc_error;
6141: END IF;
6142:
6143: /* Check for p_contiguity_override */
6144: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
6140: RAISE fnd_api.g_exc_error;
6141: END IF;
6142:
6143: /* Check for p_contiguity_override */
6144: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
6145: gme_common_pvt.log_message ('GME_INVALID_FIELD'
6146: ,'FIELD'
6147: ,'p_contiguity_override');
6148: RAISE fnd_api.g_exc_error;
6144: IF (p_contiguity_override NOT IN (fnd_api.g_true, fnd_api.g_false) ) THEN
6145: gme_common_pvt.log_message ('GME_INVALID_FIELD'
6146: ,'FIELD'
6147: ,'p_contiguity_override');
6148: RAISE fnd_api.g_exc_error;
6149: END IF;
6150: --FPBug#4585491 End
6151:
6152: /* Set the return status to success initially */
6149: END IF;
6150: --FPBug#4585491 End
6151:
6152: /* Set the return status to success initially */
6153: x_return_status := fnd_api.g_ret_sts_success;
6154:
6155: /* Get the Batch header */
6156: gme_common_pvt.validate_batch
6157: (p_batch_header_rec => p_batch_header_rec
6161: ,x_message_count => x_message_count
6162: ,x_message_list => x_message_list
6163: ,x_return_status => x_return_status );
6164:
6165: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6166: IF (g_debug = gme_debug.g_log_statement) THEN
6167: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6168: || ': batch validate error ');
6169: END IF;
6166: IF (g_debug = gme_debug.g_log_statement) THEN
6167: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6168: || ': batch validate error ');
6169: END IF;
6170: RAISE fnd_api.g_exc_error;
6171: END IF;
6172:
6173: gme_reroute_batch_pvt.validate_validity_id_from_pub
6174: (p_batch_header_rec => l_batch_header_rec
6174: (p_batch_header_rec => l_batch_header_rec
6175: ,p_validity_rule_id => p_validity_rule_id
6176: ,x_return_status => x_return_status);
6177:
6178: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6179: RAISE fnd_api.g_exc_error;
6180: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6181: RAISE fnd_api.g_exc_unexpected_error;
6182: END IF;
6175: ,p_validity_rule_id => p_validity_rule_id
6176: ,x_return_status => x_return_status);
6177:
6178: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6179: RAISE fnd_api.g_exc_error;
6180: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6181: RAISE fnd_api.g_exc_unexpected_error;
6182: END IF;
6183:
6176: ,x_return_status => x_return_status);
6177:
6178: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6179: RAISE fnd_api.g_exc_error;
6180: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6181: RAISE fnd_api.g_exc_unexpected_error;
6182: END IF;
6183:
6184: gme_api_main.reroute_batch
6177:
6178: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6179: RAISE fnd_api.g_exc_error;
6180: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6181: RAISE fnd_api.g_exc_unexpected_error;
6182: END IF;
6183:
6184: gme_api_main.reroute_batch
6185: (p_validation_level => p_validation_level
6182: END IF;
6183:
6184: gme_api_main.reroute_batch
6185: (p_validation_level => p_validation_level
6186: ,p_init_msg_list => fnd_api.g_false
6187: ,p_batch_header_rec => l_batch_header_rec
6188: ,p_validity_rule_id => p_validity_rule_id
6189: ,p_use_workday_cal => p_use_workday_cal
6190: ,p_contiguity_override => p_contiguity_override
6193: ,x_return_status => x_return_status
6194: ,x_batch_header_rec => x_batch_header_rec);
6195:
6196: IF (x_return_status = 'C') THEN
6197: RAISE fnd_api.g_exc_error; --message will be set on stack in pvt layer itself
6198: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
6199: RAISE reroute_batch_failed;
6200: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6201: RAISE fnd_api.g_exc_unexpected_error;
6194: ,x_batch_header_rec => x_batch_header_rec);
6195:
6196: IF (x_return_status = 'C') THEN
6197: RAISE fnd_api.g_exc_error; --message will be set on stack in pvt layer itself
6198: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
6199: RAISE reroute_batch_failed;
6200: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6201: RAISE fnd_api.g_exc_unexpected_error;
6202: END IF;
6196: IF (x_return_status = 'C') THEN
6197: RAISE fnd_api.g_exc_error; --message will be set on stack in pvt layer itself
6198: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
6199: RAISE reroute_batch_failed;
6200: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6201: RAISE fnd_api.g_exc_unexpected_error;
6202: END IF;
6203: gme_api_pub.save_batch
6204: (p_header_id => NULL
6197: RAISE fnd_api.g_exc_error; --message will be set on stack in pvt layer itself
6198: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
6199: RAISE reroute_batch_failed;
6200: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6201: RAISE fnd_api.g_exc_unexpected_error;
6202: END IF;
6203: gme_api_pub.save_batch
6204: (p_header_id => NULL
6205: ,p_table => gme_common_pvt.g_interface_table
6205: ,p_table => gme_common_pvt.g_interface_table
6206: ,p_commit => p_commit
6207: ,x_return_status => x_return_status);
6208:
6209: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6210: RAISE fnd_api.g_exc_error;
6211: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6212: RAISE fnd_api.g_exc_unexpected_error;
6213: END IF;
6206: ,p_commit => p_commit
6207: ,x_return_status => x_return_status);
6208:
6209: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6210: RAISE fnd_api.g_exc_error;
6211: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6212: RAISE fnd_api.g_exc_unexpected_error;
6213: END IF;
6214:
6207: ,x_return_status => x_return_status);
6208:
6209: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6210: RAISE fnd_api.g_exc_error;
6211: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6212: RAISE fnd_api.g_exc_unexpected_error;
6213: END IF;
6214:
6215: IF (fnd_api.to_boolean (p_commit) ) THEN
6208:
6209: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
6210: RAISE fnd_api.g_exc_error;
6211: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6212: RAISE fnd_api.g_exc_unexpected_error;
6213: END IF;
6214:
6215: IF (fnd_api.to_boolean (p_commit) ) THEN
6216: COMMIT WORK;
6211: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6212: RAISE fnd_api.g_exc_unexpected_error;
6213: END IF;
6214:
6215: IF (fnd_api.to_boolean (p_commit) ) THEN
6216: COMMIT WORK;
6217: END IF;
6218:
6219: gme_common_pvt.count_and_get (x_count => x_message_count
6216: COMMIT WORK;
6217: END IF;
6218:
6219: gme_common_pvt.count_and_get (x_count => x_message_count
6220: ,p_encoded => fnd_api.g_false
6221: ,x_data => x_message_list);
6222:
6223: IF g_debug <= gme_debug.g_log_procedure THEN
6224: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
6228: WHEN reroute_batch_failed THEN
6229: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6230: x_batch_header_rec := NULL;
6231: gme_common_pvt.count_and_get (x_count => x_message_count
6232: ,p_encoded => fnd_api.g_false
6233: ,x_data => x_message_list);
6234: WHEN fnd_api.g_exc_error THEN
6235: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6236: x_batch_header_rec := NULL;
6230: x_batch_header_rec := NULL;
6231: gme_common_pvt.count_and_get (x_count => x_message_count
6232: ,p_encoded => fnd_api.g_false
6233: ,x_data => x_message_list);
6234: WHEN fnd_api.g_exc_error THEN
6235: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6236: x_batch_header_rec := NULL;
6237: x_return_status := fnd_api.g_ret_sts_error;
6238: gme_common_pvt.count_and_get (x_count => x_message_count
6233: ,x_data => x_message_list);
6234: WHEN fnd_api.g_exc_error THEN
6235: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6236: x_batch_header_rec := NULL;
6237: x_return_status := fnd_api.g_ret_sts_error;
6238: gme_common_pvt.count_and_get (x_count => x_message_count
6239: ,p_encoded => fnd_api.g_false
6240: ,x_data => x_message_list);
6241: WHEN fnd_api.g_exc_unexpected_error THEN
6235: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6236: x_batch_header_rec := NULL;
6237: x_return_status := fnd_api.g_ret_sts_error;
6238: gme_common_pvt.count_and_get (x_count => x_message_count
6239: ,p_encoded => fnd_api.g_false
6240: ,x_data => x_message_list);
6241: WHEN fnd_api.g_exc_unexpected_error THEN
6242: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6243: x_batch_header_rec := NULL;
6237: x_return_status := fnd_api.g_ret_sts_error;
6238: gme_common_pvt.count_and_get (x_count => x_message_count
6239: ,p_encoded => fnd_api.g_false
6240: ,x_data => x_message_list);
6241: WHEN fnd_api.g_exc_unexpected_error THEN
6242: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6243: x_batch_header_rec := NULL;
6244: x_return_status := fnd_api.g_ret_sts_unexp_error;
6245:
6240: ,x_data => x_message_list);
6241: WHEN fnd_api.g_exc_unexpected_error THEN
6242: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6243: x_batch_header_rec := NULL;
6244: x_return_status := fnd_api.g_ret_sts_unexp_error;
6245:
6246: IF (g_debug > 0) THEN gme_debug.put_line ( g_pkg_name || '.' ||
6247: l_api_name || ':' || 'UNEXPECTED:' || SQLERRM);
6248: END IF;
6246: IF (g_debug > 0) THEN gme_debug.put_line ( g_pkg_name || '.' ||
6247: l_api_name || ':' || 'UNEXPECTED:' || SQLERRM);
6248: END IF;
6249: gme_common_pvt.count_and_get (x_count => x_message_count
6250: ,p_encoded => fnd_api.g_false
6251: ,x_data => x_message_list);
6252: WHEN OTHERS THEN
6253: ROLLBACK TO SAVEPOINT reroute_batch_pub;
6254: x_batch_header_rec := NULL;
6277: U - Unexpected Error
6278: History
6279: G. Muratore 17-MAY-2011 Bug 12418545
6280: Introduced new p_bypass_gmf_check parameter. User must explicitly
6281: pass in fnd_api.g_false if they want the GMF check to stop processing
6282: in the event of a problem.
6283:
6284: G. Muratore 24-AUG-2011 Bug 11846735
6285: Load resource transactions so that they get processed properly during cancel.
6294: PROCEDURE cancel_batch (
6295: p_api_version IN NUMBER := 2.0
6296: ,p_validation_level IN NUMBER
6297: := gme_common_pvt.g_max_errors
6298: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6299: ,p_commit IN VARCHAR2 := fnd_api.g_false
6300: ,x_message_count OUT NOCOPY NUMBER
6301: ,x_message_list OUT NOCOPY VARCHAR2
6302: ,x_return_status OUT NOCOPY VARCHAR2
6295: p_api_version IN NUMBER := 2.0
6296: ,p_validation_level IN NUMBER
6297: := gme_common_pvt.g_max_errors
6298: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6299: ,p_commit IN VARCHAR2 := fnd_api.g_false
6300: ,x_message_count OUT NOCOPY NUMBER
6301: ,x_message_list OUT NOCOPY VARCHAR2
6302: ,x_return_status OUT NOCOPY VARCHAR2
6303: ,p_org_code IN VARCHAR2
6323: || 'Entering');
6324: END IF;
6325:
6326: /* Set the return status to success initially */
6327: x_return_status := fnd_api.g_ret_sts_success;
6328:
6329: /* Set savepoint here */
6330: SAVEPOINT cancel_batch_pub;
6331:
6328:
6329: /* Set savepoint here */
6330: SAVEPOINT cancel_batch_pub;
6331:
6332: IF p_init_msg_list = fnd_api.g_true THEN
6333: fnd_msg_pub.initialize;
6334: END IF;
6335:
6336: IF NOT fnd_api.compatible_api_call (2.0
6332: IF p_init_msg_list = fnd_api.g_true THEN
6333: fnd_msg_pub.initialize;
6334: END IF;
6335:
6336: IF NOT fnd_api.compatible_api_call (2.0
6337: ,p_api_version
6338: ,'cancel_batch'
6339: ,g_pkg_name) THEN
6340: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6337: ,p_api_version
6338: ,'cancel_batch'
6339: ,g_pkg_name) THEN
6340: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6341: RAISE fnd_api.g_exc_error;
6342: END IF;
6343:
6344: --fetch the batch
6345: gme_common_pvt.validate_batch
6350: ,x_message_count => x_message_count
6351: ,x_message_list => x_message_list
6352: ,x_return_status => x_return_status );
6353:
6354: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6355: IF (g_debug = gme_debug.g_log_statement) THEN
6356: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6357: || ': batch validate error ');
6358: END IF;
6355: IF (g_debug = gme_debug.g_log_statement) THEN
6356: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6357: || ': batch validate error ');
6358: END IF;
6359: RAISE fnd_api.g_exc_error;
6360: END IF;
6361:
6362: --
6363: -- bug 13457726
6364: -- Allowing the cancellation of FPO as well
6365: --
6366: IF (l_batch_header_rec.batch_type NOT IN (gme_common_pvt.g_doc_type_batch, gme_common_pvt.g_doc_type_fpo)) THEN
6367: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
6368: RAISE fnd_api.g_exc_error;
6369: END IF;
6370:
6371: gme_common_pvt.g_error_count := 0;
6372:
6372:
6373: /* Check for batch status */
6374: IF l_batch_header_rec.batch_status <> gme_common_pvt.g_batch_pending THEN
6375: gme_common_pvt.log_message ('GME_API_INVALID_BATCH_CANCEL');
6376: RAISE fnd_api.g_exc_error;
6377: END IF;
6378:
6379: -- Bug 12967042 Commented code below.
6380:
6396: IF l_gmf_prof_val <> 0 THEN
6397: IF NOT GMF_BATCH_VALIDATIONS.check_cancel_batch(l_batch_header_rec.batch_id) THEN
6398: IF l_gmf_prof_val = 2 THEN
6399: gme_common_pvt.log_message ('GME_GMF_WIP_ACCT_ISSUE');
6400: RAISE fnd_api.g_exc_error;
6401: END IF;
6402:
6403: -- Notify GMF that user has chosed to bypass validation and proceed with cancel batch.
6404: GMF_LAYERS.log_message (
6424: (p_batch_row => l_batch_header_rec
6425: ,x_rsc_row_count => l_rsrc_cnt
6426: ,x_return_status => l_return_status);
6427:
6428: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
6429: RAISE fnd_api.g_exc_error;
6430: END IF;
6431:
6432: IF g_debug <= gme_debug.g_log_statement THEN
6425: ,x_rsc_row_count => l_rsrc_cnt
6426: ,x_return_status => l_return_status);
6427:
6428: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
6429: RAISE fnd_api.g_exc_error;
6430: END IF;
6431:
6432: IF g_debug <= gme_debug.g_log_statement THEN
6433: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ':'
6434: || 'calling main cancel');
6435: END IF;
6436:
6437: gme_api_main.cancel_batch (p_validation_level => p_validation_level
6438: ,p_init_msg_list => fnd_api.g_false
6439: ,x_message_count => x_message_count
6440: ,x_message_list => x_message_list
6441: ,x_return_status => x_return_status
6442: ,p_batch_header_rec => l_batch_header_rec
6446: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ':' ||
6447: 'return_status from main'|| x_return_status);
6448: END IF;
6449:
6450: IF x_return_status = fnd_api.g_ret_sts_success THEN
6451: IF p_commit = fnd_api.g_true THEN
6452: gme_api_pub.save_batch
6453: (p_header_id => NULL
6454: ,p_table => gme_common_pvt.g_interface_table
6447: 'return_status from main'|| x_return_status);
6448: END IF;
6449:
6450: IF x_return_status = fnd_api.g_ret_sts_success THEN
6451: IF p_commit = fnd_api.g_true THEN
6452: gme_api_pub.save_batch
6453: (p_header_id => NULL
6454: ,p_table => gme_common_pvt.g_interface_table
6455: ,p_commit => p_commit
6454: ,p_table => gme_common_pvt.g_interface_table
6455: ,p_commit => p_commit
6456: ,x_return_status => x_return_status);
6457:
6458: IF x_return_status = fnd_api.g_ret_sts_success THEN
6459: COMMIT;
6460: ELSE
6461: RAISE fnd_api.g_exc_error;
6462: END IF;
6457:
6458: IF x_return_status = fnd_api.g_ret_sts_success THEN
6459: COMMIT;
6460: ELSE
6461: RAISE fnd_api.g_exc_error;
6462: END IF;
6463: END IF;
6464: ELSE
6465: RAISE batch_cancel_failure;
6465: RAISE batch_cancel_failure;
6466: END IF;
6467:
6468: gme_common_pvt.count_and_get (x_count => x_message_count
6469: ,p_encoded => fnd_api.g_false
6470: ,x_data => x_message_list);
6471:
6472: IF g_debug <= gme_debug.g_log_procedure THEN
6473: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
6477: WHEN batch_cancel_failure THEN
6478: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6479: x_batch_header_rec := NULL;
6480: gme_common_pvt.count_and_get (x_count => x_message_count
6481: ,p_encoded => fnd_api.g_false
6482: ,x_data => x_message_list);
6483: WHEN fnd_api.g_exc_error THEN
6484: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6485: x_return_status := fnd_api.g_ret_sts_error;
6479: x_batch_header_rec := NULL;
6480: gme_common_pvt.count_and_get (x_count => x_message_count
6481: ,p_encoded => fnd_api.g_false
6482: ,x_data => x_message_list);
6483: WHEN fnd_api.g_exc_error THEN
6484: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6485: x_return_status := fnd_api.g_ret_sts_error;
6486: x_batch_header_rec := NULL;
6487: gme_common_pvt.count_and_get (x_count => x_message_count
6481: ,p_encoded => fnd_api.g_false
6482: ,x_data => x_message_list);
6483: WHEN fnd_api.g_exc_error THEN
6484: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6485: x_return_status := fnd_api.g_ret_sts_error;
6486: x_batch_header_rec := NULL;
6487: gme_common_pvt.count_and_get (x_count => x_message_count
6488: ,p_encoded => fnd_api.g_false
6489: ,x_data => x_message_list);
6484: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6485: x_return_status := fnd_api.g_ret_sts_error;
6486: x_batch_header_rec := NULL;
6487: gme_common_pvt.count_and_get (x_count => x_message_count
6488: ,p_encoded => fnd_api.g_false
6489: ,x_data => x_message_list);
6490: WHEN OTHERS THEN
6491: ROLLBACK TO SAVEPOINT cancel_batch_pub;
6492: x_batch_header_rec := NULL;
6519: PROCEDURE terminate_batch (
6520: p_api_version IN NUMBER := 2.0
6521: ,p_validation_level IN NUMBER
6522: := gme_common_pvt.g_max_errors
6523: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6524: ,p_commit IN VARCHAR2 := fnd_api.g_false
6525: ,x_message_count OUT NOCOPY NUMBER
6526: ,x_message_list OUT NOCOPY VARCHAR2
6527: ,x_return_status OUT NOCOPY VARCHAR2
6520: p_api_version IN NUMBER := 2.0
6521: ,p_validation_level IN NUMBER
6522: := gme_common_pvt.g_max_errors
6523: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6524: ,p_commit IN VARCHAR2 := fnd_api.g_false
6525: ,x_message_count OUT NOCOPY NUMBER
6526: ,x_message_list OUT NOCOPY VARCHAR2
6527: ,x_return_status OUT NOCOPY VARCHAR2
6528: ,p_org_code IN VARCHAR2
6560: || 'Entering');
6561: END IF;
6562:
6563: /* Set the return status to success initially */
6564: x_return_status := fnd_api.g_ret_sts_success;
6565:
6566: /* Set savepoint here */
6567: SAVEPOINT terminate_batch;
6568:
6565:
6566: /* Set savepoint here */
6567: SAVEPOINT terminate_batch;
6568:
6569: IF p_init_msg_list = fnd_api.g_true THEN
6570: fnd_msg_pub.initialize;
6571: END IF;
6572:
6573: IF NOT fnd_api.compatible_api_call (2.0
6569: IF p_init_msg_list = fnd_api.g_true THEN
6570: fnd_msg_pub.initialize;
6571: END IF;
6572:
6573: IF NOT fnd_api.compatible_api_call (2.0
6574: ,p_api_version
6575: ,'terminate_batch'
6576: ,g_pkg_name) THEN
6577: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6574: ,p_api_version
6575: ,'terminate_batch'
6576: ,g_pkg_name) THEN
6577: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6578: RAISE fnd_api.g_exc_error;
6579: END IF;
6580: --Bug#5281136 Fetching the batch before checking for the reason_id or reason name.
6581: --fetch the batch
6582: gme_common_pvt.validate_batch
6587: ,x_message_count => x_message_count
6588: ,x_message_list => x_message_list
6589: ,x_return_status => x_return_status );
6590:
6591: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6592: IF (g_debug = gme_debug.g_log_statement) THEN
6593: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6594: || ': batch validate error ');
6595: END IF;
6592: IF (g_debug = gme_debug.g_log_statement) THEN
6593: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
6594: || ': batch validate error ');
6595: END IF;
6596: RAISE fnd_api.g_exc_error;
6597: END IF;
6598:
6599: /* Check for reason id */
6600: IF p_batch_header_rec.terminate_reason_id IS NOT NULL THEN
6614: p_batch_header_rec.terminate_reason_id;
6615: ELSE
6616: gme_common_pvt.log_message(p_product_code => 'INV'
6617: ,p_message_code => 'INV_LOTC_REASONID_INVALID');
6618: RAISE FND_API.g_exc_error;
6619: END IF;
6620: END IF;
6621: ELSIF p_reason_name IS NOT NULL THEN
6622: i := 0;
6626: END LOOP;
6627:
6628: IF i > 1 THEN
6629: gme_common_pvt.log_message('GME_REASON_NAME_NOT_UNIQUE');
6630: RAISE FND_API.g_exc_error;
6631: ELSIF i = 0 THEN
6632: gme_common_pvt.log_message('GME_INVALID_REASON_NAME');
6633: RAISE FND_API.g_exc_error;
6634: END IF;
6629: gme_common_pvt.log_message('GME_REASON_NAME_NOT_UNIQUE');
6630: RAISE FND_API.g_exc_error;
6631: ELSIF i = 0 THEN
6632: gme_common_pvt.log_message('GME_INVALID_REASON_NAME');
6633: RAISE FND_API.g_exc_error;
6634: END IF;
6635: END IF;
6636:
6637:
6636:
6637:
6638: IF (l_batch_header_rec.batch_type <> gme_common_pvt.g_doc_type_batch) THEN
6639: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
6640: RAISE fnd_api.g_exc_error;
6641: END IF;
6642:
6643: gme_common_pvt.g_error_count := 0;
6644:
6650: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ':'
6651: || 'INVALID_BATCH_STATUS');
6652: END IF;
6653:
6654: RAISE fnd_api.g_exc_error;
6655: END IF;
6656:
6657: /* check for dates*/
6658: /* Completion date cannot be greater than start date or in future */
6661: ELSIF (p_batch_header_rec.actual_cmplt_date <
6662: l_batch_header_rec.actual_start_date) THEN
6663: gme_common_pvt.log_message ('GME_INVALID_DATE_RANGE' ,'DATE1'
6664: ,'Termination date' ,'DATE2','Start date');
6665: x_return_status := fnd_api.g_ret_sts_error;
6666: RAISE fnd_api.g_exc_error;
6667: ELSIF (p_batch_header_rec.actual_cmplt_date > SYSDATE) THEN
6668: gme_common_pvt.log_message(p_product_code => 'GMA'
6669: ,p_message_code => 'SY_NOFUTUREDATE');
6662: l_batch_header_rec.actual_start_date) THEN
6663: gme_common_pvt.log_message ('GME_INVALID_DATE_RANGE' ,'DATE1'
6664: ,'Termination date' ,'DATE2','Start date');
6665: x_return_status := fnd_api.g_ret_sts_error;
6666: RAISE fnd_api.g_exc_error;
6667: ELSIF (p_batch_header_rec.actual_cmplt_date > SYSDATE) THEN
6668: gme_common_pvt.log_message(p_product_code => 'GMA'
6669: ,p_message_code => 'SY_NOFUTUREDATE');
6670: x_return_status := fnd_api.g_ret_sts_error;
6666: RAISE fnd_api.g_exc_error;
6667: ELSIF (p_batch_header_rec.actual_cmplt_date > SYSDATE) THEN
6668: gme_common_pvt.log_message(p_product_code => 'GMA'
6669: ,p_message_code => 'SY_NOFUTUREDATE');
6670: x_return_status := fnd_api.g_ret_sts_error;
6671: RAISE fnd_api.g_exc_error;
6672: ELSE
6673: l_batch_header_rec.actual_cmplt_date :=
6674: p_batch_header_rec.actual_cmplt_date;
6667: ELSIF (p_batch_header_rec.actual_cmplt_date > SYSDATE) THEN
6668: gme_common_pvt.log_message(p_product_code => 'GMA'
6669: ,p_message_code => 'SY_NOFUTUREDATE');
6670: x_return_status := fnd_api.g_ret_sts_error;
6671: RAISE fnd_api.g_exc_error;
6672: ELSE
6673: l_batch_header_rec.actual_cmplt_date :=
6674: p_batch_header_rec.actual_cmplt_date;
6675: END IF;
6678: gme_debug.put_line ('calling main terminate');
6679: END IF;
6680:
6681: gme_api_main.terminate_batch (p_validation_level => p_validation_level
6682: ,p_init_msg_list => fnd_api.g_false
6683: ,x_message_count => x_message_count
6684: ,x_message_list => x_message_list
6685: ,x_return_status => x_return_status
6686: ,p_batch_header_rec => l_batch_header_rec
6694: || 'return_status from main'
6695: || x_return_status);
6696: END IF;
6697:
6698: IF x_return_status = fnd_api.g_ret_sts_success THEN
6699: IF p_commit = fnd_api.g_true THEN
6700: gme_api_pub.save_batch
6701: (p_header_id => NULL
6702: ,p_table => gme_common_pvt.g_interface_table
6695: || x_return_status);
6696: END IF;
6697:
6698: IF x_return_status = fnd_api.g_ret_sts_success THEN
6699: IF p_commit = fnd_api.g_true THEN
6700: gme_api_pub.save_batch
6701: (p_header_id => NULL
6702: ,p_table => gme_common_pvt.g_interface_table
6703: ,p_commit => p_commit
6702: ,p_table => gme_common_pvt.g_interface_table
6703: ,p_commit => p_commit
6704: ,x_return_status => x_return_status);
6705:
6706: IF x_return_status = fnd_api.g_ret_sts_success THEN
6707: COMMIT;
6708: ELSE
6709: RAISE fnd_api.g_exc_error;
6710: END IF;
6705:
6706: IF x_return_status = fnd_api.g_ret_sts_success THEN
6707: COMMIT;
6708: ELSE
6709: RAISE fnd_api.g_exc_error;
6710: END IF;
6711: END IF;
6712: ELSE
6713: RAISE batch_terminate_failure;
6713: RAISE batch_terminate_failure;
6714: END IF;
6715:
6716: gme_common_pvt.count_and_get (x_count => x_message_count
6717: ,p_encoded => fnd_api.g_false
6718: ,x_data => x_message_list);
6719:
6720: IF g_debug <= gme_debug.g_log_procedure THEN
6721: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
6725: WHEN batch_terminate_failure THEN
6726: ROLLBACK TO SAVEPOINT terminate_batch;
6727: x_batch_header_rec := NULL;
6728: gme_common_pvt.count_and_get (x_count => x_message_count
6729: ,p_encoded => fnd_api.g_false
6730: ,x_data => x_message_list);
6731: WHEN fnd_api.g_exc_error THEN
6732: ROLLBACK TO SAVEPOINT terminate_batch;
6733: x_batch_header_rec := NULL;
6727: x_batch_header_rec := NULL;
6728: gme_common_pvt.count_and_get (x_count => x_message_count
6729: ,p_encoded => fnd_api.g_false
6730: ,x_data => x_message_list);
6731: WHEN fnd_api.g_exc_error THEN
6732: ROLLBACK TO SAVEPOINT terminate_batch;
6733: x_batch_header_rec := NULL;
6734: x_return_status := fnd_api.g_ret_sts_error;
6735: gme_common_pvt.count_and_get (x_count => x_message_count
6730: ,x_data => x_message_list);
6731: WHEN fnd_api.g_exc_error THEN
6732: ROLLBACK TO SAVEPOINT terminate_batch;
6733: x_batch_header_rec := NULL;
6734: x_return_status := fnd_api.g_ret_sts_error;
6735: gme_common_pvt.count_and_get (x_count => x_message_count
6736: ,p_encoded => fnd_api.g_false
6737: ,x_data => x_message_list);
6738: WHEN OTHERS THEN
6732: ROLLBACK TO SAVEPOINT terminate_batch;
6733: x_batch_header_rec := NULL;
6734: x_return_status := fnd_api.g_ret_sts_error;
6735: gme_common_pvt.count_and_get (x_count => x_message_count
6736: ,p_encoded => fnd_api.g_false
6737: ,x_data => x_message_list);
6738: WHEN OTHERS THEN
6739: ROLLBACK TO SAVEPOINT terminate_batch;
6740: IF g_debug <= gme_debug.g_log_unexpected THEN
6756: PROCEDURE convert_dtl_reservation (
6757: p_api_version IN NUMBER := 2.0
6758: ,p_validation_level IN NUMBER
6759: := gme_common_pvt.g_max_errors
6760: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6761: ,p_commit IN VARCHAR2 := fnd_api.g_false
6762: ,x_message_count OUT NOCOPY NUMBER
6763: ,x_message_list OUT NOCOPY VARCHAR2
6764: ,x_return_status OUT NOCOPY VARCHAR2
6757: p_api_version IN NUMBER := 2.0
6758: ,p_validation_level IN NUMBER
6759: := gme_common_pvt.g_max_errors
6760: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
6761: ,p_commit IN VARCHAR2 := fnd_api.g_false
6762: ,x_message_count OUT NOCOPY NUMBER
6763: ,x_message_list OUT NOCOPY VARCHAR2
6764: ,x_return_status OUT NOCOPY VARCHAR2
6765: ,p_reservation_rec IN mtl_reservations%ROWTYPE
6795: /* Set the savepoint */
6796: SAVEPOINT convert_dtl_reservation;
6797:
6798: /* Set the return status to success initially */
6799: x_return_status := fnd_api.g_ret_sts_success;
6800:
6801: IF p_init_msg_list = fnd_api.g_true THEN
6802: fnd_msg_pub.initialize;
6803: END IF;
6797:
6798: /* Set the return status to success initially */
6799: x_return_status := fnd_api.g_ret_sts_success;
6800:
6801: IF p_init_msg_list = fnd_api.g_true THEN
6802: fnd_msg_pub.initialize;
6803: END IF;
6804:
6805: IF NOT fnd_api.compatible_api_call (2.0
6801: IF p_init_msg_list = fnd_api.g_true THEN
6802: fnd_msg_pub.initialize;
6803: END IF;
6804:
6805: IF NOT fnd_api.compatible_api_call (2.0
6806: ,p_api_version
6807: ,'convert_dtl_reservation'
6808: ,g_pkg_name) THEN
6809: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6806: ,p_api_version
6807: ,'convert_dtl_reservation'
6808: ,g_pkg_name) THEN
6809: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
6810: RAISE fnd_api.g_exc_error;
6811: END IF;
6812:
6813: IF g_debug <= gme_debug.g_log_statement THEN
6814: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ' Input
6832: g_pkg_name || '.' || l_api_name || ' Retrieval failure against
6833: mtl_reservations using id of ' || p_reservation_rec.reservation_id);
6834: END IF;
6835:
6836: RAISE fnd_api.g_exc_error;
6837: END IF;
6838: CLOSE cur_fetch_reservation;
6839:
6840:
6846:
6847: gme_common_pvt.log_message (p_product_code => 'GMI'
6848: ,p_message_code => 'IC_ACTIONQTYNEG');
6849: /*Bug#6778968 Rework */
6850: x_return_status := fnd_api.g_ret_sts_error;
6851: RAISE negative_qty_error;
6852: END IF;
6853:
6854: /* Do setups appropriate to the organization */
6856: gme_common_pvt.setup (p_org_id => l_reservation_rec.organization_id
6857: ,p_org_code => NULL);
6858:
6859: IF NOT gme_common_pvt.g_setup_done THEN
6860: RAISE fnd_api.g_exc_error;
6861: END IF;
6862:
6863: gme_common_pvt.set_timestamp;
6864: /* Verify that we have a valid row in gme_material_details */
6866: l_reservation_rec.demand_source_line_id;
6867:
6868: IF NOT (gme_material_details_dbl.fetch_row (l_material_details_rec
6869: ,l_material_details_rec) ) THEN
6870: RAISE fnd_api.g_exc_error;
6871: END IF;
6872:
6873: -- Bug 13532998 - Check to make sure date is not in the future and after start date of batch.
6874: IF p_trans_date IS NOT NULL THEN
6877: l_batch_header_rec.batch_id := l_material_details_rec.batch_id;
6878:
6879: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
6880: ,l_batch_header_rec) ) THEN
6881: RAISE fnd_api.g_exc_error;
6882: END IF;
6883:
6884: IF p_trans_date > SYSDATE THEN
6885: gme_common_pvt.log_message(p_product_code => 'GMA'
6884: IF p_trans_date > SYSDATE THEN
6885: gme_common_pvt.log_message(p_product_code => 'GMA'
6886: ,p_message_code => 'SY_NOFUTUREDATE');
6887:
6888: x_return_status := fnd_api.g_ret_sts_error;
6889: RAISE bad_trans_date_error;
6890: END IF;
6891:
6892: IF p_trans_date < l_batch_header_rec.actual_start_date THEN
6892: IF p_trans_date < l_batch_header_rec.actual_start_date THEN
6893: gme_common_pvt.log_message(p_product_code => 'GME'
6894: ,p_message_code => 'GME_NOT_VALID_TRANS_DATE');
6895:
6896: x_return_status := fnd_api.g_ret_sts_error;
6897: RAISE bad_trans_date_error;
6898: END IF;
6899: END IF;
6900:
6918: p_supply_demand_code => 2, -- signals DEMAND
6919: p_supply_demand_type_id => INV_RESERVATION_GLOBAL.g_source_type_wip,
6920: p_supply_demand_header_id => l_material_details_rec.batch_id,
6921: p_supply_demand_line_id => l_material_details_rec.material_detail_id,
6922: p_supply_demand_line_detail => FND_API.G_MISS_NUM,
6923: p_demand_ship_date => NULL,
6924: p_expected_receipt_date => NULL,
6925: p_called_by => 'CVT',
6926: p_api_version_number => 1.0,
6923: p_demand_ship_date => NULL,
6924: p_expected_receipt_date => NULL,
6925: p_called_by => 'CVT',
6926: p_api_version_number => 1.0,
6927: p_init_msg_lst => FND_API.G_FALSE );
6928:
6929: IF g_debug <= gme_debug.g_log_statement THEN
6930: gme_debug.put_line
6931: ( g_pkg_name
6934: || ' Return status from gme_api_grp.validate_supply_demand is '
6935: || x_return_status);
6936: END IF;
6937:
6938: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
6939: OR l_valid_status <> 'Y' THEN
6940: RAISE fnd_api.g_exc_error;
6941: END IF;
6942:
6936: END IF;
6937:
6938: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
6939: OR l_valid_status <> 'Y' THEN
6940: RAISE fnd_api.g_exc_error;
6941: END IF;
6942:
6943: /* Invoke private layer to process transactions */
6944: gme_reservations_pvt.convert_dtl_reservation
6958: || ' Return status from gme_reservations_pvt.convert_dtl_reservation is '
6959: || x_return_status);
6960: END IF;
6961:
6962: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6963: RAISE detail_reservation_error;
6964: END IF;
6965: gme_api_pub.save_batch
6966: (p_header_id => gme_common_pvt.g_transaction_header_id
6976: || ' return status from gme_api_pub.save_batch is '
6977: || x_return_status);
6978: END IF;
6979:
6980: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6981: RAISE fnd_api.g_exc_error;
6982: END IF;
6983:
6984: IF g_debug <= gme_debug.g_log_procedure THEN
6977: || x_return_status);
6978: END IF;
6979:
6980: IF x_return_status <> fnd_api.g_ret_sts_success THEN
6981: RAISE fnd_api.g_exc_error;
6982: END IF;
6983:
6984: IF g_debug <= gme_debug.g_log_procedure THEN
6985: gme_debug.put_line ( ' Completed '
6990: EXCEPTION
6991: WHEN detail_reservation_error OR negative_qty_error OR bad_trans_date_error THEN
6992: ROLLBACK TO SAVEPOINT convert_dtl_reservation;
6993: gme_common_pvt.count_and_get (x_count => x_message_count
6994: ,p_encoded => fnd_api.g_false
6995: ,x_data => x_message_list);
6996: WHEN OTHERS THEN
6997: ROLLBACK TO SAVEPOINT convert_dtl_reservation;
6998: gme_when_others ( p_api_name => l_api_name
7006: PROCEDURE insert_batchstep_resource (
7007: p_api_version IN NUMBER
7008: ,p_validation_level IN NUMBER
7009: := gme_common_pvt.g_max_errors
7010: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7011: ,p_commit IN VARCHAR2 := fnd_api.g_false
7012: ,p_batchstep_resource_rec IN gme_batch_step_resources%ROWTYPE
7013: ,p_org_code IN VARCHAR2 := NULL
7014: ,p_batch_no IN VARCHAR2 := NULL
7007: p_api_version IN NUMBER
7008: ,p_validation_level IN NUMBER
7009: := gme_common_pvt.g_max_errors
7010: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7011: ,p_commit IN VARCHAR2 := fnd_api.g_false
7012: ,p_batchstep_resource_rec IN gme_batch_step_resources%ROWTYPE
7013: ,p_org_code IN VARCHAR2 := NULL
7014: ,p_batch_no IN VARCHAR2 := NULL
7015: ,p_batchstep_no IN NUMBER := NULL
7013: ,p_org_code IN VARCHAR2 := NULL
7014: ,p_batch_no IN VARCHAR2 := NULL
7015: ,p_batchstep_no IN NUMBER := NULL
7016: ,p_activity IN VARCHAR2 := NULL
7017: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_false
7018: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
7019: ,x_batchstep_resource_rec OUT NOCOPY gme_batch_step_resources%ROWTYPE
7020: ,x_message_count OUT NOCOPY NUMBER
7021: ,x_message_list OUT NOCOPY VARCHAR2
7014: ,p_batch_no IN VARCHAR2 := NULL
7015: ,p_batchstep_no IN NUMBER := NULL
7016: ,p_activity IN VARCHAR2 := NULL
7017: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_false
7018: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
7019: ,x_batchstep_resource_rec OUT NOCOPY gme_batch_step_resources%ROWTYPE
7020: ,x_message_count OUT NOCOPY NUMBER
7021: ,x_message_list OUT NOCOPY VARCHAR2
7022: ,x_return_status OUT NOCOPY VARCHAR2)
7092: /* Set the savepoint */
7093: SAVEPOINT insert_batchstep_rsrc;
7094:
7095: /* Set the return status to success initially */
7096: x_return_status := fnd_api.g_ret_sts_success;
7097:
7098: /* Make sure we are call compatible */
7099: IF NOT fnd_api.compatible_api_call (2.0
7100: ,p_api_version
7095: /* Set the return status to success initially */
7096: x_return_status := fnd_api.g_ret_sts_success;
7097:
7098: /* Make sure we are call compatible */
7099: IF NOT fnd_api.compatible_api_call (2.0
7100: ,p_api_version
7101: ,'insert_batchstep_resource'
7102: ,g_pkg_name) THEN
7103: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7100: ,p_api_version
7101: ,'insert_batchstep_resource'
7102: ,g_pkg_name) THEN
7103: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7104: RAISE fnd_api.g_exc_error;
7105: END IF;
7106:
7107: /* Initialize message list and count if needed */
7108: IF p_init_msg_list = fnd_api.g_true THEN
7104: RAISE fnd_api.g_exc_error;
7105: END IF;
7106:
7107: /* Initialize message list and count if needed */
7108: IF p_init_msg_list = fnd_api.g_true THEN
7109: fnd_msg_pub.initialize;
7110: gme_common_pvt.g_error_count := 0;
7111: END IF;
7112:
7124: (p_org_id => p_batchstep_resource_rec.organization_id
7125: ,p_org_code => p_org_code);
7126:
7127: IF NOT gme_common_pvt.g_setup_done THEN
7128: RAISE fnd_api.g_exc_error;
7129: END IF;
7130:
7131: gme_common_pvt.set_timestamp;
7132: gme_common_pvt.g_check_primary_rsrc := 1;
7137: IF l_batchstep_resource_rec.resources IS NULL THEN
7138: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
7139: ,'FIELD_NAME'
7140: ,'RESOURCES');
7141: RAISE fnd_api.g_exc_error;
7142: END IF;
7143:
7144: IF l_batchstep_resource_rec.batchstep_activity_id IS NOT NULL THEN
7145: --added by qzeng no need to check if done in bulk validation
7166: gme_common_pvt.log_message
7167: ('GME_ACTID_NOT_FOUND'
7168: ,'BATCHSTEP_ACT_ID'
7169: ,l_batchstep_resource_rec.batchstep_activity_id);
7170: RAISE fnd_api.g_exc_error;
7171: END IF;
7172:
7173: CLOSE cur_validate_activity;
7174:
7189: IF cur_validate_batch_type%FOUND THEN
7190: CLOSE cur_validate_batch_type;
7191:
7192: gme_common_pvt.log_message ('GME_FPO_RSRC_NO_EDIT');
7193: RAISE fnd_api.g_exc_error;
7194: END IF;
7195:
7196: CLOSE cur_validate_batch_type;
7197: END IF;
7227: || ' validate_param returns '
7228: || l_return_status);
7229: END IF;
7230:
7231: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7232: RAISE fnd_api.g_exc_error;
7233: END IF;
7234:
7235: IF g_debug <= gme_debug.g_log_statement THEN
7228: || l_return_status);
7229: END IF;
7230:
7231: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7232: RAISE fnd_api.g_exc_error;
7233: END IF;
7234:
7235: IF g_debug <= gme_debug.g_log_statement THEN
7236: gme_debug.put_line (g_pkg_name || '.' || l_api_name || ' batch_id
7278: CLOSE cur_get_rsrc_hdr;
7279:
7280: fnd_message.set_name ('GMD', 'FM_BAD_RESOURCE');
7281: fnd_msg_pub.ADD;
7282: RAISE fnd_api.g_exc_error;
7283: END IF;
7284: CLOSE cur_get_rsrc_hdr;
7285: END IF;
7286:
7305:
7306: gme_common_pvt.log_message ('GME_NO_DATA_FOUND'
7307: ,'TABLE_NAME'
7308: ,'GME_BATCH_STEPS');
7309: RAISE fnd_api.g_exc_error;
7310: END IF;
7311:
7312: IF g_debug <= gme_debug.g_log_statement THEN
7313: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ' step_status
7323: || ' Invoke validate_rsrc_param');
7324: END IF;
7325:
7326: --FPBug#4395561 Start setting global flex validate variable
7327: IF p_validate_flexfields = FND_API.G_TRUE THEN
7328: gme_common_pvt.g_flex_validate_prof := 1;
7329: ELSE
7330: gme_common_pvt.g_flex_validate_prof := 0;
7331: END IF;
7351:
7352: --FPBug#4395561 resetting globla flex field variable
7353: gme_common_pvt.g_flex_validate_prof := 0;
7354:
7355: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7356: RAISE fnd_api.g_exc_error;
7357: END IF;
7358:
7359: -- Set capacity data
7352: --FPBug#4395561 resetting globla flex field variable
7353: gme_common_pvt.g_flex_validate_prof := 0;
7354:
7355: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7356: RAISE fnd_api.g_exc_error;
7357: END IF;
7358:
7359: -- Set capacity data
7360: IF g_debug <= gme_debug.g_log_statement THEN
7397: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || '
7398: insert_batchstep_rsrc returns '|| x_return_status);
7399: END IF;
7400:
7401: IF x_return_status = fnd_api.g_ret_sts_success THEN
7402: IF g_debug <= gme_debug.g_log_statement THEN
7403: gme_debug.put_line ( g_pkg_name
7404: || '.'
7405: || l_api_name
7415: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || '
7416: save_batch returns '|| x_return_status);
7417: END IF;
7418:
7419: IF x_return_status <> fnd_api.g_ret_sts_success THEN
7420: RAISE fnd_api.g_exc_error;
7421: END IF;
7422: ELSE
7423: RAISE insert_rsrc_failed;
7416: save_batch returns '|| x_return_status);
7417: END IF;
7418:
7419: IF x_return_status <> fnd_api.g_ret_sts_success THEN
7420: RAISE fnd_api.g_exc_error;
7421: END IF;
7422: ELSE
7423: RAISE insert_rsrc_failed;
7424: END IF;
7429: END IF;
7430:
7431: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
7432: gme_common_pvt.count_and_get(x_count => x_message_count
7433: ,p_encoded => fnd_api.g_false
7434: ,x_data => x_message_list);
7435: EXCEPTION
7436: WHEN insert_rsrc_failed THEN
7437: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7435: EXCEPTION
7436: WHEN insert_rsrc_failed THEN
7437: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7438: gme_common_pvt.count_and_get(x_count => x_message_count
7439: ,p_encoded => fnd_api.g_false
7440: ,x_data => x_message_list);
7441: WHEN fnd_api.g_exc_error THEN
7442: x_return_status := fnd_api.g_ret_sts_error;
7443: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7437: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7438: gme_common_pvt.count_and_get(x_count => x_message_count
7439: ,p_encoded => fnd_api.g_false
7440: ,x_data => x_message_list);
7441: WHEN fnd_api.g_exc_error THEN
7442: x_return_status := fnd_api.g_ret_sts_error;
7443: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7444: gme_common_pvt.count_and_get(x_count => x_message_count
7445: ,p_encoded => fnd_api.g_false
7438: gme_common_pvt.count_and_get(x_count => x_message_count
7439: ,p_encoded => fnd_api.g_false
7440: ,x_data => x_message_list);
7441: WHEN fnd_api.g_exc_error THEN
7442: x_return_status := fnd_api.g_ret_sts_error;
7443: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7444: gme_common_pvt.count_and_get(x_count => x_message_count
7445: ,p_encoded => fnd_api.g_false
7446: ,x_data => x_message_list);
7441: WHEN fnd_api.g_exc_error THEN
7442: x_return_status := fnd_api.g_ret_sts_error;
7443: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7444: gme_common_pvt.count_and_get(x_count => x_message_count
7445: ,p_encoded => fnd_api.g_false
7446: ,x_data => x_message_list);
7447: WHEN OTHERS THEN
7448: ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
7449: gme_when_others ( p_api_name => l_api_name
7455: /*************************************************************************/
7456: PROCEDURE update_batchstep_resource (
7457: p_api_version IN NUMBER
7458: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
7459: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7460: ,p_commit IN VARCHAR2 := fnd_api.g_false
7461: ,p_batchstep_resource_rec IN gme_batch_step_resources%ROWTYPE
7462: ,p_org_code IN VARCHAR2 := NULL
7463: ,p_batch_no IN VARCHAR2 := NULL
7456: PROCEDURE update_batchstep_resource (
7457: p_api_version IN NUMBER
7458: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
7459: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7460: ,p_commit IN VARCHAR2 := fnd_api.g_false
7461: ,p_batchstep_resource_rec IN gme_batch_step_resources%ROWTYPE
7462: ,p_org_code IN VARCHAR2 := NULL
7463: ,p_batch_no IN VARCHAR2 := NULL
7464: ,p_batchstep_no IN NUMBER := NULL
7462: ,p_org_code IN VARCHAR2 := NULL
7463: ,p_batch_no IN VARCHAR2 := NULL
7464: ,p_batchstep_no IN NUMBER := NULL
7465: ,p_activity IN VARCHAR2 := NULL
7466: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_false
7467: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
7468: ,x_batchstep_resource_rec OUT NOCOPY gme_batch_step_resources%ROWTYPE
7469: ,x_message_count OUT NOCOPY NUMBER
7470: ,x_message_list OUT NOCOPY VARCHAR2
7463: ,p_batch_no IN VARCHAR2 := NULL
7464: ,p_batchstep_no IN NUMBER := NULL
7465: ,p_activity IN VARCHAR2 := NULL
7466: ,p_ignore_qty_below_cap IN VARCHAR2 := fnd_api.g_false
7467: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
7468: ,x_batchstep_resource_rec OUT NOCOPY gme_batch_step_resources%ROWTYPE
7469: ,x_message_count OUT NOCOPY NUMBER
7470: ,x_message_list OUT NOCOPY VARCHAR2
7471: ,x_return_status OUT NOCOPY VARCHAR2)
7501: || l_api_name);
7502: END IF;
7503:
7504: /* Set the return status to success initially */
7505: x_return_status := fnd_api.g_ret_sts_success;
7506:
7507: /* Make sure we are call compatible */
7508: IF NOT fnd_api.compatible_api_call (2.0
7509: ,p_api_version
7504: /* Set the return status to success initially */
7505: x_return_status := fnd_api.g_ret_sts_success;
7506:
7507: /* Make sure we are call compatible */
7508: IF NOT fnd_api.compatible_api_call (2.0
7509: ,p_api_version
7510: ,'update_batchstep_resource'
7511: ,g_pkg_name) THEN
7512: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7509: ,p_api_version
7510: ,'update_batchstep_resource'
7511: ,g_pkg_name) THEN
7512: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7513: RAISE fnd_api.g_exc_error;
7514: END IF;
7515:
7516: gme_common_pvt.set_timestamp;
7517:
7515:
7516: gme_common_pvt.set_timestamp;
7517:
7518: /* Initialize message list and count if needed */
7519: IF p_init_msg_list = fnd_api.g_true THEN
7520: fnd_msg_pub.initialize;
7521: gme_common_pvt.g_error_count := 0;
7522: END IF;
7523:
7546: || l_api_name
7547: || ' get_batchstep_rsrc failed to retrieve row');
7548: END IF;
7549:
7550: RAISE fnd_api.g_exc_error;
7551: END IF;
7552:
7553: /* Make sure the essential keys are populated from the retrieved row */
7554: /* Don't overwrite any other input data which carries the updates */
7597: || l_api_name
7598: || ' setup failure ');
7599: END IF;
7600:
7601: RAISE fnd_api.g_exc_error;
7602: END IF;
7603:
7604: /* Establish the step_status of the batchstep */
7605: IF g_debug <= gme_debug.g_log_statement THEN
7621:
7622: gme_common_pvt.log_message ('GME_BATCH_STEP_NOT_FOUND'
7623: ,'STEP_ID'
7624: ,l_batchstep_resource_rec.batchstep_id);
7625: RAISE fnd_api.g_exc_error;
7626: END IF;
7627:
7628: IF g_debug <= gme_debug.g_log_statement THEN
7629: gme_debug.put_line ( g_pkg_name
7635:
7636: CLOSE cur_get_batchstep_status;
7637:
7638: --FPBug#4395561 Start setting global flex validate variable
7639: IF p_validate_flexfields = FND_API.G_TRUE THEN
7640: gme_common_pvt.g_flex_validate_prof := 1;
7641: ELSE
7642: gme_common_pvt.g_flex_validate_prof := 0;
7643: END IF;
7659:
7660: --FPBug#4395561 resetting global flex field validate
7661: gme_common_pvt.g_flex_validate_prof := 0;
7662:
7663: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7664: RAISE fnd_api.g_exc_error;
7665: END IF;
7666:
7667: l_batchstep_resource_rec := l_batchstep_resource_rec_out;
7660: --FPBug#4395561 resetting global flex field validate
7661: gme_common_pvt.g_flex_validate_prof := 0;
7662:
7663: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7664: RAISE fnd_api.g_exc_error;
7665: END IF;
7666:
7667: l_batchstep_resource_rec := l_batchstep_resource_rec_out;
7668:
7686: || ' update_batchstep_rsrc returns '
7687: || x_return_status);
7688: END IF;
7689:
7690: IF x_return_status = fnd_api.g_ret_sts_success THEN
7691: IF g_debug <= gme_debug.g_log_statement THEN
7692: gme_debug.put_line ( g_pkg_name
7693: || '.'
7694: || l_api_name
7709: || ' save_batch return_status is '
7710: || x_return_status);
7711: END IF;
7712:
7713: IF x_return_status <> fnd_api.g_ret_sts_success THEN
7714: RAISE fnd_api.g_exc_error;
7715: END IF;
7716: ELSE
7717: RAISE update_rsrc_failed;
7710: || x_return_status);
7711: END IF;
7712:
7713: IF x_return_status <> fnd_api.g_ret_sts_success THEN
7714: RAISE fnd_api.g_exc_error;
7715: END IF;
7716: ELSE
7717: RAISE update_rsrc_failed;
7718: END IF;
7718: END IF;
7719:
7720: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
7721: gme_common_pvt.count_and_get(x_count => x_message_count
7722: ,p_encoded => fnd_api.g_false
7723: ,x_data => x_message_list);
7724:
7725: IF g_debug <= gme_debug.g_log_procedure THEN
7726: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
7729: EXCEPTION
7730: WHEN update_rsrc_failed THEN
7731: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7732: gme_common_pvt.count_and_get(x_count => x_message_count
7733: ,p_encoded => fnd_api.g_false
7734: ,x_data => x_message_list);
7735: WHEN fnd_api.g_exc_error THEN
7736: x_return_status := fnd_api.g_ret_sts_error;
7737: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7731: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7732: gme_common_pvt.count_and_get(x_count => x_message_count
7733: ,p_encoded => fnd_api.g_false
7734: ,x_data => x_message_list);
7735: WHEN fnd_api.g_exc_error THEN
7736: x_return_status := fnd_api.g_ret_sts_error;
7737: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7738: gme_common_pvt.count_and_get(x_count => x_message_count
7739: ,p_encoded => fnd_api.g_false
7732: gme_common_pvt.count_and_get(x_count => x_message_count
7733: ,p_encoded => fnd_api.g_false
7734: ,x_data => x_message_list);
7735: WHEN fnd_api.g_exc_error THEN
7736: x_return_status := fnd_api.g_ret_sts_error;
7737: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7738: gme_common_pvt.count_and_get(x_count => x_message_count
7739: ,p_encoded => fnd_api.g_false
7740: ,x_data => x_message_list);
7735: WHEN fnd_api.g_exc_error THEN
7736: x_return_status := fnd_api.g_ret_sts_error;
7737: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7738: gme_common_pvt.count_and_get(x_count => x_message_count
7739: ,p_encoded => fnd_api.g_false
7740: ,x_data => x_message_list);
7741: WHEN OTHERS THEN
7742: ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
7743: gme_when_others ( p_api_name => l_api_name
7750: PROCEDURE delete_batchstep_resource (
7751: p_api_version IN NUMBER := 2.0
7752: ,p_validation_level IN NUMBER
7753: := gme_common_pvt.g_max_errors
7754: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7755: ,p_commit IN VARCHAR2 := fnd_api.g_false
7756: ,p_batchstep_resource_id IN NUMBER := NULL
7757: ,p_org_code IN VARCHAR2 := NULL
7758: ,p_batch_no IN VARCHAR2 := NULL
7751: p_api_version IN NUMBER := 2.0
7752: ,p_validation_level IN NUMBER
7753: := gme_common_pvt.g_max_errors
7754: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
7755: ,p_commit IN VARCHAR2 := fnd_api.g_false
7756: ,p_batchstep_resource_id IN NUMBER := NULL
7757: ,p_org_code IN VARCHAR2 := NULL
7758: ,p_batch_no IN VARCHAR2 := NULL
7759: ,p_batchstep_no IN NUMBER := NULL
7809: || l_api_name);
7810: END IF;
7811:
7812: /* Set the return status to success initially */
7813: x_return_status := fnd_api.g_ret_sts_success;
7814:
7815: /* Make sure we are call compatible */
7816: IF NOT fnd_api.compatible_api_call (2.0
7817: ,p_api_version
7812: /* Set the return status to success initially */
7813: x_return_status := fnd_api.g_ret_sts_success;
7814:
7815: /* Make sure we are call compatible */
7816: IF NOT fnd_api.compatible_api_call (2.0
7817: ,p_api_version
7818: ,'delete_batchstep_resource'
7819: ,g_pkg_name) THEN
7820: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7817: ,p_api_version
7818: ,'delete_batchstep_resource'
7819: ,g_pkg_name) THEN
7820: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
7821: RAISE fnd_api.g_exc_error;
7822: END IF;
7823:
7824: gme_common_pvt.set_timestamp;
7825:
7823:
7824: gme_common_pvt.set_timestamp;
7825:
7826: /* Initialize message list and count if needed */
7827: IF p_init_msg_list = fnd_api.g_true THEN
7828: fnd_msg_pub.initialize;
7829: gme_common_pvt.g_error_count := 0;
7830: END IF;
7831:
7846: IF (p_batchstep_resource_id IS NULL AND p_resource IS NULL) THEN
7847: gme_common_pvt.log_message ('GME_FIELD_VALUE_REQUIRED'
7848: ,'FIELD_NAME'
7849: ,'RESOURCES');
7850: RAISE fnd_api.g_exc_error;
7851: END IF;
7852:
7853: /* validate key values where no internal ID provided */
7854: IF p_batchstep_resource_id IS NULL THEN
7883: || 'validate_param returns rsrc_id : '
7884: || l_rsrc_id );
7885: END IF;
7886:
7887: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7888: RAISE fnd_api.g_exc_error;
7889: END IF;
7890: ELSE
7891: IF g_debug <= gme_debug.g_log_statement THEN
7884: || l_rsrc_id );
7885: END IF;
7886:
7887: IF l_return_status <> fnd_api.g_ret_sts_success THEN
7888: RAISE fnd_api.g_exc_error;
7889: END IF;
7890: ELSE
7891: IF g_debug <= gme_debug.g_log_statement THEN
7892: gme_debug.put_line ( g_pkg_name
7916: IF cur_get_step_dtl%NOTFOUND THEN
7917: CLOSE cur_get_step_dtl;
7918:
7919: gme_common_pvt.log_message ('GME_INVALID_RSRC_ID');
7920: RAISE fnd_api.g_exc_error;
7921: END IF;
7922:
7923: CLOSE cur_get_step_dtl;
7924:
7938: gme_common_pvt.setup (p_org_id => l_organization_id
7939: ,p_org_code => p_org_code);
7940:
7941: IF NOT gme_common_pvt.g_setup_done THEN
7942: RAISE fnd_api.g_exc_error;
7943: END IF;
7944:
7945: /* Validations prior to deletion */
7946: IF g_debug <= gme_debug.g_log_statement THEN
7960:
7961: IF cur_validate_batch_type%FOUND THEN
7962: CLOSE cur_validate_batch_type;
7963: gme_common_pvt.log_message ('GME_FPO_RSRC_NO_EDIT');
7964: RAISE fnd_api.g_exc_error;
7965: END IF;
7966:
7967: CLOSE cur_validate_batch_type;
7968: END IF;
7983: -- Bug 13992005 - We do not need to check batch status for this function.
7984: /*
7985: IF l_batch_status <> gme_common_pvt.g_batch_pending THEN
7986: gme_common_pvt.log_message ('PM_WRONG_STATUS');
7987: RAISE fnd_api.g_exc_error;
7988: ELSIF l_step_status <> gme_common_pvt.g_step_pending THEN
7989: gme_common_pvt.log_message ('PC_STEP_STATUS_ERR');
7990: RAISE fnd_api.g_exc_error;
7991: END IF;
7986: gme_common_pvt.log_message ('PM_WRONG_STATUS');
7987: RAISE fnd_api.g_exc_error;
7988: ELSIF l_step_status <> gme_common_pvt.g_step_pending THEN
7989: gme_common_pvt.log_message ('PC_STEP_STATUS_ERR');
7990: RAISE fnd_api.g_exc_error;
7991: END IF;
7992: */
7993: -- Bug 13992005
7994: IF l_step_status <> gme_common_pvt.g_step_pending THEN
7992: */
7993: -- Bug 13992005
7994: IF l_step_status <> gme_common_pvt.g_step_pending THEN
7995: gme_common_pvt.log_message ('PC_STEP_STATUS_ERR');
7996: RAISE fnd_api.g_exc_error;
7997: END IF;
7998:
7999: /* Ensure that the batchstep_resource_rec is sufficiently populated for deletion to proceed */
8000: l_batchstep_resource_rec.organization_id := l_organization_id;
8026: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ' return
8027: status from delete is ' || x_return_status);
8028: END IF;
8029:
8030: IF x_return_status = fnd_api.g_ret_sts_success THEN
8031: IF g_debug <= gme_debug.g_log_statement THEN
8032: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ' invoke
8033: save_batch tith commit set ' || p_commit);
8034: END IF;
8044: status from save_batch is '
8045: || x_return_status);
8046: END IF;
8047:
8048: IF x_return_status <> fnd_api.g_ret_sts_success THEN
8049: RAISE fnd_api.g_exc_error;
8050: END IF;
8051: ELSE
8052: RAISE delete_rsrc_failed;
8045: || x_return_status);
8046: END IF;
8047:
8048: IF x_return_status <> fnd_api.g_ret_sts_success THEN
8049: RAISE fnd_api.g_exc_error;
8050: END IF;
8051: ELSE
8052: RAISE delete_rsrc_failed;
8053: END IF;
8057: || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
8058: END IF;
8059: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
8060: gme_common_pvt.count_and_get(x_count => x_message_count
8061: ,p_encoded => fnd_api.g_false
8062: ,x_data => x_message_list);
8063: EXCEPTION
8064: WHEN delete_rsrc_failed THEN
8065: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8063: EXCEPTION
8064: WHEN delete_rsrc_failed THEN
8065: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8066: gme_common_pvt.count_and_get(x_count => x_message_count
8067: ,p_encoded => fnd_api.g_false
8068: ,x_data => x_message_list);
8069: WHEN fnd_api.g_exc_error THEN
8070: x_return_status := fnd_api.g_ret_sts_error;
8071: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8065: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8066: gme_common_pvt.count_and_get(x_count => x_message_count
8067: ,p_encoded => fnd_api.g_false
8068: ,x_data => x_message_list);
8069: WHEN fnd_api.g_exc_error THEN
8070: x_return_status := fnd_api.g_ret_sts_error;
8071: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8072: gme_common_pvt.count_and_get(x_count => x_message_count
8073: ,p_encoded => fnd_api.g_false
8066: gme_common_pvt.count_and_get(x_count => x_message_count
8067: ,p_encoded => fnd_api.g_false
8068: ,x_data => x_message_list);
8069: WHEN fnd_api.g_exc_error THEN
8070: x_return_status := fnd_api.g_ret_sts_error;
8071: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8072: gme_common_pvt.count_and_get(x_count => x_message_count
8073: ,p_encoded => fnd_api.g_false
8074: ,x_data => x_message_list);
8069: WHEN fnd_api.g_exc_error THEN
8070: x_return_status := fnd_api.g_ret_sts_error;
8071: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8072: gme_common_pvt.count_and_get(x_count => x_message_count
8073: ,p_encoded => fnd_api.g_false
8074: ,x_data => x_message_list);
8075: WHEN OTHERS THEN
8076: ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
8077: gme_when_others ( p_api_name => l_api_name
8084: PROCEDURE auto_detail_line (
8085: p_api_version IN NUMBER := 2.0
8086: ,p_validation_level IN NUMBER
8087: := gme_common_pvt.g_max_errors
8088: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
8089: ,p_commit IN VARCHAR2 := fnd_api.g_false
8090: ,x_message_count OUT NOCOPY NUMBER
8091: ,x_message_list OUT NOCOPY VARCHAR2
8092: ,x_return_status OUT NOCOPY VARCHAR2
8085: p_api_version IN NUMBER := 2.0
8086: ,p_validation_level IN NUMBER
8087: := gme_common_pvt.g_max_errors
8088: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
8089: ,p_commit IN VARCHAR2 := fnd_api.g_false
8090: ,x_message_count OUT NOCOPY NUMBER
8091: ,x_message_list OUT NOCOPY VARCHAR2
8092: ,x_return_status OUT NOCOPY VARCHAR2
8093: ,p_material_detail_id IN NUMBER
8121:
8122: /* Set the savepoint */
8123: SAVEPOINT auto_detail_line;
8124: /* Set the return status to success initially */
8125: x_return_status := fnd_api.g_ret_sts_success;
8126:
8127: IF p_init_msg_list = fnd_api.g_true THEN
8128: fnd_msg_pub.initialize;
8129: END IF;
8123: SAVEPOINT auto_detail_line;
8124: /* Set the return status to success initially */
8125: x_return_status := fnd_api.g_ret_sts_success;
8126:
8127: IF p_init_msg_list = fnd_api.g_true THEN
8128: fnd_msg_pub.initialize;
8129: END IF;
8130:
8131: IF NOT fnd_api.compatible_api_call (2.0
8127: IF p_init_msg_list = fnd_api.g_true THEN
8128: fnd_msg_pub.initialize;
8129: END IF;
8130:
8131: IF NOT fnd_api.compatible_api_call (2.0
8132: ,p_api_version
8133: ,'auto_detail_line'
8134: ,g_pkg_name) THEN
8135: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8132: ,p_api_version
8133: ,'auto_detail_line'
8134: ,g_pkg_name) THEN
8135: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8136: RAISE fnd_api.g_exc_error;
8137: END IF;
8138:
8139: IF g_debug <= gme_debug.g_log_statement THEN
8140: gme_debug.put_line (
8158: ,x_material_detail_rec => l_material_details_rec_out
8159: ,x_message_count => x_message_count
8160: ,x_message_list => x_message_list
8161: ,x_return_status => x_return_status );
8162: IF x_return_status <> fnd_api.g_ret_sts_success THEN
8163: IF (g_debug = gme_debug.g_log_statement) THEN
8164: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
8165: || ': batch mateiral validate error ');
8166: END IF;
8163: IF (g_debug = gme_debug.g_log_statement) THEN
8164: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
8165: || ': batch mateiral validate error ');
8166: END IF;
8167: RAISE fnd_api.g_exc_error;
8168: ELSE
8169: l_material_details_rec := l_material_details_rec_out;
8170: END IF;
8171: gme_common_pvt.set_timestamp;
8190: p_supply_demand_code => 2, -- signals DEMAND
8191: p_supply_demand_type_id => INV_RESERVATION_GLOBAL.g_source_type_wip,
8192: p_supply_demand_header_id => l_material_details_rec.batch_id,
8193: p_supply_demand_line_id => l_material_details_rec.material_detail_id,
8194: p_supply_demand_line_detail => FND_API.G_MISS_NUM,
8195: p_demand_ship_date => NULL,
8196: p_expected_receipt_date => NULL,
8197: p_api_version_number => 1.0,
8198: p_init_msg_lst => FND_API.G_FALSE );
8194: p_supply_demand_line_detail => FND_API.G_MISS_NUM,
8195: p_demand_ship_date => NULL,
8196: p_expected_receipt_date => NULL,
8197: p_api_version_number => 1.0,
8198: p_init_msg_lst => FND_API.G_FALSE );
8199:
8200: IF g_debug <= gme_debug.g_log_statement THEN
8201: gme_debug.put_line
8202: ( g_pkg_name
8210: || ' valid status is '
8211: || l_valid_status);
8212: END IF;
8213:
8214: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
8215: OR l_valid_status <> 'Y' THEN
8216: RAISE fnd_api.g_exc_error;
8217: END IF;
8218:
8212: END IF;
8213:
8214: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
8215: OR l_valid_status <> 'Y' THEN
8216: RAISE fnd_api.g_exc_error;
8217: END IF;
8218:
8219: /* Invoke auto_detail_line to create detailed level reservations */
8220: gme_api_main.auto_detail_line
8217: END IF;
8218:
8219: /* Invoke auto_detail_line to create detailed level reservations */
8220: gme_api_main.auto_detail_line
8221: (p_init_msg_list => fnd_api.g_false
8222: ,p_material_detail_rec => l_material_details_rec
8223: ,x_message_count => x_message_count
8224: ,x_message_list => x_message_list
8225: ,x_return_status => x_return_status);
8229: ' Return status from GME_API_MAIN.Auto_Detail_Line is '
8230: || x_return_status);
8231: END IF;
8232:
8233: IF x_return_status <> fnd_api.g_ret_sts_success THEN
8234: RAISE auto_detail_error;
8235: END IF;
8236:
8237: /* COMMIT handling */
8234: RAISE auto_detail_error;
8235: END IF;
8236:
8237: /* COMMIT handling */
8238: IF p_commit = fnd_api.g_true THEN
8239: COMMIT;
8240: END IF;
8241:
8242: IF g_debug <= gme_debug.g_log_procedure THEN
8250: EXCEPTION
8251: WHEN auto_detail_error THEN
8252: ROLLBACK TO SAVEPOINT auto_detail_line;
8253: gme_common_pvt.count_and_get (x_count => x_message_count
8254: ,p_encoded => fnd_api.g_false
8255: ,x_data => x_message_list);
8256: WHEN fnd_api.g_exc_error THEN
8257: x_return_status := fnd_api.g_ret_sts_error;
8258: ROLLBACK TO SAVEPOINT auto_detail_line;
8252: ROLLBACK TO SAVEPOINT auto_detail_line;
8253: gme_common_pvt.count_and_get (x_count => x_message_count
8254: ,p_encoded => fnd_api.g_false
8255: ,x_data => x_message_list);
8256: WHEN fnd_api.g_exc_error THEN
8257: x_return_status := fnd_api.g_ret_sts_error;
8258: ROLLBACK TO SAVEPOINT auto_detail_line;
8259: gme_common_pvt.count_and_get (x_count => x_message_count
8260: ,p_encoded => fnd_api.g_false
8253: gme_common_pvt.count_and_get (x_count => x_message_count
8254: ,p_encoded => fnd_api.g_false
8255: ,x_data => x_message_list);
8256: WHEN fnd_api.g_exc_error THEN
8257: x_return_status := fnd_api.g_ret_sts_error;
8258: ROLLBACK TO SAVEPOINT auto_detail_line;
8259: gme_common_pvt.count_and_get (x_count => x_message_count
8260: ,p_encoded => fnd_api.g_false
8261: ,x_data => x_message_list);
8256: WHEN fnd_api.g_exc_error THEN
8257: x_return_status := fnd_api.g_ret_sts_error;
8258: ROLLBACK TO SAVEPOINT auto_detail_line;
8259: gme_common_pvt.count_and_get (x_count => x_message_count
8260: ,p_encoded => fnd_api.g_false
8261: ,x_data => x_message_list);
8262: WHEN OTHERS THEN
8263: ROLLBACK TO SAVEPOINT auto_detail_line;
8264: gme_when_others ( p_api_name => l_api_name
8268: END auto_detail_line;
8269:
8270: /*************************************************************************/
8271: PROCEDURE auto_detail_batch (p_api_version IN NUMBER := 2.0
8272: ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
8273: ,p_commit IN VARCHAR2 := FND_API.G_FALSE
8274: ,x_message_count OUT NOCOPY NUMBER
8275: ,x_message_list OUT NOCOPY VARCHAR2
8276: ,x_return_status OUT NOCOPY VARCHAR2
8269:
8270: /*************************************************************************/
8271: PROCEDURE auto_detail_batch (p_api_version IN NUMBER := 2.0
8272: ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
8273: ,p_commit IN VARCHAR2 := FND_API.G_FALSE
8274: ,x_message_count OUT NOCOPY NUMBER
8275: ,x_message_list OUT NOCOPY VARCHAR2
8276: ,x_return_status OUT NOCOPY VARCHAR2
8277: ,p_org_code IN VARCHAR2
8294: /* Set the savepoint */
8295: SAVEPOINT auto_detail_batch;
8296:
8297: /* Set the return status to success initially */
8298: x_return_status := FND_API.G_RET_STS_SUCCESS;
8299:
8300: IF p_init_msg_list = FND_API.G_TRUE THEN
8301: fnd_msg_pub.initialize;
8302: END IF;
8296:
8297: /* Set the return status to success initially */
8298: x_return_status := FND_API.G_RET_STS_SUCCESS;
8299:
8300: IF p_init_msg_list = FND_API.G_TRUE THEN
8301: fnd_msg_pub.initialize;
8302: END IF;
8303:
8304: IF NOT FND_API.compatible_api_call(2.0
8300: IF p_init_msg_list = FND_API.G_TRUE THEN
8301: fnd_msg_pub.initialize;
8302: END IF;
8303:
8304: IF NOT FND_API.compatible_api_call(2.0
8305: ,p_api_version
8306: ,'auto_detail_batch'
8307: ,g_pkg_name ) THEN
8308: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8305: ,p_api_version
8306: ,'auto_detail_batch'
8307: ,g_pkg_name ) THEN
8308: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8309: RAISE fnd_api.g_exc_error;
8310: END IF;
8311:
8312: IF g_debug <= gme_debug.g_log_statement THEN
8313: gme_debug.put_line( g_pkg_name
8331: gme_common_pvt.setup (p_org_id => l_batch_header_rec.organization_id,
8332: p_org_code => p_org_code);
8333:
8334: IF NOT gme_common_pvt.g_setup_done THEN
8335: RAISE fnd_api.g_exc_error;
8336: ELSE
8337: l_batch_rec.organization_id := gme_common_pvt.g_organization_id;
8338: IF g_debug <= gme_debug.g_log_statement THEN
8339: gme_debug.put_line( g_pkg_name
8350: END IF;
8351:
8352: IF (NOT gme_batch_header_dbl.fetch_row (l_batch_rec,
8353: l_batch_header_rec) ) THEN
8354: RAISE fnd_api.g_exc_error;
8355: END IF;
8356:
8357: /* Validate for organization */
8358: IF (l_batch_header_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
8357: /* Validate for organization */
8358: IF (l_batch_header_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
8359: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
8360: fnd_msg_pub.ADD;
8361: RAISE fnd_api.g_exc_error;
8362: END IF;
8363:
8364: /* Check setup is done. For all profile/parameter values based on orgn_code/organization_id. */
8365: gme_common_pvt.g_setup_done :=
8366: gme_common_pvt.setup (p_org_id => l_batch_header_rec.organization_id,
8367: p_org_code => p_org_code);
8368:
8369: IF NOT gme_common_pvt.g_setup_done THEN
8370: RAISE fnd_api.g_exc_error;
8371: END IF;
8372:
8373: /* Verify that update_inventory is permitted for this batch */
8374: IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
8372:
8373: /* Verify that update_inventory is permitted for this batch */
8374: IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
8375: gme_common_pvt.log_message ('GME_INVENTORY_UPDATE_BLOCKED');
8376: RAISE fnd_api.g_exc_error;
8377: END IF;
8378:
8379: /* Verify Batch to be in pending or WIP status */
8380: IF l_batch_header_rec.batch_status NOT IN
8379: /* Verify Batch to be in pending or WIP status */
8380: IF l_batch_header_rec.batch_status NOT IN
8381: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
8382: gme_common_pvt.log_message ('GME_INVALID_BATCH_STATUS','PROCESS','AUTO_DETAIL_BATCH');
8383: RAISE fnd_api.g_exc_error;
8384: END IF;
8385:
8386: /* Reservations not permitted for FPOs */
8387: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
8385:
8386: /* Reservations not permitted for FPOs */
8387: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
8388: gme_common_pvt.log_message ('GME_FPO_RESERVATION_ERROR');
8389: RAISE fnd_api.g_exc_error;
8390: END IF;
8391:
8392: gme_common_pvt.set_timestamp;
8393:
8391:
8392: gme_common_pvt.set_timestamp;
8393:
8394: /* Invoke auto_detail_batch to create detailed level reservations */
8395: GME_API_MAIN.Auto_Detail_Batch(p_init_msg_list => FND_API.G_FALSE
8396: ,x_message_count => x_message_count
8397: ,x_message_list => x_message_list
8398: ,x_return_status => x_return_status
8399: ,p_batch_rec => l_batch_header_rec);
8405: ||' Return status from GME_API_MAIN.Auto_Detail_Batch is '
8406: ||x_return_status);
8407: END IF;
8408:
8409: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8410: RAISE auto_detail_error;
8411: END IF;
8412:
8413: /* COMMIT handling */
8410: RAISE auto_detail_error;
8411: END IF;
8412:
8413: /* COMMIT handling */
8414: IF p_commit = FND_API.G_TRUE THEN
8415: COMMIT;
8416: END IF;
8417:
8418: IF g_debug <= gme_debug.g_log_procedure THEN
8427: EXCEPTION
8428: WHEN auto_detail_error THEN
8429: ROLLBACK TO SAVEPOINT auto_detail_batch;
8430: gme_common_pvt.count_and_get(x_count => x_message_count,
8431: p_encoded => FND_API.g_false,
8432: x_data => x_message_list);
8433: WHEN fnd_api.g_exc_error THEN
8434: x_return_status := FND_API.g_ret_sts_error;
8435: ROLLBACK TO SAVEPOINT auto_detail_batch;
8429: ROLLBACK TO SAVEPOINT auto_detail_batch;
8430: gme_common_pvt.count_and_get(x_count => x_message_count,
8431: p_encoded => FND_API.g_false,
8432: x_data => x_message_list);
8433: WHEN fnd_api.g_exc_error THEN
8434: x_return_status := FND_API.g_ret_sts_error;
8435: ROLLBACK TO SAVEPOINT auto_detail_batch;
8436: gme_common_pvt.count_and_get(x_count => x_message_count,
8437: p_encoded => FND_API.g_false,
8430: gme_common_pvt.count_and_get(x_count => x_message_count,
8431: p_encoded => FND_API.g_false,
8432: x_data => x_message_list);
8433: WHEN fnd_api.g_exc_error THEN
8434: x_return_status := FND_API.g_ret_sts_error;
8435: ROLLBACK TO SAVEPOINT auto_detail_batch;
8436: gme_common_pvt.count_and_get(x_count => x_message_count,
8437: p_encoded => FND_API.g_false,
8438: x_data => x_message_list);
8433: WHEN fnd_api.g_exc_error THEN
8434: x_return_status := FND_API.g_ret_sts_error;
8435: ROLLBACK TO SAVEPOINT auto_detail_batch;
8436: gme_common_pvt.count_and_get(x_count => x_message_count,
8437: p_encoded => FND_API.g_false,
8438: x_data => x_message_list);
8439: WHEN OTHERS THEN
8440: ROLLBACK TO SAVEPOINT auto_detail_batch;
8441: gme_when_others ( p_api_name => l_api_name
8474: p_api_version IN NUMBER ,
8475: p_validation_level IN NUMBER
8476: := gme_common_pvt.g_max_errors,
8477: p_init_msg_list IN VARCHAR2
8478: DEFAULT fnd_api.g_false,
8479: p_commit IN VARCHAR2
8480: DEFAULT fnd_api.g_false,
8481: p_org_code IN VARCHAR2,
8482: p_batchstep_activity_rec IN gme_batch_step_activities%ROWTYPE,
8476: := gme_common_pvt.g_max_errors,
8477: p_init_msg_list IN VARCHAR2
8478: DEFAULT fnd_api.g_false,
8479: p_commit IN VARCHAR2
8480: DEFAULT fnd_api.g_false,
8481: p_org_code IN VARCHAR2,
8482: p_batchstep_activity_rec IN gme_batch_step_activities%ROWTYPE,
8483: p_batchstep_resource_tbl IN gme_create_step_pvt.resources_tab,
8484: p_batch_no IN VARCHAR2 := NULL,
8483: p_batchstep_resource_tbl IN gme_create_step_pvt.resources_tab,
8484: p_batch_no IN VARCHAR2 := NULL,
8485: p_batchstep_no IN NUMBER := NULL,
8486: p_ignore_qty_below_cap IN VARCHAR2
8487: DEFAULT fnd_api.g_false,
8488: p_validate_flexfield IN VARCHAR2
8489: DEFAULT fnd_api.g_false,
8490: x_batchstep_activity_rec OUT NOCOPY gme_batch_step_activities%ROWTYPE,
8491: x_message_count OUT NOCOPY NUMBER,
8485: p_batchstep_no IN NUMBER := NULL,
8486: p_ignore_qty_below_cap IN VARCHAR2
8487: DEFAULT fnd_api.g_false,
8488: p_validate_flexfield IN VARCHAR2
8489: DEFAULT fnd_api.g_false,
8490: x_batchstep_activity_rec OUT NOCOPY gme_batch_step_activities%ROWTYPE,
8491: x_message_count OUT NOCOPY NUMBER,
8492: x_message_list OUT NOCOPY VARCHAR2,
8493: x_return_status OUT NOCOPY VARCHAR2
8509: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
8510: || l_api_name);
8511: END IF;
8512:
8513: IF (fnd_api.to_boolean (p_init_msg_list))
8514: THEN
8515: fnd_msg_pub.initialize;
8516: gme_common_pvt.g_error_count := 0;
8517: END IF;
8516: gme_common_pvt.g_error_count := 0;
8517: END IF;
8518:
8519: -- Standard call to check for call compatibility.
8520: IF NOT fnd_api.compatible_api_call (2.0,
8521: p_api_version,
8522: l_api_name,
8523: g_pkg_name
8524: ) THEN
8522: l_api_name,
8523: g_pkg_name
8524: ) THEN
8525: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8526: RAISE fnd_api.g_exc_error;
8527: END IF;
8528:
8529: /* Set the return status to success initially */
8530: x_return_status := fnd_api.g_ret_sts_success;
8526: RAISE fnd_api.g_exc_error;
8527: END IF;
8528:
8529: /* Set the return status to success initially */
8530: x_return_status := fnd_api.g_ret_sts_success;
8531: --added by qzeng no need to check if done in bulk validation
8532: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
8533: /* Setup the common constants used accross the apis */
8534: IF (NOT gme_common_pvt.setup (p_org_id => NULL,
8533: /* Setup the common constants used accross the apis */
8534: IF (NOT gme_common_pvt.setup (p_org_id => NULL,
8535: p_org_code => p_org_code)
8536: )THEN
8537: RAISE fnd_api.g_exc_error;
8538: END IF;
8539: END IF;
8540: --FPBug#4395561 Start setting global flex validate variable
8541: IF p_validate_flexfield = FND_API.G_TRUE THEN
8537: RAISE fnd_api.g_exc_error;
8538: END IF;
8539: END IF;
8540: --FPBug#4395561 Start setting global flex validate variable
8541: IF p_validate_flexfield = FND_API.G_TRUE THEN
8542: gme_common_pvt.g_flex_validate_prof := 1;
8543: ELSE
8544: gme_common_pvt.g_flex_validate_prof := 0;
8545: END IF;
8558: );
8559: --FPBug#4395561 resetting global flex field validate
8560: gme_common_pvt.g_flex_validate_prof := 0;
8561:
8562: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
8563: RAISE insert_activity_failed;
8564: END IF;
8565:
8566: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8563: RAISE insert_activity_failed;
8564: END IF;
8565:
8566: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8567: IF p_commit = fnd_api.g_true THEN
8568: gme_api_pub.save_batch (p_commit => p_commit
8569: ,x_return_status => x_return_status);
8570:
8571: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8567: IF p_commit = fnd_api.g_true THEN
8568: gme_api_pub.save_batch (p_commit => p_commit
8569: ,x_return_status => x_return_status);
8570:
8571: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8572: RAISE fnd_api.g_exc_error;
8573: END IF;
8574: END IF;
8575:
8568: gme_api_pub.save_batch (p_commit => p_commit
8569: ,x_return_status => x_return_status);
8570:
8571: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8572: RAISE fnd_api.g_exc_error;
8573: END IF;
8574: END IF;
8575:
8576: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8574: END IF;
8575:
8576: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8577:
8578: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8579: -- COMMIT WORK;
8580: -- ELSE
8581: -- RAISE fnd_api.g_exc_error;
8582: -- END IF;
8577:
8578: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8579: -- COMMIT WORK;
8580: -- ELSE
8581: -- RAISE fnd_api.g_exc_error;
8582: -- END IF;
8583:
8584: gme_common_pvt.count_and_get (x_count => x_message_count,
8585: p_encoded => fnd_api.g_false,
8581: -- RAISE fnd_api.g_exc_error;
8582: -- END IF;
8583:
8584: gme_common_pvt.count_and_get (x_count => x_message_count,
8585: p_encoded => fnd_api.g_false,
8586: x_data => x_message_list
8587: );
8588:
8589: IF g_debug <= gme_debug.g_log_procedure THEN
8593: EXCEPTION
8594: WHEN insert_activity_failed THEN
8595: ROLLBACK TO SAVEPOINT insert_activity_pub;
8596: gme_common_pvt.count_and_get (x_count => x_message_count,
8597: p_encoded => fnd_api.g_false,
8598: x_data => x_message_list
8599: );
8600: WHEN fnd_api.g_exc_error THEN
8601: ROLLBACK TO SAVEPOINT insert_activity_pub;
8596: gme_common_pvt.count_and_get (x_count => x_message_count,
8597: p_encoded => fnd_api.g_false,
8598: x_data => x_message_list
8599: );
8600: WHEN fnd_api.g_exc_error THEN
8601: ROLLBACK TO SAVEPOINT insert_activity_pub;
8602: x_return_status := fnd_api.g_ret_sts_error;
8603: gme_common_pvt.count_and_get (x_count => x_message_count,
8604: p_encoded => fnd_api.g_false,
8598: x_data => x_message_list
8599: );
8600: WHEN fnd_api.g_exc_error THEN
8601: ROLLBACK TO SAVEPOINT insert_activity_pub;
8602: x_return_status := fnd_api.g_ret_sts_error;
8603: gme_common_pvt.count_and_get (x_count => x_message_count,
8604: p_encoded => fnd_api.g_false,
8605: x_data => x_message_list
8606: );
8600: WHEN fnd_api.g_exc_error THEN
8601: ROLLBACK TO SAVEPOINT insert_activity_pub;
8602: x_return_status := fnd_api.g_ret_sts_error;
8603: gme_common_pvt.count_and_get (x_count => x_message_count,
8604: p_encoded => fnd_api.g_false,
8605: x_data => x_message_list
8606: );
8607: WHEN OTHERS THEN
8608: ROLLBACK TO SAVEPOINT insert_activity_pub;
8637: p_api_version IN NUMBER ,
8638: p_validation_level IN NUMBER
8639: := gme_common_pvt.g_max_errors,
8640: p_init_msg_list IN VARCHAR2
8641: DEFAULT fnd_api.g_false,
8642: p_commit IN VARCHAR2
8643: DEFAULT fnd_api.g_false,
8644: p_org_code IN VARCHAR2,
8645: p_batchstep_activity_rec IN gme_batch_step_activities%ROWTYPE,
8639: := gme_common_pvt.g_max_errors,
8640: p_init_msg_list IN VARCHAR2
8641: DEFAULT fnd_api.g_false,
8642: p_commit IN VARCHAR2
8643: DEFAULT fnd_api.g_false,
8644: p_org_code IN VARCHAR2,
8645: p_batchstep_activity_rec IN gme_batch_step_activities%ROWTYPE,
8646: p_batch_no IN VARCHAR2 := NULL,
8647: p_batchstep_no IN NUMBER := NULL,
8645: p_batchstep_activity_rec IN gme_batch_step_activities%ROWTYPE,
8646: p_batch_no IN VARCHAR2 := NULL,
8647: p_batchstep_no IN NUMBER := NULL,
8648: p_validate_flexfield IN VARCHAR2
8649: DEFAULT fnd_api.g_false,
8650: x_batchstep_activity_rec OUT NOCOPY gme_batch_step_activities%ROWTYPE,
8651: x_message_count OUT NOCOPY NUMBER,
8652: x_message_list OUT NOCOPY VARCHAR2,
8653: x_return_status OUT NOCOPY VARCHAR2
8666: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
8667: || l_api_name);
8668: END IF;
8669:
8670: IF (fnd_api.to_boolean (p_init_msg_list)) THEN
8671: fnd_msg_pub.initialize;
8672: gme_common_pvt.g_error_count := 0;
8673: END IF;
8674:
8672: gme_common_pvt.g_error_count := 0;
8673: END IF;
8674:
8675: -- Standard call to check for call compatibility.
8676: IF NOT fnd_api.compatible_api_call (2.0,
8677: p_api_version,
8678: l_api_name,
8679: g_pkg_name
8680: ) THEN
8678: l_api_name,
8679: g_pkg_name
8680: ) THEN
8681: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8682: RAISE fnd_api.g_exc_error;
8683: END IF;
8684:
8685: /* Set the return status to success initially */
8686: x_return_status := fnd_api.g_ret_sts_success;
8682: RAISE fnd_api.g_exc_error;
8683: END IF;
8684:
8685: /* Set the return status to success initially */
8686: x_return_status := fnd_api.g_ret_sts_success;
8687:
8688: --added by qzeng no need to check if done in bulk validation
8689: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
8690: /* Setup the common constants used accross the apis */
8689: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
8690: /* Setup the common constants used accross the apis */
8691: IF (NOT gme_common_pvt.setup (p_org_id => NULL,
8692: p_org_code => p_org_code)) THEN
8693: RAISE fnd_api.g_exc_error;
8694: END IF;
8695: END IF;
8696: --FPBug#4395561 Start setting global flex validate variable
8697: IF p_validate_flexfield = FND_API.G_TRUE THEN
8693: RAISE fnd_api.g_exc_error;
8694: END IF;
8695: END IF;
8696: --FPBug#4395561 Start setting global flex validate variable
8697: IF p_validate_flexfield = FND_API.G_TRUE THEN
8698: gme_common_pvt.g_flex_validate_prof := 1;
8699: ELSE
8700: gme_common_pvt.g_flex_validate_prof := 0;
8701: END IF;
8712: );
8713: --FPBug#4395561 resetting global flex-field validate variable
8714: gme_common_pvt.g_flex_validate_prof := 0;
8715:
8716: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
8717: RAISE update_activity_failed;
8718: END IF;
8719:
8720: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8717: RAISE update_activity_failed;
8718: END IF;
8719:
8720: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8721: IF p_commit = fnd_api.g_true THEN
8722: gme_api_pub.save_batch (p_commit => p_commit
8723: ,x_return_status => x_return_status);
8724:
8725: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8721: IF p_commit = fnd_api.g_true THEN
8722: gme_api_pub.save_batch (p_commit => p_commit
8723: ,x_return_status => x_return_status);
8724:
8725: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8726: RAISE fnd_api.g_exc_error;
8727: END IF;
8728: END IF;
8729:
8722: gme_api_pub.save_batch (p_commit => p_commit
8723: ,x_return_status => x_return_status);
8724:
8725: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8726: RAISE fnd_api.g_exc_error;
8727: END IF;
8728: END IF;
8729:
8730: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8728: END IF;
8729:
8730: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8731:
8732: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8733: -- COMMIT WORK;
8734: -- ELSE
8735: -- RAISE fnd_api.g_exc_error;
8736: -- END IF;
8731:
8732: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8733: -- COMMIT WORK;
8734: -- ELSE
8735: -- RAISE fnd_api.g_exc_error;
8736: -- END IF;
8737:
8738: gme_common_pvt.count_and_get (x_count => x_message_count,
8739: p_encoded => fnd_api.g_false,
8735: -- RAISE fnd_api.g_exc_error;
8736: -- END IF;
8737:
8738: gme_common_pvt.count_and_get (x_count => x_message_count,
8739: p_encoded => fnd_api.g_false,
8740: x_data => x_message_list
8741: );
8742: IF g_debug <= gme_debug.g_log_procedure THEN
8743: gme_debug.put_line ( 'Completed ' || l_api_name || ' at '
8746: EXCEPTION
8747: WHEN update_activity_failed THEN
8748: ROLLBACK TO SAVEPOINT update_activity_pub;
8749: gme_common_pvt.count_and_get (x_count => x_message_count,
8750: p_encoded => fnd_api.g_false,
8751: x_data => x_message_list
8752: );
8753: WHEN fnd_api.g_exc_error THEN
8754: ROLLBACK TO SAVEPOINT update_activity_pub;
8749: gme_common_pvt.count_and_get (x_count => x_message_count,
8750: p_encoded => fnd_api.g_false,
8751: x_data => x_message_list
8752: );
8753: WHEN fnd_api.g_exc_error THEN
8754: ROLLBACK TO SAVEPOINT update_activity_pub;
8755: x_return_status := fnd_api.g_ret_sts_error;
8756: gme_common_pvt.count_and_get (x_count => x_message_count,
8757: p_encoded => fnd_api.g_false,
8751: x_data => x_message_list
8752: );
8753: WHEN fnd_api.g_exc_error THEN
8754: ROLLBACK TO SAVEPOINT update_activity_pub;
8755: x_return_status := fnd_api.g_ret_sts_error;
8756: gme_common_pvt.count_and_get (x_count => x_message_count,
8757: p_encoded => fnd_api.g_false,
8758: x_data => x_message_list
8759: );
8753: WHEN fnd_api.g_exc_error THEN
8754: ROLLBACK TO SAVEPOINT update_activity_pub;
8755: x_return_status := fnd_api.g_ret_sts_error;
8756: gme_common_pvt.count_and_get (x_count => x_message_count,
8757: p_encoded => fnd_api.g_false,
8758: x_data => x_message_list
8759: );
8760: WHEN OTHERS THEN
8761: ROLLBACK TO SAVEPOINT update_activity_pub;
8788: p_api_version IN NUMBER := 2.0,
8789: p_validation_level IN NUMBER
8790: := gme_common_pvt.g_max_errors,
8791: p_init_msg_list IN VARCHAR2
8792: DEFAULT fnd_api.g_false,
8793: p_commit IN VARCHAR2
8794: DEFAULT fnd_api.g_false,
8795: p_org_code IN VARCHAR2,
8796: p_batchstep_activity_id IN NUMBER := NULL,
8790: := gme_common_pvt.g_max_errors,
8791: p_init_msg_list IN VARCHAR2
8792: DEFAULT fnd_api.g_false,
8793: p_commit IN VARCHAR2
8794: DEFAULT fnd_api.g_false,
8795: p_org_code IN VARCHAR2,
8796: p_batchstep_activity_id IN NUMBER := NULL,
8797: p_batch_no IN VARCHAR2 := NULL,
8798: p_batchstep_no IN NUMBER := NULL,
8817: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
8818: || l_api_name);
8819: END IF;
8820:
8821: IF (fnd_api.to_boolean (p_init_msg_list))
8822: THEN
8823: fnd_msg_pub.initialize;
8824: gme_common_pvt.g_error_count := 0;
8825: END IF;
8824: gme_common_pvt.g_error_count := 0;
8825: END IF;
8826:
8827: -- Standard call to check for call compatibility.
8828: IF NOT fnd_api.compatible_api_call (2.0,
8829: p_api_version,
8830: l_api_name,
8831: g_pkg_name) THEN
8832: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8829: p_api_version,
8830: l_api_name,
8831: g_pkg_name) THEN
8832: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8833: RAISE fnd_api.g_exc_error;
8834: END IF;
8835:
8836: /* Set the return status to success initially */
8837: x_return_status := fnd_api.g_ret_sts_success;
8833: RAISE fnd_api.g_exc_error;
8834: END IF;
8835:
8836: /* Set the return status to success initially */
8837: x_return_status := fnd_api.g_ret_sts_success;
8838:
8839: --added by qzeng no need to check if done in bulk validation
8840: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
8841: /* Setup the common constants used accross the apis */
8840: IF NVL(gme_common_pvt.g_bulk_validation_done, 'N') = 'N' THEN
8841: /* Setup the common constants used accross the apis */
8842: IF (NOT gme_common_pvt.setup (p_org_id => NULL,
8843: p_org_code => p_org_code)) THEN
8844: RAISE fnd_api.g_exc_error;
8845: END IF;
8846: END IF;
8847: gme_common_pvt.set_timestamp;
8848: gme_batchstep_act_pvt.delete_batchstep_activity (p_batchstep_activity_id => p_batchstep_activity_id,
8851: p_batchstep_no => p_batchstep_no,
8852: p_activity => p_activity,
8853: x_return_status => x_return_status
8854: );
8855: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
8856: RAISE delete_activity_failed;
8857: END IF;
8858:
8859: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8856: RAISE delete_activity_failed;
8857: END IF;
8858:
8859: -- Bug 13072622 Conditionalize call to save batch using p_commit value.
8860: IF p_commit = fnd_api.g_true THEN
8861: gme_api_pub.save_batch (p_commit => p_commit
8862: ,x_return_status => x_return_status);
8863:
8864: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8860: IF p_commit = fnd_api.g_true THEN
8861: gme_api_pub.save_batch (p_commit => p_commit
8862: ,x_return_status => x_return_status);
8863:
8864: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8865: RAISE fnd_api.g_exc_error;
8866: END IF;
8867: END IF;
8868:
8861: gme_api_pub.save_batch (p_commit => p_commit
8862: ,x_return_status => x_return_status);
8863:
8864: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8865: RAISE fnd_api.g_exc_error;
8866: END IF;
8867: END IF;
8868:
8869: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8867: END IF;
8868:
8869: -- gme_api_pub.save_batch (x_return_status => x_return_status);
8870:
8871: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8872: -- COMMIT WORK;
8873: -- ELSE
8874: -- RAISE fnd_api.g_exc_error;
8875: -- END IF;
8870:
8871: -- IF (x_return_status = fnd_api.g_ret_sts_success) THEN
8872: -- COMMIT WORK;
8873: -- ELSE
8874: -- RAISE fnd_api.g_exc_error;
8875: -- END IF;
8876:
8877: gme_common_pvt.count_and_get (x_count => x_message_count,
8878: p_encoded => fnd_api.g_false,
8874: -- RAISE fnd_api.g_exc_error;
8875: -- END IF;
8876:
8877: gme_common_pvt.count_and_get (x_count => x_message_count,
8878: p_encoded => fnd_api.g_false,
8879: x_data => x_message_list
8880: );
8881:
8882: IF g_debug <= gme_debug.g_log_procedure THEN
8886: EXCEPTION
8887: WHEN delete_activity_failed THEN
8888: ROLLBACK TO SAVEPOINT delete_activity_pub;
8889: gme_common_pvt.count_and_get (x_count => x_message_count,
8890: p_encoded => fnd_api.g_false,
8891: x_data => x_message_list
8892: );
8893: WHEN fnd_api.g_exc_error THEN
8894: ROLLBACK TO SAVEPOINT delete_activity_pub;
8889: gme_common_pvt.count_and_get (x_count => x_message_count,
8890: p_encoded => fnd_api.g_false,
8891: x_data => x_message_list
8892: );
8893: WHEN fnd_api.g_exc_error THEN
8894: ROLLBACK TO SAVEPOINT delete_activity_pub;
8895: x_return_status := fnd_api.g_ret_sts_error;
8896: gme_common_pvt.count_and_get (x_count => x_message_count,
8897: p_encoded => fnd_api.g_false,
8891: x_data => x_message_list
8892: );
8893: WHEN fnd_api.g_exc_error THEN
8894: ROLLBACK TO SAVEPOINT delete_activity_pub;
8895: x_return_status := fnd_api.g_ret_sts_error;
8896: gme_common_pvt.count_and_get (x_count => x_message_count,
8897: p_encoded => fnd_api.g_false,
8898: x_data => x_message_list
8899: );
8893: WHEN fnd_api.g_exc_error THEN
8894: ROLLBACK TO SAVEPOINT delete_activity_pub;
8895: x_return_status := fnd_api.g_ret_sts_error;
8896: gme_common_pvt.count_and_get (x_count => x_message_count,
8897: p_encoded => fnd_api.g_false,
8898: x_data => x_message_list
8899: );
8900: WHEN OTHERS THEN
8901: ROLLBACK TO SAVEPOINT delete_activity_pub;
8908: /*************************************************************************/
8909: PROCEDURE convert_fpo (
8910: p_api_version IN NUMBER := 2.0,
8911: p_validation_level IN NUMBER := gme_common_pvt.g_max_errors,
8912: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
8913: p_commit IN VARCHAR2 := fnd_api.g_false,
8914: x_message_count OUT NOCOPY NUMBER,
8915: x_message_list OUT NOCOPY VARCHAR2,
8916: p_enforce_vldt_check IN VARCHAR2 := fnd_api.g_true,
8909: PROCEDURE convert_fpo (
8910: p_api_version IN NUMBER := 2.0,
8911: p_validation_level IN NUMBER := gme_common_pvt.g_max_errors,
8912: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
8913: p_commit IN VARCHAR2 := fnd_api.g_false,
8914: x_message_count OUT NOCOPY NUMBER,
8915: x_message_list OUT NOCOPY VARCHAR2,
8916: p_enforce_vldt_check IN VARCHAR2 := fnd_api.g_true,
8917: x_return_status OUT NOCOPY VARCHAR2,
8912: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
8913: p_commit IN VARCHAR2 := fnd_api.g_false,
8914: x_message_count OUT NOCOPY NUMBER,
8915: x_message_list OUT NOCOPY VARCHAR2,
8916: p_enforce_vldt_check IN VARCHAR2 := fnd_api.g_true,
8917: x_return_status OUT NOCOPY VARCHAR2,
8918: p_org_code IN VARCHAR2 := NULL,
8919: p_batch_header IN gme_batch_header%ROWTYPE,
8920: x_batch_header OUT NOCOPY gme_batch_header%ROWTYPE,
8926: p_batch_offset IN NUMBER DEFAULT 0,
8927: p_offset_type IN NUMBER DEFAULT 0,
8928: p_plan_start_date IN gme_batch_header.plan_start_date%TYPE,
8929: p_plan_cmplt_date IN gme_batch_header.plan_cmplt_date%TYPE,
8930: p_use_shop_cal IN VARCHAR2 := fnd_api.g_false,
8931: p_contiguity_override IN VARCHAR2 := fnd_api.g_true,
8932: p_use_for_all IN VARCHAR2 := fnd_api.g_true
8933: ) IS
8934: l_api_name CONSTANT VARCHAR2 (30) := 'CONVERT_FPO';
8927: p_offset_type IN NUMBER DEFAULT 0,
8928: p_plan_start_date IN gme_batch_header.plan_start_date%TYPE,
8929: p_plan_cmplt_date IN gme_batch_header.plan_cmplt_date%TYPE,
8930: p_use_shop_cal IN VARCHAR2 := fnd_api.g_false,
8931: p_contiguity_override IN VARCHAR2 := fnd_api.g_true,
8932: p_use_for_all IN VARCHAR2 := fnd_api.g_true
8933: ) IS
8934: l_api_name CONSTANT VARCHAR2 (30) := 'CONVERT_FPO';
8935: l_batch_header gme_batch_header%ROWTYPE;
8928: p_plan_start_date IN gme_batch_header.plan_start_date%TYPE,
8929: p_plan_cmplt_date IN gme_batch_header.plan_cmplt_date%TYPE,
8930: p_use_shop_cal IN VARCHAR2 := fnd_api.g_false,
8931: p_contiguity_override IN VARCHAR2 := fnd_api.g_true,
8932: p_use_for_all IN VARCHAR2 := fnd_api.g_true
8933: ) IS
8934: l_api_name CONSTANT VARCHAR2 (30) := 'CONVERT_FPO';
8935: l_batch_header gme_batch_header%ROWTYPE;
8936:
8948: || l_api_name);
8949: END IF;
8950:
8951: /* Set the return status to success initially */
8952: x_return_status := fnd_api.g_ret_sts_success;
8953:
8954: IF p_init_msg_list = fnd_api.g_true THEN
8955: fnd_msg_pub.initialize;
8956: END IF;
8950:
8951: /* Set the return status to success initially */
8952: x_return_status := fnd_api.g_ret_sts_success;
8953:
8954: IF p_init_msg_list = fnd_api.g_true THEN
8955: fnd_msg_pub.initialize;
8956: END IF;
8957:
8958: IF NOT fnd_api.compatible_api_call (2.0
8954: IF p_init_msg_list = fnd_api.g_true THEN
8955: fnd_msg_pub.initialize;
8956: END IF;
8957:
8958: IF NOT fnd_api.compatible_api_call (2.0
8959: ,p_api_version
8960: ,'convertFPO'
8961: ,g_pkg_name) THEN
8962: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8959: ,p_api_version
8960: ,'convertFPO'
8961: ,g_pkg_name) THEN
8962: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
8963: RAISE fnd_api.g_exc_error;
8964: END IF;
8965:
8966:
8967: IF (p_batch_header.organization_id IS NULL AND p_org_code IS NULL) THEN
8966:
8967: IF (p_batch_header.organization_id IS NULL AND p_org_code IS NULL) THEN
8968: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
8969: fnd_msg_pub.ADD;
8970: RAISE fnd_api.g_exc_error;
8971: END IF;
8972:
8973: /* Use local variable, so that user does not have to pass batch_type value 10 */
8974: l_batch_header := p_batch_header;
8979: p_batch_header => l_batch_header,
8980: x_return_status => x_return_status
8981: ) THEN
8982: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
8983: RAISE fnd_api.g_exc_error;
8984: ELSIF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8985: RAISE fnd_api.g_exc_error;
8986: END IF;
8987:
8980: x_return_status => x_return_status
8981: ) THEN
8982: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
8983: RAISE fnd_api.g_exc_error;
8984: ELSIF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8985: RAISE fnd_api.g_exc_error;
8986: END IF;
8987:
8988: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
8981: ) THEN
8982: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
8983: RAISE fnd_api.g_exc_error;
8984: ELSIF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8985: RAISE fnd_api.g_exc_error;
8986: END IF;
8987:
8988: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
8989: gme_debug.put_line (g_pkg_name ||
9000: gme_common_pvt.setup (p_org_id => l_batch_header.organization_id
9001: ,p_org_code => p_org_code);
9002:
9003: IF NOT gme_common_pvt.g_setup_done THEN
9004: RAISE fnd_api.g_exc_error;
9005: ELSE
9006: l_batch_header.organization_id := gme_common_pvt.g_organization_id;
9007: END IF;
9008:
9026: x_batch_header => x_batch_header,
9027: p_use_for_all => p_use_for_all
9028: );
9029:
9030: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
9031: IF p_commit = fnd_api.g_true THEN
9032: gme_api_pub.save_batch (p_header_id => NULL
9033: ,p_table => NULL
9034: ,p_commit => p_commit
9027: p_use_for_all => p_use_for_all
9028: );
9029:
9030: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
9031: IF p_commit = fnd_api.g_true THEN
9032: gme_api_pub.save_batch (p_header_id => NULL
9033: ,p_table => NULL
9034: ,p_commit => p_commit
9035: ,x_return_status => x_return_status);
9033: ,p_table => NULL
9034: ,p_commit => p_commit
9035: ,x_return_status => x_return_status);
9036:
9037: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9038: RAISE fnd_api.g_exc_error;
9039: ELSE
9040: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
9041: END IF;
9034: ,p_commit => p_commit
9035: ,x_return_status => x_return_status);
9036:
9037: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9038: RAISE fnd_api.g_exc_error;
9039: ELSE
9040: gme_common_pvt.log_message ('GME_API_BATCH_CREATED');
9041: END IF;
9042: END IF;
9044: RAISE convert_fpo_failed;
9045: END IF;
9046:
9047: gme_common_pvt.count_and_get (x_count => x_message_count,
9048: p_encoded => FND_API.g_false,
9049: x_data => x_message_list);
9050: IF g_debug <= gme_debug.g_log_procedure THEN
9051: gme_debug.put_line ( 'Completed ' || l_api_name || ' at ' || TO_CHAR
9052: (SYSDATE, 'MM/DD/YYYY HH24:MI:SS'));
9055: WHEN convert_fpo_failed THEN
9056: ROLLBACK TO SAVEPOINT convert_fpo;
9057: x_batch_header := NULL;
9058: gme_common_pvt.count_and_get (x_count => x_message_count,
9059: p_encoded => FND_API.g_false,
9060: x_data => x_message_list);
9061: WHEN fnd_api.g_exc_error THEN
9062: ROLLBACK TO SAVEPOINT convert_fpo;
9063: x_batch_header := NULL;
9057: x_batch_header := NULL;
9058: gme_common_pvt.count_and_get (x_count => x_message_count,
9059: p_encoded => FND_API.g_false,
9060: x_data => x_message_list);
9061: WHEN fnd_api.g_exc_error THEN
9062: ROLLBACK TO SAVEPOINT convert_fpo;
9063: x_batch_header := NULL;
9064: x_return_status := fnd_api.g_ret_sts_error;
9065: gme_common_pvt.count_and_get (x_count => x_message_count,
9060: x_data => x_message_list);
9061: WHEN fnd_api.g_exc_error THEN
9062: ROLLBACK TO SAVEPOINT convert_fpo;
9063: x_batch_header := NULL;
9064: x_return_status := fnd_api.g_ret_sts_error;
9065: gme_common_pvt.count_and_get (x_count => x_message_count,
9066: p_encoded => FND_API.g_false,
9067: x_data => x_message_list);
9068: WHEN OTHERS THEN
9062: ROLLBACK TO SAVEPOINT convert_fpo;
9063: x_batch_header := NULL;
9064: x_return_status := fnd_api.g_ret_sts_error;
9065: gme_common_pvt.count_and_get (x_count => x_message_count,
9066: p_encoded => FND_API.g_false,
9067: x_data => x_message_list);
9068: WHEN OTHERS THEN
9069: ROLLBACK TO SAVEPOINT convert_fpo;
9070: x_batch_header := NULL;
9119: PROCEDURE create_pending_product_lot
9120: (p_api_version IN NUMBER
9121: ,p_validation_level IN NUMBER
9122: := gme_common_pvt.g_max_errors
9123: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9124: ,p_commit IN VARCHAR2 := fnd_api.g_false
9125: ,x_message_count OUT NOCOPY NUMBER
9126: ,x_message_list OUT NOCOPY VARCHAR2
9127: ,x_return_status OUT NOCOPY VARCHAR2
9120: (p_api_version IN NUMBER
9121: ,p_validation_level IN NUMBER
9122: := gme_common_pvt.g_max_errors
9123: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9124: ,p_commit IN VARCHAR2 := fnd_api.g_false
9125: ,x_message_count OUT NOCOPY NUMBER
9126: ,x_message_list OUT NOCOPY VARCHAR2
9127: ,x_return_status OUT NOCOPY VARCHAR2
9128: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9126: ,x_message_list OUT NOCOPY VARCHAR2
9127: ,x_return_status OUT NOCOPY VARCHAR2
9128: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9129: ,p_org_code IN VARCHAR2
9130: ,p_create_lot IN VARCHAR2 := fnd_api.g_false
9131: ,p_generate_lot IN VARCHAR2 := fnd_api.g_false
9132: ,p_generate_parent_lot IN VARCHAR2 := fnd_api.g_false
9133: ,p_parent_lot IN mtl_lot_numbers.lot_number%TYPE := NULL
9134: ,p_material_detail_rec IN gme_material_details%ROWTYPE
9127: ,x_return_status OUT NOCOPY VARCHAR2
9128: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9129: ,p_org_code IN VARCHAR2
9130: ,p_create_lot IN VARCHAR2 := fnd_api.g_false
9131: ,p_generate_lot IN VARCHAR2 := fnd_api.g_false
9132: ,p_generate_parent_lot IN VARCHAR2 := fnd_api.g_false
9133: ,p_parent_lot IN mtl_lot_numbers.lot_number%TYPE := NULL
9134: ,p_material_detail_rec IN gme_material_details%ROWTYPE
9135: /* nsinghi bug#4486074 Added the p_expiration_dt parameter. */
9128: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9129: ,p_org_code IN VARCHAR2
9130: ,p_create_lot IN VARCHAR2 := fnd_api.g_false
9131: ,p_generate_lot IN VARCHAR2 := fnd_api.g_false
9132: ,p_generate_parent_lot IN VARCHAR2 := fnd_api.g_false
9133: ,p_parent_lot IN mtl_lot_numbers.lot_number%TYPE := NULL
9134: ,p_material_detail_rec IN gme_material_details%ROWTYPE
9135: /* nsinghi bug#4486074 Added the p_expiration_dt parameter. */
9136: ,p_expiration_date IN mtl_lot_numbers.expiration_date%TYPE := NULL
9157: || l_api_name);
9158: END IF;
9159:
9160: /* Set the return status to success initially */
9161: x_return_status := fnd_api.g_ret_sts_success;
9162:
9163: /* Set savepoint here */
9164: SAVEPOINT create_pending_product_lot;
9165:
9162:
9163: /* Set savepoint here */
9164: SAVEPOINT create_pending_product_lot;
9165:
9166: IF p_init_msg_list = fnd_api.g_true THEN
9167: fnd_msg_pub.initialize;
9168: END IF;
9169:
9170: IF NOT fnd_api.compatible_api_call (2.0
9166: IF p_init_msg_list = fnd_api.g_true THEN
9167: fnd_msg_pub.initialize;
9168: END IF;
9169:
9170: IF NOT fnd_api.compatible_api_call (2.0
9171: ,p_api_version
9172: ,'create_pending_prod_lot'
9173: ,g_pkg_name) THEN
9174: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9171: ,p_api_version
9172: ,'create_pending_prod_lot'
9173: ,g_pkg_name) THEN
9174: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9175: RAISE fnd_api.g_exc_error;
9176: END IF;
9177:
9178: l_batch_id := NVL(p_pending_product_lots_rec.batch_id,
9179: NVL(p_material_detail_rec.batch_id, p_batch_header_rec.batch_id));
9193: ,x_material_detail_rec => l_material_detail_rec
9194: ,x_message_count => x_message_count
9195: ,x_message_list => x_message_list
9196: ,x_return_status => x_return_status );
9197: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9198: IF (g_debug = gme_debug.g_log_statement) THEN
9199: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9200: || ': batch mateiral validate error ');
9201: END IF;
9198: IF (g_debug = gme_debug.g_log_statement) THEN
9199: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9200: || ': batch mateiral validate error ');
9201: END IF;
9202: RAISE fnd_api.g_exc_error;
9203: END IF;
9204:
9205: -- Validations
9206: gme_pending_product_lots_pvt.validate_material_for_create
9207: (p_batch_header_rec => l_batch_header_rec
9208: ,p_material_detail_rec => l_material_detail_rec
9209: ,x_return_status => x_return_status);
9210:
9211: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9212: RAISE fnd_api.g_exc_error;
9213: END IF;
9214:
9215: -- Bug 9482460 - Pass in the parent lot value.
9208: ,p_material_detail_rec => l_material_detail_rec
9209: ,x_return_status => x_return_status);
9210:
9211: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9212: RAISE fnd_api.g_exc_error;
9213: END IF;
9214:
9215: -- Bug 9482460 - Pass in the parent lot value.
9216: gme_pending_product_lots_pvt.validate_record_for_create
9224: ,x_return_status => x_return_status
9225: /* nsinghi bug#4486074 Added the following parameter. */
9226: ,p_expiration_date => p_expiration_date);
9227:
9228: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9229: RAISE fnd_api.g_exc_error;
9230: END IF;
9231:
9232: /* Invoke main */
9225: /* nsinghi bug#4486074 Added the following parameter. */
9226: ,p_expiration_date => p_expiration_date);
9227:
9228: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9229: RAISE fnd_api.g_exc_error;
9230: END IF;
9231:
9232: /* Invoke main */
9233: gme_api_main.create_pending_product_lot
9231:
9232: /* Invoke main */
9233: gme_api_main.create_pending_product_lot
9234: (p_validation_level => p_validation_level
9235: ,p_init_msg_list => fnd_api.g_false
9236: ,x_message_count => x_message_count
9237: ,x_message_list => x_message_list
9238: ,x_return_status => x_return_status
9239: ,p_org_id => l_batch_header_rec.organization_id
9249: || ' Return status from gme_api_main.create_pending_product_lot is '
9250: || x_return_status);
9251: END IF;
9252:
9253: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9254: RAISE error_create_pp_lot;
9255: END IF;
9256:
9257: -- Bug 8490219 - Only call save batch is commit is TRUE.
9254: RAISE error_create_pp_lot;
9255: END IF;
9256:
9257: -- Bug 8490219 - Only call save batch is commit is TRUE.
9258: IF p_commit = fnd_api.g_true THEN
9259: gme_api_pub.save_batch
9260: (p_header_id => gme_common_pvt.g_transaction_header_id
9261: ,p_table => 1
9262: ,p_commit => p_commit
9270: || ' Return status from gme_api_pub.save_batch is '
9271: || x_return_status);
9272: END IF;
9273:
9274: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9275: RAISE fnd_api.g_exc_error;
9276: END IF;
9277: END IF;
9278:
9271: || x_return_status);
9272: END IF;
9273:
9274: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9275: RAISE fnd_api.g_exc_error;
9276: END IF;
9277: END IF;
9278:
9279: IF g_debug <= gme_debug.g_log_procedure THEN
9286: EXCEPTION
9287: WHEN error_create_pp_lot THEN
9288: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9289: gme_common_pvt.count_and_get (x_count => x_message_count
9290: ,p_encoded => fnd_api.g_false
9291: ,x_data => x_message_list);
9292: WHEN fnd_api.g_exc_error THEN
9293: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9294: x_return_status := fnd_api.g_ret_sts_error;
9288: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9289: gme_common_pvt.count_and_get (x_count => x_message_count
9290: ,p_encoded => fnd_api.g_false
9291: ,x_data => x_message_list);
9292: WHEN fnd_api.g_exc_error THEN
9293: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9294: x_return_status := fnd_api.g_ret_sts_error;
9295: gme_common_pvt.count_and_get (x_count => x_message_count
9296: ,p_encoded => fnd_api.g_false
9290: ,p_encoded => fnd_api.g_false
9291: ,x_data => x_message_list);
9292: WHEN fnd_api.g_exc_error THEN
9293: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9294: x_return_status := fnd_api.g_ret_sts_error;
9295: gme_common_pvt.count_and_get (x_count => x_message_count
9296: ,p_encoded => fnd_api.g_false
9297: ,x_data => x_message_list);
9298: WHEN OTHERS THEN
9292: WHEN fnd_api.g_exc_error THEN
9293: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9294: x_return_status := fnd_api.g_ret_sts_error;
9295: gme_common_pvt.count_and_get (x_count => x_message_count
9296: ,p_encoded => fnd_api.g_false
9297: ,x_data => x_message_list);
9298: WHEN OTHERS THEN
9299: ROLLBACK TO SAVEPOINT create_pending_product_lot;
9300: gme_when_others ( p_api_name => l_api_name
9328: PROCEDURE update_pending_product_lot
9329: (p_api_version IN NUMBER
9330: ,p_validation_level IN NUMBER
9331: := gme_common_pvt.g_max_errors
9332: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9333: ,p_commit IN VARCHAR2 := fnd_api.g_false
9334: ,x_message_count OUT NOCOPY NUMBER
9335: ,x_message_list OUT NOCOPY VARCHAR2
9336: ,x_return_status OUT NOCOPY VARCHAR2
9329: (p_api_version IN NUMBER
9330: ,p_validation_level IN NUMBER
9331: := gme_common_pvt.g_max_errors
9332: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9333: ,p_commit IN VARCHAR2 := fnd_api.g_false
9334: ,x_message_count OUT NOCOPY NUMBER
9335: ,x_message_list OUT NOCOPY VARCHAR2
9336: ,x_return_status OUT NOCOPY VARCHAR2
9337: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9362: || l_api_name);
9363: END IF;
9364:
9365: /* Set the return status to success initially */
9366: x_return_status := fnd_api.g_ret_sts_success;
9367:
9368: /* Set savepoint here */
9369: SAVEPOINT update_pending_product_lot;
9370:
9367:
9368: /* Set savepoint here */
9369: SAVEPOINT update_pending_product_lot;
9370:
9371: IF p_init_msg_list = fnd_api.g_true THEN
9372: fnd_msg_pub.initialize;
9373: END IF;
9374:
9375: IF NOT fnd_api.compatible_api_call (2.0
9371: IF p_init_msg_list = fnd_api.g_true THEN
9372: fnd_msg_pub.initialize;
9373: END IF;
9374:
9375: IF NOT fnd_api.compatible_api_call (2.0
9376: ,p_api_version
9377: ,'update_pending_prod_lot'
9378: ,g_pkg_name) THEN
9379: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9376: ,p_api_version
9377: ,'update_pending_prod_lot'
9378: ,g_pkg_name) THEN
9379: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9380: RAISE fnd_api.g_exc_error;
9381: END IF;
9382:
9383: IF p_pending_product_lots_rec.pending_product_lot_id IS NOT NULL THEN
9384: IF NOT gme_pending_product_lots_dbl.fetch_row
9383: IF p_pending_product_lots_rec.pending_product_lot_id IS NOT NULL THEN
9384: IF NOT gme_pending_product_lots_dbl.fetch_row
9385: (p_pending_product_lots_rec => p_pending_product_lots_rec
9386: ,x_pending_product_lots_rec => l_db_pending_product_lots_rec) THEN
9387: x_return_status := fnd_api.g_ret_sts_error;
9388: RAISE fnd_api.g_exc_error;
9389: END IF;
9390:
9391: l_in_material_detail_rec.material_detail_id := l_db_pending_product_lots_rec.material_detail_id;
9384: IF NOT gme_pending_product_lots_dbl.fetch_row
9385: (p_pending_product_lots_rec => p_pending_product_lots_rec
9386: ,x_pending_product_lots_rec => l_db_pending_product_lots_rec) THEN
9387: x_return_status := fnd_api.g_ret_sts_error;
9388: RAISE fnd_api.g_exc_error;
9389: END IF;
9390:
9391: l_in_material_detail_rec.material_detail_id := l_db_pending_product_lots_rec.material_detail_id;
9392: l_in_material_detail_rec.batch_id := l_db_pending_product_lots_rec.batch_id;
9399: ,x_material_detail_rec => l_material_detail_rec
9400: ,x_message_count => x_message_count
9401: ,x_message_list => x_message_list
9402: ,x_return_status => x_return_status );
9403: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9404: IF (g_debug = gme_debug.g_log_statement) THEN
9405: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9406: || ': batch mateiral validate error ');
9407: END IF;
9404: IF (g_debug = gme_debug.g_log_statement) THEN
9405: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9406: || ': batch mateiral validate error ');
9407: END IF;
9408: RAISE fnd_api.g_exc_error;
9409: END IF;
9410:
9411: ELSE
9412: l_batch_id := NVL(p_pending_product_lots_rec.batch_id,
9427: ,x_material_detail_rec => l_material_detail_rec
9428: ,x_message_count => x_message_count
9429: ,x_message_list => x_message_list
9430: ,x_return_status => x_return_status );
9431: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9432: IF (g_debug = gme_debug.g_log_statement) THEN
9433: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9434: || ': batch mateiral validate error ');
9435: END IF;
9432: IF (g_debug = gme_debug.g_log_statement) THEN
9433: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9434: || ': batch mateiral validate error ');
9435: END IF;
9436: RAISE fnd_api.g_exc_error;
9437: END IF;
9438: END IF;
9439:
9440: -- Validations
9442: (p_batch_header_rec => l_batch_header_rec
9443: ,p_material_detail_rec => l_material_detail_rec
9444: ,x_return_status => x_return_status);
9445:
9446: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9447: RAISE fnd_api.g_exc_error;
9448: END IF;
9449:
9450: gme_pending_product_lots_pvt.validate_record_for_update
9443: ,p_material_detail_rec => l_material_detail_rec
9444: ,x_return_status => x_return_status);
9445:
9446: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9447: RAISE fnd_api.g_exc_error;
9448: END IF;
9449:
9450: gme_pending_product_lots_pvt.validate_record_for_update
9451: (p_material_detail_rec => l_material_detail_rec
9453: ,p_pending_product_lots_rec => p_pending_product_lots_rec
9454: ,x_pending_product_lots_rec => l_pending_product_lots_rec
9455: ,x_return_status => x_return_status);
9456:
9457: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9458: RAISE fnd_api.g_exc_error;
9459: END IF;
9460:
9461: /* Invoke main */
9454: ,x_pending_product_lots_rec => l_pending_product_lots_rec
9455: ,x_return_status => x_return_status);
9456:
9457: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9458: RAISE fnd_api.g_exc_error;
9459: END IF;
9460:
9461: /* Invoke main */
9462: gme_api_main.update_pending_product_lot
9460:
9461: /* Invoke main */
9462: gme_api_main.update_pending_product_lot
9463: (p_validation_level => p_validation_level
9464: ,p_init_msg_list => fnd_api.g_false
9465: ,x_message_count => x_message_count
9466: ,x_message_list => x_message_list
9467: ,x_return_status => x_return_status
9468: ,p_org_id => l_batch_header_rec.organization_id
9478: || ' Return status from gme_api_main.update_pending_product_lot is '
9479: || x_return_status);
9480: END IF;
9481:
9482: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9483: RAISE error_update_pp_lot;
9484: END IF;
9485:
9486: /* Invoke save_batch */
9507: || ' Return status from gme_api_pub.save_batch is '
9508: || x_return_status);
9509: END IF;
9510:
9511: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9512: RAISE fnd_api.g_exc_error;
9513: END IF;
9514:
9515: IF g_debug <= gme_debug.g_log_procedure THEN
9508: || x_return_status);
9509: END IF;
9510:
9511: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9512: RAISE fnd_api.g_exc_error;
9513: END IF;
9514:
9515: IF g_debug <= gme_debug.g_log_procedure THEN
9516: gme_debug.put_line ( ' Completed '
9522: WHEN error_update_pp_lot THEN
9523: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9524: x_pending_product_lots_rec := NULL;
9525: gme_common_pvt.count_and_get (x_count => x_message_count
9526: ,p_encoded => fnd_api.g_false
9527: ,x_data => x_message_list);
9528: WHEN fnd_api.g_exc_error THEN
9529: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9530: x_pending_product_lots_rec := NULL;
9524: x_pending_product_lots_rec := NULL;
9525: gme_common_pvt.count_and_get (x_count => x_message_count
9526: ,p_encoded => fnd_api.g_false
9527: ,x_data => x_message_list);
9528: WHEN fnd_api.g_exc_error THEN
9529: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9530: x_pending_product_lots_rec := NULL;
9531: x_return_status := fnd_api.g_ret_sts_error;
9532: gme_common_pvt.count_and_get (x_count => x_message_count
9527: ,x_data => x_message_list);
9528: WHEN fnd_api.g_exc_error THEN
9529: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9530: x_pending_product_lots_rec := NULL;
9531: x_return_status := fnd_api.g_ret_sts_error;
9532: gme_common_pvt.count_and_get (x_count => x_message_count
9533: ,p_encoded => fnd_api.g_false
9534: ,x_data => x_message_list);
9535: WHEN OTHERS THEN
9529: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9530: x_pending_product_lots_rec := NULL;
9531: x_return_status := fnd_api.g_ret_sts_error;
9532: gme_common_pvt.count_and_get (x_count => x_message_count
9533: ,p_encoded => fnd_api.g_false
9534: ,x_data => x_message_list);
9535: WHEN OTHERS THEN
9536: ROLLBACK TO SAVEPOINT update_pending_product_lot;
9537: x_pending_product_lots_rec := NULL;
9566: PROCEDURE delete_pending_product_lot
9567: (p_api_version IN NUMBER
9568: ,p_validation_level IN NUMBER
9569: := gme_common_pvt.g_max_errors
9570: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9571: ,p_commit IN VARCHAR2 := fnd_api.g_false
9572: ,x_message_count OUT NOCOPY NUMBER
9573: ,x_message_list OUT NOCOPY VARCHAR2
9574: ,x_return_status OUT NOCOPY VARCHAR2
9567: (p_api_version IN NUMBER
9568: ,p_validation_level IN NUMBER
9569: := gme_common_pvt.g_max_errors
9570: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9571: ,p_commit IN VARCHAR2 := fnd_api.g_false
9572: ,x_message_count OUT NOCOPY NUMBER
9573: ,x_message_list OUT NOCOPY VARCHAR2
9574: ,x_return_status OUT NOCOPY VARCHAR2
9575: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9605: || l_api_name);
9606: END IF;
9607:
9608: /* Set the return status to success initially */
9609: x_return_status := fnd_api.g_ret_sts_success;
9610:
9611: /* Set savepoint here */
9612: SAVEPOINT delete_pending_product_lot;
9613:
9610:
9611: /* Set savepoint here */
9612: SAVEPOINT delete_pending_product_lot;
9613:
9614: IF p_init_msg_list = fnd_api.g_true THEN
9615: fnd_msg_pub.initialize;
9616: END IF;
9617:
9618: IF NOT fnd_api.compatible_api_call (2.0
9614: IF p_init_msg_list = fnd_api.g_true THEN
9615: fnd_msg_pub.initialize;
9616: END IF;
9617:
9618: IF NOT fnd_api.compatible_api_call (2.0
9619: ,p_api_version
9620: ,'delete_pending_prod_lot'
9621: ,g_pkg_name) THEN
9622: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9619: ,p_api_version
9620: ,'delete_pending_prod_lot'
9621: ,g_pkg_name) THEN
9622: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9623: RAISE fnd_api.g_exc_error;
9624: END IF;
9625:
9626: IF p_pending_product_lots_rec.pending_product_lot_id IS NOT NULL THEN
9627: IF NOT gme_pending_product_lots_dbl.fetch_row
9626: IF p_pending_product_lots_rec.pending_product_lot_id IS NOT NULL THEN
9627: IF NOT gme_pending_product_lots_dbl.fetch_row
9628: (p_pending_product_lots_rec => p_pending_product_lots_rec
9629: ,x_pending_product_lots_rec => l_db_pending_product_lots_rec) THEN
9630: x_return_status := fnd_api.g_ret_sts_error;
9631: RAISE fnd_api.g_exc_error;
9632: END IF;
9633:
9634: l_in_material_detail_rec.material_detail_id := l_db_pending_product_lots_rec.material_detail_id;
9627: IF NOT gme_pending_product_lots_dbl.fetch_row
9628: (p_pending_product_lots_rec => p_pending_product_lots_rec
9629: ,x_pending_product_lots_rec => l_db_pending_product_lots_rec) THEN
9630: x_return_status := fnd_api.g_ret_sts_error;
9631: RAISE fnd_api.g_exc_error;
9632: END IF;
9633:
9634: l_in_material_detail_rec.material_detail_id := l_db_pending_product_lots_rec.material_detail_id;
9635: l_in_material_detail_rec.batch_id := l_db_pending_product_lots_rec.batch_id;
9642: ,x_material_detail_rec => l_material_detail_rec
9643: ,x_message_count => x_message_count
9644: ,x_message_list => x_message_list
9645: ,x_return_status => x_return_status );
9646: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9647: IF (g_debug = gme_debug.g_log_statement) THEN
9648: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9649: || ': batch mateiral validate error ');
9650: END IF;
9647: IF (g_debug = gme_debug.g_log_statement) THEN
9648: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9649: || ': batch mateiral validate error ');
9650: END IF;
9651: RAISE fnd_api.g_exc_error;
9652: END IF;
9653: ELSE
9654: l_batch_id := NVL(p_pending_product_lots_rec.batch_id,
9655: NVL(p_material_detail_rec.batch_id, p_batch_header_rec.batch_id));
9669: ,x_material_detail_rec => l_material_detail_rec
9670: ,x_message_count => x_message_count
9671: ,x_message_list => x_message_list
9672: ,x_return_status => x_return_status );
9673: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9674: IF (g_debug = gme_debug.g_log_statement) THEN
9675: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9676: || ': batch mateiral validate error ');
9677: END IF;
9674: IF (g_debug = gme_debug.g_log_statement) THEN
9675: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9676: || ': batch mateiral validate error ');
9677: END IF;
9678: RAISE fnd_api.g_exc_error;
9679: END IF;
9680: END IF;
9681: -- Validations
9682: gme_pending_product_lots_pvt.validate_material_for_delete
9683: (p_batch_header_rec => l_batch_header_rec
9684: ,p_material_detail_rec => l_material_detail_rec
9685: ,x_return_status => x_return_status);
9686:
9687: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9688: RAISE fnd_api.g_exc_error;
9689: END IF;
9690:
9691: gme_pending_product_lots_pvt.validate_record_for_delete
9684: ,p_material_detail_rec => l_material_detail_rec
9685: ,x_return_status => x_return_status);
9686:
9687: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9688: RAISE fnd_api.g_exc_error;
9689: END IF;
9690:
9691: gme_pending_product_lots_pvt.validate_record_for_delete
9692: (p_material_detail_rec => l_material_detail_rec
9694: ,p_pending_product_lots_rec => p_pending_product_lots_rec
9695: ,x_pending_product_lots_rec => l_pending_product_lots_rec
9696: ,x_return_status => x_return_status);
9697:
9698: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9699: RAISE fnd_api.g_exc_error;
9700: END IF;
9701:
9702: /* Invoke main */
9695: ,x_pending_product_lots_rec => l_pending_product_lots_rec
9696: ,x_return_status => x_return_status);
9697:
9698: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9699: RAISE fnd_api.g_exc_error;
9700: END IF;
9701:
9702: /* Invoke main */
9703: gme_api_main.delete_pending_product_lot
9701:
9702: /* Invoke main */
9703: gme_api_main.delete_pending_product_lot
9704: (p_validation_level => p_validation_level
9705: ,p_init_msg_list => fnd_api.g_false
9706: ,x_message_count => x_message_count
9707: ,x_message_list => x_message_list
9708: ,x_return_status => x_return_status
9709: ,p_org_id => l_batch_header_rec.organization_id
9718: || ' Return status from gme_api_main.delete_pending_product_lot is '
9719: || x_return_status);
9720: END IF;
9721:
9722: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9723: RAISE error_delete_pp_lot;
9724: END IF;
9725:
9726: /* Invoke save_batch */
9747: || ' Return status from gme_api_pub.save_batch is '
9748: || x_return_status);
9749: END IF;
9750:
9751: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9752: RAISE fnd_api.g_exc_error;
9753: END IF;
9754:
9755: IF g_debug <= gme_debug.g_log_procedure THEN
9748: || x_return_status);
9749: END IF;
9750:
9751: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9752: RAISE fnd_api.g_exc_error;
9753: END IF;
9754:
9755: IF g_debug <= gme_debug.g_log_procedure THEN
9756: gme_debug.put_line ( ' Completed '
9762: EXCEPTION
9763: WHEN error_delete_pp_lot THEN
9764: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9765: gme_common_pvt.count_and_get (x_count => x_message_count
9766: ,p_encoded => fnd_api.g_false
9767: ,x_data => x_message_list);
9768: WHEN fnd_api.g_exc_error THEN
9769: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9770: x_return_status := fnd_api.g_ret_sts_error;
9764: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9765: gme_common_pvt.count_and_get (x_count => x_message_count
9766: ,p_encoded => fnd_api.g_false
9767: ,x_data => x_message_list);
9768: WHEN fnd_api.g_exc_error THEN
9769: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9770: x_return_status := fnd_api.g_ret_sts_error;
9771: gme_common_pvt.count_and_get (x_count => x_message_count
9772: ,p_encoded => fnd_api.g_false
9766: ,p_encoded => fnd_api.g_false
9767: ,x_data => x_message_list);
9768: WHEN fnd_api.g_exc_error THEN
9769: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9770: x_return_status := fnd_api.g_ret_sts_error;
9771: gme_common_pvt.count_and_get (x_count => x_message_count
9772: ,p_encoded => fnd_api.g_false
9773: ,x_data => x_message_list);
9774: WHEN OTHERS THEN
9768: WHEN fnd_api.g_exc_error THEN
9769: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9770: x_return_status := fnd_api.g_ret_sts_error;
9771: gme_common_pvt.count_and_get (x_count => x_message_count
9772: ,p_encoded => fnd_api.g_false
9773: ,x_data => x_message_list);
9774: WHEN OTHERS THEN
9775: ROLLBACK TO SAVEPOINT delete_pending_product_lot;
9776: gme_when_others ( p_api_name => l_api_name
9809: PROCEDURE unrelease_batch
9810: (p_api_version IN NUMBER
9811: ,p_validation_level IN NUMBER
9812: := gme_common_pvt.g_max_errors
9813: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9814: ,p_commit IN VARCHAR2 := fnd_api.g_false
9815: ,x_message_count OUT NOCOPY NUMBER
9816: ,x_message_list OUT NOCOPY VARCHAR2
9817: ,x_return_status OUT NOCOPY VARCHAR2
9810: (p_api_version IN NUMBER
9811: ,p_validation_level IN NUMBER
9812: := gme_common_pvt.g_max_errors
9813: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
9814: ,p_commit IN VARCHAR2 := fnd_api.g_false
9815: ,x_message_count OUT NOCOPY NUMBER
9816: ,x_message_list OUT NOCOPY VARCHAR2
9817: ,x_return_status OUT NOCOPY VARCHAR2
9818: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
9855: || l_api_name);
9856: END IF;
9857:
9858: /* Set the return status to success initially */
9859: x_return_status := fnd_api.g_ret_sts_success;
9860:
9861: /* Set savepoint here */
9862: SAVEPOINT unrelease_batch;
9863:
9860:
9861: /* Set savepoint here */
9862: SAVEPOINT unrelease_batch;
9863:
9864: IF p_init_msg_list = fnd_api.g_true THEN
9865: fnd_msg_pub.initialize;
9866: END IF;
9867:
9868: IF NOT fnd_api.compatible_api_call (2.0
9864: IF p_init_msg_list = fnd_api.g_true THEN
9865: fnd_msg_pub.initialize;
9866: END IF;
9867:
9868: IF NOT fnd_api.compatible_api_call (2.0
9869: ,p_api_version
9870: ,'unrelease_batch'
9871: ,g_pkg_name) THEN
9872: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9869: ,p_api_version
9870: ,'unrelease_batch'
9871: ,g_pkg_name) THEN
9872: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
9873: RAISE fnd_api.g_exc_error;
9874: END IF;
9875:
9876:
9877: --l_in_batch_header_rec.batch_type := gme_common_pvt.g_doc_type_batch;
9883: ,x_message_count => x_message_count
9884: ,x_message_list => x_message_list
9885: ,x_return_status => x_return_status );
9886:
9887: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9888: IF (g_debug = gme_debug.g_log_statement) THEN
9889: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9890: || ': batch validate error ');
9891: END IF;
9888: IF (g_debug = gme_debug.g_log_statement) THEN
9889: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
9890: || ': batch validate error ');
9891: END IF;
9892: RAISE fnd_api.g_exc_error;
9893: END IF;
9894:
9895:
9896: -- Validations
9897: gme_unrelease_batch_pvt.validate_batch_for_unrelease
9898: (p_batch_hdr_rec => l_batch_header_rec
9899: ,x_return_status => x_return_status);
9900:
9901: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9902: RAISE fnd_api.g_exc_error;
9903: END IF;
9904:
9905: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
9898: (p_batch_hdr_rec => l_batch_header_rec
9899: ,x_return_status => x_return_status);
9900:
9901: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9902: RAISE fnd_api.g_exc_error;
9903: END IF;
9904:
9905: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
9906:
9901: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9902: RAISE fnd_api.g_exc_error;
9903: END IF;
9904:
9905: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
9906:
9907: /* Invoke main */
9908: gme_api_main.unrelease_batch
9909: (p_validation_level => p_validation_level
9906:
9907: /* Invoke main */
9908: gme_api_main.unrelease_batch
9909: (p_validation_level => p_validation_level
9910: ,p_init_msg_list => fnd_api.g_false
9911: ,x_message_count => x_message_count
9912: ,x_message_list => x_message_list
9913: ,x_return_status => x_return_status
9914: ,p_batch_header_rec => l_batch_header_rec
9920: ' Return status from main.unrelease_batch is '|| x_return_status);
9921: END IF;
9922:
9923: -- Bug 11846735 - restructure save block.
9924: -- IF x_return_status <> fnd_api.g_ret_sts_success THEN
9925: -- RAISE error_unrelease_batch;
9926: -- END IF;
9927:
9928: /* Invoke save_batch */
9938: ' Return status from gme_api_pub.save_batch is '
9939: || x_return_status);
9940: END IF;
9941:
9942: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9943: RAISE fnd_api.g_exc_error;
9944: END IF;
9945: */
9946:
9939: || x_return_status);
9940: END IF;
9941:
9942: IF x_return_status <> fnd_api.g_ret_sts_success THEN
9943: RAISE fnd_api.g_exc_error;
9944: END IF;
9945: */
9946:
9947: IF x_return_status = fnd_api.g_ret_sts_success THEN
9943: RAISE fnd_api.g_exc_error;
9944: END IF;
9945: */
9946:
9947: IF x_return_status = fnd_api.g_ret_sts_success THEN
9948: IF p_commit = fnd_api.g_true THEN
9949: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
9950: ,p_table => 1
9951: ,p_commit => fnd_api.g_false
9944: END IF;
9945: */
9946:
9947: IF x_return_status = fnd_api.g_ret_sts_success THEN
9948: IF p_commit = fnd_api.g_true THEN
9949: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
9950: ,p_table => 1
9951: ,p_commit => fnd_api.g_false
9952: ,x_return_status => x_return_status);
9947: IF x_return_status = fnd_api.g_ret_sts_success THEN
9948: IF p_commit = fnd_api.g_true THEN
9949: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
9950: ,p_table => 1
9951: ,p_commit => fnd_api.g_false
9952: ,x_return_status => x_return_status);
9953:
9954: IF x_return_status = fnd_api.g_ret_sts_success THEN
9955: COMMIT;
9950: ,p_table => 1
9951: ,p_commit => fnd_api.g_false
9952: ,x_return_status => x_return_status);
9953:
9954: IF x_return_status = fnd_api.g_ret_sts_success THEN
9955: COMMIT;
9956: ELSE
9957: RAISE fnd_api.g_exc_error;
9958: END IF;
9953:
9954: IF x_return_status = fnd_api.g_ret_sts_success THEN
9955: COMMIT;
9956: ELSE
9957: RAISE fnd_api.g_exc_error;
9958: END IF;
9959: END IF;
9960: ELSE
9961: RAISE error_unrelease_batch;
9970: WHEN error_unrelease_batch THEN
9971: ROLLBACK TO SAVEPOINT unrelease_batch;
9972: x_batch_header_rec := NULL;
9973: gme_common_pvt.count_and_get (x_count => x_message_count
9974: ,p_encoded => fnd_api.g_false
9975: ,x_data => x_message_list);
9976: WHEN fnd_api.g_exc_error THEN
9977: ROLLBACK TO SAVEPOINT unrelease_batch;
9978: x_batch_header_rec := NULL;
9972: x_batch_header_rec := NULL;
9973: gme_common_pvt.count_and_get (x_count => x_message_count
9974: ,p_encoded => fnd_api.g_false
9975: ,x_data => x_message_list);
9976: WHEN fnd_api.g_exc_error THEN
9977: ROLLBACK TO SAVEPOINT unrelease_batch;
9978: x_batch_header_rec := NULL;
9979: x_return_status := fnd_api.g_ret_sts_error;
9980: gme_common_pvt.count_and_get (x_count => x_message_count
9975: ,x_data => x_message_list);
9976: WHEN fnd_api.g_exc_error THEN
9977: ROLLBACK TO SAVEPOINT unrelease_batch;
9978: x_batch_header_rec := NULL;
9979: x_return_status := fnd_api.g_ret_sts_error;
9980: gme_common_pvt.count_and_get (x_count => x_message_count
9981: ,p_encoded => fnd_api.g_false
9982: ,x_data => x_message_list);
9983: WHEN OTHERS THEN
9977: ROLLBACK TO SAVEPOINT unrelease_batch;
9978: x_batch_header_rec := NULL;
9979: x_return_status := fnd_api.g_ret_sts_error;
9980: gme_common_pvt.count_and_get (x_count => x_message_count
9981: ,p_encoded => fnd_api.g_false
9982: ,x_data => x_message_list);
9983: WHEN OTHERS THEN
9984: ROLLBACK TO SAVEPOINT unrelease_batch;
9985: x_batch_header_rec := NULL;
10020: PROCEDURE unrelease_step
10021: (p_api_version IN NUMBER
10022: ,p_validation_level IN NUMBER
10023: := gme_common_pvt.g_max_errors
10024: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10025: ,p_commit IN VARCHAR2 := fnd_api.g_false
10026: ,x_message_count OUT NOCOPY NUMBER
10027: ,x_message_list OUT NOCOPY VARCHAR2
10028: ,x_return_status OUT NOCOPY VARCHAR2
10021: (p_api_version IN NUMBER
10022: ,p_validation_level IN NUMBER
10023: := gme_common_pvt.g_max_errors
10024: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10025: ,p_commit IN VARCHAR2 := fnd_api.g_false
10026: ,x_message_count OUT NOCOPY NUMBER
10027: ,x_message_list OUT NOCOPY VARCHAR2
10028: ,x_return_status OUT NOCOPY VARCHAR2
10029: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10050: || l_api_name);
10051: END IF;
10052:
10053: /* Set the return status to success initially */
10054: x_return_status := fnd_api.g_ret_sts_success;
10055:
10056: /* Set savepoint here */
10057: SAVEPOINT unrelease_step;
10058:
10055:
10056: /* Set savepoint here */
10057: SAVEPOINT unrelease_step;
10058:
10059: IF p_init_msg_list = fnd_api.g_true THEN
10060: fnd_msg_pub.initialize;
10061: END IF;
10062:
10063: IF NOT fnd_api.compatible_api_call (2.0
10059: IF p_init_msg_list = fnd_api.g_true THEN
10060: fnd_msg_pub.initialize;
10061: END IF;
10062:
10063: IF NOT fnd_api.compatible_api_call (2.0
10064: ,p_api_version
10065: ,'unrelease_step'
10066: ,g_pkg_name) THEN
10067: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10064: ,p_api_version
10065: ,'unrelease_step'
10066: ,g_pkg_name) THEN
10067: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10068: RAISE fnd_api.g_exc_error;
10069: END IF;
10070:
10071: /* Validate Input parameters */
10072: gme_common_pvt.Validate_batch_step (
10078: ,x_message_count => x_message_count
10079: ,x_message_list => x_message_list
10080: ,x_return_status => x_return_status) ;
10081:
10082: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10083: IF (g_debug = gme_debug.g_log_statement) THEN
10084: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10085: || ': batch step validate error ');
10086: END IF;
10083: IF (g_debug = gme_debug.g_log_statement) THEN
10084: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10085: || ': batch step validate error ');
10086: END IF;
10087: RAISE fnd_api.g_exc_error;
10088: END IF;
10089:
10090: -- Validations
10091: gme_unrelease_step_pvt.validate_step_for_unrelease
10092: (p_batch_hdr_rec => l_batch_header_rec
10093: ,p_batch_step_rec => l_batch_step_rec
10094: ,x_return_status => x_return_status);
10095:
10096: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10097: RAISE fnd_api.g_exc_error;
10098: END IF;
10099:
10100: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10093: ,p_batch_step_rec => l_batch_step_rec
10094: ,x_return_status => x_return_status);
10095:
10096: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10097: RAISE fnd_api.g_exc_error;
10098: END IF;
10099:
10100: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10101:
10096: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10097: RAISE fnd_api.g_exc_error;
10098: END IF;
10099:
10100: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10101:
10102: /* Invoke main */
10103: gme_api_main.unrelease_step
10104: (p_validation_level => p_validation_level
10101:
10102: /* Invoke main */
10103: gme_api_main.unrelease_step
10104: (p_validation_level => p_validation_level
10105: ,p_init_msg_list => fnd_api.g_false
10106: ,x_message_count => x_message_count
10107: ,x_message_list => x_message_list
10108: ,x_return_status => x_return_status
10109: ,p_batch_step_rec => l_batch_step_rec
10119: || ' Return status from gme_api_main.unrelease_step is '
10120: || x_return_status);
10121: END IF;
10122:
10123: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10124: RAISE error_unrelease_step;
10125: END IF;
10126:
10127: /* Invoke save_batch */
10134: || gme_common_pvt.g_transaction_header_id);
10135: END IF;
10136:
10137: -- Bug 11846735 - restructure save block.
10138: IF x_return_status = fnd_api.g_ret_sts_success THEN
10139: IF p_commit = fnd_api.g_true THEN
10140: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
10141: ,p_table => 1
10142: ,p_commit => fnd_api.g_false
10135: END IF;
10136:
10137: -- Bug 11846735 - restructure save block.
10138: IF x_return_status = fnd_api.g_ret_sts_success THEN
10139: IF p_commit = fnd_api.g_true THEN
10140: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
10141: ,p_table => 1
10142: ,p_commit => fnd_api.g_false
10143: ,x_return_status => x_return_status);
10138: IF x_return_status = fnd_api.g_ret_sts_success THEN
10139: IF p_commit = fnd_api.g_true THEN
10140: gme_api_pub.save_batch (p_header_id => gme_common_pvt.g_transaction_header_id
10141: ,p_table => 1
10142: ,p_commit => fnd_api.g_false
10143: ,x_return_status => x_return_status);
10144:
10145: IF x_return_status = fnd_api.g_ret_sts_success THEN
10146: COMMIT;
10141: ,p_table => 1
10142: ,p_commit => fnd_api.g_false
10143: ,x_return_status => x_return_status);
10144:
10145: IF x_return_status = fnd_api.g_ret_sts_success THEN
10146: COMMIT;
10147: ELSE
10148: RAISE fnd_api.g_exc_error;
10149: END IF;
10144:
10145: IF x_return_status = fnd_api.g_ret_sts_success THEN
10146: COMMIT;
10147: ELSE
10148: RAISE fnd_api.g_exc_error;
10149: END IF;
10150: END IF;
10151: ELSE
10152: RAISE error_unrelease_step;
10163: WHEN error_unrelease_step THEN
10164: ROLLBACK TO SAVEPOINT unrelease_step;
10165: x_batch_step_rec := NULL;
10166: gme_common_pvt.count_and_get (x_count => x_message_count
10167: ,p_encoded => fnd_api.g_false
10168: ,x_data => x_message_list);
10169: WHEN fnd_api.g_exc_error THEN
10170: ROLLBACK TO SAVEPOINT unrelease_step;
10171: x_batch_step_rec := NULL;
10165: x_batch_step_rec := NULL;
10166: gme_common_pvt.count_and_get (x_count => x_message_count
10167: ,p_encoded => fnd_api.g_false
10168: ,x_data => x_message_list);
10169: WHEN fnd_api.g_exc_error THEN
10170: ROLLBACK TO SAVEPOINT unrelease_step;
10171: x_batch_step_rec := NULL;
10172: x_return_status := fnd_api.g_ret_sts_error;
10173: gme_common_pvt.count_and_get (x_count => x_message_count
10168: ,x_data => x_message_list);
10169: WHEN fnd_api.g_exc_error THEN
10170: ROLLBACK TO SAVEPOINT unrelease_step;
10171: x_batch_step_rec := NULL;
10172: x_return_status := fnd_api.g_ret_sts_error;
10173: gme_common_pvt.count_and_get (x_count => x_message_count
10174: ,p_encoded => fnd_api.g_false
10175: ,x_data => x_message_list);
10176: WHEN OTHERS THEN
10170: ROLLBACK TO SAVEPOINT unrelease_step;
10171: x_batch_step_rec := NULL;
10172: x_return_status := fnd_api.g_ret_sts_error;
10173: gme_common_pvt.count_and_get (x_count => x_message_count
10174: ,p_encoded => fnd_api.g_false
10175: ,x_data => x_message_list);
10176: WHEN OTHERS THEN
10177: ROLLBACK TO SAVEPOINT unrelease_step;
10178: x_batch_step_rec := NULL;
10195: p_batch_header_rec (O) batch header to identify the batch to complete;
10196: p_org_code (O) organization code to identify the batch is conjunction with batch_no in p_batch_header_rec
10197: p_ignore_exception (O) indicates whether to ignore exceptions; if exceptions are ignored,
10198: x_exception_material_tbl won't be populated even if exceptions were found
10199: p_validate_flexfields (O) indicates whether to validate flexfields... Defaults to fnd_api.g_false;
10200: this is used for direct completion only because of release batch
10201: x_batch_header_rec Output batch header record after complete
10202: x_exception_material_tbl Batch exceptions found in complete batch
10203: x_return_status outcome of the API call
10219: PROCEDURE complete_batch
10220: (p_api_version IN NUMBER
10221: ,p_validation_level IN NUMBER
10222: := gme_common_pvt.g_max_errors
10223: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10224: ,p_commit IN VARCHAR2 := fnd_api.g_false
10225: ,x_message_count OUT NOCOPY NUMBER
10226: ,x_message_list OUT NOCOPY VARCHAR2
10227: ,x_return_status OUT NOCOPY VARCHAR2
10220: (p_api_version IN NUMBER
10221: ,p_validation_level IN NUMBER
10222: := gme_common_pvt.g_max_errors
10223: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10224: ,p_commit IN VARCHAR2 := fnd_api.g_false
10225: ,x_message_count OUT NOCOPY NUMBER
10226: ,x_message_list OUT NOCOPY VARCHAR2
10227: ,x_return_status OUT NOCOPY VARCHAR2
10228: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10226: ,x_message_list OUT NOCOPY VARCHAR2
10227: ,x_return_status OUT NOCOPY VARCHAR2
10228: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10229: ,p_org_code IN VARCHAR2
10230: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10231: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10232: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
10233: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10234: IS
10227: ,x_return_status OUT NOCOPY VARCHAR2
10228: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10229: ,p_org_code IN VARCHAR2
10230: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10231: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10232: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
10233: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10234: IS
10235: l_api_name CONSTANT VARCHAR2 (30) := 'COMPLETE_BATCH';
10251: || l_api_name);
10252: END IF;
10253:
10254: /* Set the return status to success initially */
10255: x_return_status := fnd_api.g_ret_sts_success;
10256:
10257: /* Set savepoint here */
10258: SAVEPOINT complete_batch;
10259:
10256:
10257: /* Set savepoint here */
10258: SAVEPOINT complete_batch;
10259:
10260: IF p_init_msg_list = fnd_api.g_true THEN
10261: fnd_msg_pub.initialize;
10262: END IF;
10263:
10264: IF NOT fnd_api.compatible_api_call (2.0
10260: IF p_init_msg_list = fnd_api.g_true THEN
10261: fnd_msg_pub.initialize;
10262: END IF;
10263:
10264: IF NOT fnd_api.compatible_api_call (2.0
10265: ,p_api_version
10266: ,'complete_batch'
10267: ,g_pkg_name) THEN
10268: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10265: ,p_api_version
10266: ,'complete_batch'
10267: ,g_pkg_name) THEN
10268: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10269: RAISE fnd_api.g_exc_error;
10270: END IF;
10271:
10272:
10273: -- l_in_batch_header_rec.batch_type := gme_common_pvt.g_doc_type_batch;
10279: ,x_message_count => x_message_count
10280: ,x_message_list => x_message_list
10281: ,x_return_status => x_return_status );
10282:
10283: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10284: IF (g_debug = gme_debug.g_log_statement) THEN
10285: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10286: || ': batch validate error ');
10287: END IF;
10284: IF (g_debug = gme_debug.g_log_statement) THEN
10285: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10286: || ': batch validate error ');
10287: END IF;
10288: RAISE fnd_api.g_exc_error;
10289: END IF;
10290:
10291: -- Bug 15977300 - initialize header record once.
10292: l_in_batch_header_rec := l_batch_header_rec;
10292: l_in_batch_header_rec := l_batch_header_rec;
10293:
10294: -- Validations
10295: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending THEN
10296: IF p_validate_flexfields = fnd_api.g_true THEN
10297: gme_common_pvt.g_flex_validate_prof := 1;
10298: ELSE
10299: gme_common_pvt.g_flex_validate_prof := 0;
10300: END IF;
10305: l_in_batch_header_rec.actual_start_date := p_batch_header_rec.actual_start_date;
10306: -- call release batch validation... output batch header will have actual start date filled in
10307: NULL;
10308:
10309: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10310: RAISE fnd_api.g_exc_error;
10311: END IF;
10312:
10313: -- reset flex global
10306: -- call release batch validation... output batch header will have actual start date filled in
10307: NULL;
10308:
10309: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10310: RAISE fnd_api.g_exc_error;
10311: END IF;
10312:
10313: -- reset flex global
10314: gme_common_pvt.g_flex_validate_prof := 0;
10327: (p_batch_header_rec => l_in_batch_header_rec
10328: ,x_batch_header_rec => l_batch_header_rec
10329: ,x_return_status => x_return_status);
10330:
10331: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10332: RAISE fnd_api.g_exc_error;
10333: END IF;
10334:
10335: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10328: ,x_batch_header_rec => l_batch_header_rec
10329: ,x_return_status => x_return_status);
10330:
10331: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10332: RAISE fnd_api.g_exc_error;
10333: END IF;
10334:
10335: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10336:
10331: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10332: RAISE fnd_api.g_exc_error;
10333: END IF;
10334:
10335: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10336:
10337: /* Invoke main */
10338: gme_api_main.complete_batch
10339: (p_validation_level => p_validation_level
10336:
10337: /* Invoke main */
10338: gme_api_main.complete_batch
10339: (p_validation_level => p_validation_level
10340: ,p_init_msg_list => fnd_api.g_false
10341: ,x_message_count => x_message_count
10342: ,x_message_list => x_message_list
10343: ,x_return_status => x_return_status
10344: ,p_batch_header_rec => l_batch_header_rec
10354: || ' Return status from gme_api_main.complete_batch is '
10355: || x_return_status);
10356: END IF;
10357:
10358: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10359: x_return_status := fnd_api.g_ret_sts_success;
10360: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10361: x_exception_material_tbl := l_exception_material_tbl;
10362: END IF;
10355: || x_return_status);
10356: END IF;
10357:
10358: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10359: x_return_status := fnd_api.g_ret_sts_success;
10360: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10361: x_exception_material_tbl := l_exception_material_tbl;
10362: END IF;
10363:
10360: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10361: x_exception_material_tbl := l_exception_material_tbl;
10362: END IF;
10363:
10364: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10365: RAISE error_complete_batch;
10366: END IF;
10367:
10368: -- Bug 8312658 - Delete all remaining reservations including for phantom batches.
10372: ,p_delete_trans_pairs => 'F'
10373: ,p_recursive => 'R'
10374: ,x_return_status => x_return_status);
10375:
10376: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10377: IF (g_debug <= gme_debug.g_log_procedure) THEN
10378: gme_debug.put_line ( g_pkg_name
10379: || '.'
10380: || l_api_name
10409: || ' Return status from gme_api_pub.save_batch is '
10410: || x_return_status);
10411: END IF;
10412:
10413: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10414: RAISE fnd_api.g_exc_error;
10415: END IF;
10416:
10417: IF g_debug <= gme_debug.g_log_procedure THEN
10410: || x_return_status);
10411: END IF;
10412:
10413: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10414: RAISE fnd_api.g_exc_error;
10415: END IF;
10416:
10417: IF g_debug <= gme_debug.g_log_procedure THEN
10418: gme_debug.put_line ( ' Completed '
10425: WHEN error_complete_batch THEN
10426: ROLLBACK TO SAVEPOINT complete_batch;
10427: x_batch_header_rec := NULL;
10428: gme_common_pvt.count_and_get (x_count => x_message_count
10429: ,p_encoded => fnd_api.g_false
10430: ,x_data => x_message_list);
10431: WHEN fnd_api.g_exc_error THEN
10432: ROLLBACK TO SAVEPOINT complete_batch;
10433: x_batch_header_rec := NULL;
10427: x_batch_header_rec := NULL;
10428: gme_common_pvt.count_and_get (x_count => x_message_count
10429: ,p_encoded => fnd_api.g_false
10430: ,x_data => x_message_list);
10431: WHEN fnd_api.g_exc_error THEN
10432: ROLLBACK TO SAVEPOINT complete_batch;
10433: x_batch_header_rec := NULL;
10434: x_return_status := fnd_api.g_ret_sts_error;
10435: gme_common_pvt.count_and_get (x_count => x_message_count
10430: ,x_data => x_message_list);
10431: WHEN fnd_api.g_exc_error THEN
10432: ROLLBACK TO SAVEPOINT complete_batch;
10433: x_batch_header_rec := NULL;
10434: x_return_status := fnd_api.g_ret_sts_error;
10435: gme_common_pvt.count_and_get (x_count => x_message_count
10436: ,p_encoded => fnd_api.g_false
10437: ,x_data => x_message_list);
10438: WHEN purge_exception_err THEN
10432: ROLLBACK TO SAVEPOINT complete_batch;
10433: x_batch_header_rec := NULL;
10434: x_return_status := fnd_api.g_ret_sts_error;
10435: gme_common_pvt.count_and_get (x_count => x_message_count
10436: ,p_encoded => fnd_api.g_false
10437: ,x_data => x_message_list);
10438: WHEN purge_exception_err THEN
10439: ROLLBACK TO SAVEPOINT complete_batch;
10440: gme_common_pvt.count_and_get (x_count => x_message_count
10437: ,x_data => x_message_list);
10438: WHEN purge_exception_err THEN
10439: ROLLBACK TO SAVEPOINT complete_batch;
10440: gme_common_pvt.count_and_get (x_count => x_message_count
10441: ,p_encoded => fnd_api.g_false
10442: ,x_data => x_message_list);
10443: WHEN OTHERS THEN
10444: ROLLBACK TO SAVEPOINT complete_batch;
10445: gme_when_others ( p_api_name => l_api_name
10463: p_batch_no (O) batch_no to identify the step
10464: p_org_code (O) organization code to identify the step is conjunction with batch_no in p_batch_header_rec
10465: p_ignore_exception (O) indicates whether to ignore exceptions; if exceptions are ignored,
10466: x_exception_material_tbl won't be populated ever if exceptions were found
10467: p_override_quality (O) Override quality indicator; defaults to fnd_api.g_false
10468: p_validate_flexfields (O) indicates whether to validate flexfields... Defaults to fnd_api.g_false;
10469: this is used for direct step completion (pending_batch) only, because of release batch
10470: x_batch_step_rec Output batch step record after complete
10471: x_exception_material_tbl Material exceptions found in complete step (only those associated to step)
10464: p_org_code (O) organization code to identify the step is conjunction with batch_no in p_batch_header_rec
10465: p_ignore_exception (O) indicates whether to ignore exceptions; if exceptions are ignored,
10466: x_exception_material_tbl won't be populated ever if exceptions were found
10467: p_override_quality (O) Override quality indicator; defaults to fnd_api.g_false
10468: p_validate_flexfields (O) indicates whether to validate flexfields... Defaults to fnd_api.g_false;
10469: this is used for direct step completion (pending_batch) only, because of release batch
10470: x_batch_step_rec Output batch step record after complete
10471: x_exception_material_tbl Material exceptions found in complete step (only those associated to step)
10472: x_return_status outcome of the API call
10489: PROCEDURE complete_step
10490: (p_api_version IN NUMBER
10491: ,p_validation_level IN NUMBER
10492: := gme_common_pvt.g_max_errors
10493: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10494: ,p_commit IN VARCHAR2 := fnd_api.g_false
10495: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10496: ,x_message_count OUT NOCOPY NUMBER
10497: ,x_message_list OUT NOCOPY VARCHAR2
10490: (p_api_version IN NUMBER
10491: ,p_validation_level IN NUMBER
10492: := gme_common_pvt.g_max_errors
10493: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10494: ,p_commit IN VARCHAR2 := fnd_api.g_false
10495: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10496: ,x_message_count OUT NOCOPY NUMBER
10497: ,x_message_list OUT NOCOPY VARCHAR2
10498: ,x_return_status OUT NOCOPY VARCHAR2
10491: ,p_validation_level IN NUMBER
10492: := gme_common_pvt.g_max_errors
10493: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10494: ,p_commit IN VARCHAR2 := fnd_api.g_false
10495: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10496: ,x_message_count OUT NOCOPY NUMBER
10497: ,x_message_list OUT NOCOPY VARCHAR2
10498: ,x_return_status OUT NOCOPY VARCHAR2
10499: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10498: ,x_return_status OUT NOCOPY VARCHAR2
10499: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10500: ,p_batch_no IN VARCHAR2
10501: ,p_org_code IN VARCHAR2
10502: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10503: ,p_override_quality IN VARCHAR2 := fnd_api.g_false
10504: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10505: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
10506: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10499: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10500: ,p_batch_no IN VARCHAR2
10501: ,p_org_code IN VARCHAR2
10502: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10503: ,p_override_quality IN VARCHAR2 := fnd_api.g_false
10504: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10505: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
10506: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10507: IS
10500: ,p_batch_no IN VARCHAR2
10501: ,p_org_code IN VARCHAR2
10502: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10503: ,p_override_quality IN VARCHAR2 := fnd_api.g_false
10504: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10505: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
10506: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10507: IS
10508: l_api_name CONSTANT VARCHAR2 (30) := 'COMPLETE_STEP';
10526: || l_api_name);
10527: END IF;
10528:
10529: /* Set the return status to success initially */
10530: x_return_status := fnd_api.g_ret_sts_success;
10531:
10532: /* Set savepoint here */
10533: SAVEPOINT complete_step;
10534:
10531:
10532: /* Set savepoint here */
10533: SAVEPOINT complete_step;
10534:
10535: IF p_init_msg_list = fnd_api.g_true THEN
10536: fnd_msg_pub.initialize;
10537: END IF;
10538:
10539: IF NOT fnd_api.compatible_api_call (2.0
10535: IF p_init_msg_list = fnd_api.g_true THEN
10536: fnd_msg_pub.initialize;
10537: END IF;
10538:
10539: IF NOT fnd_api.compatible_api_call (2.0
10540: ,p_api_version
10541: ,'complete_step'
10542: ,g_pkg_name) THEN
10543: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10540: ,p_api_version
10541: ,'complete_step'
10542: ,g_pkg_name) THEN
10543: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10544: RAISE fnd_api.g_exc_error;
10545: END IF;
10546:
10547: /* Validate Input parameters */
10548: gme_common_pvt.Validate_batch_step (
10554: ,x_message_count => x_message_count
10555: ,x_message_list => x_message_list
10556: ,x_return_status => x_return_status) ;
10557:
10558: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10559: IF (g_debug = gme_debug.g_log_statement) THEN
10560: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10561: || ': batch step validate error ');
10562: END IF;
10559: IF (g_debug = gme_debug.g_log_statement) THEN
10560: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10561: || ': batch step validate error ');
10562: END IF;
10563: RAISE fnd_api.g_exc_error;
10564: END IF;
10565: -- Validations
10566:
10567: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
10565: -- Validations
10566:
10567: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
10568: gme_common_pvt.log_message('GME_API_INVALID_BATCH_TYPE');
10569: RAISE fnd_api.g_exc_error;
10570: END IF;
10571:
10572: -- current Step Status must be Pending or WIP
10573: IF (l_batch_step_rec.step_status NOT IN (gme_common_pvt.g_step_pending, gme_common_pvt.g_step_WIP)) THEN
10571:
10572: -- current Step Status must be Pending or WIP
10573: IF (l_batch_step_rec.step_status NOT IN (gme_common_pvt.g_step_pending, gme_common_pvt.g_step_WIP)) THEN
10574: gme_common_pvt.log_message('GME_API_INV_STAT_STEP_CERT');
10575: RAISE fnd_api.g_exc_error;
10576: END IF;
10577:
10578: IF l_batch_header_rec.batch_status NOT IN
10579: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
10577:
10578: IF l_batch_header_rec.batch_status NOT IN
10579: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
10580: gme_common_pvt.log_message ('GME_API_INV_BATCH_CERT_STEP');
10581: RAISE fnd_api.g_exc_error;
10582: END IF;
10583:
10584: --Bug#5109119 checking for parameter value 1 instead of Y
10585: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending AND
10585: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending AND
10586: (gme_common_pvt.g_step_controls_batch_sts_ind <> 1 OR
10587: l_batch_header_rec.parentline_id IS NOT NULL) THEN
10588: gme_common_pvt.log_message ('GME_API_INV_BATCH_CMPL_STEP');
10589: RAISE fnd_api.g_exc_error;
10590: END IF;
10591:
10592: l_in_batch_step_rec := l_batch_step_rec;
10593: l_in_batch_step_rec.actual_cmplt_date := p_batch_step_rec.actual_cmplt_date;
10598: ,p_override_quality => p_override_quality
10599: ,x_batch_step_rec => l_batch_step_rec
10600: ,x_return_status => x_return_status);
10601:
10602: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10603: RAISE fnd_api.g_exc_error;
10604: END IF;
10605:
10606: IF l_batch_step_rec.step_status = gme_common_pvt.g_step_pending THEN
10599: ,x_batch_step_rec => l_batch_step_rec
10600: ,x_return_status => x_return_status);
10601:
10602: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10603: RAISE fnd_api.g_exc_error;
10604: END IF;
10605:
10606: IF l_batch_step_rec.step_status = gme_common_pvt.g_step_pending THEN
10607: -- call release step validation; use step actual cmplt date
10614: ,p_batch_header_rec => l_batch_header_rec
10615: ,x_batch_start_date => l_calc_batch_start_date
10616: ,x_return_status => x_return_status);
10617:
10618: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10619: RAISE fnd_api.g_exc_error;
10620: END IF;
10621:
10622: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
10615: ,x_batch_start_date => l_calc_batch_start_date
10616: ,x_return_status => x_return_status);
10617:
10618: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10619: RAISE fnd_api.g_exc_error;
10620: END IF;
10621:
10622: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
10623: IF p_validate_flexfields = fnd_api.g_true THEN
10619: RAISE fnd_api.g_exc_error;
10620: END IF;
10621:
10622: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
10623: IF p_validate_flexfields = fnd_api.g_true THEN
10624: gme_common_pvt.g_flex_validate_prof := 1;
10625: ELSE
10626: gme_common_pvt.g_flex_validate_prof := 0;
10627: END IF;
10631: l_in_batch_header_rec.actual_start_date := l_calc_batch_start_date;
10632: -- call release batch validation...
10633: NULL;
10634:
10635: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10636: RAISE fnd_api.g_exc_error;
10637: END IF;
10638: END IF;
10639:
10632: -- call release batch validation...
10633: NULL;
10634:
10635: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10636: RAISE fnd_api.g_exc_error;
10637: END IF;
10638: END IF;
10639:
10640: -- Bug 13981238 - comment out the following line so that any transactions are moved to mmt.
10637: END IF;
10638: END IF;
10639:
10640: -- Bug 13981238 - comment out the following line so that any transactions are moved to mmt.
10641: -- gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10642:
10643: /* Invoke main */
10644: gme_api_main.complete_step
10645: (p_validation_level => p_validation_level
10642:
10643: /* Invoke main */
10644: gme_api_main.complete_step
10645: (p_validation_level => p_validation_level
10646: ,p_init_msg_list => fnd_api.g_false
10647: ,x_message_count => x_message_count
10648: ,x_message_list => x_message_list
10649: ,x_return_status => x_return_status
10650: ,p_batch_step_rec => l_batch_step_rec
10661: || ' Return status from gme_api_main.complete_step is '
10662: || x_return_status);
10663: END IF;
10664:
10665: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10666: x_return_status := fnd_api.g_ret_sts_success;
10667: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10668: x_exception_material_tbl := l_exception_material_tbl;
10669: END IF;
10662: || x_return_status);
10663: END IF;
10664:
10665: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10666: x_return_status := fnd_api.g_ret_sts_success;
10667: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10668: x_exception_material_tbl := l_exception_material_tbl;
10669: END IF;
10670:
10667: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10668: x_exception_material_tbl := l_exception_material_tbl;
10669: END IF;
10670:
10671: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10672: RAISE error_complete_step;
10673: END IF;
10674: -- reset flex global
10675: gme_common_pvt.g_flex_validate_prof := 0;
10676:
10677: -- Bug 13981238 Restructure call to save_batch conditionalize on p_commit flag.
10678:
10679: -- Invoke save_batch
10680: -- IF (p_commit = fnd_api.g_true) THEN
10681:
10682: -- Bug 16079623 - Conditionalize call to save_batch based on p_save_batch. Rework of 13981238.
10683: IF (p_save_batch = fnd_api.g_true) THEN
10684: -- Bug 13981238 Change table parameter to 2 since now transactions will be in mmt.
10679: -- Invoke save_batch
10680: -- IF (p_commit = fnd_api.g_true) THEN
10681:
10682: -- Bug 16079623 - Conditionalize call to save_batch based on p_save_batch. Rework of 13981238.
10683: IF (p_save_batch = fnd_api.g_true) THEN
10684: -- Bug 13981238 Change table parameter to 2 since now transactions will be in mmt.
10685: gme_api_pub.save_batch
10686: (p_header_id => gme_common_pvt.g_transaction_header_id
10687: ,p_table => 2
10697: || x_return_status);
10698: END IF;
10699: END IF;
10700:
10701: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10702: RAISE fnd_api.g_exc_error;
10703: END IF;
10704:
10705: IF g_debug <= gme_debug.g_log_procedure THEN
10698: END IF;
10699: END IF;
10700:
10701: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10702: RAISE fnd_api.g_exc_error;
10703: END IF;
10704:
10705: IF g_debug <= gme_debug.g_log_procedure THEN
10706: gme_debug.put_line ( ' Completed '
10712: WHEN error_complete_step THEN
10713: ROLLBACK TO SAVEPOINT complete_step;
10714: x_batch_step_rec := NULL;
10715: gme_common_pvt.count_and_get (x_count => x_message_count
10716: ,p_encoded => fnd_api.g_false
10717: ,x_data => x_message_list);
10718: WHEN fnd_api.g_exc_error THEN
10719: ROLLBACK TO SAVEPOINT complete_step;
10720: x_batch_step_rec := NULL;
10714: x_batch_step_rec := NULL;
10715: gme_common_pvt.count_and_get (x_count => x_message_count
10716: ,p_encoded => fnd_api.g_false
10717: ,x_data => x_message_list);
10718: WHEN fnd_api.g_exc_error THEN
10719: ROLLBACK TO SAVEPOINT complete_step;
10720: x_batch_step_rec := NULL;
10721: x_return_status := fnd_api.g_ret_sts_error;
10722: gme_common_pvt.count_and_get (x_count => x_message_count
10717: ,x_data => x_message_list);
10718: WHEN fnd_api.g_exc_error THEN
10719: ROLLBACK TO SAVEPOINT complete_step;
10720: x_batch_step_rec := NULL;
10721: x_return_status := fnd_api.g_ret_sts_error;
10722: gme_common_pvt.count_and_get (x_count => x_message_count
10723: ,p_encoded => fnd_api.g_false
10724: ,x_data => x_message_list);
10725: WHEN OTHERS THEN
10719: ROLLBACK TO SAVEPOINT complete_step;
10720: x_batch_step_rec := NULL;
10721: x_return_status := fnd_api.g_ret_sts_error;
10722: gme_common_pvt.count_and_get (x_count => x_message_count
10723: ,p_encoded => fnd_api.g_false
10724: ,x_data => x_message_list);
10725: WHEN OTHERS THEN
10726: ROLLBACK TO SAVEPOINT complete_step;
10727: x_batch_step_rec := NULL;
10744: p_batch_header_rec (O) batch header to identify the batch to release;
10745: p_org_code (O) organization code to identify the batch is conjunction with batch_no in p_batch_header_rec
10746: p_ignore_exception (O) indicates whether to ignore exceptions; if exceptions are ignored,
10747: x_exception_material_tbl won't be populated even if exceptions were found
10748: p_validate_flexfields (O) indicates whether to validate flexfields... Defaults to fnd_api.g_false;
10749: x_batch_header_rec Output batch header record after release
10750: x_exception_material_tbl Batch exceptions found in release batch
10751: x_return_status outcome of the API call
10752: S - Success
10757: PROCEDURE release_batch
10758: (p_api_version IN NUMBER
10759: ,p_validation_level IN NUMBER
10760: := gme_common_pvt.g_max_errors
10761: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10762: ,p_commit IN VARCHAR2 := fnd_api.g_false
10763: ,x_message_count OUT NOCOPY NUMBER
10764: ,x_message_list OUT NOCOPY VARCHAR2
10765: ,x_return_status OUT NOCOPY VARCHAR2
10758: (p_api_version IN NUMBER
10759: ,p_validation_level IN NUMBER
10760: := gme_common_pvt.g_max_errors
10761: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10762: ,p_commit IN VARCHAR2 := fnd_api.g_false
10763: ,x_message_count OUT NOCOPY NUMBER
10764: ,x_message_list OUT NOCOPY VARCHAR2
10765: ,x_return_status OUT NOCOPY VARCHAR2
10766: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10764: ,x_message_list OUT NOCOPY VARCHAR2
10765: ,x_return_status OUT NOCOPY VARCHAR2
10766: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10767: ,p_org_code IN VARCHAR2
10768: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10769: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10770: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
10771: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10772: IS
10765: ,x_return_status OUT NOCOPY VARCHAR2
10766: ,p_batch_header_rec IN gme_batch_header%ROWTYPE
10767: ,p_org_code IN VARCHAR2
10768: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10769: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10770: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
10771: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10772: IS
10773: l_api_name CONSTANT VARCHAR2 (30) := 'RELEASE_BATCH';
10787: || l_api_name);
10788: END IF;
10789:
10790: /* Set the return status to success initially */
10791: x_return_status := fnd_api.g_ret_sts_success;
10792:
10793: /* Set savepoint here */
10794: SAVEPOINT release_batch;
10795:
10792:
10793: /* Set savepoint here */
10794: SAVEPOINT release_batch;
10795:
10796: IF p_init_msg_list = fnd_api.g_true THEN
10797: fnd_msg_pub.initialize;
10798: END IF;
10799:
10800: IF NOT fnd_api.compatible_api_call (2.0
10796: IF p_init_msg_list = fnd_api.g_true THEN
10797: fnd_msg_pub.initialize;
10798: END IF;
10799:
10800: IF NOT fnd_api.compatible_api_call (2.0
10801: ,p_api_version
10802: ,'release_batch'
10803: ,g_pkg_name) THEN
10804: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10801: ,p_api_version
10802: ,'release_batch'
10803: ,g_pkg_name) THEN
10804: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
10805: RAISE fnd_api.g_exc_error;
10806: END IF;
10807:
10808: gme_common_pvt.validate_batch
10809: (p_batch_header_rec => p_batch_header_rec
10813: ,x_message_count => x_message_count
10814: ,x_message_list => x_message_list
10815: ,x_return_status => x_return_status );
10816:
10817: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10818: IF (g_debug = gme_debug.g_log_statement) THEN
10819: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10820: || ': batch validate error ');
10821: END IF;
10818: IF (g_debug = gme_debug.g_log_statement) THEN
10819: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10820: || ': batch validate error ');
10821: END IF;
10822: RAISE fnd_api.g_exc_error;
10823: END IF;
10824: -- Validations
10825: IF p_validate_flexfields = fnd_api.g_true THEN
10826: gme_common_pvt.g_flex_validate_prof := 1;
10821: END IF;
10822: RAISE fnd_api.g_exc_error;
10823: END IF;
10824: -- Validations
10825: IF p_validate_flexfields = fnd_api.g_true THEN
10826: gme_common_pvt.g_flex_validate_prof := 1;
10827: ELSE
10828: gme_common_pvt.g_flex_validate_prof := 0;
10829: END IF;
10836: p_batch_header_rec => l_in_batch_header_rec
10837: ,x_batch_header_rec => l_batch_header_rec
10838: ,x_return_status => x_return_status);
10839:
10840: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10841: RAISE fnd_api.g_exc_error;
10842: END IF;
10843:
10844: -- reset flex global
10837: ,x_batch_header_rec => l_batch_header_rec
10838: ,x_return_status => x_return_status);
10839:
10840: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10841: RAISE fnd_api.g_exc_error;
10842: END IF;
10843:
10844: -- reset flex global
10845: gme_common_pvt.g_flex_validate_prof := 0;
10843:
10844: -- reset flex global
10845: gme_common_pvt.g_flex_validate_prof := 0;
10846:
10847: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
10848: IF g_debug <= gme_debug.g_log_statement THEN
10849: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
10850: || 'batch_id '||l_batch_header_rec.batch_id);
10851: END IF;
10851: END IF;
10852: /* Invoke main */
10853: gme_api_main.release_batch
10854: (p_validation_level => p_validation_level
10855: ,p_init_msg_list => fnd_api.g_false
10856: ,x_message_count => x_message_count
10857: ,x_message_list => x_message_list
10858: ,x_return_status => x_return_status
10859: ,p_batch_header_rec => l_batch_header_rec
10866: ' Return status from gme_api_main.release_batch is '
10867: || x_return_status);
10868: END IF;
10869:
10870: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10871: x_return_status := fnd_api.g_ret_sts_success;
10872: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10873: x_exception_material_tbl := l_exception_material_tbl;
10874: END IF;
10867: || x_return_status);
10868: END IF;
10869:
10870: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
10871: x_return_status := fnd_api.g_ret_sts_success;
10872: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10873: x_exception_material_tbl := l_exception_material_tbl;
10874: END IF;
10875:
10872: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
10873: x_exception_material_tbl := l_exception_material_tbl;
10874: END IF;
10875:
10876: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10877: RAISE error_release_batch;
10878: END IF;
10879:
10880: /* Invoke save_batch */
10893: gme_debug.put_line ( g_pkg_name || '.' || l_api_name ||
10894: ' Return status from gme_api_pub.save_batch is ' || x_return_status);
10895: END IF;
10896:
10897: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10898: RAISE fnd_api.g_exc_error;
10899: END IF;
10900:
10901: IF g_debug <= gme_debug.g_log_procedure THEN
10894: ' Return status from gme_api_pub.save_batch is ' || x_return_status);
10895: END IF;
10896:
10897: IF x_return_status <> fnd_api.g_ret_sts_success THEN
10898: RAISE fnd_api.g_exc_error;
10899: END IF;
10900:
10901: IF g_debug <= gme_debug.g_log_procedure THEN
10902: gme_debug.put_line ( ' Completed ' || l_api_name || ' at '
10906: WHEN error_release_batch THEN
10907: ROLLBACK TO SAVEPOINT release_batch;
10908: x_batch_header_rec := NULL;
10909: gme_common_pvt.count_and_get (x_count => x_message_count
10910: ,p_encoded => fnd_api.g_false
10911: ,x_data => x_message_list);
10912: WHEN fnd_api.g_exc_error THEN
10913: ROLLBACK TO SAVEPOINT release_batch;
10914: x_batch_header_rec := NULL;
10908: x_batch_header_rec := NULL;
10909: gme_common_pvt.count_and_get (x_count => x_message_count
10910: ,p_encoded => fnd_api.g_false
10911: ,x_data => x_message_list);
10912: WHEN fnd_api.g_exc_error THEN
10913: ROLLBACK TO SAVEPOINT release_batch;
10914: x_batch_header_rec := NULL;
10915: x_return_status := fnd_api.g_ret_sts_error;
10916: gme_common_pvt.count_and_get (x_count => x_message_count
10911: ,x_data => x_message_list);
10912: WHEN fnd_api.g_exc_error THEN
10913: ROLLBACK TO SAVEPOINT release_batch;
10914: x_batch_header_rec := NULL;
10915: x_return_status := fnd_api.g_ret_sts_error;
10916: gme_common_pvt.count_and_get (x_count => x_message_count
10917: ,p_encoded => fnd_api.g_false
10918: ,x_data => x_message_list);
10919: WHEN OTHERS THEN
10913: ROLLBACK TO SAVEPOINT release_batch;
10914: x_batch_header_rec := NULL;
10915: x_return_status := fnd_api.g_ret_sts_error;
10916: gme_common_pvt.count_and_get (x_count => x_message_count
10917: ,p_encoded => fnd_api.g_false
10918: ,x_data => x_message_list);
10919: WHEN OTHERS THEN
10920: ROLLBACK TO SAVEPOINT release_batch;
10921: x_batch_header_rec := NULL;
10940: p_batch_no (O) batch_no to identify the step
10941: p_org_code (O) organization code to identify the step is conjunction with batch_no in p_batch_header_rec
10942: p_ignore_exception (O) indicates whether to ignore exceptions; if exceptions are ignored,
10943: x_exception_material_tbl won't be populated ever if exceptions were found
10944: p_validate_flexfields (O) indicates whether to validate flexfields... Defaults to fnd_api.g_false;
10945: x_batch_step_rec Output batch step record after release
10946: x_exception_material_tbl Material exceptions found in release step (only those associated to step and processed dep steps)
10947: x_return_status outcome of the API call
10948: S - Success
10965: PROCEDURE release_step
10966: (p_api_version IN NUMBER
10967: ,p_validation_level IN NUMBER
10968: := gme_common_pvt.g_max_errors
10969: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10970: ,p_commit IN VARCHAR2 := fnd_api.g_false
10971: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10972: ,x_message_count OUT NOCOPY NUMBER
10973: ,x_message_list OUT NOCOPY VARCHAR2
10966: (p_api_version IN NUMBER
10967: ,p_validation_level IN NUMBER
10968: := gme_common_pvt.g_max_errors
10969: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10970: ,p_commit IN VARCHAR2 := fnd_api.g_false
10971: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10972: ,x_message_count OUT NOCOPY NUMBER
10973: ,x_message_list OUT NOCOPY VARCHAR2
10974: ,x_return_status OUT NOCOPY VARCHAR2
10967: ,p_validation_level IN NUMBER
10968: := gme_common_pvt.g_max_errors
10969: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
10970: ,p_commit IN VARCHAR2 := fnd_api.g_false
10971: ,p_save_batch IN VARCHAR2 := fnd_api.g_true -- Bug 16079623
10972: ,x_message_count OUT NOCOPY NUMBER
10973: ,x_message_list OUT NOCOPY VARCHAR2
10974: ,x_return_status OUT NOCOPY VARCHAR2
10975: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10974: ,x_return_status OUT NOCOPY VARCHAR2
10975: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10976: ,p_batch_no IN VARCHAR2
10977: ,p_org_code IN VARCHAR2
10978: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10979: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10980: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
10981: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10982: IS
10975: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
10976: ,p_batch_no IN VARCHAR2
10977: ,p_org_code IN VARCHAR2
10978: ,p_ignore_exception IN VARCHAR2 := fnd_api.g_false
10979: ,p_validate_flexfields IN VARCHAR2 := fnd_api.g_false
10980: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
10981: ,x_exception_material_tbl OUT NOCOPY gme_common_pvt.exceptions_tab)
10982: IS
10983: l_api_name CONSTANT VARCHAR2 (30) := 'RELEASE_STEP';
11000: || l_api_name);
11001: END IF;
11002:
11003: /* Set the return status to success initially */
11004: x_return_status := fnd_api.g_ret_sts_success;
11005:
11006: /* Set savepoint here */
11007: SAVEPOINT release_step;
11008:
11005:
11006: /* Set savepoint here */
11007: SAVEPOINT release_step;
11008:
11009: IF p_init_msg_list = fnd_api.g_true THEN
11010: fnd_msg_pub.initialize;
11011: END IF;
11012:
11013: IF NOT fnd_api.compatible_api_call (2.0
11009: IF p_init_msg_list = fnd_api.g_true THEN
11010: fnd_msg_pub.initialize;
11011: END IF;
11012:
11013: IF NOT fnd_api.compatible_api_call (2.0
11014: ,p_api_version
11015: ,'release_step'
11016: ,g_pkg_name) THEN
11017: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11014: ,p_api_version
11015: ,'release_step'
11016: ,g_pkg_name) THEN
11017: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11018: RAISE fnd_api.g_exc_error;
11019: END IF;
11020: /* Validate Input parameters */
11021: gme_common_pvt.Validate_batch_step (
11022: p_batch_step_rec => p_batch_step_rec
11027: ,x_message_count => x_message_count
11028: ,x_message_list => x_message_list
11029: ,x_return_status => x_return_status );
11030:
11031: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11032: IF (g_debug = gme_debug.g_log_statement) THEN
11033: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
11034: || ': batch step validate error ');
11035: END IF;
11032: IF (g_debug = gme_debug.g_log_statement) THEN
11033: gme_debug.put_line ( g_pkg_name || '.' || l_api_name
11034: || ': batch step validate error ');
11035: END IF;
11036: RAISE fnd_api.g_exc_error;
11037: END IF;
11038: -- Validations
11039: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
11040: gme_common_pvt.log_message('GME_API_INVALID_BATCH_TYPE');
11037: END IF;
11038: -- Validations
11039: IF l_batch_header_rec.batch_type = gme_common_pvt.g_doc_type_fpo THEN
11040: gme_common_pvt.log_message('GME_API_INVALID_BATCH_TYPE');
11041: RAISE fnd_api.g_exc_error;
11042: END IF;
11043: -- current Step Status must be Pending
11044: IF (l_batch_step_rec.step_status <> gme_common_pvt.g_step_pending) THEN
11045: gme_common_pvt.log_message('GME_API_INV_STAT_STEP_REL');
11042: END IF;
11043: -- current Step Status must be Pending
11044: IF (l_batch_step_rec.step_status <> gme_common_pvt.g_step_pending) THEN
11045: gme_common_pvt.log_message('GME_API_INV_STAT_STEP_REL');
11046: RAISE fnd_api.g_exc_error;
11047: END IF;
11048:
11049: IF l_batch_header_rec.batch_status NOT IN
11050: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
11048:
11049: IF l_batch_header_rec.batch_status NOT IN
11050: (gme_common_pvt.g_batch_pending, gme_common_pvt.g_batch_wip) THEN
11051: gme_common_pvt.log_message ('GME_API_INV_BATCH_REL_STEP');
11052: RAISE fnd_api.g_exc_error;
11053: END IF;
11054:
11055: --Pawan kumar changed to number for g_step_controls_batch_sts
11056: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending AND
11056: IF l_batch_header_rec.batch_status = gme_common_pvt.g_batch_pending AND
11057: (gme_common_pvt.g_step_controls_batch_sts_ind <> 1 OR
11058: l_batch_header_rec.parentline_id IS NOT NULL) THEN
11059: gme_common_pvt.log_message ('GME_API_INV_BATCH_REL_STEP');
11060: RAISE fnd_api.g_exc_error;
11061: END IF;
11062:
11063: l_in_batch_step_rec := l_batch_step_rec;
11064: l_in_batch_step_rec.actual_start_date := p_batch_step_rec.actual_start_date;
11068: ,p_batch_step_rec => l_in_batch_step_rec
11069: ,x_batch_step_rec => l_batch_step_rec
11070: ,x_return_status => x_return_status);
11071:
11072: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11073: RAISE fnd_api.g_exc_error;
11074: END IF;
11075:
11076: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
11069: ,x_batch_step_rec => l_batch_step_rec
11070: ,x_return_status => x_return_status);
11071:
11072: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11073: RAISE fnd_api.g_exc_error;
11074: END IF;
11075:
11076: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
11077: IF p_validate_flexfields = fnd_api.g_true THEN
11073: RAISE fnd_api.g_exc_error;
11074: END IF;
11075:
11076: -- needed for release batch AND/OR release step (release step is in private to take care of dependent steps)
11077: IF p_validate_flexfields = fnd_api.g_true THEN
11078: gme_common_pvt.g_flex_validate_prof := 1;
11079: ELSE
11080: gme_common_pvt.g_flex_validate_prof := 0;
11081: END IF;
11089: (p_batch_header_rec => l_in_batch_header_rec
11090: ,x_batch_header_rec => l_batch_header_rec
11091: ,x_return_status => x_return_status);
11092:
11093: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11094: RAISE fnd_api.g_exc_error;
11095: END IF;
11096: END IF;
11097:
11090: ,x_batch_header_rec => l_batch_header_rec
11091: ,x_return_status => x_return_status);
11092:
11093: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11094: RAISE fnd_api.g_exc_error;
11095: END IF;
11096: END IF;
11097:
11098: -- Bug 13981238 - comment out the following line so that any transactions are moved to mmt.
11095: END IF;
11096: END IF;
11097:
11098: -- Bug 13981238 - comment out the following line so that any transactions are moved to mmt.
11099: -- gme_common_pvt.g_move_to_temp := fnd_api.g_false;
11100:
11101: /* Invoke main */
11102: gme_api_main.release_step
11103: (p_validation_level => p_validation_level
11100:
11101: /* Invoke main */
11102: gme_api_main.release_step
11103: (p_validation_level => p_validation_level
11104: ,p_init_msg_list => fnd_api.g_false
11105: ,x_message_count => x_message_count
11106: ,x_message_list => x_message_list
11107: ,x_return_status => x_return_status
11108: ,p_batch_step_rec => l_batch_step_rec
11118:
11119: -- reset flex global
11120: gme_common_pvt.g_flex_validate_prof := 0;
11121:
11122: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
11123: x_return_status := fnd_api.g_ret_sts_success;
11124: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
11125: x_exception_material_tbl := l_exception_material_tbl;
11126: END IF;
11119: -- reset flex global
11120: gme_common_pvt.g_flex_validate_prof := 0;
11121:
11122: IF p_ignore_exception = fnd_api.g_true AND x_return_status = gme_common_pvt.g_exceptions_err THEN
11123: x_return_status := fnd_api.g_ret_sts_success;
11124: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
11125: x_exception_material_tbl := l_exception_material_tbl;
11126: END IF;
11127:
11124: ELSIF x_return_status = gme_common_pvt.g_exceptions_err THEN
11125: x_exception_material_tbl := l_exception_material_tbl;
11126: END IF;
11127:
11128: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11129: RAISE error_release_step;
11130: END IF;
11131:
11132: /* Invoke save_batch */
11136: END IF;
11137:
11138: -- Bug 13981238 Restructure call to save_batch conditionalize on p_commit flag.
11139: -- Invoke save_batch
11140: -- IF (p_commit = fnd_api.g_true) THEN
11141:
11142: -- Bug 16079623 - Conditionalize call to save_batch based on p_save_batch. Rework of 13981238.
11143: IF (p_save_batch = fnd_api.g_true) THEN
11144: -- Bug 13981238 Change table parameter to 2 since now transactions will be in mmt.
11139: -- Invoke save_batch
11140: -- IF (p_commit = fnd_api.g_true) THEN
11141:
11142: -- Bug 16079623 - Conditionalize call to save_batch based on p_save_batch. Rework of 13981238.
11143: IF (p_save_batch = fnd_api.g_true) THEN
11144: -- Bug 13981238 Change table parameter to 2 since now transactions will be in mmt.
11145: gme_api_pub.save_batch
11146: (p_header_id => gme_common_pvt.g_transaction_header_id
11147: ,p_table => 2
11153: status from gme_api_pub.save_batch is ' || x_return_status);
11154: END IF;
11155: END IF;
11156:
11157: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11158: RAISE fnd_api.g_exc_error;
11159: END IF;
11160:
11161: IF g_debug <= gme_debug.g_log_procedure THEN
11154: END IF;
11155: END IF;
11156:
11157: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11158: RAISE fnd_api.g_exc_error;
11159: END IF;
11160:
11161: IF g_debug <= gme_debug.g_log_procedure THEN
11162: gme_debug.put_line ( ' Completed ' || l_api_name || ' at '
11167: WHEN error_release_step THEN
11168: ROLLBACK TO SAVEPOINT release_step;
11169: x_batch_step_rec := NULL;
11170: gme_common_pvt.count_and_get (x_count => x_message_count
11171: ,p_encoded => fnd_api.g_false
11172: ,x_data => x_message_list);
11173: WHEN fnd_api.g_exc_error THEN
11174: ROLLBACK TO SAVEPOINT release_step;
11175: x_batch_step_rec := NULL;
11169: x_batch_step_rec := NULL;
11170: gme_common_pvt.count_and_get (x_count => x_message_count
11171: ,p_encoded => fnd_api.g_false
11172: ,x_data => x_message_list);
11173: WHEN fnd_api.g_exc_error THEN
11174: ROLLBACK TO SAVEPOINT release_step;
11175: x_batch_step_rec := NULL;
11176: x_return_status := fnd_api.g_ret_sts_error;
11177: gme_common_pvt.count_and_get (x_count => x_message_count
11172: ,x_data => x_message_list);
11173: WHEN fnd_api.g_exc_error THEN
11174: ROLLBACK TO SAVEPOINT release_step;
11175: x_batch_step_rec := NULL;
11176: x_return_status := fnd_api.g_ret_sts_error;
11177: gme_common_pvt.count_and_get (x_count => x_message_count
11178: ,p_encoded => fnd_api.g_false
11179: ,x_data => x_message_list);
11180: WHEN OTHERS THEN
11174: ROLLBACK TO SAVEPOINT release_step;
11175: x_batch_step_rec := NULL;
11176: x_return_status := fnd_api.g_ret_sts_error;
11177: gme_common_pvt.count_and_get (x_count => x_message_count
11178: ,p_encoded => fnd_api.g_false
11179: ,x_data => x_message_list);
11180: WHEN OTHERS THEN
11181: ROLLBACK TO SAVEPOINT release_step;
11182: x_batch_step_rec := NULL;
11211: PROCEDURE process_group
11212: (p_api_version IN NUMBER
11213: ,p_validation_level IN NUMBER
11214: := gme_common_pvt.g_max_errors
11215: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
11216: ,p_commit IN VARCHAR2 := fnd_api.g_false
11217: ,p_group_name IN VARCHAR2
11218: ,p_org_code IN VARCHAR2
11219: ,p_action IN NUMBER
11212: (p_api_version IN NUMBER
11213: ,p_validation_level IN NUMBER
11214: := gme_common_pvt.g_max_errors
11215: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
11216: ,p_commit IN VARCHAR2 := fnd_api.g_false
11217: ,p_group_name IN VARCHAR2
11218: ,p_org_code IN VARCHAR2
11219: ,p_action IN NUMBER
11220: ,p_on_error_flag IN VARCHAR2
11277: || l_api_name);
11278: END IF;
11279:
11280: /* Set the return status to success initially */
11281: x_return_status := fnd_api.g_ret_sts_success;
11282:
11283: /* Set savepoint here */
11284: /* SAVEPOINT process_group; */
11285:
11282:
11283: /* Set savepoint here */
11284: /* SAVEPOINT process_group; */
11285:
11286: IF p_init_msg_list = fnd_api.g_true THEN
11287: fnd_msg_pub.initialize;
11288: END IF;
11289:
11290: IF NOT fnd_api.compatible_api_call (2.0
11286: IF p_init_msg_list = fnd_api.g_true THEN
11287: fnd_msg_pub.initialize;
11288: END IF;
11289:
11290: IF NOT fnd_api.compatible_api_call (2.0
11291: ,p_api_version
11292: ,'process_group'
11293: ,g_pkg_name) THEN
11294: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11291: ,p_api_version
11292: ,'process_group'
11293: ,g_pkg_name) THEN
11294: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11295: RAISE fnd_api.g_exc_error;
11296: END IF;
11297:
11298: /* Validate Input parameters */
11299:
11300:
11301: IF (p_org_code IS NULL) THEN
11302: fnd_message.set_name ('INV', 'INV_ORG_REQUIRED');
11303: fnd_msg_pub.ADD;
11304: RAISE fnd_api.g_exc_error;
11305: END IF;
11306:
11307: IF (p_group_name IS NULL) THEN
11308: fnd_message.set_name ('GME', 'GME_GROUP_REQUIRED');
11306:
11307: IF (p_group_name IS NULL) THEN
11308: fnd_message.set_name ('GME', 'GME_GROUP_REQUIRED');
11309: fnd_msg_pub.ADD;
11310: RAISE fnd_api.g_exc_error;
11311: END IF;
11312:
11313: IF (p_action IS NULL) THEN
11314: fnd_message.set_name ('GME', 'GME_ACTION_REQUIRED');
11312:
11313: IF (p_action IS NULL) THEN
11314: fnd_message.set_name ('GME', 'GME_ACTION_REQUIRED');
11315: fnd_msg_pub.ADD;
11316: RAISE fnd_api.g_exc_error;
11317: END IF;
11318:
11319: IF (p_on_error_flag IS NULL) THEN
11320: fnd_message.set_name ('GME', 'GME_ERR_FLAG_REQUIRED');
11318:
11319: IF (p_on_error_flag IS NULL) THEN
11320: fnd_message.set_name ('GME', 'GME_ERR_FLAG_REQUIRED');
11321: fnd_msg_pub.ADD;
11322: RAISE fnd_api.g_exc_error;
11323: END IF;
11324:
11325: OPEN get_organization (p_org_code);
11326:
11328:
11329: IF get_organization%NOTFOUND THEN
11330: CLOSE get_organization;
11331: gme_common_pvt.log_message ('GME_INVALID_ORG');
11332: RAISE fnd_api.g_exc_error;
11333: END IF;
11334:
11335: CLOSE get_organization;
11336:
11340:
11341: IF get_group_id%NOTFOUND THEN
11342: CLOSE get_group_id;
11343: gme_common_pvt.log_message ('GME_INVALID_GROUP');
11344: RAISE fnd_api.g_exc_error;
11345: END IF;
11346:
11347: CLOSE get_group_id;
11348:
11351:
11352: IF validate_lookup_code%NOTFOUND THEN
11353: CLOSE validate_lookup_code;
11354: gme_common_pvt.log_message ('GME_INVALID_GROUP_ACTION');
11355: RAISE fnd_api.g_exc_error;
11356: END IF;
11357:
11358: CLOSE validate_lookup_code;
11359:
11358: CLOSE validate_lookup_code;
11359:
11360: IF (p_on_error_flag <> 'STOP' AND p_on_error_flag <> 'CONTINUE') THEN
11361: gme_common_pvt.log_message ('GME_INVALID_ERR_FLAG');
11362: RAISE fnd_api.g_exc_error;
11363: END IF;
11364:
11365: i := 0;
11366: FOR get_rec IN get_associated_batches(l_group_id) LOOP
11495: );
11496: END IF;
11497:
11498: -- DBMS_OUTPUT.put_line ('return status is = ' || x_return_status);
11499: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11500: failed_count := failed_count + 1;
11501: gme_common_pvt.count_and_get (x_count => x_message_count
11502: ,p_encoded => fnd_api.g_false
11503: ,x_data => x_message_list);
11498: -- DBMS_OUTPUT.put_line ('return status is = ' || x_return_status);
11499: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11500: failed_count := failed_count + 1;
11501: gme_common_pvt.count_and_get (x_count => x_message_count
11502: ,p_encoded => fnd_api.g_false
11503: ,x_data => x_message_list);
11504: -- DBMS_OUTPUT.put_line('Error ' || x_message_list);
11505: IF (p_on_error_flag = 'STOP') THEN
11506: RAISE error_process_group;
11512: EXCEPTION
11513: WHEN OTHERS THEN
11514: failed_count := failed_count + 1;
11515: gme_common_pvt.count_and_get (x_count => x_message_count
11516: ,p_encoded => fnd_api.g_false
11517: ,x_data => x_message_list);
11518: -- DBMS_OUTPUT.put_line('Error ' || x_message_list);
11519: IF (p_on_error_flag = 'STOP') THEN
11520: RAISE error_process_group;
11523: END LOOP;
11524:
11525: IF i=0 THEN
11526: gme_common_pvt.log_message ('GME_NO_GROUP_ASSOC');
11527: RAISE fnd_api.g_exc_error;
11528: ELSE
11529: -- DBMS_OUTPUT.put_line('Total ' || i);
11530: -- DBMS_OUTPUT.put_line('Success ' || success_count);
11531: -- DBMS_OUTPUT.put_line('Failed ' || failed_count);
11553: EXCEPTION
11554:
11555: WHEN error_process_group THEN
11556: gme_common_pvt.count_and_get (x_count => x_message_count
11557: ,p_encoded => fnd_api.g_false
11558: ,x_data => x_message_list);
11559: WHEN fnd_api.g_exc_error THEN
11560: x_return_status := fnd_api.g_ret_sts_error;
11561: gme_common_pvt.count_and_get (x_count => x_message_count
11555: WHEN error_process_group THEN
11556: gme_common_pvt.count_and_get (x_count => x_message_count
11557: ,p_encoded => fnd_api.g_false
11558: ,x_data => x_message_list);
11559: WHEN fnd_api.g_exc_error THEN
11560: x_return_status := fnd_api.g_ret_sts_error;
11561: gme_common_pvt.count_and_get (x_count => x_message_count
11562: ,p_encoded => fnd_api.g_false
11563: ,x_data => x_message_list);
11556: gme_common_pvt.count_and_get (x_count => x_message_count
11557: ,p_encoded => fnd_api.g_false
11558: ,x_data => x_message_list);
11559: WHEN fnd_api.g_exc_error THEN
11560: x_return_status := fnd_api.g_ret_sts_error;
11561: gme_common_pvt.count_and_get (x_count => x_message_count
11562: ,p_encoded => fnd_api.g_false
11563: ,x_data => x_message_list);
11564: WHEN OTHERS THEN
11558: ,x_data => x_message_list);
11559: WHEN fnd_api.g_exc_error THEN
11560: x_return_status := fnd_api.g_ret_sts_error;
11561: gme_common_pvt.count_and_get (x_count => x_message_count
11562: ,p_encoded => fnd_api.g_false
11563: ,x_data => x_message_list);
11564: WHEN OTHERS THEN
11565: gme_when_others ( p_api_name => l_api_name
11566: ,x_message_count => x_message_count
11599: ================================================================================*/
11600: PROCEDURE update_batchstep_qty (
11601: p_api_version IN NUMBER := 1.0
11602: ,p_validation_level IN NUMBER := gme_common_pvt.g_max_errors
11603: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
11604: ,p_commit IN VARCHAR2
11605: ,p_org_code IN VARCHAR2
11606: ,p_batch_no IN VARCHAR2 := NULL
11607: ,p_add IN VARCHAR2 := 'N'
11637: || l_api_name);
11638: END IF;
11639:
11640: /* Set the return status to success initially */
11641: x_return_status := fnd_api.g_ret_sts_success;
11642:
11643: /* Make sure we are call compatible */
11644:
11645: IF NOT fnd_api.compatible_api_call (1.0
11641: x_return_status := fnd_api.g_ret_sts_success;
11642:
11643: /* Make sure we are call compatible */
11644:
11645: IF NOT fnd_api.compatible_api_call (1.0
11646: ,p_api_version
11647: ,'update_batchstep'
11648: ,g_pkg_name) THEN
11649: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11646: ,p_api_version
11647: ,'update_batchstep'
11648: ,g_pkg_name) THEN
11649: gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
11650: RAISE fnd_api.g_exc_error;
11651: END IF;
11652:
11653: gme_common_pvt.set_timestamp;
11654:
11652:
11653: gme_common_pvt.set_timestamp;
11654:
11655: /* Initialize message list and count if needed */
11656: IF p_init_msg_list = fnd_api.g_true THEN
11657: fnd_msg_pub.initialize;
11658: gme_common_pvt.g_error_count := 0;
11659: END IF;
11660:
11681: || l_api_name
11682: || ' get_batchstep failed to retrieve row');
11683: END IF;
11684:
11685: RAISE fnd_api.g_exc_error;
11686: END IF;
11687:
11688: IF g_debug <= gme_debug.g_log_statement THEN
11689: gme_debug.put_line ( g_pkg_name
11718: || l_api_name
11719: || ' setup failure ');
11720: END IF;
11721:
11722: RAISE fnd_api.g_exc_error;
11723: END IF;
11724:
11725: /* Check the step_status of the batchstep */
11726: IF g_debug <= gme_debug.g_log_statement THEN
11798:
11799: -- Send information back to calling program.
11800: x_batch_step_rec := l_batch_step_rec;
11801:
11802: IF x_return_status = fnd_api.g_ret_sts_success THEN
11803: IF g_debug <= gme_debug.g_log_statement THEN
11804: gme_debug.put_line ( g_pkg_name
11805: || '.'
11806: || l_api_name
11809: END IF;
11810:
11811: -- We may revert back to using just a pure commit if required. Leaving code for now.
11812: /*
11813: IF p_commit = fnd_api.g_true THEN
11814: COMMIT;
11815: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
11816: END IF;
11817: */
11814: COMMIT;
11815: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
11816: END IF;
11817: */
11818: IF p_commit = fnd_api.g_true THEN
11819: gme_api_pub.save_batch
11820: (p_header_id => gme_common_pvt.g_transaction_header_id
11821: ,p_table => null
11822: ,p_commit => p_commit
11819: gme_api_pub.save_batch
11820: (p_header_id => gme_common_pvt.g_transaction_header_id
11821: ,p_table => null
11822: ,p_commit => p_commit
11823: ,p_clear_qty_cache => fnd_api.g_true
11824: ,x_return_status => x_return_status);
11825:
11826: IF g_debug <= gme_debug.g_log_statement THEN
11827: gme_debug.put_line ( g_pkg_name
11830: || ' save_batch return_status is '
11831: || x_return_status);
11832: END IF;
11833:
11834: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11835: RAISE fnd_api.g_exc_error;
11836: END IF;
11837:
11838: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
11831: || x_return_status);
11832: END IF;
11833:
11834: IF x_return_status <> fnd_api.g_ret_sts_success THEN
11835: RAISE fnd_api.g_exc_error;
11836: END IF;
11837:
11838: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
11839: gme_common_pvt.count_and_get(x_count => x_message_count
11836: END IF;
11837:
11838: gme_common_pvt.log_message ('PM_SAVED_CHANGES');
11839: gme_common_pvt.count_and_get(x_count => x_message_count
11840: ,p_encoded => fnd_api.g_false
11841: ,x_data => x_message_list);
11842: END IF;
11843: ELSE
11844: RAISE update_step_failed;
11855: END IF;
11856: EXCEPTION
11857: WHEN l_invalid_step_status OR negative_qty_error OR update_step_failed THEN
11858: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11859: x_return_status := fnd_api.g_ret_sts_error;
11860: gme_common_pvt.count_and_get (x_count => x_message_count
11861: ,p_encoded => fnd_api.g_false
11862: ,x_data => x_message_list);
11863: WHEN fnd_api.g_exc_error THEN
11857: WHEN l_invalid_step_status OR negative_qty_error OR update_step_failed THEN
11858: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11859: x_return_status := fnd_api.g_ret_sts_error;
11860: gme_common_pvt.count_and_get (x_count => x_message_count
11861: ,p_encoded => fnd_api.g_false
11862: ,x_data => x_message_list);
11863: WHEN fnd_api.g_exc_error THEN
11864: x_return_status := fnd_api.g_ret_sts_error;
11865: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11859: x_return_status := fnd_api.g_ret_sts_error;
11860: gme_common_pvt.count_and_get (x_count => x_message_count
11861: ,p_encoded => fnd_api.g_false
11862: ,x_data => x_message_list);
11863: WHEN fnd_api.g_exc_error THEN
11864: x_return_status := fnd_api.g_ret_sts_error;
11865: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11866: gme_common_pvt.count_and_get (x_count => x_message_count
11867: ,p_encoded => fnd_api.g_false
11860: gme_common_pvt.count_and_get (x_count => x_message_count
11861: ,p_encoded => fnd_api.g_false
11862: ,x_data => x_message_list);
11863: WHEN fnd_api.g_exc_error THEN
11864: x_return_status := fnd_api.g_ret_sts_error;
11865: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11866: gme_common_pvt.count_and_get (x_count => x_message_count
11867: ,p_encoded => fnd_api.g_false
11868: ,x_data => x_message_list);
11863: WHEN fnd_api.g_exc_error THEN
11864: x_return_status := fnd_api.g_ret_sts_error;
11865: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11866: gme_common_pvt.count_and_get (x_count => x_message_count
11867: ,p_encoded => fnd_api.g_false
11868: ,x_data => x_message_list);
11869: WHEN OTHERS THEN
11870: ROLLBACK TO SAVEPOINT update_batchstep_qty;
11871: gme_when_others ( p_api_name => l_api_name