194:
195:
196: -- Find out if there are rows in msd_setup_parameters in the source instance
197: --
198: -- Call MSD_CONC_LOG_UTIL.Initialize for log file for concurrent program
199: --
200: msd_conc_log_util.Initilize(msd_conc_log_util.C_OUTPUT_TO_FNDFILE);
201: --
202:
196: -- Find out if there are rows in msd_setup_parameters in the source instance
197: --
198: -- Call MSD_CONC_LOG_UTIL.Initialize for log file for concurrent program
199: --
200: msd_conc_log_util.Initilize(msd_conc_log_util.C_OUTPUT_TO_FNDFILE);
201: --
202:
203: msd_common_utilities.get_db_link(p_instance_id, g_dblink, l_retcode);
204: if (l_retcode = -1) then
201: --
202:
203: msd_common_utilities.get_db_link(p_instance_id, g_dblink, l_retcode);
204: if (l_retcode = -1) then
205: msd_conc_log_util.display_message('Instance id : ' || p_instance_id || ' not found ', msd_conc_log_util.C_FATAL_ERROR);
206: return;
207: end if;
208:
209:
207: end if;
208:
209:
210: -- log details
211: msd_conc_log_util.display_message('Demand Plan Push Setup Parameters', msd_conc_log_util.C_SECTION);
212: msd_conc_log_util.display_message(' ', msd_conc_log_util.C_HEADING);
213: msd_conc_log_util.display_message('Demand Plan Push Setup Program Parameters', msd_conc_log_util.C_HEADING);
214: msd_conc_log_util.display_message('-----------------------------------------', msd_conc_log_util.C_HEADING);
215: -- get instance dblink
208:
209:
210: -- log details
211: msd_conc_log_util.display_message('Demand Plan Push Setup Parameters', msd_conc_log_util.C_SECTION);
212: msd_conc_log_util.display_message(' ', msd_conc_log_util.C_HEADING);
213: msd_conc_log_util.display_message('Demand Plan Push Setup Program Parameters', msd_conc_log_util.C_HEADING);
214: msd_conc_log_util.display_message('-----------------------------------------', msd_conc_log_util.C_HEADING);
215: -- get instance dblink
216: --
209:
210: -- log details
211: msd_conc_log_util.display_message('Demand Plan Push Setup Parameters', msd_conc_log_util.C_SECTION);
212: msd_conc_log_util.display_message(' ', msd_conc_log_util.C_HEADING);
213: msd_conc_log_util.display_message('Demand Plan Push Setup Program Parameters', msd_conc_log_util.C_HEADING);
214: msd_conc_log_util.display_message('-----------------------------------------', msd_conc_log_util.C_HEADING);
215: -- get instance dblink
216: --
217: msd_common_utilities.get_db_link(p_instance_id, g_dblink, l_retcode);
210: -- log details
211: msd_conc_log_util.display_message('Demand Plan Push Setup Parameters', msd_conc_log_util.C_SECTION);
212: msd_conc_log_util.display_message(' ', msd_conc_log_util.C_HEADING);
213: msd_conc_log_util.display_message('Demand Plan Push Setup Program Parameters', msd_conc_log_util.C_HEADING);
214: msd_conc_log_util.display_message('-----------------------------------------', msd_conc_log_util.C_HEADING);
215: -- get instance dblink
216: --
217: msd_common_utilities.get_db_link(p_instance_id, g_dblink, l_retcode);
218: -- Check results
217: msd_common_utilities.get_db_link(p_instance_id, g_dblink, l_retcode);
218: -- Check results
219: if (l_retcode = -1) then
220: -- Log Fatal Error
221: msd_conc_log_util.display_message('Instance id : ' || p_instance_id || ' not found ', msd_conc_log_util.C_FATAL_ERROR);
222: return;
223: else
224: -- Log success details
225: msd_conc_log_util.display_message('Instance ID : ' || p_instance_id, msd_conc_log_util.C_INFORMATION);
221: msd_conc_log_util.display_message('Instance id : ' || p_instance_id || ' not found ', msd_conc_log_util.C_FATAL_ERROR);
222: return;
223: else
224: -- Log success details
225: msd_conc_log_util.display_message('Instance ID : ' || p_instance_id, msd_conc_log_util.C_INFORMATION);
226: msd_conc_log_util.display_message('DB Link : ' || g_dblink , msd_conc_log_util.C_INFORMATION);
227: end if;
228:
229: --
222: return;
223: else
224: -- Log success details
225: msd_conc_log_util.display_message('Instance ID : ' || p_instance_id, msd_conc_log_util.C_INFORMATION);
226: msd_conc_log_util.display_message('DB Link : ' || g_dblink , msd_conc_log_util.C_INFORMATION);
227: end if;
228:
229: --
230: -- Call Push_profile
235: --
236: push_organization (errbuf, retcode, p_instance_id);
237: --
238:
239: retcode := msd_conc_log_util.retcode;
240: --
241: msd_conc_log_util.display_message('Exiting with : ', msd_conc_log_util.Result);
242:
243:
237: --
238:
239: retcode := msd_conc_log_util.retcode;
240: --
241: msd_conc_log_util.display_message('Exiting with : ', msd_conc_log_util.Result);
242:
243:
244: --
245: Exception
242:
243:
244: --
245: Exception
246: When msd_conc_log_util.EX_FATAL_ERROR then
247: retcode := 2;
248: errbuf := substr( sqlerrm, 1, 80);
249: when others then
250: retcode := 2;
338: --
339: --
340: Begin
341: -- Log
342: msd_conc_log_util.display_message('Push Profile', msd_conc_log_util.C_SECTION);
343: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
344: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
345:
346: -- Read profiles/functions from the array and initialise on source instance
339: --
340: Begin
341: -- Log
342: msd_conc_log_util.display_message('Push Profile', msd_conc_log_util.C_SECTION);
343: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
344: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
345:
346: -- Read profiles/functions from the array and initialise on source instance
347: --
340: Begin
341: -- Log
342: msd_conc_log_util.display_message('Push Profile', msd_conc_log_util.C_SECTION);
343: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
344: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
345:
346: -- Read profiles/functions from the array and initialise on source instance
347: --
348: l_err := 0;
349:
350: /* Get the parameter values */
351: FOR i IN l_para_prof.FIRST..l_para_prof.LAST LOOP
352: l_para_prof(i).parameter_value := decode_profile_function(l_para_prof(i));
353: msd_conc_log_util.display_message('Profile ' || l_para_prof(i).profile_name || ' : ' ||
354: l_para_prof(i).parameter_value, msd_conc_log_util.C_INFORMATION);
355: END LOOP;
356:
357: IF ((l_para_prof(2).parameter_value is NULL) or
350: /* Get the parameter values */
351: FOR i IN l_para_prof.FIRST..l_para_prof.LAST LOOP
352: l_para_prof(i).parameter_value := decode_profile_function(l_para_prof(i));
353: msd_conc_log_util.display_message('Profile ' || l_para_prof(i).profile_name || ' : ' ||
354: l_para_prof(i).parameter_value, msd_conc_log_util.C_INFORMATION);
355: END LOOP;
356:
357: IF ((l_para_prof(2).parameter_value is NULL) or
358: (l_para_prof(3).parameter_value is NULL) or
379:
380:
381: /* If Two-Level Planning has not been set, then default it to NO */
382: IF (l_para_prof(8).parameter_value is NULL) THEN
383: msd_conc_log_util.display_message('Profile ' || l_para_prof(8).profile_name ||
384: ' is not defined. Defaulting this profile value to ',msd_conc_log_util.C_INFORMATION);
385: msd_conc_log_util.display_message('''Exclude family members with forecast control NONE''',
386: msd_conc_log_util.C_INFORMATION);
387: l_para_prof(8).parameter_value := 2;
380:
381: /* If Two-Level Planning has not been set, then default it to NO */
382: IF (l_para_prof(8).parameter_value is NULL) THEN
383: msd_conc_log_util.display_message('Profile ' || l_para_prof(8).profile_name ||
384: ' is not defined. Defaulting this profile value to ',msd_conc_log_util.C_INFORMATION);
385: msd_conc_log_util.display_message('''Exclude family members with forecast control NONE''',
386: msd_conc_log_util.C_INFORMATION);
387: l_para_prof(8).parameter_value := 2;
388: END IF;
381: /* If Two-Level Planning has not been set, then default it to NO */
382: IF (l_para_prof(8).parameter_value is NULL) THEN
383: msd_conc_log_util.display_message('Profile ' || l_para_prof(8).profile_name ||
384: ' is not defined. Defaulting this profile value to ',msd_conc_log_util.C_INFORMATION);
385: msd_conc_log_util.display_message('''Exclude family members with forecast control NONE''',
386: msd_conc_log_util.C_INFORMATION);
387: l_para_prof(8).parameter_value := 2;
388: END IF;
389:
382: IF (l_para_prof(8).parameter_value is NULL) THEN
383: msd_conc_log_util.display_message('Profile ' || l_para_prof(8).profile_name ||
384: ' is not defined. Defaulting this profile value to ',msd_conc_log_util.C_INFORMATION);
385: msd_conc_log_util.display_message('''Exclude family members with forecast control NONE''',
386: msd_conc_log_util.C_INFORMATION);
387: l_para_prof(8).parameter_value := 2;
388: END IF;
389:
390: if ((l_err <> 1) and (l_warning = 1)) then
388: END IF;
389:
390: if ((l_err <> 1) and (l_warning = 1)) then
391:
392: msd_conc_log_util.display_message('Profile ' || l_para_prof(4).profile_name ||
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
389:
390: if ((l_err <> 1) and (l_warning = 1)) then
391:
392: msd_conc_log_util.display_message('Profile ' || l_para_prof(4).profile_name ||
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
390: if ((l_err <> 1) and (l_warning = 1)) then
391:
392: msd_conc_log_util.display_message('Profile ' || l_para_prof(4).profile_name ||
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
398: msd_conc_log_util.display_message(' and rerun the Push Setup Parameters concurrent program', msd_conc_log_util.C_WARNING);
391:
392: msd_conc_log_util.display_message('Profile ' || l_para_prof(4).profile_name ||
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
398: msd_conc_log_util.display_message(' and rerun the Push Setup Parameters concurrent program', msd_conc_log_util.C_WARNING);
399: end if;
392: msd_conc_log_util.display_message('Profile ' || l_para_prof(4).profile_name ||
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
398: msd_conc_log_util.display_message(' and rerun the Push Setup Parameters concurrent program', msd_conc_log_util.C_WARNING);
399: end if;
400:
393: ' in the Source instance NOT SET !!!', msd_conc_log_util.C_INFORMATION);
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
398: msd_conc_log_util.display_message(' and rerun the Push Setup Parameters concurrent program', msd_conc_log_util.C_WARNING);
399: end if;
400:
401:
394: msd_conc_log_util.display_message('The system has determined to use Organization Id = ' ||
395: l_para_prof(4).parameter_value || ' as the master org', msd_conc_log_util.C_INFORMATION);
396: msd_conc_log_util.display_message('If this is not the master org, please update the MSD_MASTER_ORG profile on the source',
397: msd_conc_log_util.C_WARNING);
398: msd_conc_log_util.display_message(' and rerun the Push Setup Parameters concurrent program', msd_conc_log_util.C_WARNING);
399: end if;
400:
401:
402: IF (l_err = 1) THEN
399: end if;
400:
401:
402: IF (l_err = 1) THEN
403: msd_conc_log_util.display_message('Please make sure that profiles ' ||
404: 'MSD_CONVERSION_TYPE and MSD_MASTER_ORG are set in Source instance.', msd_conc_log_util.C_ERROR);
405: msd_conc_log_util.display_message(' and MSD_CURRENCY_CODE profile in the Planning Server are set.', msd_conc_log_util.C_ERROR);
406: ELSE
407: msd_conc_log_util.display_message('Deleting records from msd_setup_parameters in the Source instance', msd_conc_log_util.C_HEADING);
400:
401:
402: IF (l_err = 1) THEN
403: msd_conc_log_util.display_message('Please make sure that profiles ' ||
404: 'MSD_CONVERSION_TYPE and MSD_MASTER_ORG are set in Source instance.', msd_conc_log_util.C_ERROR);
405: msd_conc_log_util.display_message(' and MSD_CURRENCY_CODE profile in the Planning Server are set.', msd_conc_log_util.C_ERROR);
406: ELSE
407: msd_conc_log_util.display_message('Deleting records from msd_setup_parameters in the Source instance', msd_conc_log_util.C_HEADING);
408: /* Truncate Source msd_setup_parameters */
401:
402: IF (l_err = 1) THEN
403: msd_conc_log_util.display_message('Please make sure that profiles ' ||
404: 'MSD_CONVERSION_TYPE and MSD_MASTER_ORG are set in Source instance.', msd_conc_log_util.C_ERROR);
405: msd_conc_log_util.display_message(' and MSD_CURRENCY_CODE profile in the Planning Server are set.', msd_conc_log_util.C_ERROR);
406: ELSE
407: msd_conc_log_util.display_message('Deleting records from msd_setup_parameters in the Source instance', msd_conc_log_util.C_HEADING);
408: /* Truncate Source msd_setup_parameters */
409: l_sql := 'delete from msd_setup_parameters' || g_dblink;
403: msd_conc_log_util.display_message('Please make sure that profiles ' ||
404: 'MSD_CONVERSION_TYPE and MSD_MASTER_ORG are set in Source instance.', msd_conc_log_util.C_ERROR);
405: msd_conc_log_util.display_message(' and MSD_CURRENCY_CODE profile in the Planning Server are set.', msd_conc_log_util.C_ERROR);
406: ELSE
407: msd_conc_log_util.display_message('Deleting records from msd_setup_parameters in the Source instance', msd_conc_log_util.C_HEADING);
408: /* Truncate Source msd_setup_parameters */
409: l_sql := 'delete from msd_setup_parameters' || g_dblink;
410: EXECUTE IMMEDIATE l_sql;
411:
408: /* Truncate Source msd_setup_parameters */
409: l_sql := 'delete from msd_setup_parameters' || g_dblink;
410: EXECUTE IMMEDIATE l_sql;
411:
412: msd_conc_log_util.display_message('Inserting profile into source msd_setup_parameters', msd_conc_log_util.C_INFORMATION);
413:
414: /* Insert profiles in source msd_setup_parameters */
415: l_sql := 'insert into msd_setup_parameters' || g_dblink ||
416: ' (instance_id, parameter_name, parameter_value) values (:1, :2, :3)';
440: l_sql varchar2(2000);
441: --
442: Begin
443: -- Log
444: msd_conc_log_util.display_message('Push Organization', msd_conc_log_util.C_SECTION);
445: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
446: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
447: --
448: msd_conc_log_util.display_message('Deleting Organizations from source MSD_APP_INSTANCE_ORGS', msd_conc_log_util.C_INFORMATION);
441: --
442: Begin
443: -- Log
444: msd_conc_log_util.display_message('Push Organization', msd_conc_log_util.C_SECTION);
445: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
446: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
447: --
448: msd_conc_log_util.display_message('Deleting Organizations from source MSD_APP_INSTANCE_ORGS', msd_conc_log_util.C_INFORMATION);
449: --
442: Begin
443: -- Log
444: msd_conc_log_util.display_message('Push Organization', msd_conc_log_util.C_SECTION);
445: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
446: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
447: --
448: msd_conc_log_util.display_message('Deleting Organizations from source MSD_APP_INSTANCE_ORGS', msd_conc_log_util.C_INFORMATION);
449: --
450: -- Delete all organization records from MSD_APP_INSTANCE_ORGS
444: msd_conc_log_util.display_message('Push Organization', msd_conc_log_util.C_SECTION);
445: msd_conc_log_util.display_message('Action', msd_conc_log_util.C_HEADING);
446: msd_conc_log_util.display_message(rpad('-', 80, '-'), msd_conc_log_util.C_HEADING);
447: --
448: msd_conc_log_util.display_message('Deleting Organizations from source MSD_APP_INSTANCE_ORGS', msd_conc_log_util.C_INFORMATION);
449: --
450: -- Delete all organization records from MSD_APP_INSTANCE_ORGS
451: l_sql := 'Delete from MSD_APP_INSTANCE_ORGS' || g_dblink;
452: EXECUTE IMMEDIATE l_sql;
450: -- Delete all organization records from MSD_APP_INSTANCE_ORGS
451: l_sql := 'Delete from MSD_APP_INSTANCE_ORGS' || g_dblink;
452: EXECUTE IMMEDIATE l_sql;
453: --
454: msd_conc_log_util.display_message('Creating Organizations into source MSD_APP_INSTANCE_ORGS', msd_conc_log_util.C_INFORMATION);
455: --
456: -- Create rows in MSD_APP_INSTANCE_ORGS, in source database, for all the enabled
457: -- organization in msc_instance_orgs
458: --
526:
527: /* Get db_link */
528: msd_common_utilities.get_db_link(p_instance_id, g_dblink, retcode);
529: IF retcode <> 0 THEN
530: msd_conc_log_util.display_message('Instance id : ' || p_instance_id ||
531: ' not found ', msd_conc_log_util.C_FATAL_ERROR);
532: return;
533: END IF;
534:
527: /* Get db_link */
528: msd_common_utilities.get_db_link(p_instance_id, g_dblink, retcode);
529: IF retcode <> 0 THEN
530: msd_conc_log_util.display_message('Instance id : ' || p_instance_id ||
531: ' not found ', msd_conc_log_util.C_FATAL_ERROR);
532: return;
533: END IF;
534:
535: /* First, Check the setup parameters, and then check organization */