1: PACKAGE BODY ozf_net_accrual_engine_pvt AS
2: /* $Header: ozfvnaeb.pls 120.24.12020000.16 2013/03/21 09:50:28 nepanda ship $ */
3:
4: G_DEBUG_LOW BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_low);
5: TYPE number_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
6:
7: FUNCTION validate_customer( p_invoice_to_org_id IN NUMBER,
8: p_ship_to_org_id IN NUMBER,
379: x_return_status := FND_API.g_ret_sts_unexp_error;
380:
381: FND_MESSAGE.set_name('OZF', 'OZF_OFFER_PARTY_STMT_FAILED');
382: FND_MESSAGE.set_token('ERR_MSG',SQLERRM);
383: FND_MSG_PUB.add;
384:
385: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
386: THEN
387: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
381: FND_MESSAGE.set_name('OZF', 'OZF_OFFER_PARTY_STMT_FAILED');
382: FND_MESSAGE.set_token('ERR_MSG',SQLERRM);
383: FND_MSG_PUB.add;
384:
385: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
386: THEN
387: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
388: END IF;
389:
383: FND_MSG_PUB.add;
384:
385: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
386: THEN
387: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
388: END IF;
389:
390: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
391: p_count => x_msg_count,
386: THEN
387: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
388: END IF;
389:
390: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
391: p_count => x_msg_count,
392: p_data => x_msg_data);
393: END refresh_parties;
394:
480:
481: ozf_utility_pvt.write_conc_log(l_stmt_debug);
482: ozf_utility_pvt.write_conc_log(SQLERRM);
483:
484: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
485: THEN
486: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
487: END IF;
488:
482: ozf_utility_pvt.write_conc_log(SQLERRM);
483:
484: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
485: THEN
486: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
487: END IF;
488:
489: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
490: p_count => x_msg_count,
485: THEN
486: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
487: END IF;
488:
489: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
490: p_count => x_msg_count,
491: p_data => x_msg_data);
492: END populate_customers;
493:
714:
715: ozf_utility_pvt.write_conc_log(l_stmt_debug);
716: ozf_utility_pvt.write_conc_log(SQLERRM);
717:
718: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
719: THEN
720: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
721: END IF;
722:
716: ozf_utility_pvt.write_conc_log(SQLERRM);
717:
718: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
719: THEN
720: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
721: END IF;
722:
723: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
724: p_count => x_msg_count,
719: THEN
720: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
721: END IF;
722:
723: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
724: p_count => x_msg_count,
725: p_data => x_msg_data);
726: END populate_prod_line;
727:
941:
942: ozf_utility_pvt.write_conc_log(l_stmt_debug);
943: ozf_utility_pvt.write_conc_log(SQLERRM);
944:
945: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
946: THEN
947: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
948: END IF;
949:
943: ozf_utility_pvt.write_conc_log(SQLERRM);
944:
945: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
946: THEN
947: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
948: END IF;
949:
950: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
951: p_count => x_msg_count,
946: THEN
947: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
948: END IF;
949:
950: FND_MSG_PUB.count_and_get(p_encoded => FND_API.g_false,
951: p_count => x_msg_count,
952: p_data => x_msg_data);
953:
954: END populate_prod_tier;
2492: FETCH c_gl_period INTO l_gl_date_count;
2493: CLOSE c_gl_period;
2494:
2495: IF l_gl_date_count = 0 THEN
2496: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2497: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
2498: FND_MSG_PUB.add;
2499: END IF;
2500: ozf_utility_pvt.write_conc_log;
2494:
2495: IF l_gl_date_count = 0 THEN
2496: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2497: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
2498: FND_MSG_PUB.add;
2499: END IF;
2500: ozf_utility_pvt.write_conc_log;
2501: RAISE FND_API.G_EXC_ERROR;
2502: END IF;
3059: FETCH c_gl_period INTO l_gl_date_count;
3060: CLOSE c_gl_period;
3061:
3062: IF l_gl_date_count = 0 THEN
3063: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3064: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3065: FND_MSG_PUB.add;
3066: END IF;
3067: ozf_utility_pvt.write_conc_log;
3061:
3062: IF l_gl_date_count = 0 THEN
3063: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3064: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3065: FND_MSG_PUB.add;
3066: END IF;
3067: ozf_utility_pvt.write_conc_log;
3068: RAISE FND_API.G_EXC_ERROR;
3069: END IF;
3411: FETCH c_gl_period INTO l_gl_date_count;
3412: CLOSE c_gl_period;
3413:
3414: IF l_gl_date_count = 0 THEN
3415: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3416: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3417: FND_MSG_PUB.add;
3418: END IF;
3419: ozf_utility_pvt.write_conc_log;
3413:
3414: IF l_gl_date_count = 0 THEN
3415: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3416: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3417: FND_MSG_PUB.add;
3418: END IF;
3419: ozf_utility_pvt.write_conc_log;
3420: RAISE FND_API.G_EXC_ERROR;
3421: END IF;
3862: FETCH c_gl_period INTO l_gl_date_count;
3863: CLOSE c_gl_period;
3864:
3865: IF l_gl_date_count = 0 THEN
3866: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3867: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3868: FND_MSG_PUB.add;
3869: END IF;
3870: ozf_utility_pvt.write_conc_log;
3864:
3865: IF l_gl_date_count = 0 THEN
3866: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
3867: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
3868: FND_MSG_PUB.add;
3869: END IF;
3870: ozf_utility_pvt.write_conc_log;
3871: RAISE FND_API.G_EXC_ERROR;
3872: END IF;
4219: FETCH c_gl_period INTO l_gl_date_count;
4220: CLOSE c_gl_period;
4221:
4222: IF l_gl_date_count = 0 THEN
4223: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
4224: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
4225: FND_MSG_PUB.add;
4226: END IF;
4227: ozf_utility_pvt.write_conc_log;
4221:
4222: IF l_gl_date_count = 0 THEN
4223: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
4224: FND_MESSAGE.set_name('OZF', 'OZF_SETL_GLDATE_INVALID');
4225: FND_MSG_PUB.add;
4226: END IF;
4227: ozf_utility_pvt.write_conc_log;
4228: RAISE FND_API.G_EXC_ERROR;
4229: END IF;
4628:
4629: WHEN FND_API.G_EXC_ERROR THEN
4630: ROLLBACK TO net_accrual_offer;
4631: -- Standard call to get message count and if count=1, get the message
4632: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4633: p_count => l_msg_count,
4634: p_data => l_msg_data);
4635:
4636: ERRBUF := l_msg_data;
4638:
4639: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4640: ROLLBACK TO net_accrual_offer;
4641: -- Standard call to get message count and if count=1, get the message
4642: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4643: p_count => l_msg_count,
4644: p_data => l_msg_data);
4645:
4646: ERRBUF := l_msg_data;
4648:
4649: WHEN OTHERS THEN
4650: ROLLBACK TO net_accrual_offer;
4651: -- Standard call to get message count and if count=1, get the message
4652: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4653: p_count => l_msg_count,
4654: p_data => l_msg_data);
4655: --ERRBUF := l_msg_data;
4656: ERRBUF := SQLERRM;
4667: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || l_schema || '.OZF_NA_UNIQUE_PRODUCTS_TEMP';
4668:
4669: ozf_utility_pvt.write_conc_log('-- Done -- ' || to_char(sysdate,'MM/DD/YYYY:HH:MM:SS'));
4670:
4671: Fnd_Msg_Pub.Count_AND_Get(p_count => l_msg_count,
4672: p_data => l_msg_data,
4673: p_encoded => Fnd_Api.G_FALSE);
4674:
4675: EXCEPTION
4680: WHEN FND_API.G_EXC_ERROR THEN
4681: --ROLLBACK TO net_accrual_engine;
4682: ROLLBACK;
4683: -- Standard call to get message count and if count=1, get the message
4684: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4685: p_count => l_msg_count,
4686: p_data => l_msg_data);
4687:
4688: ERRBUF := l_msg_data;
4690:
4691: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4692: ROLLBACK ;
4693: -- Standard call to get message count and if count=1, get the message
4694: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4695: p_count => l_msg_count,
4696: p_data => l_msg_data);
4697:
4698: ERRBUF := l_msg_data;
4700:
4701: WHEN OTHERS THEN
4702: ROLLBACK ;
4703: -- Standard call to get message count and if count=1, get the message
4704: FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
4705: p_count => l_msg_count,
4706: p_data => l_msg_data);
4707: --ERRBUF := l_msg_data;
4708: ERRBUF := SQLERRM;
4759:
4760: SAVEPOINT retroactive_offer_adj;
4761:
4762: IF Fnd_Api.to_boolean(p_init_msg_list) THEN
4763: Fnd_Msg_Pub.initialize;
4764: END IF;
4765:
4766: x_return_status := Fnd_Api.g_ret_sts_success;
4767:
4788: EXCEPTION
4789: WHEN Fnd_Api.G_EXC_ERROR THEN
4790: x_return_status := Fnd_Api.g_ret_sts_error;
4791: ROLLBACK TO retroactive_offer_adj;
4792: Fnd_Msg_Pub.Count_AND_Get
4793: ( p_count => x_msg_count,
4794: p_data => x_msg_data,
4795: p_encoded => Fnd_Api.G_FALSE
4796: );
4796: );
4797: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
4798: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4799: ROLLBACK TO retroactive_offer_adj;
4800: Fnd_Msg_Pub.Count_AND_Get
4801: ( p_count => x_msg_count,
4802: p_data => x_msg_data,
4803: p_encoded => Fnd_Api.G_FALSE
4804: );
4804: );
4805: WHEN OTHERS THEN
4806: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4807: ROLLBACK TO retroactive_offer_adj;
4808: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4809: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4810: END IF;
4811: Fnd_Msg_Pub.Count_AND_Get
4812: ( p_count => x_msg_count,
4805: WHEN OTHERS THEN
4806: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4807: ROLLBACK TO retroactive_offer_adj;
4808: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4809: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4810: END IF;
4811: Fnd_Msg_Pub.Count_AND_Get
4812: ( p_count => x_msg_count,
4813: p_data => x_msg_data,
4807: ROLLBACK TO retroactive_offer_adj;
4808: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4809: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4810: END IF;
4811: Fnd_Msg_Pub.Count_AND_Get
4812: ( p_count => x_msg_count,
4813: p_data => x_msg_data,
4814: p_encoded => Fnd_Api.G_FALSE
4815: );
4874: BEGIN
4875: SAVEPOINT offer_adj_new_product;
4876:
4877: IF Fnd_Api.to_boolean(p_init_msg_list) THEN
4878: Fnd_Msg_Pub.initialize;
4879: END IF;
4880:
4881: x_return_status := Fnd_Api.g_ret_sts_success;
4882:
4937: EXCEPTION
4938: WHEN Fnd_Api.G_EXC_ERROR THEN
4939: x_return_status := Fnd_Api.g_ret_sts_error;
4940: ROLLBACK TO offer_adj_new_product;
4941: Fnd_Msg_Pub.Count_AND_Get
4942: ( p_count => x_msg_count,
4943: p_data => x_msg_data,
4944: p_encoded => Fnd_Api.G_FALSE
4945: );
4945: );
4946: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
4947: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4948: ROLLBACK TO offer_adj_new_product;
4949: Fnd_Msg_Pub.Count_AND_Get
4950: ( p_count => x_msg_count,
4951: p_data => x_msg_data,
4952: p_encoded => Fnd_Api.G_FALSE
4953: );
4953: );
4954: WHEN OTHERS THEN
4955: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4956: ROLLBACK TO offer_adj_new_product;
4957: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4958: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4959: END IF;
4960: Fnd_Msg_Pub.Count_AND_Get
4961: ( p_count => x_msg_count,
4954: WHEN OTHERS THEN
4955: x_return_status := Fnd_Api.g_ret_sts_unexp_error;
4956: ROLLBACK TO offer_adj_new_product;
4957: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4958: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4959: END IF;
4960: Fnd_Msg_Pub.Count_AND_Get
4961: ( p_count => x_msg_count,
4962: p_data => x_msg_data,
4956: ROLLBACK TO offer_adj_new_product;
4957: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR ) THEN
4958: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
4959: END IF;
4960: Fnd_Msg_Pub.Count_AND_Get
4961: ( p_count => x_msg_count,
4962: p_data => x_msg_data,
4963: p_encoded => Fnd_Api.G_FALSE
4964: );