[Home] [Help]
1: PACKAGE BODY cn_proc_batches_pkg AS
2: /* $Header: cnsybatb.pls 120.26 2011/09/24 16:32:03 rnagired ship $ */
3:
4: /*
5: Date Name Description
693: WHEN OTHERS THEN
694: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
695: fnd_log.STRING(
696: fnd_log.level_unexpected
697: , 'cn.plsql.cn_proc_batches_pkg.populate_calcsub_batches.loop'
698: , SQLERRM
699: );
700: END IF;
701:
777: END IF;
778:
779: cn_message_pkg.FLUSH;
780: WHEN OTHERS THEN
781: fnd_file.put_line(fnd_file.LOG, 'In cn_proc_batches_pkg.populate_calcsub_batch: ' || SQLERRM);
782: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_calcsub_batch:');
783: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
784:
785: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
778:
779: cn_message_pkg.FLUSH;
780: WHEN OTHERS THEN
781: fnd_file.put_line(fnd_file.LOG, 'In cn_proc_batches_pkg.populate_calcsub_batch: ' || SQLERRM);
782: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_calcsub_batch:');
783: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
784:
785: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
786: fnd_log.STRING(
784:
785: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
786: fnd_log.STRING(
787: fnd_log.level_unexpected
788: , 'cn.plsql.cn_proc_batches_pkg.populate_calcsub_batches.exception'
789: , SQLERRM
790: );
791: END IF;
792:
1109: WHEN OTHERS THEN
1110: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
1111: fnd_log.STRING(
1112: fnd_log.level_unexpected
1113: , 'cn.plsql.cn_proc_batches_pkg.find_srp_incomplete_plan.exception'
1114: , SQLERRM
1115: );
1116: END IF;
1117:
1247:
1248: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
1249: fnd_log.MESSAGE(
1250: fnd_log.level_exception
1251: , 'cn.plsql.cn_proc_batches_pkg.populate_process_batches.all_reps'
1252: , FALSE
1253: );
1254: END IF;
1255:
1343:
1344: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
1345: fnd_log.MESSAGE(
1346: fnd_log.level_exception
1347: , 'cn.plsql.cn_proc_batches_pkg.populate_process_batches.user_specify'
1348: , FALSE
1349: );
1350: END IF;
1351:
1536: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
1537: fnd_log.STRING
1538: (
1539: fnd_log.level_exception
1540: , 'cn.plsql.cn_proc_batches_pkg.populate_process_batches.reps_in_notify_log'
1541: , 'No salesreps to calculate ...'
1542: );
1543: END IF;
1544:
1550: WHEN no_one_with_complete_plan THEN
1551: fnd_file.put_line
1552: (
1553: fnd_file.LOG
1554: , 'Exception occurs in cn_proc_batches_pkg.populate_process_batch: No one with complete compensation plan to calculate.'
1555: );
1556: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_process_batch:');
1557: cn_message_pkg.rollback_errormsg_commit
1558: ('No one with complete compensation plan to calculate.');
1552: (
1553: fnd_file.LOG
1554: , 'Exception occurs in cn_proc_batches_pkg.populate_process_batch: No one with complete compensation plan to calculate.'
1555: );
1556: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_process_batch:');
1557: cn_message_pkg.rollback_errormsg_commit
1558: ('No one with complete compensation plan to calculate.');
1559: RAISE;
1560: WHEN OTHERS THEN
1557: cn_message_pkg.rollback_errormsg_commit
1558: ('No one with complete compensation plan to calculate.');
1559: RAISE;
1560: WHEN OTHERS THEN
1561: fnd_file.put_line(fnd_file.LOG, 'In cn_proc_batches_pkg.populate_process_batch:' || SQLERRM);
1562:
1563: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
1564: fnd_log.STRING(
1565: fnd_log.level_unexpected
1562:
1563: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
1564: fnd_log.STRING(
1565: fnd_log.level_unexpected
1566: , 'cn.plsql.cn_proc_batches_pkg.populate_process_batch.exception'
1567: , SQLERRM
1568: );
1569: END IF;
1570:
1567: , SQLERRM
1568: );
1569: END IF;
1570:
1571: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_process_batch: ');
1572: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
1573: RAISE;
1574: END populate_process_batch;
1575:
1600: BEGIN
1601: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1602: fnd_log.STRING(
1603: fnd_log.level_procedure
1604: , 'cn.plsql.cn_proc_batches_pkg.calculation_submission.begin'
1605: , 'Beginning of calculation submission procedure ...'
1606: );
1607: END IF;
1608:
1662: WHERE logical_batch_id = g_logical_batch_id;
1663:
1664: IF l_status <> 'COMPLETE' THEN
1665: cn_global_var.initialize_instance_info(l_batch_rec.org_id);
1666: cn_proc_batches_pkg.main(
1667: p_concurrent_flag => l_batch_rec.concurrent_flag
1668: , p_process_name => 'CALCULATION'
1669: , p_logical_batch_id => g_logical_batch_id
1670: , p_start_date => l_batch_rec.start_date
1683:
1684: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1685: fnd_log.STRING(
1686: fnd_log.level_procedure
1687: , 'cn.plsql.cn_proc_batches_pkg.calculation_submission.end'
1688: , 'End of calculation submission procedure.'
1689: );
1690: END IF;
1691: EXCEPTION
1692: WHEN no_one_with_complete_plan THEN
1693: fnd_file.put_line
1694: (
1695: fnd_file.LOG
1696: , 'no_one_with_complete_plan EXCEPTION in cn_proc_batches_pkg.calculation_submission'
1697: );
1698: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.calculation_submission');
1699: cn_message_pkg.rollback_errormsg_commit
1700: ('No resource with complete compensation plan to calculate.');
1694: (
1695: fnd_file.LOG
1696: , 'no_one_with_complete_plan EXCEPTION in cn_proc_batches_pkg.calculation_submission'
1697: );
1698: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.calculation_submission');
1699: cn_message_pkg.rollback_errormsg_commit
1700: ('No resource with complete compensation plan to calculate.');
1701: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
1702: COMMIT;
1702: COMMIT;
1703: app_exception.raise_exception;
1704: WHEN OTHERS THEN
1705: x_process_status_code := 'FAIL';
1706: fnd_file.put_line(fnd_file.LOG, 'Error in cn_proc_batches_pkg.calculation_submission.');
1707: fnd_file.put_line(fnd_file.LOG, SQLERRM);
1708: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.calculation_submission:');
1709: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
1710: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
1704: WHEN OTHERS THEN
1705: x_process_status_code := 'FAIL';
1706: fnd_file.put_line(fnd_file.LOG, 'Error in cn_proc_batches_pkg.calculation_submission.');
1707: fnd_file.put_line(fnd_file.LOG, SQLERRM);
1708: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.calculation_submission:');
1709: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
1710: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
1711: COMMIT;
1712:
1712:
1713: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
1714: fnd_log.STRING(
1715: fnd_log.level_unexpected
1716: , 'cn.plsql.cn_proc_batches_pkg.calculation_submission.exception'
1717: , SQLERRM
1718: );
1719: END IF;
1720: END calculation_submission;
1735: WHEN OTHERS THEN
1736: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
1737: fnd_log.STRING(
1738: fnd_log.level_unexpected
1739: , 'cn.plsql.cn_proc_batches_pkg.get_physical_batch_id.exception'
1740: , SQLERRM
1741: );
1742: END IF;
1743:
1876: BEGIN
1877: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1878: fnd_log.STRING(
1879: fnd_log.level_procedure
1880: , 'cn.plsql.cn_proc_batches_pkg.assign.begin'
1881: , 'Beginning of assigning resources to physical batches ...'
1882: );
1883: END IF;
1884:
1959:
1960: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
1961: fnd_log.STRING(
1962: fnd_log.level_exception
1963: , 'cn.plsql.cn_proc_batches_pkg.assign.reps_count'
1964: , 'No salesreps to process.'
1965: );
1966: END IF;
1967:
2043:
2044: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
2045: fnd_log.STRING(
2046: fnd_log.level_procedure
2047: , 'cn.plsql.cn_proc_batches_pkg.assign.end'
2048: , 'Finish assigning resources to physical batches.'
2049: );
2050: END IF;
2051:
2053: cn_message_pkg.FLUSH;
2054: COMMIT;
2055: EXCEPTION
2056: WHEN no_comm_lines THEN
2057: fnd_file.put_line(fnd_file.LOG, 'no_comm_lines exception in cn_proc_batches_pkg.assign');
2058: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.assign:');
2059: cn_message_pkg.DEBUG('No transactions to process.');
2060: RAISE;
2061: WHEN OTHERS THEN
2054: COMMIT;
2055: EXCEPTION
2056: WHEN no_comm_lines THEN
2057: fnd_file.put_line(fnd_file.LOG, 'no_comm_lines exception in cn_proc_batches_pkg.assign');
2058: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.assign:');
2059: cn_message_pkg.DEBUG('No transactions to process.');
2060: RAISE;
2061: WHEN OTHERS THEN
2062: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2059: cn_message_pkg.DEBUG('No transactions to process.');
2060: RAISE;
2061: WHEN OTHERS THEN
2062: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2063: fnd_log.STRING(fnd_log.level_unexpected, 'cn.plsql.cn_proc_batches_pkg.assign.exception'
2064: , SQLERRM);
2065: END IF;
2066:
2067: fnd_file.put_line(fnd_file.LOG, 'In cn_proc_batches.assign: ' || SQLERRM);
2064: , SQLERRM);
2065: END IF;
2066:
2067: fnd_file.put_line(fnd_file.LOG, 'In cn_proc_batches.assign: ' || SQLERRM);
2068: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.assign:');
2069: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
2070: RAISE;
2071: END assign;
2072:
2118: IF (x_request_id = 0 OR x_request_id IS NULL) THEN
2119: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
2120: fnd_log.STRING(
2121: fnd_log.level_error
2122: , 'cn.plsql.cn_proc_batches_pkg.conc_submit.submission_status'
2123: , 'Submission failure for batch: ' || x_physical_batch_id
2124: );
2125: END IF;
2126:
2196: BEGIN
2197: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
2198: fnd_log.STRING(
2199: fnd_log.level_procedure
2200: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.begin'
2201: , 'Beginning of conc_dispatch...'
2202: );
2203: END IF;
2204:
2338:
2339: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2340: fnd_log.STRING(
2341: fnd_log.level_unexpected
2342: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.request_status'
2343: , 'Request ' || l_failed_request_id || ' failed (batch_id = ' || l_temp_phys_batch_id
2344: );
2345: END IF;
2346:
2380:
2381: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
2382: fnd_log.STRING(
2383: fnd_log.level_error
2384: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.request_status'
2385: , 'Request ' || l_failed_request_id || ' failed (batch_id = '
2386: || l_temp_phys_batch_id
2387: );
2388: END IF;
2482:
2483: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
2484: fnd_log.STRING(
2485: fnd_log.level_procedure
2486: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.end'
2487: , 'End of conc_dispatch.'
2488: );
2489: END IF;
2490: EXCEPTION
2488: );
2489: END IF;
2490: EXCEPTION
2491: WHEN conc_fail THEN
2492: fnd_file.put_line(fnd_file.LOG, 'conc_fail exception in cn_proc_batches_pkg.conc_dispatch');
2493: update_error(l_temp_phys_batch_id);
2494:
2495: -- canceling running/pending requests
2496: IF (l_primary_request_stack.COUNT > 0) THEN
2498: IF (l_primary_request_stack(i) > 0) THEN
2499: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
2500: fnd_log.STRING(
2501: fnd_log.level_exception
2502: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.exception'
2503: , 'Cancelling request: ' || l_primary_request_stack(i)
2504: );
2505: END IF;
2506:
2514: cn_message_pkg.end_batch(x_parent_proc_audit_id);
2515: WHEN OTHERS THEN
2516: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2517: fnd_log.STRING(fnd_log.level_unexpected
2518: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.exception', SQLERRM);
2519: END IF;
2520:
2521: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.conc_dispatch');
2522: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.conc_dispatch:');
2517: fnd_log.STRING(fnd_log.level_unexpected
2518: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.exception', SQLERRM);
2519: END IF;
2520:
2521: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.conc_dispatch');
2522: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.conc_dispatch:');
2523: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
2524: RAISE;
2525: END conc_dispatch;
2518: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch.exception', SQLERRM);
2519: END IF;
2520:
2521: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.conc_dispatch');
2522: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.conc_dispatch:');
2523: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
2524: RAISE;
2525: END conc_dispatch;
2526:
2611: BEGIN
2612: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
2613: fnd_log.STRING(
2614: fnd_log.level_procedure
2615: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.begin'
2616: , 'Beginning of conc_dispatch2...'
2617: );
2618: END IF;
2619:
2726:
2727: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2728: fnd_log.STRING(
2729: fnd_log.level_unexpected
2730: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.request_status'
2731: , 'Request ' || l_failed_request_id || ' failed (batch_id = ' || l_temp_phys_batch_id
2732: );
2733: END IF;
2734:
2776:
2777: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
2778: fnd_log.STRING(
2779: fnd_log.level_error
2780: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.request_status'
2781: , 'Request ' || l_failed_request_id || ' failed (batch_id = '
2782: || l_temp_phys_batch_id
2783: );
2784: END IF;
2923:
2924: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
2925: fnd_log.STRING(
2926: fnd_log.level_procedure
2927: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.end'
2928: , 'End of conc_dispatch.'
2929: );
2930: END IF;
2931: EXCEPTION
2929: );
2930: END IF;
2931: EXCEPTION
2932: WHEN conc_fail THEN
2933: fnd_file.put_line(fnd_file.LOG, 'conc_fail exception in cn_proc_batches_pkg.conc_dispatch');
2934: update_error(l_temp_phys_batch_id);
2935:
2936: -- canceling running/pending requests
2937: IF (l_primary_request_stack.COUNT > 0) THEN
2939: IF (l_primary_request_stack(i) > 0) THEN
2940: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
2941: fnd_log.STRING(
2942: fnd_log.level_exception
2943: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.exception'
2944: , 'Cancelling request: ' || l_primary_request_stack(i)
2945: );
2946: END IF;
2947:
2960: WHEN OTHERS THEN
2961: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
2962: fnd_log.STRING(
2963: fnd_log.level_unexpected
2964: , 'cn.plsql.cn_proc_batches_pkg.conc_dispatch2.exception'
2965: , SQLERRM
2966: );
2967: END IF;
2968:
2965: , SQLERRM
2966: );
2967: END IF;
2968:
2969: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.conc_dispatch');
2970: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.conc_dispatch2:');
2971: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
2972: RAISE;
2973: END conc_dispatch2;
2966: );
2967: END IF;
2968:
2969: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.conc_dispatch');
2970: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.conc_dispatch2:');
2971: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
2972: RAISE;
2973: END conc_dispatch2;
2974:
2998: BEGIN
2999: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3000: fnd_log.STRING(
3001: fnd_log.level_procedure
3002: , 'cn.plsql.cn_proc_batches_pkg.seq_dispatch.begin'
3003: , 'Beginning of seq_dispatch...'
3004: );
3005: END IF;
3006:
3054:
3055: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3056: fnd_log.STRING(
3057: fnd_log.level_procedure
3058: , 'cn.plsql.cn_proc_batches_pkg.seq_dispatch.end'
3059: , 'End of seq_dispatch.'
3060: );
3061: END IF;
3062: EXCEPTION
3062: EXCEPTION
3063: WHEN OTHERS THEN
3064: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
3065: fnd_log.STRING(fnd_log.level_unexpected
3066: , 'cn.plsql.cn_proc_batches_pkg.seq_dispatch.exception', SQLERRM);
3067: END IF;
3068:
3069: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches.seq_dispatch:');
3070: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
3089:
3090: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3091: fnd_log.STRING(
3092: fnd_log.level_procedure
3093: , 'cn.plsql.cn_proc_batches_pkg.calculate_batch.begin'
3094: , 'Beginning of calculate_batch...'
3095: );
3096: END IF;
3097:
3139:
3140: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3141: fnd_log.STRING(
3142: fnd_log.level_procedure
3143: , 'cn.plsql.cn_proc_batches_pkg.calculate_batch.end'
3144: , 'End of calculate_batch.'
3145: );
3146: END IF;
3147:
3155:
3156: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
3157: fnd_log.STRING(
3158: fnd_log.level_unexpected
3159: , 'cn.plsql.cn_proc_batches_pkg.calculate_batch.exception'
3160: , SQLERRM
3161: );
3162: END IF;
3163:
3211: BEGIN
3212: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3213: fnd_log.STRING(
3214: fnd_log.level_procedure
3215: , 'cn.plsql.cn_proc_batches_pkg.calc.begin'
3216: , 'Beginning of concurrent program calc ...'
3217: );
3218: END IF;
3219:
3233: , cn_api.get_lkup_meaning('NAME', 'CALC_SUBMISSION_OBJECT_TYPE'));
3234: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
3235:
3236: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3237: fnd_log.MESSAGE(fnd_log.level_error, 'cn.plsql.cn_proc_batches_pkg.calc.validation', TRUE);
3238: END IF;
3239:
3240: RAISE ABORT;
3241: END IF;
3247: fnd_message.set_name('CN', 'CN_INVALID_DATE_RANGE');
3248: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
3249:
3250: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3251: fnd_log.MESSAGE(fnd_log.level_error, 'cn.plsql.cn_proc_batches_pkg.calc.validation', TRUE);
3252: END IF;
3253:
3254: RAISE ABORT;
3255: ELSE
3261: fnd_message.set_token('DATE', p_start_date);
3262: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
3263:
3264: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3265: fnd_log.MESSAGE(fnd_log.level_error, 'cn.plsql.cn_proc_batches_pkg.calc.validation', TRUE);
3266: END IF;
3267:
3268: RAISE ABORT;
3269: END IF;
3278: fnd_message.set_token('DATE', p_end_date);
3279: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
3280:
3281: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3282: fnd_log.MESSAGE(fnd_log.level_error, 'cn.plsql.cn_proc_batches_pkg.calc.validation'
3283: , TRUE);
3284: END IF;
3285:
3286: RAISE ABORT;
3293: fnd_message.set_name('CN', 'CN_CALC_NO_SALESREP');
3294: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
3295:
3296: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3297: fnd_log.MESSAGE(fnd_log.level_error, 'cn.plsql.cn_proc_batches_pkg.calc.validation', TRUE);
3298: END IF;
3299:
3300: RAISE ABORT;
3301: END IF;
3336:
3337: IF (fnd_log.level_event >= fnd_log.g_current_runtime_level) THEN
3338: fnd_log.STRING(
3339: fnd_log.level_event
3340: , 'cn.plsql.cn_proc_batches_pkg.calc.submission'
3341: , 'Successfully created submission records.'
3342: );
3343: END IF;
3344:
3361:
3362: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3363: fnd_log.STRING(
3364: fnd_log.level_procedure
3365: , 'cn.plsql.cn_proc_batches_pkg.calc.end'
3366: , 'End of concurrent program calc.'
3367: );
3368: END IF;
3369: EXCEPTION
3430: ) IS
3431: dummy NUMBER;
3432: dummy_char VARCHAR2(30);
3433: BEGIN
3434: cn_proc_batches_pkg.main(
3435: p_concurrent_flag => 'Y'
3436: , p_process_name => 'COLLECTION'
3437: , p_logical_batch_id => NULL
3438: , p_start_date => p_start_date
3485: BEGIN
3486: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3487: fnd_log.STRING(
3488: fnd_log.level_procedure
3489: , 'cn.plsql.cn_proc_batches_pkg.runner.begin'
3490: , 'Beginning of batch runner '
3491: || p_physical_batch_id
3492: || ' in the phase of '
3493: || p_physical_process
3519: cn_message_pkg.DEBUG(
3520: 'Start batch runner (phase=' || p_physical_process || ', batch ID=' || p_physical_batch_id
3521: || ')'
3522: );
3523: cn_proc_batches_pkg.process_status(
3524: x_physical_process => p_physical_process
3525: , x_curr_status => l_curr_status
3526: , x_new_status => l_new_status
3527: );
3681:
3682: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
3683: fnd_log.STRING(
3684: fnd_log.level_procedure
3685: , 'cn.plsql.cn_proc_batches_pkg.runner.end'
3686: , 'End of batch runner '
3687: || p_physical_batch_id
3688: || 'at '
3689: || TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS')
3733: COMMIT;
3734: END IF;
3735:
3736: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
3737: fnd_log.STRING(fnd_log.level_unexpected, 'cn.plsql.cn_proc_batches_pkg.runner.exception'
3738: , SQLERRM);
3739: END IF;
3740: END runner;
3741:
3852:
3853: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3854: fnd_log.MESSAGE(
3855: fnd_log.level_error
3856: , 'cn.plsql.cn_proc_batches_pkg.validate_ruleset_status.validation'
3857: , TRUE
3858: );
3859: END IF;
3860:
3976: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'COMPLETE');
3977: fnd_message.set_name('CN', 'ALL_PROCESS_DONE_OK');
3978:
3979: IF (fnd_log.level_event >= fnd_log.g_current_runtime_level) THEN
3980: fnd_log.MESSAGE(fnd_log.level_event, 'cn.plsql.cn_proc_batches_pkg.processor.event'
3981: , TRUE);
3982: END IF;
3983: EXCEPTION
3984: WHEN NO_DATA_FOUND THEN
3988: fnd_message.set_name('CN', 'ALL_PROCESS_DONE_FAIL');
3989:
3990: IF (fnd_log.level_error >= fnd_log.g_current_runtime_level) THEN
3991: fnd_log.MESSAGE(fnd_log.level_error
3992: , 'cn.plsql.cn_proc_batches_pkg.processor.exception', TRUE);
3993: END IF;
3994: END;
3995:
3996: -- Mark the processed batches for deletion
4002: EXCEPTION
4003: WHEN OTHERS THEN
4004: retcode := 2;
4005: errbuf := SQLERRM;
4006: fnd_file.put_line(fnd_file.LOG, 'Unexpected exception in cn_proc_batches_pkg.processor');
4007: fnd_file.put_line(fnd_file.LOG, SQLERRM);
4008: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.processor:');
4009: cn_message_pkg.rollback_errormsg_commit(errbuf);
4010: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
4004: retcode := 2;
4005: errbuf := SQLERRM;
4006: fnd_file.put_line(fnd_file.LOG, 'Unexpected exception in cn_proc_batches_pkg.processor');
4007: fnd_file.put_line(fnd_file.LOG, SQLERRM);
4008: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.processor:');
4009: cn_message_pkg.rollback_errormsg_commit(errbuf);
4010: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
4011: cn_message_pkg.end_batch(l_paid);
4012:
4011: cn_message_pkg.end_batch(l_paid);
4012:
4013: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
4014: fnd_log.STRING(fnd_log.level_unexpected
4015: , 'cn.plsql.cn_proc_batches_pkg.processor.exception', SQLERRM);
4016: END IF;
4017:
4018: RAISE;
4019: END processor;
4065: BEGIN
4066: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4067: fnd_log.STRING(
4068: fnd_log.level_procedure
4069: , 'cn.plsql.cn_proc_batches_pkg.main.begin'
4070: , 'Beginning of cn_proc_batches_pkg.main...'
4071: );
4072: END IF;
4073:
4066: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4067: fnd_log.STRING(
4068: fnd_log.level_procedure
4069: , 'cn.plsql.cn_proc_batches_pkg.main.begin'
4070: , 'Beginning of cn_proc_batches_pkg.main...'
4071: );
4072: END IF;
4073:
4074: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'PROCESSING');
4100: RAISE ABORT;
4101: END IF;
4102: ELSE
4103: fnd_file.put_line(fnd_file.LOG
4104: , 'cn_proc_batches_pkg.main: bad process name: ' || p_process_name);
4105: cn_message_pkg.DEBUG('Invalid process code (' || p_process_name || ')');
4106: RAISE ABORT;
4107: END IF;
4108:
4114:
4115: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4116: fnd_log.STRING(
4117: fnd_log.level_procedure
4118: , 'cn.plsql.cn_proc_batches_pkg.main.run_processor'
4119: , 'Before calling procedure processor.'
4120: );
4121: END IF;
4122:
4121: END IF;
4122:
4123: IF (p_concurrent_flag = 'N' OR(p_concurrent_flag = 'Y' AND fnd_global.conc_program_id <> -1)) THEN
4124: cn_message_pkg.DEBUG('Start processing transactions (non concurrent calculation)');
4125: cn_proc_batches_pkg.processor(
4126: l_dummy
4127: , l_temp
4128: , x_process_audit_id
4129: , p_concurrent_flag
4184: );
4185:
4186: IF l_request_id = 0 THEN
4187: fnd_file.put_line(fnd_file.LOG
4188: , 'cn_proc_batches_pkg.main: unable to submit batch_processor');
4189: cn_message_pkg.DEBUG('Failed to submit concurrent request (Batch Processor)');
4190: cn_message_pkg.DEBUG(fnd_message.get);
4191: x_process_status_code := 'FAIL';
4192:
4192:
4193: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
4194: fnd_log.STRING(
4195: fnd_log.level_unexpected
4196: , 'cn.plsql.cn_proc_batches_pkg.main.exception'
4197: , 'Failed to submit request for BATCH_PROCESSOR.'
4198: );
4199: END IF;
4200:
4214:
4215: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4216: fnd_log.STRING(
4217: fnd_log.level_procedure
4218: , 'cn.plsql.cn_proc_batches_pkg.main.run_processor'
4219: , 'After calling procedure processor.'
4220: );
4221: END IF;
4222:
4222:
4223: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4224: fnd_log.STRING(
4225: fnd_log.level_procedure
4226: , 'cn.plsql.cn_proc_batches_pkg.main.end'
4227: , 'End of cn_proc_batches_pkg.main...'
4228: );
4229: END IF;
4230: EXCEPTION
4223: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4224: fnd_log.STRING(
4225: fnd_log.level_procedure
4226: , 'cn.plsql.cn_proc_batches_pkg.main.end'
4227: , 'End of cn_proc_batches_pkg.main...'
4228: );
4229: END IF;
4230: EXCEPTION
4231: WHEN ABORT THEN
4228: );
4229: END IF;
4230: EXCEPTION
4231: WHEN ABORT THEN
4232: cn_message_pkg.rollback_errormsg_commit('Exception occurs in cn_proc_batches_pkg.main.');
4233: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
4234: COMMIT;
4235: x_process_status_code := 'FAIL';
4236: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
4235: x_process_status_code := 'FAIL';
4236: fnd_file.put_line(fnd_file.LOG, fnd_message.get);
4237: cn_message_pkg.end_batch(x_process_audit_id);
4238: WHEN OTHERS THEN
4239: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.main');
4240: fnd_file.put_line(fnd_file.LOG, SQLERRM);
4241: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.main: ');
4242: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
4243: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
4237: cn_message_pkg.end_batch(x_process_audit_id);
4238: WHEN OTHERS THEN
4239: fnd_file.put_line(fnd_file.LOG, 'unexpected exception in cn_proc_batches_pkg.main');
4240: fnd_file.put_line(fnd_file.LOG, SQLERRM);
4241: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.main: ');
4242: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
4243: cn_calc_sub_batches_pkg.update_calc_sub_batch(g_logical_batch_id, 'FAILED');
4244: COMMIT;
4245: x_process_status_code := 'FAIL';
4246: --cn_message_pkg.set_name('CN','ALL_PROCESS_DONE_FAIL');
4247: cn_message_pkg.end_batch(x_process_audit_id);
4248:
4249: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
4250: fnd_log.STRING(fnd_log.level_unexpected, 'cn.plsql.cn_proc_batches_pkg.main.exception'
4251: , SQLERRM);
4252: END IF;
4253: END main;
4254:
4629: BEGIN
4630: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4631: fnd_log.STRING(
4632: fnd_log.level_procedure
4633: , 'cn.plsql.cn_proc_batches_pkg.populate_bonus_process_batch.begin'
4634: , 'Beginning of poulate_bonus_process_batch ...'
4635: );
4636: END IF;
4637:
4866:
4867: IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level) THEN
4868: fnd_log.MESSAGE(
4869: fnd_log.level_exception
4870: , 'cn.plsql.cn_proc_batches_pkg.populate_bonus_process_batch.error'
4871: , TRUE
4872: );
4873: END IF;
4874:
4877:
4878: IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
4879: fnd_log.STRING(
4880: fnd_log.level_procedure
4881: , 'cn.plsql.cn_proc_batches_pkg.populate_bonus_process_batch.end'
4882: , 'Beginning of poulate_bonus_process_batch ...'
4883: );
4884: END IF;
4885: EXCEPTION
4883: );
4884: END IF;
4885: EXCEPTION
4886: WHEN no_comm_lines THEN
4887: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_bonus_process_batch:');
4888: cn_message_pkg.rollback_errormsg_commit
4889: (
4890: 'No one with complete compensation plan to calculate or the period specified is not at the end of the plan element interval'
4891: );
4891: );
4892: fnd_file.put_line
4893: (
4894: fnd_file.LOG
4895: , 'Exception in cn_proc_batches_pkg.populate_bonus_process_batch: no one with complete '
4896: || 'compensation plan or the period specified is not at the end of the interval'
4897: );
4898: RAISE;
4899: WHEN OTHERS THEN
4899: WHEN OTHERS THEN
4900: IF (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) THEN
4901: fnd_log.STRING(
4902: fnd_log.level_unexpected
4903: , 'cn.plsql.cn_proc_batches_pkg.populate_bonus_process_batch.exception'
4904: , SQLERRM
4905: );
4906: END IF;
4907:
4904: , SQLERRM
4905: );
4906: END IF;
4907:
4908: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_bonus_process_batch: ');
4909: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
4910: fnd_file.put_line(fnd_file.LOG
4911: , 'Exception in cn_proc_batches_pkg.populate_bonus_process_batch: ' || SQLERRM);
4912: RAISE;
4907:
4908: cn_message_pkg.DEBUG('Exception occurs in cn_proc_batches_pkg.populate_bonus_process_batch: ');
4909: cn_message_pkg.rollback_errormsg_commit(SQLERRM);
4910: fnd_file.put_line(fnd_file.LOG
4911: , 'Exception in cn_proc_batches_pkg.populate_bonus_process_batch: ' || SQLERRM);
4912: RAISE;
4913: END populate_bonus_process_batch;
4914: END cn_proc_batches_pkg;
4910: fnd_file.put_line(fnd_file.LOG
4911: , 'Exception in cn_proc_batches_pkg.populate_bonus_process_batch: ' || SQLERRM);
4912: RAISE;
4913: END populate_bonus_process_batch;
4914: END cn_proc_batches_pkg;