DBA Data[Home] [Help]

PACKAGE BODY: APPS.ISC_FS_TASK_BAC_AGE_ETL_PKG

Source


1 package body isc_fs_task_bac_age_etl_pkg
2 /* $Header: iscfsbacageetlb.pls 120.2 2005/10/26 20:47:12 kreardon noship $ */
3 as
4 
5   g_pkg_name constant varchar2(30) := 'isc_fs_task_bac_age_etl_pkg';
6   g_user_id  number;
7   g_login_id number;
8   g_program_id number;
9   g_program_login_id number;
10   g_program_application_id number;
11   g_request_id number;
12   g_success constant varchar2(10) := '0';
13   g_error   constant varchar2(10) := '-1';
14   g_warning constant varchar2(10) := '1';
15   g_bis_setup_exception exception;
16   g_global_start_date date;
17   g_object_name constant varchar2(30) := 'ISC_FS_TASK_BAC_DATES_F';
18   g_max_date constant date := to_date('4712/01/01','yyyy/mm/dd');
19 
20 procedure bis_collection_utilities_log
21 ( m varchar2, indent number default null )
22 as
23 begin
24   --if indent is not null then
25   --  for i in 1..indent loop
26   --    dbms_output.put('__');
27   --  end loop;
28   --end if;
29   --dbms_output.put_line(substr(m,1,254));
30 
31   bis_collection_utilities.log( substr(m,1,2000-(nvl(indent,0)*3)), nvl(indent,0) );
32 
33 end bis_collection_utilities_log;
34 
35 procedure local_init
36 as
37 begin
38   g_user_id  := fnd_global.user_id;
39   g_login_id := fnd_global.login_id;
40   g_global_start_date := bis_common_parameters.get_global_start_date;
41   g_program_id := fnd_global.conc_program_id;
42   g_program_login_id := fnd_global.conc_login_id;
43   g_program_application_id := fnd_global.prog_appl_id;
44   g_request_id := fnd_global.conc_request_id;
45 end local_init;
46 
47 procedure logger
48 ( p_proc_name varchar2
49 , p_stmt_id number
50 , p_message varchar2
51 )
52 as
53 begin
54   bis_collection_utilities_log( g_pkg_name || '.' || p_proc_name ||
55                                 ' #' || p_stmt_id || ' ' ||
56                                 p_message
57                               , 3 );
58 end logger;
59 
60 function get_schema_name
61 ( x_schema_name   out nocopy varchar2
62 , x_error_message out nocopy varchar2 )
63 return number as
64 
65   l_isc_schema   varchar2(30);
66   l_status       varchar2(30);
67   l_industry     varchar2(30);
68 
69 begin
70 
71   if fnd_installation.get_app_info('ISC', l_status, l_industry, l_isc_schema) then
72     x_schema_name := l_isc_schema;
73   else
74     x_error_message := 'FND_INSTALLATION.GET_APP_INFO returned false';
75     return -1;
76   end if;
77 
78   return 0;
79 
80 exception
81   when others then
82     x_error_message := 'Error in function get_schema_name : ' || sqlerrm;
83     return -1;
84 
85 end get_schema_name;
86 
87 function truncate_table
88 ( p_isc_schema    in varchar2
89 , p_table_name    in varchar2
90 , x_error_message out nocopy varchar2 )
91 return number as
92 
93 begin
94 
95   execute immediate 'truncate table ' || p_isc_schema || '.' || p_table_name;
96 
97   return 0;
98 
99 exception
100   when others then
101     x_error_message  := 'Error in function truncate_table : ' || sqlerrm;
102     return -1;
103 
104 end truncate_table;
105 
106 function gather_statistics
107 ( p_isc_schema    in varchar2
108 , p_table_name    in varchar2
109 , x_error_message out nocopy varchar2 )
110 return number as
111 
112 begin
113 
114   fnd_stats.gather_table_stats( ownname => p_isc_schema
115                               , tabname => p_table_name
116                               );
117 
118   return 0;
119 
120 exception
121   when others then
122     x_error_message  := 'Error in function gather_statistics : ' || sqlerrm;
123     return -1;
124 
125 end gather_statistics;
126 
127 function get_last_refresh_date
128 ( p_object_name in varchar2
129 , x_refresh_date out nocopy date
130 , x_error_message out nocopy varchar2 )
131 return number as
132 
133   l_refresh_date date;
134 
135 begin
136 
137   l_refresh_date := fnd_date.displaydt_to_date(bis_collection_utilities.get_last_refresh_period(p_object_name));
138   x_refresh_date := l_refresh_date;
139   return 0;
140 
141 exception
142   when others then
143     x_error_message := 'Error in function get_last_refresh_date : ' || sqlerrm;
144     return -1;
145 
146 end get_last_refresh_date;
147 
148 function load
149 ( p_mode in varchar2
150 , p_collect_to_date in date
151 , p_isc_schema in varchar2
152 , x_rowcount out nocopy number
153 , x_error_message out nocopy varchar2
154 )
155 return number
156 as
157 
158   l_proc_name constant varchar2(30) := 'load';
159   l_stmt_id number;
160 
161   l_collect_to_date date;
162   l_collect_to_date_trunc date;
163   l_max_aging_date date;
164 
165 begin
166 
167   l_collect_to_date := p_collect_to_date;
168   l_collect_to_date_trunc := trunc(p_collect_to_date);
169 
170   bis_collection_utilities_log( 'Begin current backlog age dates load', 1 );
171 
172   -- check last as at date if doing incremental_load
173   l_stmt_id := 10;
174   if p_mode = 'incremental_load' then
175     select max(aging_date)
176     into l_max_aging_date
177     from isc_fs_task_bac_dates_c;
178   else
179     l_max_aging_date := l_collect_to_date_trunc-1;
180   end if;
181 
182   l_stmt_id := 20;
183   if trunc(l_max_aging_date) = l_collect_to_date_trunc then
184     update isc_fs_task_bac_dates_c
185     set aging_date = l_collect_to_date
186     , last_update_date = sysdate
187     , last_updated_by = g_user_id
188     , last_update_login = g_login_id
189     , program_id = g_program_id
190     , program_login_id = g_program_login_id
191     , program_application_id = g_program_application_id
192     , request_id = g_request_id
193     where aging_date = l_max_aging_date;
194 
195     bis_collection_utilities_log( 'Previous current as at date row updated in task current backlog age dates table', 2 );
196 
197     bis_collection_utilities_log( 'End current backlog age dates load', 1 );
198 
199     return 0;
200 
201   end if;
202 
203   -- truncate the isc_fs_task_bac_dates_c fact table
204   l_stmt_id := 30;
205   if truncate_table
206      ( p_isc_schema
207      , 'ISC_FS_TASK_BAC_DATES_C'
208      , x_error_message ) <> 0 then
209     logger( l_proc_name, l_stmt_id, x_error_message );
210     return -1;
211   end if;
212 
213   bis_collection_utilities_log( 'Task current backlog age dates table truncated', 2 );
214 
215   -- insert into task current backlog age dates tables
216   l_stmt_id := 40;
217 
218   insert
219   into isc_fs_task_bac_dates_c
220   ( aging_date
221   , record_type_id
222   , xtd_end_date_flag
223   , week_start_date
224   , ent_period_start_date
225   , ent_qtr_start_date
226   , ent_year_start_date
227   , day_start_date
228   , creation_date
229   , created_by
230   , last_update_date
231   , last_updated_by
232   , last_update_login
233   , program_id
234   , program_login_id
235   , program_application_id
236   , request_id
237   )
238   select
239     aging_date
240   , sum( power(2,id) ) record_type_id
241   , max(xtd_end_date_flag)
242   , max(week_start_date)
243   , max(ent_period_start_date)
244   , max(ent_qtr_start_date)
245   , max(ent_yr_start_date)
246   , max(day_start_date)
247   , sysdate
248   , g_user_id
249   , sysdate
250   , g_user_id
251   , g_login_id
252   , g_program_id
253   , g_program_login_id
254   , g_program_application_id
255   , g_request_id
256   from
257     ( select -- WTD
258         id
259       , aging_date
260       , decode(trunc(aging_date),end_date,'Y','N') xtd_end_date_flag
261       , start_date week_start_date
262       , to_date(null) ent_period_start_date
263       , to_date(null) ent_qtr_start_date
264       , to_date(null) ent_yr_start_date
265       , to_date(null) day_start_date
266       from
267        ( select m.id
268          , least(fii.end_date+86399/86400, m.the_date) aging_date
269          , fii.start_date
270          , fii.end_date
271          , rank() over (partition by m.id  order by fii.start_date desc ) rnk
272          from fii_time_week fii
273          , (select
274               id
275             , case
276                 when id = 9 then FII_TIME_API.sd_lyswk(l_collect_to_date_trunc)+86399/86400
277                 when id = 5 then FII_TIME_API.sd_pwk(l_collect_to_date_trunc)+86399/86400
278                 else l_collect_to_date
279               end the_date
280             from oki_dbi_multiplexer_b
281             where id in (1,5,9)
282            ) m
283          where fii.start_date < m.the_date
284       )
285       where rnk <= 13
286       --
287       union all
288       --
289       select -- MTD
290         id
291       , aging_date
292       , decode(trunc(aging_date),end_date,'Y','N')
293       , null
294       , start_date
295       , null
296       , null
297       , null
298       from
299        ( select m.id
300          , least(fii.end_date+86399/86400, m.the_date) aging_date
301          , fii.start_date
302          , fii.end_date
303          , rank() over (partition by m.id  order by fii.start_date desc ) rnk
304          from fii_time_ent_period fii
305          , (select
306               id
307             , case
308                 when id = 10 then FII_TIME_API.ent_sd_lysper_end(l_collect_to_date_trunc)+86399/86400
309                 when id = 6 then FII_TIME_API.ent_sd_pper_end(l_collect_to_date_trunc)+86399/86400
310                 else l_collect_to_date
311               end the_date
312             from oki_dbi_multiplexer_b
313             where id in (2,6,10)
314            ) m
315          where fii.start_date < m.the_date
316       )
317       where rnk <= 12
318       --
319       union all
320       --
321       select -- QTD
322         id
323       , aging_date
324       , decode(trunc(aging_date),end_date,'Y','N')
325       , null
326       , null
327       , start_date
328       , null
329       , null
330       from
331        ( select m.id
332          , least(fii.end_date+86399/86400, m.the_date) aging_date
333          , fii.start_date
334          , fii.end_date
335          , rank() over (partition by m.id  order by fii.start_date desc ) rnk
336          from fii_time_ent_qtr fii
337          , (select
338               id
339             , case
340                 when id = 11 then FII_TIME_API.ent_sd_lysqtr_end(l_collect_to_date_trunc)+86399/86400
341                 when id = 7 then FII_TIME_API.ent_sd_pqtr_end (l_collect_to_date_trunc)+86399/86400
342                 else l_collect_to_date
343               end the_date
344             from oki_dbi_multiplexer_b
345             where id in (3,7,11)
346            ) m
347          where fii.start_date < m.the_date
348       )
349       where (id in (3,7) and rnk <=8) or (id = 11 and rnk <= 4)
350       --
351       union all
352       --
353       select -- YTD
354         id
355       , aging_date
356       , decode(trunc(aging_date),end_date,'Y','N')
357       , null
358       , null
359       , null
360       , start_date
361       , null
362       from
363        ( select m.id
364          , least(fii.end_date+86399/86400, m.the_date) aging_date
365          , fii.start_date
366          , fii.end_date
367          , rank() over (partition by m.id  order by fii.start_date desc ) rnk
368          from fii_time_ent_year fii
369          , (select
370               id
371             , case
372                 when id = 12 then FII_TIME_API.ent_sd_lyr_end(l_collect_to_date_trunc)+86399/86400
373                 when id = 8 then FII_TIME_API.ent_sd_lyr_end(l_collect_to_date_trunc)+86399/86400
374                 else l_collect_to_date
375               end the_date
376             from oki_dbi_multiplexer_b
377             where id in (4,8,12)
378            ) m
379          where fii.start_date < m.the_date
380         )
381       where rnk <= 4
382       union all
383       select -- DAY
384         id
385       , aging_date
386       , 'N'
387       , null
388       , null
389       , null
390       , null
391       , start_date
392       from
393        ( select m.id
394          , least(fii.report_date+86399/86400, m.the_date) aging_date
395          , fii.report_date start_date
396          , rank() over (partition by m.id  order by fii.report_date desc ) rnk
397          from fii_time_day fii
398          , (select
399               id
400             , case
401                 when id = 15 then  FII_TIME_API.ent_sd_lyr_end(l_collect_to_date_trunc)+86399/86400
402                 when id = 14 then (l_collect_to_date_trunc - 1)+86399/86400
403                 else l_collect_to_date
404               end the_date
405             from oki_dbi_multiplexer_b
406             where id in (13,14,15)
407            ) m
408          where fii.report_date < m.the_date
409       )
410       where rnk <= 7
411     )
412   group by aging_date;
413 
414   x_rowcount := sql%rowcount;
415 
416   bis_collection_utilities_log( x_rowcount || ' rows inserted into task current backlog age dates table', 2 );
417 
418   commit;
419 
420   -- gather stats for staging table
421   l_stmt_id := 50;
422   if gather_statistics
423      ( p_isc_schema
424      , 'ISC_FS_TASK_BAC_DATES_C'
425      , x_error_message ) <> 0 then
426     logger( l_proc_name, l_stmt_id, x_error_message );
427     return -1;
428   end if;
429 
430   bis_collection_utilities_log( 'Gathered stats for current backlog age dates table', 2 );
431 
432   bis_collection_utilities_log( 'End current backlog age dates load', 1 );
433 
434   return 0;
435 
436 exception
437   when others then
438     x_error_message := 'Error in function load : ' || sqlerrm;
439     return -1;
440 
441 end load;
442 
443 -- -------------------------------------------------------------------
444 -- PUBLIC PROCEDURES
445 -- -------------------------------------------------------------------
446 procedure initial_load
447 ( errbuf out nocopy varchar2
448 , retcode out nocopy number
449 )
450 as
451 
452   l_proc_name constant varchar2(30) := 'initial_load';
453   l_stmt_id number;
454   l_exception exception;
455   l_error_message varchar2(4000);
456   l_isc_schema varchar2(100);
457 
458   l_rowcount number;
459   l_temp_rowcount number;
460 
461   l_collect_from_date date;
462   l_collect_to_date date;
463 
464 begin
465 
466   local_init;
467 
468   bis_collection_utilities_log( 'Begin Initial Load' );
469 
470   l_stmt_id := 0;
471   if not bis_collection_utilities.setup( g_object_name ) then
472     l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
473     logger( l_proc_name, l_stmt_id, l_error_message );
474     raise g_bis_setup_exception;
475   end if;
476 
477   -- determine the date we last collected backlog to
478   l_stmt_id := 10;
479   if get_last_refresh_date( isc_fs_task_etl_pkg.g_object_name
480                           , l_collect_to_date
481                           , l_error_message ) <> 0 then
482     logger( l_proc_name, l_stmt_id, l_error_message );
483     raise l_exception;
484   end if;
485 
486   if l_collect_to_date = g_global_start_date then
487     l_error_message := 'Load can only be run after a completed initial or incremental load of Task Activity and Backlog';
488     logger( l_proc_name, l_stmt_id, l_error_message );
489     raise l_exception;
490   end if;
491 
492   l_collect_from_date := l_collect_to_date;
493 
494   bis_collection_utilities_log( 'As At ' || fnd_date.date_to_displaydt(l_collect_to_date), 1 );
495 
496   -- get the isc schema name
497   l_stmt_id := 20;
498   if get_schema_name
499      ( l_isc_schema
500      , l_error_message ) <> 0 then
501     logger( l_proc_name, l_stmt_id, l_error_message );
502     raise l_exception;
503   end if;
504 
505   -- load current backlog age dates
506   l_stmt_id := 30;
507   if load
508      ( l_proc_name
509      , l_collect_to_date
510      , l_isc_schema
511      , l_rowcount
512      , l_error_message ) <> 0 then
513     logger( l_proc_name, l_stmt_id, l_error_message );
514     raise l_exception;
515   end if;
516 
517   -- truncate the isc_fs_task_bac_dates_f fact table
518   l_stmt_id := 40;
519   if truncate_table
520      ( l_isc_schema
521      , 'ISC_FS_TASK_BAC_DATES_F'
522      , l_error_message ) <> 0 then
523     logger( l_proc_name, l_stmt_id, l_error_message );
524     raise l_exception;
525   end if;
526 
527   bis_collection_utilities_log( 'Task backlog age dates base summary table truncated', 1 );
528 
529   -- insert into isc_fs_task_bac_dates_f fact table
530   l_stmt_id := 50;
531   insert /*+ append f */
532   into isc_fs_task_bac_dates_f f
533   ( report_date
534   , aging_date
535   , xtd_end_date_flag
536   , creation_date
537   , created_by
538   , last_update_date
539   , last_updated_by
540   , last_update_login
541   , program_id
542   , program_login_id
543   , program_application_id
544   , request_id
545   )
546   select
547     trunc(aging_date)
548   , aging_date
549   , xtd_end_date_flag
550   , sysdate
551   , g_user_id
552   , sysdate
553   , g_user_id
554   , g_login_id
555   , g_program_id
556   , g_program_login_id
557   , g_program_application_id
558   , g_request_id
559   from
560     isc_fs_task_bac_dates_c;
561 
562   l_temp_rowcount := sql%rowcount;
563 
564   bis_collection_utilities_log( l_temp_rowcount || ' rows inserted into task backlog age dates base summary table', 1 );
565 
566   l_rowcount := nvl(l_rowcount,0) + l_temp_rowcount;
567 
568   commit;
569 
570   l_stmt_id := 60;
571   bis_collection_utilities.wrapup( p_status => true
572                                  , p_period_from => l_collect_from_date
573                                  , p_period_to => l_collect_to_date
574                                  , p_count => l_rowcount
575                                  );
576 
577   bis_collection_utilities_log('End Initial Load');
578 
579   errbuf := null;
580   retcode := g_success;
581 
582 exception
583   when g_bis_setup_exception then
584     rollback;
585     errbuf := l_error_message;
586     retcode := g_error;
587     bis_collection_utilities_log('End Initial Load with Error');
588 
589   when l_exception then
590     rollback;
591     if l_error_message is null then
592       l_error_message := substr(sqlerrm,1,4000);
593     end if;
594     bis_collection_utilities.wrapup( p_status => false
595                                    , p_message => l_error_message
596                                    , p_period_from => l_collect_from_date
597                                    , p_period_to => l_collect_to_date
598                                    );
599     errbuf := l_error_message;
600     retcode := g_error;
601     bis_collection_utilities_log('End Initial Load with Error');
602 
603   when others then
604     rollback;
605     if l_error_message is null then
606       l_error_message := substr(sqlerrm,1,4000);
607     end if;
608     logger( l_proc_name, l_stmt_id, l_error_message );
609     bis_collection_utilities.wrapup( p_status => false
610                                    , p_message => l_error_message
611                                    , p_period_from => l_collect_from_date
612                                    , p_period_to => l_collect_to_date
613                                    );
614     errbuf := l_error_message;
615     retcode := g_error;
616     bis_collection_utilities_log('End Initial Load with Error');
617 
618 end initial_load;
619 
620 procedure incremental_load
621 ( errbuf out nocopy varchar2
622 , retcode out nocopy number
623 )
624 as
625 
626   l_proc_name constant varchar2(30) := 'incremental_load';
627   l_stmt_id number;
628   l_exception exception;
629   l_error_message varchar2(4000);
630   l_isc_schema varchar2(100);
631 
632   l_rowcount number;
633   l_temp_rowcount number;
634 
635   l_collect_from_date date;
636   l_collect_to_date date;
637 
638 begin
639 
640   local_init;
641 
642   bis_collection_utilities_log( 'Begin Incremental Load' );
643 
644   l_stmt_id := 0;
645   if not bis_collection_utilities.setup( g_object_name ) then
646     l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
647     logger( l_proc_name, l_stmt_id, l_error_message );
648     raise g_bis_setup_exception;
649   end if;
650 
651   -- determine the date we last collected to
652   l_stmt_id := 10;
653   if get_last_refresh_date( isc_fs_task_etl_pkg.g_object_name
654                           , l_collect_to_date
655                           , l_error_message ) <> 0 then
656     logger( l_proc_name, l_stmt_id, l_error_message );
657     raise l_exception;
658   end if;
659 
660   if l_collect_to_date = g_global_start_date then
661     l_error_message := 'Load can only be run after a completed initial or incremental load of Task Activity and Backlog';
662     logger( l_proc_name, l_stmt_id, l_error_message );
663     raise l_exception;
664   end if;
665 
666   l_collect_from_date := l_collect_to_date;
667 
668   bis_collection_utilities_log( 'As At ' || fnd_date.date_to_displaydt(l_collect_to_date), 1 );
669 
670   -- get the isc schema name
671   l_stmt_id := 20;
672   if get_schema_name
673      ( l_isc_schema
674      , l_error_message ) <> 0 then
675     logger( l_proc_name, l_stmt_id, l_error_message );
676     raise l_exception;
677   end if;
678 
679   -- load current backlog age dates
680   l_stmt_id := 30;
681   if load
682      ( l_proc_name
683      , l_collect_to_date
684      , l_isc_schema
685      , l_rowcount
686      , l_error_message ) <> 0 then
687     logger( l_proc_name, l_stmt_id, l_error_message );
688     raise l_exception;
689   end if;
690 
691   -- delete the "current" row for last aging as was probably a partitial day (<midnight)
692   l_stmt_id := 40;
693   delete from isc_fs_task_bac_dates_f
694   where report_date = (select max(report_date) from isc_fs_task_bac_dates_f)
695   and aging_date <> l_collect_to_date;
696 
697   if sql%rowcount > 0 then
698     bis_collection_utilities_log( 'Previous current as at date row deleted from task backlog age dates base summary table', 1 );
699   end if;
700 
701   -- cleanup isc_fs_task_bac_dates_f, remove old rows that are not for period ends
702   l_stmt_id := 50;
703   delete from isc_fs_task_bac_dates_f
704   where report_date not in (select trunc(aging_date) from isc_fs_task_bac_dates_c);
705 
706   l_temp_rowcount := sql%rowcount;
707 
708   bis_collection_utilities_log( l_temp_rowcount || ' rows deleted from task backlog age dates base summary table', 1 );
709   l_rowcount := l_rowcount + l_temp_rowcount;
710 
711   -- insert into isc_fs_task_bac_dates_f fact table
712   l_stmt_id := 60;
713   insert
714   into isc_fs_task_bac_dates_f
715   ( report_date
716   , aging_date
717   , xtd_end_date_flag
718   , created_by
719   , creation_date
720   , last_updated_by
721   , last_update_date
722   , last_update_login
723   , program_id
724   , program_login_id
725   , program_application_id
726   , request_id
727   )
728   select
729     trunc(aging_date) report_date
730   , aging_date
731   , xtd_end_date_flag
732   , g_user_id
733   , sysdate
734   , g_user_id
735   , sysdate
736   , g_login_id
737   , g_program_id
738   , g_program_login_id
739   , g_program_application_id
740   , g_request_id
741   from
742     isc_fs_task_bac_dates_c c
743   where
744       trunc(aging_date) not in (select report_date from isc_fs_task_bac_dates_f);
745 
746   l_temp_rowcount := sql%rowcount;
747 
748   bis_collection_utilities_log( l_temp_rowcount || ' rows inserted into task backlog age dates base summary table', 1 );
749   l_rowcount := l_rowcount + l_temp_rowcount;
750 
751   commit;
752 
753   l_stmt_id := 50;
754   bis_collection_utilities.wrapup( p_status => true
755                                  , p_period_from => l_collect_from_date
756                                  , p_period_to => l_collect_to_date
757                                  , p_count => l_rowcount
758                                  );
759 
760   bis_collection_utilities_log('End Incremental Load');
761 
762   errbuf := null;
763   retcode := g_success;
764 
765 exception
766   when g_bis_setup_exception then
767     rollback;
768     errbuf := l_error_message;
769     retcode := g_error;
770     bis_collection_utilities_log('End Incremental Load with Error');
771 
772   when l_exception then
773     rollback;
774     if l_error_message is null then
775       l_error_message := substr(sqlerrm,1,4000);
776     end if;
777     bis_collection_utilities.wrapup( p_status => false
778                                    , p_message => l_error_message
779                                    , p_period_from => l_collect_from_date
780                                    , p_period_to => l_collect_to_date
781                                    );
782     errbuf := l_error_message;
783     retcode := g_error;
784     bis_collection_utilities_log('End Incremental Load with Error');
785 
786   when others then
787     rollback;
788     if l_error_message is null then
789       l_error_message := substr(sqlerrm,1,4000);
790     end if;
791     logger( l_proc_name, l_stmt_id, l_error_message );
792     bis_collection_utilities.wrapup( p_status => false
793                                    , p_message => l_error_message
794                                    , p_period_from => l_collect_from_date
795                                    , p_period_to => l_collect_to_date
796                                    );
797     errbuf := l_error_message;
798     retcode := g_error;
799     bis_collection_utilities_log('End Incremental Load with Error');
800 
801 end incremental_load;
802 
803 function get_period_bit_tbl
804 return t_period_bit_tbl
805 is
806 
807   l_period_bit_tbl t_period_bit_tbl;
808 
809 begin
810 
811   l_period_bit_tbl('WTD').curr := G_WTD;
812   l_period_bit_tbl('WTD').prior_period := G_WTD_PP;
813   l_period_bit_tbl('WTD').prior_year := G_WTD_PY;
814 
815   l_period_bit_tbl('MTD').curr := G_MTD;
816   l_period_bit_tbl('MTD').prior_period := G_MTD_PP;
817   l_period_bit_tbl('MTD').prior_year := G_MTD_PY;
818 
819   l_period_bit_tbl('QTD').curr := G_QTD;
820   l_period_bit_tbl('QTD').prior_period := G_QTD_PP;
821   l_period_bit_tbl('QTD').prior_year := G_QTD_PY;
822 
823   l_period_bit_tbl('YTD').curr := G_YTD;
824   l_period_bit_tbl('YTD').prior_period := G_YTD_PP;
825   l_period_bit_tbl('YTD').prior_year := G_YTD_PY;
826 
827   l_period_bit_tbl('DAY').curr := G_DAY;
828   l_period_bit_tbl('DAY').prior_period := G_DAY_PP;
829   l_period_bit_tbl('DAY').prior_year := G_DAY_PY;
830 
831   return l_period_bit_tbl;
832 
833 end get_period_bit_tbl;
834 
835 end isc_fs_task_bac_age_etl_pkg;