215: END IF;
216: l_debug := g_debug;
217:
218: -- Standard call to check for call compatibility
219: IF NOT fnd_api.compatible_api_call( l_api_version
220: ,p_api_version
221: ,l_api_name
222: ,g_pkg_name ) THEN
223: RAISE fnd_api.g_exc_unexpected_error;
219: IF NOT fnd_api.compatible_api_call( l_api_version
220: ,p_api_version
221: ,l_api_name
222: ,g_pkg_name ) THEN
223: RAISE fnd_api.g_exc_unexpected_error;
224: END IF;
225:
226:
227: -- Initialize message list if p_init_msg_list is set to TRUE
224: END IF;
225:
226:
227: -- Initialize message list if p_init_msg_list is set to TRUE
228: IF fnd_api.to_boolean( p_init_msg_list ) THEN
229: fnd_msg_pub.initialize;
230: END IF;
231: --
232: -- Initialize API return status to success
229: fnd_msg_pub.initialize;
230: END IF;
231: --
232: -- Initialize API return status to success
233: x_return_status := fnd_api.g_ret_sts_success;
234:
235: -- debugging portion
236: -- can be commented out for final code
237:
242: END IF;
243:
244: -- Validate input parameters and pre-requisites, if validation level
245: -- requires this
246: IF p_validation_level <> fnd_api.g_valid_level_none THEN
247:
248: --check for null line_id
249: if (p_line_id IS NULL) then
250: fnd_message.set_name('WMS','WMS_CG_MISSING_LINE_ID');
249: if (p_line_id IS NULL) then
250: fnd_message.set_name('WMS','WMS_CG_MISSING_LINE_ID');
251: fnd_msg_pub.add;
252: log_error_msg(l_api_name, 'missing_line_id');
253: raise fnd_api.g_exc_error;
254: end if;
255:
256: --check for null type code
257: if (p_input_type IS NULL) then
257: if (p_input_type IS NULL) then
258: fnd_message.set_name('WMS','WMS_CG_MISSING_INPUT_TYPE');
259: fnd_msg_pub.add;
260: log_error_msg(l_api_name, 'missing_input_type');
261: raise fnd_api.g_exc_error;
262: end if;
263:
264: END IF;
265:
276: ELSE
277: fnd_message.set_name('WMS','WMS_CG_MISSING_INPUT_TYPE');
278: fnd_msg_pub.add;
279: log_error_msg(l_api_name, 'invalid_input_type');
280: raise fnd_api.g_exc_error;
281: END IF;
282:
283: --set record type in global variable
284: g_current_input_type := p_input_type;
304: CLOSE c_input_line;
305: fnd_message.set_name('WMS','WMS_CG_LINE_NOT_FOUND');
306: fnd_msg_pub.add;
307: log_error_msg(l_api_name, 'line_not_found');
308: raise fnd_api.g_exc_error;
309: END IF;
310: CLOSE c_input_line;
311:
312: -- Determine which organization to use.
355: log_event(l_api_name, 'p_organization_id', l_organization_id);
356: end if;
357: wms_rules_workbench_pvt.cg_mmtt_search
358: ( p_api_version => 1.0
359: ,p_init_msg_list => fnd_api.g_false
360: ,p_validation_level => fnd_api.g_valid_level_none
361: ,x_return_status => l_return_status
362: ,x_msg_count => x_msg_count
363: ,x_msg_data => x_msg_data
356: end if;
357: wms_rules_workbench_pvt.cg_mmtt_search
358: ( p_api_version => 1.0
359: ,p_init_msg_list => fnd_api.g_false
360: ,p_validation_level => fnd_api.g_valid_level_none
361: ,x_return_status => l_return_status
362: ,x_msg_count => x_msg_count
363: ,x_msg_data => x_msg_data
364: ,p_transaction_temp_id => p_line_id
379: log_event(l_api_name, 'Search', 'wms_rules_workbench_pvt.search');
380: end if;
381: wms_rules_workbench_pvt.Search
382: ( p_api_version => 1.0
383: ,p_init_msg_list => fnd_api.g_false
384: ,p_validation_level => fnd_api.g_valid_level_none
385: ,x_return_status => l_return_status
386: ,x_msg_count => x_msg_count
387: ,x_msg_data => x_msg_data
380: end if;
381: wms_rules_workbench_pvt.Search
382: ( p_api_version => 1.0
383: ,p_init_msg_list => fnd_api.g_false
384: ,p_validation_level => fnd_api.g_valid_level_none
385: ,x_return_status => l_return_status
386: ,x_msg_count => x_msg_count
387: ,x_msg_data => x_msg_data
388: ,p_transaction_temp_id => p_line_id
399: log_statement(l_api_name, ': l_sequence_number ', l_sequence_number );
400: log_event(l_api_name, 'search', 'End');
401: end if;
402: End if;
403: if l_return_status = fnd_api.g_ret_sts_unexp_error then
404: if l_debug = 1 THEN
405: log_error(l_api_name, 'strat_search_unexp_err',
406: 'Unexpected error in wms_strategy_pvt search procedure');
407: end if;
404: if l_debug = 1 THEN
405: log_error(l_api_name, 'strat_search_unexp_err',
406: 'Unexpected error in wms_strategy_pvt search procedure');
407: end if;
408: raise fnd_api.g_exc_unexpected_error;
409:
410: elsif l_return_status = fnd_api.g_ret_sts_error then
411: if l_debug = 1 then
412: log_error(l_api_name, 'strat_search_err',
406: 'Unexpected error in wms_strategy_pvt search procedure');
407: end if;
408: raise fnd_api.g_exc_unexpected_error;
409:
410: elsif l_return_status = fnd_api.g_ret_sts_error then
411: if l_debug = 1 then
412: log_error(l_api_name, 'strat_search_err',
413: 'Error in wms_strategy_pvt search procedure');
414: end if;
411: if l_debug = 1 then
412: log_error(l_api_name, 'strat_search_err',
413: 'Error in wms_strategy_pvt search procedure');
414: end if;
415: raise fnd_api.g_exc_error;
416: elsif l_return_status = fnd_api.g_ret_sts_success then
417: --If l_rules_engine_mode = 1 then
418: -- {{[ Test Case # UTK-REALLOC-3.1.3:3c
419: -- Description: Strategy search based on rule and strategy assignments
412: log_error(l_api_name, 'strat_search_err',
413: 'Error in wms_strategy_pvt search procedure');
414: end if;
415: raise fnd_api.g_exc_error;
416: elsif l_return_status = fnd_api.g_ret_sts_success then
417: --If l_rules_engine_mode = 1 then
418: -- {{[ Test Case # UTK-REALLOC-3.1.3:3c
419: -- Description: Strategy search based on rule and strategy assignments
420: -- Searching Cost Group rule assignments Misc Receipt ] }}
474: ,x_msg_count
475: ,x_msg_data
476: ,l_strategy_id );
477:
478: if l_return_status = fnd_api.g_ret_sts_unexp_error then
479: if l_debug = 1 then
480: log_error(l_api_name, 'init_rules_unexp_err',
481: 'Unexpected error in wms_strategy_pvt InitStrategyRules');
482: end if;
479: if l_debug = 1 then
480: log_error(l_api_name, 'init_rules_unexp_err',
481: 'Unexpected error in wms_strategy_pvt InitStrategyRules');
482: end if;
483: raise fnd_api.g_exc_unexpected_error;
484: elsif l_return_status = fnd_api.g_ret_sts_error then
485: if l_debug = 1 then
486: log_error(l_api_name, 'init_rules_err',
487: 'Error in wms_strategy_pvt InitStrategyRules');
480: log_error(l_api_name, 'init_rules_unexp_err',
481: 'Unexpected error in wms_strategy_pvt InitStrategyRules');
482: end if;
483: raise fnd_api.g_exc_unexpected_error;
484: elsif l_return_status = fnd_api.g_ret_sts_error then
485: if l_debug = 1 then
486: log_error(l_api_name, 'init_rules_err',
487: 'Error in wms_strategy_pvt InitStrategyRules');
488: end if;
485: if l_debug = 1 then
486: log_error(l_api_name, 'init_rules_err',
487: 'Error in wms_strategy_pvt InitStrategyRules');
488: end if;
489: raise fnd_api.g_exc_error;
490: end if;
491: END IF;
492: -- Loop through all the rules, until all input lines are satisfied
493: -- [ call the rule and exit from the loop ]
560: log_statement(l_api_name, 'l_sql_return ', l_sql_return );
561: log_error_msg(l_api_name, 'rule_package_missing');
562: log_statement(l_api_name,'', 'Package name: ' || l_package_name);
563: end if;
564: RAISE fnd_api.g_exc_unexpected_error;
565: ELSIF l_sql_return <> -1 THEN
566: EXIT;
567: END IF;
568: END LOOP;
679: fnd_msg_pub.add;
680: if l_debug = 1 then
681: log_error_msg(l_api_name, 'no_default_org_cg');
682: end if;
683: raise fnd_api.g_exc_error;
684: END IF;
685: CLOSE l_default_cg_org;
686: if l_debug = 1 then
687: log_event(l_api_name, 'default_cg_for_org',
726: wms_search_order_globals_pvt.g_costgroup_id := l_cost_group_id;
727: END IF;
728:
729: -- Standard check of p_commit
730: IF fnd_api.to_boolean(p_commit) THEN
731: COMMIT WORK;
732: END IF;
733:
734: -- debugging portion
738: log_procedure(l_api_name, '', 'End Assign_Cost_Group');
739: end if;
740: EXCEPTION
741:
742: WHEN fnd_api.g_exc_error THEN
743:
744: ROLLBACK TO assignCGSP;
745: x_return_status := fnd_api.g_ret_sts_error;
746: fnd_msg_pub.count_and_get( p_count => x_msg_count
741:
742: WHEN fnd_api.g_exc_error THEN
743:
744: ROLLBACK TO assignCGSP;
745: x_return_status := fnd_api.g_ret_sts_error;
746: fnd_msg_pub.count_and_get( p_count => x_msg_count
747: ,p_data => x_msg_data );
748: if l_debug = 1 then
749: log_error(l_api_name, 'error', 'Error - ' || x_msg_data);
751:
752: WHEN OTHERS THEN
753:
754: ROLLBACK TO assignCGSP;
755: x_return_status := fnd_api.g_ret_sts_unexp_error;
756: fnd_msg_pub.count_and_get( p_count => x_msg_count
757: ,p_data => x_msg_data );
758: if l_debug = 1 then
759: log_error(l_api_name,'unexp_error','Unexpected error - ' || x_msg_data);