154: Begin
155:
156: l_stmt := 'truncate table '||g_schema||'.'||p_table_name;
157: if g_debug_flag = 'Y' then
158: OZF_TP_UTIL_PVT.put_line(l_stmt);
159: end if;
160: execute immediate l_stmt;
161:
162: Exception
177: -- ----------------------
178: -- Initialize the global variables
179: -- ----------------------
180:
181: OZF_TP_UTIL_PVT.initialize;
182:
183: IF(FND_INSTALLATION.GET_APP_INFO('OZF', l_status, l_industry, g_schema))
184: THEN NULL;
185: END IF;
194: if (g_all_level = 'Y') then
195: g_period_set_name := ozf_common_parameters_pvt.get_period_set_name;
196: g_period_type := ozf_common_parameters_pvt.get_period_type;
197: if g_debug_flag = 'Y' then
198: OZF_TP_UTIL_PVT.put_line('Enterprise Calendar = '||g_period_set_name||' ('||g_period_type||')');
199: end if;
200: g_week_start_day := ozf_common_parameters_pvt.get_start_day_of_week_id;
201: if (g_period_set_name is null or g_period_type is null or g_week_start_day is null) then
202: raise G_OZF_PARAMETER_NOT_SETUP;
201: if (g_period_set_name is null or g_period_type is null or g_week_start_day is null) then
202: raise G_OZF_PARAMETER_NOT_SETUP;
203: end if;
204: if g_debug_flag = 'Y' then
205: OZF_TP_UTIL_PVT.put_line('Week Start Day = '||g_week_start_day);
206: end if;
207: g_week_offset := get_week_offset(g_week_start_day);
208: if g_debug_flag = 'Y' then
209: OZF_TP_UTIL_PVT.put_line('Week offset = '||g_week_offset);
205: OZF_TP_UTIL_PVT.put_line('Week Start Day = '||g_week_start_day);
206: end if;
207: g_week_offset := get_week_offset(g_week_start_day);
208: if g_debug_flag = 'Y' then
209: OZF_TP_UTIL_PVT.put_line('Week offset = '||g_week_offset);
210: OZF_TP_UTIL_PVT.put_line(' ');
211: end if;
212:
213: -- g_global_start_date := to_date('01/01/1997','MM/DD/YYYY');
206: end if;
207: g_week_offset := get_week_offset(g_week_start_day);
208: if g_debug_flag = 'Y' then
209: OZF_TP_UTIL_PVT.put_line('Week offset = '||g_week_offset);
210: OZF_TP_UTIL_PVT.put_line(' ');
211: end if;
212:
213: -- g_global_start_date := to_date('01/01/1997','MM/DD/YYYY');
214:
214:
215: g_global_start_date := ozf_common_parameters_pvt.GET_GLOBAL_START_DATE;
216: if (g_global_start_date is null) then
217: if g_debug_flag = 'Y' then
218: OZF_TP_UTIL_PVT.put_line('Global Start Date is not setup!');
219: end if;
220: raise G_OZF_PARAMETER_NOT_SETUP;
221: end if;
222:
220: raise G_OZF_PARAMETER_NOT_SETUP;
221: end if;
222:
223: if g_debug_flag = 'Y' then
224: OZF_TP_UTIL_PVT.put_line('Global Start Date = ' || g_global_start_date);
225: OZF_TP_UTIL_PVT.put_line(' ');
226: end if;
227: end if;
228:
221: end if;
222:
223: if g_debug_flag = 'Y' then
224: OZF_TP_UTIL_PVT.put_line('Global Start Date = ' || g_global_start_date);
225: OZF_TP_UTIL_PVT.put_line(' ');
226: end if;
227: end if;
228:
229: end INIT;
393: end loop;
394:
395: commit;
396: if g_debug_flag = 'Y' then
397: OZF_TP_UTIL_PVT.put_line(to_char(l_day_row)||' records has been populated or updated to Day Level');
398: end if;
399:
400: end LOAD_DAY_INC;
401:
509: end loop;
510:
511: commit;
512: if g_debug_flag = 'Y' then
513: OZF_TP_UTIL_PVT.put_line(to_char(l_day_row)||' records has been populated to Day Level');
514: end if;
515:
516: end LOAD_DAY;
517:
588: end loop;
589:
590: commit;
591: if g_debug_flag = 'Y' then
592: OZF_TP_UTIL_PVT.put_line(to_char(l_week_row)||' records has been populated to Week Level');
593: end if;
594:
595: end LOAD_WEEK;
596:
656:
657: l_period_row := sql%rowcount;
658: commit;
659: if g_debug_flag = 'Y' then
660: OZF_TP_UTIL_PVT.put_line(to_char(l_period_row)||' records has been populated to Enterprise Period Level');
661: end if;
662:
663: end LOAD_ENT_PERIOD;
664:
727:
728: l_qtr_row := sql%rowcount;
729: commit;
730: if g_debug_flag = 'Y' then
731: OZF_TP_UTIL_PVT.put_line(to_char(l_qtr_row)||' records has been populated to Enterprise Quarter Level');
732: end if;
733:
734: end LOAD_ENT_QUARTER;
735:
813:
814: l_year_row := sql%rowcount;
815: commit;
816: if g_debug_flag = 'Y' then
817: OZF_TP_UTIL_PVT.put_line(to_char(l_year_row)||' records has been populated to Enterprise Year Level');
818: end if;
819:
820: end LOAD_ENT_YEAR;
821:
845: l_from_date := trunc(to_date(p_from_date,'YYYY/MM/DD HH24:MI:SS'));
846: l_to_date := trunc(to_date(p_to_date, 'YYYY/MM/DD HH24:MI:SS'));
847: g_all_level := nvl(p_all_level,'Y');
848: if g_debug_flag = 'Y' then
849: OZF_TP_UTIL_PVT.put_line('Data loads from '||l_from_date||' to '||l_to_date);
850: end if;
851:
852: ----------------------------------------------------------
853: -- Calling ozf common parameters api to do common set ups
858:
859:
860: IF (NOT ozf_common_parameters_pvt.check_global_parameters(l_global_param_list)) THEN
861: if g_debug_flag = 'Y' then
862: OZF_TP_UTIL_PVT.put_line('Global Start Date has not been set up. ' ||
863: 'Program will exit with error status.');
864: end if;
865: x_retcode := 1;
866: raise G_OZF_PARAMETER_NOT_SETUP;
871: INIT;
872:
873: g_phase := 'Load Day Level';
874: if g_debug_flag = 'Y' then
875: OZF_TP_UTIL_PVT.start_timer;
876: end if;
877: --*** LOAD_DAY(l_from_date, l_to_date); -- full refresh
878: LOAD_DAY_INC(l_from_date, l_to_date); -- incremental refresh
879: if g_debug_flag = 'Y' then
876: end if;
877: --*** LOAD_DAY(l_from_date, l_to_date); -- full refresh
878: LOAD_DAY_INC(l_from_date, l_to_date); -- incremental refresh
879: if g_debug_flag = 'Y' then
880: OZF_TP_UTIL_PVT.stop_timer;
881: OZF_TP_UTIL_PVT.print_timer('Process Time');
882: OZF_TP_UTIL_PVT.put_line(' ');
883: end if;
884:
877: --*** LOAD_DAY(l_from_date, l_to_date); -- full refresh
878: LOAD_DAY_INC(l_from_date, l_to_date); -- incremental refresh
879: if g_debug_flag = 'Y' then
880: OZF_TP_UTIL_PVT.stop_timer;
881: OZF_TP_UTIL_PVT.print_timer('Process Time');
882: OZF_TP_UTIL_PVT.put_line(' ');
883: end if;
884:
885: if (g_all_level = 'Y') then
878: LOAD_DAY_INC(l_from_date, l_to_date); -- incremental refresh
879: if g_debug_flag = 'Y' then
880: OZF_TP_UTIL_PVT.stop_timer;
881: OZF_TP_UTIL_PVT.print_timer('Process Time');
882: OZF_TP_UTIL_PVT.put_line(' ');
883: end if;
884:
885: if (g_all_level = 'Y') then
886: g_phase := 'Load Week Level';
884:
885: if (g_all_level = 'Y') then
886: g_phase := 'Load Week Level';
887: if g_debug_flag = 'Y' then
888: OZF_TP_UTIL_PVT.start_timer;
889: end if;
890: LOAD_WEEK(l_from_date, l_to_date);
891: if g_debug_flag = 'Y' then
892: OZF_TP_UTIL_PVT.stop_timer;
888: OZF_TP_UTIL_PVT.start_timer;
889: end if;
890: LOAD_WEEK(l_from_date, l_to_date);
891: if g_debug_flag = 'Y' then
892: OZF_TP_UTIL_PVT.stop_timer;
893: OZF_TP_UTIL_PVT.print_timer('Process Time');
894: OZF_TP_UTIL_PVT.put_line(' ');
895: end if;
896:
889: end if;
890: LOAD_WEEK(l_from_date, l_to_date);
891: if g_debug_flag = 'Y' then
892: OZF_TP_UTIL_PVT.stop_timer;
893: OZF_TP_UTIL_PVT.print_timer('Process Time');
894: OZF_TP_UTIL_PVT.put_line(' ');
895: end if;
896:
897: g_phase := 'Load Enterprise Period Level';
890: LOAD_WEEK(l_from_date, l_to_date);
891: if g_debug_flag = 'Y' then
892: OZF_TP_UTIL_PVT.stop_timer;
893: OZF_TP_UTIL_PVT.print_timer('Process Time');
894: OZF_TP_UTIL_PVT.put_line(' ');
895: end if;
896:
897: g_phase := 'Load Enterprise Period Level';
898: if g_debug_flag = 'Y' then
895: end if;
896:
897: g_phase := 'Load Enterprise Period Level';
898: if g_debug_flag = 'Y' then
899: OZF_TP_UTIL_PVT.start_timer;
900: end if;
901: LOAD_ENT_PERIOD(l_from_date, l_to_date);
902: if g_debug_flag = 'Y' then
903: OZF_TP_UTIL_PVT.stop_timer;
899: OZF_TP_UTIL_PVT.start_timer;
900: end if;
901: LOAD_ENT_PERIOD(l_from_date, l_to_date);
902: if g_debug_flag = 'Y' then
903: OZF_TP_UTIL_PVT.stop_timer;
904: OZF_TP_UTIL_PVT.print_timer('Process Time');
905: OZF_TP_UTIL_PVT.put_line(' ');
906: end if;
907:
900: end if;
901: LOAD_ENT_PERIOD(l_from_date, l_to_date);
902: if g_debug_flag = 'Y' then
903: OZF_TP_UTIL_PVT.stop_timer;
904: OZF_TP_UTIL_PVT.print_timer('Process Time');
905: OZF_TP_UTIL_PVT.put_line(' ');
906: end if;
907:
908: g_phase := 'Load Enterprise Quarter Level';
901: LOAD_ENT_PERIOD(l_from_date, l_to_date);
902: if g_debug_flag = 'Y' then
903: OZF_TP_UTIL_PVT.stop_timer;
904: OZF_TP_UTIL_PVT.print_timer('Process Time');
905: OZF_TP_UTIL_PVT.put_line(' ');
906: end if;
907:
908: g_phase := 'Load Enterprise Quarter Level';
909: if g_debug_flag = 'Y' then
906: end if;
907:
908: g_phase := 'Load Enterprise Quarter Level';
909: if g_debug_flag = 'Y' then
910: OZF_TP_UTIL_PVT.start_timer;
911: end if;
912: LOAD_ENT_QUARTER(l_from_date, l_to_date);
913: if g_debug_flag = 'Y' then
914: OZF_TP_UTIL_PVT.stop_timer;
910: OZF_TP_UTIL_PVT.start_timer;
911: end if;
912: LOAD_ENT_QUARTER(l_from_date, l_to_date);
913: if g_debug_flag = 'Y' then
914: OZF_TP_UTIL_PVT.stop_timer;
915: OZF_TP_UTIL_PVT.print_timer('Process Time');
916: OZF_TP_UTIL_PVT.put_line(' ');
917: end if;
918:
911: end if;
912: LOAD_ENT_QUARTER(l_from_date, l_to_date);
913: if g_debug_flag = 'Y' then
914: OZF_TP_UTIL_PVT.stop_timer;
915: OZF_TP_UTIL_PVT.print_timer('Process Time');
916: OZF_TP_UTIL_PVT.put_line(' ');
917: end if;
918:
919: g_phase := 'Load Enterprise Year Level';
912: LOAD_ENT_QUARTER(l_from_date, l_to_date);
913: if g_debug_flag = 'Y' then
914: OZF_TP_UTIL_PVT.stop_timer;
915: OZF_TP_UTIL_PVT.print_timer('Process Time');
916: OZF_TP_UTIL_PVT.put_line(' ');
917: end if;
918:
919: g_phase := 'Load Enterprise Year Level';
920: if g_debug_flag = 'Y' then
917: end if;
918:
919: g_phase := 'Load Enterprise Year Level';
920: if g_debug_flag = 'Y' then
921: OZF_TP_UTIL_PVT.start_timer;
922: end if;
923: LOAD_ENT_YEAR(l_from_date, l_to_date);
924: if g_debug_flag = 'Y' then
925: OZF_TP_UTIL_PVT.stop_timer;
921: OZF_TP_UTIL_PVT.start_timer;
922: end if;
923: LOAD_ENT_YEAR(l_from_date, l_to_date);
924: if g_debug_flag = 'Y' then
925: OZF_TP_UTIL_PVT.stop_timer;
926: OZF_TP_UTIL_PVT.print_timer('Process Time');
927: OZF_TP_UTIL_PVT.put_line(' ');
928: end if;
929:
922: end if;
923: LOAD_ENT_YEAR(l_from_date, l_to_date);
924: if g_debug_flag = 'Y' then
925: OZF_TP_UTIL_PVT.stop_timer;
926: OZF_TP_UTIL_PVT.print_timer('Process Time');
927: OZF_TP_UTIL_PVT.put_line(' ');
928: end if;
929:
930: g_phase := 'Load Reporting Structure Table';
923: LOAD_ENT_YEAR(l_from_date, l_to_date);
924: if g_debug_flag = 'Y' then
925: OZF_TP_UTIL_PVT.stop_timer;
926: OZF_TP_UTIL_PVT.print_timer('Process Time');
927: OZF_TP_UTIL_PVT.put_line(' ');
928: end if;
929:
930: g_phase := 'Load Reporting Structure Table';
931: if g_debug_flag = 'Y' then
928: end if;
929:
930: g_phase := 'Load Reporting Structure Table';
931: if g_debug_flag = 'Y' then
932: OZF_TP_UTIL_PVT.start_timer;
933: end if;
934: LOAD_TIME_RPT_STRUCT(l_from_date, l_to_date);
935: if g_debug_flag = 'Y' then
936: OZF_TP_UTIL_PVT.stop_timer;
932: OZF_TP_UTIL_PVT.start_timer;
933: end if;
934: LOAD_TIME_RPT_STRUCT(l_from_date, l_to_date);
935: if g_debug_flag = 'Y' then
936: OZF_TP_UTIL_PVT.stop_timer;
937: OZF_TP_UTIL_PVT.print_timer('Process Time');
938: OZF_TP_UTIL_PVT.put_line(' ');
939: end if;
940:
933: end if;
934: LOAD_TIME_RPT_STRUCT(l_from_date, l_to_date);
935: if g_debug_flag = 'Y' then
936: OZF_TP_UTIL_PVT.stop_timer;
937: OZF_TP_UTIL_PVT.print_timer('Process Time');
938: OZF_TP_UTIL_PVT.put_line(' ');
939: end if;
940:
941:
934: LOAD_TIME_RPT_STRUCT(l_from_date, l_to_date);
935: if g_debug_flag = 'Y' then
936: OZF_TP_UTIL_PVT.stop_timer;
937: OZF_TP_UTIL_PVT.print_timer('Process Time');
938: OZF_TP_UTIL_PVT.put_line(' ');
939: end if;
940:
941:
942: else
945: truncate_table('OZF_TIME_ENT_QTR');
946: truncate_table('OZF_TIME_ENT_YEAR');
947: truncate_table('OZF_TIME_RPT_STRUCT');
948: if g_debug_flag = 'Y' then
949: OZF_TP_UTIL_PVT.put_line(' ');
950: end if;
951: end if;
952:
953:
954: EXCEPTION
955:
956: WHEN G_OZF_PARAMETER_NOT_SETUP THEN
957: if g_debug_flag = 'Y' then
958: OZF_TP_UTIL_PVT.put_line(fnd_message.get_string('OZF', 'OZF_TP_INVALID_PARAM_TXT'));
959: end if;
960: x_retcode := -1;
961: WHEN G_LOGIN_INFO_NOT_FOUND THEN
962: if g_debug_flag = 'Y' then
959: end if;
960: x_retcode := -1;
961: WHEN G_LOGIN_INFO_NOT_FOUND THEN
962: if g_debug_flag = 'Y' then
963: OZF_TP_UTIL_PVT.put_line('Can not get User ID and Login ID, program exit');
964: end if;
965: x_retcode := -1;
966: WHEN G_ENT_CALENDAR_NOT_FOUND THEN
967: rollback;
965: x_retcode := -1;
966: WHEN G_ENT_CALENDAR_NOT_FOUND THEN
967: rollback;
968: if g_debug_flag = 'Y' then
969: OZF_TP_UTIL_PVT.put_line(fnd_message.get_string('OZF', 'OZF_TP_ENT_CALENDAR_NOT_FOUND'));
970: end if;
971: x_retcode := -1;
972: WHEN OTHERS THEN
973: rollback;
973: rollback;
974: x_retcode := sqlcode;
975: x_errbuf := sqlerrm;
976: if g_debug_flag = 'Y' then
977: OZF_TP_UTIL_PVT.put_line(x_retcode||' : '||x_errbuf);
978: OZF_TP_UTIL_PVT.put_line('
979: -------------------------------------------
980: Error occured in Procedure: LOAD
981: Phase: ' || g_phase);
974: x_retcode := sqlcode;
975: x_errbuf := sqlerrm;
976: if g_debug_flag = 'Y' then
977: OZF_TP_UTIL_PVT.put_line(x_retcode||' : '||x_errbuf);
978: OZF_TP_UTIL_PVT.put_line('
979: -------------------------------------------
980: Error occured in Procedure: LOAD
981: Phase: ' || g_phase);
982: end if;
1342:
1343: END LOOP; -- c1_rec
1344:
1345: if g_debug_flag = 'Y' then
1346: OZF_TP_UTIL_PVT.put_line(to_char(l_row)||' records has been populated to the Reporting Structure table');
1347: end if;
1348:
1349: end LOAD_TIME_RPT_STRUCT;
1350: