298: END pre_import_counts;
299:
300: PROCEDURE activate_batch
301: (
302: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
303: p_batch_id IN NUMBER,
304: x_return_status OUT NOCOPY VARCHAR2,
305: x_msg_count OUT NOCOPY NUMBER,
306: x_msg_data OUT NOCOPY VARCHAR2
318:
319: -- Check if API is called in debug mode. If yes, enable debug.
320:
321: -- initialize message list if p_init_msg_list is set to TRUE.
322: IF fnd_api.to_boolean(p_init_msg_list) THEN
323: fnd_msg_pub.initialize;
324: END IF;
325:
326: -- initialize API return status to success.
323: fnd_msg_pub.initialize;
324: END IF;
325:
326: -- initialize API return status to success.
327: x_return_status := fnd_api.g_ret_sts_success;
328:
329: hz_imp_batch_summary_v2pub.activate_batch(p_init_msg_list => p_init_msg_list,
330: p_batch_id => p_batch_id,
331: x_return_status => x_return_status,
351: fnd_message.set_token('FK', 'p_batch_id');
352: fnd_message.set_token('COLUMN', 'batch_id');
353: fnd_message.set_token('TABLE', 'pos_imp_batch_summary');
354: fnd_msg_pub.add;
355: x_return_status := fnd_api.g_ret_sts_error;
356: END;
357:
358: IF x_return_status <> fnd_api.g_ret_sts_success THEN
359: RAISE fnd_api.g_exc_error;
354: fnd_msg_pub.add;
355: x_return_status := fnd_api.g_ret_sts_error;
356: END;
357:
358: IF x_return_status <> fnd_api.g_ret_sts_success THEN
359: RAISE fnd_api.g_exc_error;
360: END IF;
361:
362: -- batch id must be a valid batch for processing
355: x_return_status := fnd_api.g_ret_sts_error;
356: END;
357:
358: IF x_return_status <> fnd_api.g_ret_sts_success THEN
359: RAISE fnd_api.g_exc_error;
360: END IF;
361:
362: -- batch id must be a valid batch for processing
363: BEGIN
375: EXCEPTION
376: WHEN no_data_found THEN
377: fnd_message.set_name('AR', 'HZ_INVALID_IMP_BATCH');
378: fnd_msg_pub.add;
379: x_return_status := fnd_api.g_ret_sts_error;
380: END;
381:
382: IF x_return_status <> fnd_api.g_ret_sts_success THEN
383: RAISE fnd_api.g_exc_error;
378: fnd_msg_pub.add;
379: x_return_status := fnd_api.g_ret_sts_error;
380: END;
381:
382: IF x_return_status <> fnd_api.g_ret_sts_success THEN
383: RAISE fnd_api.g_exc_error;
384: END IF;
385:
386: ---------------------------------
379: x_return_status := fnd_api.g_ret_sts_error;
380: END;
381:
382: IF x_return_status <> fnd_api.g_ret_sts_success THEN
383: RAISE fnd_api.g_exc_error;
384: END IF;
385:
386: ---------------------------------
387: -- update the batch summary table
404: EXECUTE IMMEDIATE l_pre_count_stat
405: USING p_batch_id, l_original_system;
406:
407: -- standard call to get message count and if count is 1, get message info.
408: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
409: p_count => x_msg_count,
410: p_data => x_msg_data);
411:
412: EXCEPTION
409: p_count => x_msg_count,
410: p_data => x_msg_data);
411:
412: EXCEPTION
413: WHEN fnd_api.g_exc_error THEN
414: ROLLBACK TO activate_batch;
415:
416: x_return_status := fnd_api.g_ret_sts_error;
417:
412: EXCEPTION
413: WHEN fnd_api.g_exc_error THEN
414: ROLLBACK TO activate_batch;
415:
416: x_return_status := fnd_api.g_ret_sts_error;
417:
418: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
419: p_count => x_msg_count,
420: p_data => x_msg_data);
414: ROLLBACK TO activate_batch;
415:
416: x_return_status := fnd_api.g_ret_sts_error;
417:
418: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
419: p_count => x_msg_count,
420: p_data => x_msg_data);
421:
422: WHEN fnd_api.g_exc_unexpected_error THEN
418: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
419: p_count => x_msg_count,
420: p_data => x_msg_data);
421:
422: WHEN fnd_api.g_exc_unexpected_error THEN
423: ROLLBACK TO activate_batch;
424:
425: x_return_status := fnd_api.g_ret_sts_unexp_error;
426:
421:
422: WHEN fnd_api.g_exc_unexpected_error THEN
423: ROLLBACK TO activate_batch;
424:
425: x_return_status := fnd_api.g_ret_sts_unexp_error;
426:
427: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
428: p_count => x_msg_count,
429: p_data => x_msg_data);
423: ROLLBACK TO activate_batch;
424:
425: x_return_status := fnd_api.g_ret_sts_unexp_error;
426:
427: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
428: p_count => x_msg_count,
429: p_data => x_msg_data);
430:
431: WHEN OTHERS THEN
430:
431: WHEN OTHERS THEN
432: ROLLBACK TO activate_batch;
433:
434: x_return_status := fnd_api.g_ret_sts_unexp_error;
435:
436: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
437: fnd_message.set_token('ERROR', SQLERRM);
438: fnd_msg_pub.add;
436: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
437: fnd_message.set_token('ERROR', SQLERRM);
438: fnd_msg_pub.add;
439:
440: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
441: p_count => x_msg_count,
442: p_data => x_msg_data);
443:
444: END activate_batch;
462:
463: IF i >= 920 THEN
464: NULL;
465: ELSE
466: RAISE fnd_api.g_exc_error;
467: END IF;
468:
469: EXCEPTION
470: WHEN fnd_api.g_exc_error THEN
466: RAISE fnd_api.g_exc_error;
467: END IF;
468:
469: EXCEPTION
470: WHEN fnd_api.g_exc_error THEN
471: ROLLBACK WORK;
472: fnd_message.set_name('AR', 'HZ_IMP_DB_VER_CHECK');
473: fnd_msg_pub.add;
474: fnd_msg_pub.reset;
473: fnd_msg_pub.add;
474: fnd_msg_pub.reset;
475: FOR i IN 1 .. fnd_msg_pub.count_msg LOOP
476: l_error_message := fnd_msg_pub.get(p_msg_index => i,
477: p_encoded => fnd_api.g_false);
478: fnd_file.put_line(fnd_file.output, l_error_message);
479: fnd_file.put_line(fnd_file.log, l_error_message);
480: END LOOP;
481: retcode := 2;
479: fnd_file.put_line(fnd_file.log, l_error_message);
480: END LOOP;
481: retcode := 2;
482: RETURN;
483: WHEN fnd_api.g_exc_unexpected_error THEN
484: ROLLBACK WORK;
485: fnd_file.put_line(fnd_file.log, 'Unexpected error occured ');
486: fnd_file.put_line(fnd_file.log, SQLERRM);
487: retcode := 2;
503: FROM pos_imp_batch_summary
504: WHERE batch_id = p_batch_id;
505:
506: IF l_status = 'PROCESSING' THEN
507: RAISE fnd_api.g_exc_error;
508: END IF;
509: EXCEPTION
510: WHEN fnd_api.g_exc_error THEN
511: ROLLBACK WORK;
506: IF l_status = 'PROCESSING' THEN
507: RAISE fnd_api.g_exc_error;
508: END IF;
509: EXCEPTION
510: WHEN fnd_api.g_exc_error THEN
511: ROLLBACK WORK;
512: fnd_file.put_line(fnd_file.log,
513: 'Error : You cannot purge a batch when a batch is being processed.');
514: retcode := 2;
577: END purge_batch;
578:
579: PROCEDURE reject_batch
580: (
581: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
582: p_batch_id IN NUMBER,
583: x_return_status OUT NOCOPY VARCHAR2,
584: x_msg_count OUT NOCOPY NUMBER,
585: x_msg_data OUT NOCOPY VARCHAR2
597:
598: -- Check if API is called in debug mode. If yes, enable debug.
599:
600: -- initialize message list if p_init_msg_list is set to TRUE.
601: IF fnd_api.to_boolean(p_init_msg_list) THEN
602: fnd_msg_pub.initialize;
603: END IF;
604:
605: -- initialize API return status to success.
602: fnd_msg_pub.initialize;
603: END IF;
604:
605: -- initialize API return status to success.
606: x_return_status := fnd_api.g_ret_sts_success;
607:
608: ----------------
609: -- do validation
610: ----------------
626: fnd_message.set_token('FK', 'p_batch_id');
627: fnd_message.set_token('COLUMN', 'batch_id');
628: fnd_message.set_token('TABLE', 'pos_imp_batch_summary');
629: fnd_msg_pub.add;
630: x_return_status := fnd_api.g_ret_sts_error;
631: END;
632:
633: IF x_return_status <> fnd_api.g_ret_sts_success THEN
634: RAISE fnd_api.g_exc_error;
629: fnd_msg_pub.add;
630: x_return_status := fnd_api.g_ret_sts_error;
631: END;
632:
633: IF x_return_status <> fnd_api.g_ret_sts_success THEN
634: RAISE fnd_api.g_exc_error;
635: END IF;
636:
637: /* -- batch id must be a valid batch for processing
630: x_return_status := fnd_api.g_ret_sts_error;
631: END;
632:
633: IF x_return_status <> fnd_api.g_ret_sts_success THEN
634: RAISE fnd_api.g_exc_error;
635: END IF;
636:
637: /* -- batch id must be a valid batch for processing
638: BEGIN
657: EXCEPTION
658: WHEN no_data_found THEN
659: fnd_message.set_name('AR', 'HZ_INVALID_IMP_BATCH');
660: fnd_msg_pub.add;
661: x_return_status := fnd_api.g_ret_sts_error;
662: END;
663:
664: IF x_return_status <> fnd_api.g_ret_sts_success THEN
665: RAISE fnd_api.g_exc_error;
660: fnd_msg_pub.add;
661: x_return_status := fnd_api.g_ret_sts_error;
662: END;
663:
664: IF x_return_status <> fnd_api.g_ret_sts_success THEN
665: RAISE fnd_api.g_exc_error;
666: END IF; */
667:
668: ---------------------------------
661: x_return_status := fnd_api.g_ret_sts_error;
662: END;
663:
664: IF x_return_status <> fnd_api.g_ret_sts_success THEN
665: RAISE fnd_api.g_exc_error;
666: END IF; */
667:
668: ---------------------------------
669: -- update the batch summary table
686: last_update_login = hz_utility_v2pub.last_update_login
687: WHERE batch_id = p_batch_id;
688:
689: -- standard call to get message count and if count is 1, get message info.
690: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
691: p_count => x_msg_count,
692: p_data => x_msg_data);
693:
694: EXCEPTION
691: p_count => x_msg_count,
692: p_data => x_msg_data);
693:
694: EXCEPTION
695: WHEN fnd_api.g_exc_error THEN
696: ROLLBACK TO reject_batch;
697:
698: x_return_status := fnd_api.g_ret_sts_error;
699:
694: EXCEPTION
695: WHEN fnd_api.g_exc_error THEN
696: ROLLBACK TO reject_batch;
697:
698: x_return_status := fnd_api.g_ret_sts_error;
699:
700: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
701: p_count => x_msg_count,
702: p_data => x_msg_data);
696: ROLLBACK TO reject_batch;
697:
698: x_return_status := fnd_api.g_ret_sts_error;
699:
700: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
701: p_count => x_msg_count,
702: p_data => x_msg_data);
703:
704: WHEN fnd_api.g_exc_unexpected_error THEN
700: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
701: p_count => x_msg_count,
702: p_data => x_msg_data);
703:
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: ROLLBACK TO reject_batch;
706:
707: x_return_status := fnd_api.g_ret_sts_unexp_error;
708:
703:
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: ROLLBACK TO reject_batch;
706:
707: x_return_status := fnd_api.g_ret_sts_unexp_error;
708:
709: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
710: p_count => x_msg_count,
711: p_data => x_msg_data);
705: ROLLBACK TO reject_batch;
706:
707: x_return_status := fnd_api.g_ret_sts_unexp_error;
708:
709: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
710: p_count => x_msg_count,
711: p_data => x_msg_data);
712:
713: WHEN OTHERS THEN
712:
713: WHEN OTHERS THEN
714: ROLLBACK TO reject_batch;
715:
716: x_return_status := fnd_api.g_ret_sts_unexp_error;
717:
718: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
719: fnd_message.set_token('ERROR', SQLERRM);
720: fnd_msg_pub.add;
718: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
719: fnd_message.set_token('ERROR', SQLERRM);
720: fnd_msg_pub.add;
721:
722: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
723: p_count => x_msg_count,
724: p_data => x_msg_data);
725:
726: END reject_batch;
743: -- standard start of API savepoint
744: SAVEPOINT create_import_batch;
745:
746: -- initialize API return status to success.
747: x_return_status := fnd_api.g_ret_sts_success;
748:
749: ----------------
750: -- do validation
751: ----------------
777: fnd_message.set_token('FK', 'orig_system');
778: fnd_message.set_token('COLUMN', 'orig_system');
779: fnd_message.set_token('TABLE', 'HZ_ORIG_SYSTEMS_B');
780: fnd_msg_pub.add;
781: x_return_status := fnd_api.g_ret_sts_error;
782: END;
783:
784: IF x_return_status <> fnd_api.g_ret_sts_success THEN
785: RAISE fnd_api.g_exc_error;
780: fnd_msg_pub.add;
781: x_return_status := fnd_api.g_ret_sts_error;
782: END;
783:
784: IF x_return_status <> fnd_api.g_ret_sts_success THEN
785: RAISE fnd_api.g_exc_error;
786: END IF;
787:
788: --------------------------------------------
781: x_return_status := fnd_api.g_ret_sts_error;
782: END;
783:
784: IF x_return_status <> fnd_api.g_ret_sts_success THEN
785: RAISE fnd_api.g_exc_error;
786: END IF;
787:
788: --------------------------------------------
789: -- insert the record with batch id
814: hz_utility_v2pub.last_update_date,
815: hz_utility_v2pub.last_update_login);
816:
817: -- standard call to get message count and if count is 1, get message info.
818: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
819: p_count => x_msg_count,
820: p_data => x_msg_data);
821:
822: EXCEPTION
819: p_count => x_msg_count,
820: p_data => x_msg_data);
821:
822: EXCEPTION
823: WHEN fnd_api.g_exc_error THEN
824: ROLLBACK TO create_import_batch;
825:
826: x_return_status := fnd_api.g_ret_sts_error;
827:
822: EXCEPTION
823: WHEN fnd_api.g_exc_error THEN
824: ROLLBACK TO create_import_batch;
825:
826: x_return_status := fnd_api.g_ret_sts_error;
827:
828: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
829: p_count => x_msg_count,
830: p_data => x_msg_data);
824: ROLLBACK TO create_import_batch;
825:
826: x_return_status := fnd_api.g_ret_sts_error;
827:
828: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
829: p_count => x_msg_count,
830: p_data => x_msg_data);
831:
832: WHEN fnd_api.g_exc_unexpected_error THEN
828: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
829: p_count => x_msg_count,
830: p_data => x_msg_data);
831:
832: WHEN fnd_api.g_exc_unexpected_error THEN
833: ROLLBACK TO create_import_batch;
834:
835: x_return_status := fnd_api.g_ret_sts_unexp_error;
836:
831:
832: WHEN fnd_api.g_exc_unexpected_error THEN
833: ROLLBACK TO create_import_batch;
834:
835: x_return_status := fnd_api.g_ret_sts_unexp_error;
836:
837: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
838: p_count => x_msg_count,
839: p_data => x_msg_data);
833: ROLLBACK TO create_import_batch;
834:
835: x_return_status := fnd_api.g_ret_sts_unexp_error;
836:
837: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
838: p_count => x_msg_count,
839: p_data => x_msg_data);
840:
841: WHEN OTHERS THEN
840:
841: WHEN OTHERS THEN
842: ROLLBACK TO create_import_batch;
843:
844: x_return_status := fnd_api.g_ret_sts_unexp_error;
845:
846: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
847: fnd_message.set_token('ERROR', SQLERRM);
848: fnd_msg_pub.add;
846: fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
847: fnd_message.set_token('ERROR', SQLERRM);
848: fnd_msg_pub.add;
849:
850: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
851: p_count => x_msg_count,
852: p_data => x_msg_data);
853:
854: END create_import_batch;