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