94: commit;
95: end if;
96: else
97: if (l_plan_type=6) then
98: select fnd_profile.value('MSC_APCC_SNO_ITEM_SIMULATION_SET')
99: into l_item_simulation_set_id
100: from dual;
101: else
102: select item_simulation_set_id
224: greatest(sum(nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)), 0) total_obs_value,
225:
226:
227: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
228: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) excess_from_onhand_value2,
229: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
230: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) excess_from_onorder_value2,
231:
232: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
226:
227: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
228: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) excess_from_onhand_value2,
229: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
230: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) excess_from_onorder_value2,
231:
232: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
233: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onhand_value2,
234: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
229: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
230: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) excess_from_onorder_value2,
231:
232: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
233: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onhand_value2,
234: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
235: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onorder_value2,
236:
237: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
231:
232: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
233: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onhand_value2,
234: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
235: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onorder_value2,
236:
237: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
238: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
239: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
234: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
235: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) obsolete_onorder_value2,
236:
237: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
238: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
239: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
240: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) total_excess_value2,
241:
242: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
236:
237: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
238: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
239: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
240: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) total_excess_value2,
241:
242: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
243: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
244: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
239: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_excess_hor_value,0)) *
240: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) total_excess_value2,
241:
242: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
243: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
244: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
245: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) total_obs_value2,
246:
247: fnd_global.user_id, sysdate,
241:
242: greatest(sum((nvl(sdt.onhand_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
243: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) +
244: greatest(sum((nvl(sdt.onorder_value,0)-nvl(sdt.dmd_within_obs_hor_value,0)) *
245: decode(sdt.currency_code, fnd_profile.value('MSC_HUB_CUR_CODE_RPT'), 1, nvl(mcc.conv_rate,0))), 0) total_obs_value2,
246:
247: fnd_global.user_id, sysdate,
248: sysdate, fnd_global.user_id, fnd_global.login_id,
249: fnd_global.conc_program_id, fnd_global.conc_login_id,
332: and mdf.inventory_item_id=i.inventory_item_id(+)
333: ) sdt,
334: msc_currency_conv_mv mcc
335: where sdt.plan_id=p_plan_id
336: and mcc.to_currency(+)=fnd_profile.value('MSC_HUB_CUR_CODE_RPT')
337: and mcc.from_currency(+)=nvl(sdt.currency_code, l_owning_currency_code)
338: and mcc.calendar_date(+)=sdt.detail_date
339: group by
340: sdt.sr_instance_id,
345: commit;
346: end if;
347:
348: if (l_enforce_wh_cpty = 1 and l_plan_type = 4) then
349: if (nvl(fnd_profile.value('MSR_ORGANIZATION_WAREHOUSE_CAPACITY'),1) = 1) then
350: -- msc_items_f:wh_available_capacity
351: insert /*+ append nologging */ into msc_st_items_f (
352: st_transaction_id,
353: error_code,
528:
529: procedure summarize_items_f(errbuf out nocopy varchar2, retcode out nocopy varchar2,
530: p_plan_id number, p_plan_run_id number)
531: is
532: l_category_set_id1 number := fnd_profile.value('MSC_HUB_CAT_SET_ID_1');
533: begin
534: msc_phub_util.log('msc_phub_excess_pkg.summarize_items_f');
535: retcode := 0;
536: errbuf := '';