170: CLOSE c_fund_exists;
171:
172: IF l_fund_exists IS NULL THEN
173: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
174: fnd_message.set_name('OZF', 'OZF_INVALID_FUND_ID');
175: fnd_msg_pub.add;
176: END IF;
177: x_return_status := fnd_api.g_ret_sts_error;
178: RETURN;
186: IF l_fund_id IS NOT NULL THEN
187: p_adj_rec.fund_id := l_fund_id;
188: ELSE
189: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
190: fnd_message.set_name('OZF', 'OZF_INVALID_FUND_NUM');
191: fnd_msg_pub.add;
192: END IF;
193: x_return_status := fnd_api.g_ret_sts_error;
194: RETURN;
196: END IF;
197:
198: IF p_adj_rec.adjustment_type = fnd_api.g_miss_char OR p_adj_rec.adjustment_type IS NULL THEN
199: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
200: fnd_message.set_name('OZF', 'OZF_FUND_NO_ADJ_TYPE');
201: fnd_msg_pub.add;
202: END IF;
203: x_return_status := fnd_api.g_ret_sts_error;
204: RETURN;
206:
207: IF p_adj_rec.adjustment_type NOT IN ('DECREASE_COMM_EARNED', 'DECREASE_COMMITTED', 'DECREASE_EARNED',
208: 'STANDARD', 'DECREASE_PAID', 'INCREASE_PAID') THEN
209: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
210: fnd_message.set_name('OZF', 'OZF_INVALID_ADJ_TYPE');
211: fnd_msg_pub.add;
212: END IF;
213: x_return_status := fnd_api.g_ret_sts_error;
214: RETURN;
221: CLOSE c_adj_type_id;
222:
223: IF p_adj_rec.amount = fnd_api.g_miss_num OR p_adj_rec.amount IS NULL THEN
224: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
225: fnd_message.set_name('OZF', 'OZF_FUND_NO_ADJ_AMT');
226: fnd_msg_pub.add;
227: END IF;
228: x_return_status := fnd_api.g_ret_sts_error;
229: RETURN;
236: END IF;
237:
238: IF p_adj_rec.activity_type NOT IN ('CAMP', 'DELV', 'EVEH', 'OFFR') THEN
239: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
240: fnd_message.set_name('OZF', 'OZF_INVALID_ACTIVITY_TYPE');
241: fnd_msg_pub.add;
242: END IF;
243: x_return_status := fnd_api.g_ret_sts_error;
244: RETURN;
263: END IF;
264:
265: IF l_activity_id IS NULL THEN
266: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
267: fnd_message.set_name('OZF', 'OZF_INVALID_ACTIVITY_ID');
268: fnd_msg_pub.add;
269: END IF;
270: x_return_status := fnd_api.g_ret_sts_error;
271: RETURN;
280: CLOSE c_valid_csch;
281:
282: IF l_valid_csch IS NULL THEN
283: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
284: fnd_message.set_name('OZF', 'OZF_INVALID_CSCH_ID');
285: fnd_msg_pub.add;
286: END IF;
287: x_return_status := fnd_api.g_ret_sts_error;
288: RETURN;
296: CLOSE c_valid_cust_type;
297:
298: IF l_cust_type IS NULL THEN
299: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
300: fnd_message.set_name('OZF', 'OZF_INVALID_CUST_TYPE');
301: fnd_msg_pub.add;
302: END IF;
303: x_return_status := fnd_api.g_ret_sts_error;
304: RETURN;
335:
336: IF p_adj_rec.cust_account_id = fnd_api.g_miss_num OR p_adj_rec.cust_account_id IS NULL THEN
337:
338: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
339: fnd_message.set_name('OZF', 'OZF_INVALID_CUST_ID');
340: fnd_msg_pub.add;
341: END IF;
342: x_return_status := fnd_api.g_ret_sts_error;
343: RETURN;
348: IF p_adj_rec.document_type <> fnd_api.g_miss_char AND p_adj_rec.document_type IS NOT NULL THEN
349: IF p_adj_rec.document_type NOT IN ('INVOICE', 'ORDER', 'PCHO', 'TP_ORDER') THEN
350:
351: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
352: fnd_message.set_name('OZF', 'OZF_INVALID_DOCUMENT_TYPE');
353: fnd_msg_pub.add;
354: END IF;
355: x_return_status := fnd_api.g_ret_sts_error;
356: RETURN;
358:
359: IF p_adj_rec.document_number = fnd_api.g_miss_num OR p_adj_rec.document_number IS NULL THEN
360:
361: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
362: fnd_message.set_name('OZF', 'OZF_NO_DOCUMENT_NUM');
363: fnd_msg_pub.add;
364: END IF;
365: x_return_status := fnd_api.g_ret_sts_error;
366: RETURN;
375: CLOSE c_valid_scantype_id;
376:
377: IF l_valid_scantype_id IS NULL THEN
378: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
379: fnd_message.set_name('OZF', 'OZF_INVALID_SCANTYPE_ID');
380: fnd_msg_pub.add;
381: END IF;
382: x_return_status := fnd_api.g_ret_sts_error;
383: RETURN;
388: IF p_adj_rec.product_level_type <> fnd_api.g_miss_char AND p_adj_rec.product_level_type IS NOT NULL THEN
389:
390: IF p_adj_rec.product_level_type NOT IN ('FAMILY', 'PRODUCT') THEN
391: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
392: fnd_message.set_name('OZF', 'OZF_INVALID_PROD_LEVEL');
393: fnd_msg_pub.add;
394: END IF;
395: x_return_status := fnd_api.g_ret_sts_error;
396: RETURN;
403: END IF;
404:
405: IF p_adj_rec.product_name = fnd_api.g_miss_char OR p_adj_rec.product_name IS NULL THEN
406: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
407: fnd_message.set_name('OZF', 'OZF_NO_PROD_NAME');
408: fnd_msg_pub.add;
409: END IF;
410: x_return_status := fnd_api.g_ret_sts_error;
411: RETURN;
421: END IF;
422:
423: IF p_adj_rec.product_id IS NULL THEN
424: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
425: fnd_message.set_name('OZF', 'OZF_INVALID_PROD');
426: fnd_msg_pub.add;
427: END IF;
428: x_return_status := fnd_api.g_ret_sts_error;
429: RETURN;
437:
438: IF p_adj_rec.adjustment_type IN ('INCREASE_PAID', 'DECREASE_PAID') THEN
439: IF p_adj_rec.gl_account_credit = fnd_api.g_miss_num OR p_adj_rec.gl_account_credit IS NULL THEN
440: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
441: fnd_message.set_name('OZF', 'OZF_NO_GL_CREDIT_ACCT');
442: fnd_msg_pub.add;
443: END IF;
444: x_return_status := fnd_api.g_ret_sts_error;
445: RETURN;
446: END IF;
447:
448: IF p_adj_rec.gl_account_debit = fnd_api.g_miss_num OR p_adj_rec.gl_account_debit IS NULL THEN
449: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
450: fnd_message.set_name('OZF', 'OZF_NO_GL_DEBIT_ACCT');
451: fnd_msg_pub.add;
452: END IF;
453: x_return_status := fnd_api.g_ret_sts_error;
454: RETURN;
462: IF p_adj_rec.skip_acct_gen_flag <> fnd_api.g_miss_char AND p_adj_rec.skip_acct_gen_flag IS NOT NULL THEN
463:
464: IF p_adj_rec.skip_acct_gen_flag NOT IN ('F', 'T') THEN
465: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
466: fnd_message.set_name('OZF', 'OZF_INVALID_ACCT_GEN_FLAG');
467: fnd_msg_pub.add;
468: END IF;
469: x_return_status := fnd_api.g_ret_sts_error;
470: RETURN;
476: OPEN c_order_line(p_adj_rec.order_line_id);
477: FETCH c_order_line INTO l_dummy;
478: IF c_order_line%NOTFOUND THEN
479: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
480: fnd_message.set_name('OZF', 'OZF_INVALID_ORDER_LINE');
481: fnd_msg_pub.add;
482: END IF;
483: x_return_status := fnd_api.g_ret_sts_error;
484: RETURN;
563: IF l_adj_rec.fund_id IS NULL THEN
564:
565: IF l_adj_rec.currency_code = fnd_api.g_miss_char OR l_adj_rec.currency_code IS NULL THEN
566: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
567: fnd_message.set_name('OZF', 'OZF_FUND_NO_CURR_CODE');
568: fnd_msg_pub.add;
569: END IF;
570: RAISE fnd_api.g_exc_error;
571: END IF;
593: IF l_parent_src_tbl.count > 0 THEN
594: l_fund_id := l_parent_src_tbl (1).fund_id;
595: ELSE
596: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
597: fnd_message.set_name('OZF', 'OZF_NO_SRC_BUDGETS');
598: fnd_msg_pub.add;
599: END IF;
600: RAISE fnd_api.g_exc_error;
601: END IF;
637: l_act_util_rec.product_id := l_adj_rec.product_id;
638: l_act_util_rec.cust_account_id := l_adj_rec.cust_account_id;
639: l_act_util_rec.bill_to_site_use_id := l_adj_rec.bill_to_site_use_id;
640: l_act_util_rec.ship_to_site_use_id := l_adj_rec.ship_to_site_use_id;
641: l_act_budgets_rec.justification := fnd_message.get_string ('OZF', 'OZF_ADJ_PUB_API');
642: l_act_budgets_rec.budget_source_type := l_adj_rec.activity_type;
643: l_act_budgets_rec.budget_source_id := l_adj_rec.activity_id;
644: l_act_budgets_rec.transaction_type := 'DEBIT';
645: l_act_budgets_rec.request_currency := l_adj_rec.currency_code;
795: END IF;
796:
797: IF l_act_util_rec.orig_utilization_id IS NULL THEN
798: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
799: fnd_message.set_name('OZF', 'OZF_NO_ORIG_UTIL_ID');
800: fnd_msg_pub.add;
801: END IF;
802: RAISE fnd_api.g_exc_error;
803: END IF;
805: --if the original utilization is not posted to GL(e.g. marketing cost, or off invoice offer
806: --where gl posting is not required), then paid adjustment should not be allowed.
807: IF l_gl_posted_flag <> 'Y' THEN
808: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
809: fnd_message.set_name('OZF', 'OZF_ADJ_PAID_NOT_ALLOWED');
810: fnd_msg_pub.add;
811: END IF;
812: RAISE fnd_api.g_exc_error;
813: END IF;
870: END IF;
871:
872: IF l_act_util_rec.orig_utilization_id IS NULL THEN
873: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
874: fnd_message.set_name('OZF', 'OZF_NO_ORIG_UTIL_ID');
875: fnd_msg_pub.add;
876: END IF;
877: RAISE fnd_api.g_exc_error;
878: END IF;
880: --if the original utilization is not posted to GL(e.g. marketing cost, or off invoice offer
881: --where gl posting is not required), then paid adjustment should not be allowed.
882: IF l_gl_posted_flag <> 'Y' THEN
883: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
884: fnd_message.set_name('OZF', 'OZF_ADJ_PAID_NOT_ALLOWED');
885: fnd_msg_pub.add;
886: END IF;
887: RAISE fnd_api.g_exc_error;
888: END IF;