138: exception
139:
140: when l_exception then
141: x_message := err_mesg( l_message, l_func_name, l_stmnt_id );
142: bis_collection_utilities.put_line( x_message );
143: return c_error;
144:
145: when others then
146: x_message := err_mesg( sqlerrm, l_func_name, l_stmnt_id );
143: return c_error;
144:
145: when others then
146: x_message := err_mesg( sqlerrm, l_func_name, l_stmnt_id );
147: bis_collection_utilities.put_line( x_message );
148: return c_error;
149:
150: end check_initial_load_setup;
151:
164: l_rowcount number;
165:
166: begin
167:
168: bis_collection_utilities.log( 'Begin load staging table', 1 );
169:
170: l_stmnt_id := 10;
171: if p_load_type = 'init_load' then -- initial load
172:
219: , gsob.currency_code
220: , rof.dbi_date_closed;
221:
222: l_rowcount := sql%rowcount;
223: bis_collection_utilities.log( 'Inserted ' || l_rowcount || ' insert staging table', 2 );
224:
225:
226: else -- incremental load
227:
277: , gsob.currency_code
278: , rof.dbi_date_closed;
279:
280: l_rowcount := sql%rowcount;
281: bis_collection_utilities.log( 'Inserted ' || l_rowcount || ' insert staging table', 2 );
282:
283: end if;
284:
285: l_stmnt_id := 30;
291: , tabname => 'ISC_DR_COSTS_STG'
292: , percent=> 10
293: );
294:
295: bis_collection_utilities.log( 'Gather statistics onstaging table', 2 );
296:
297: bis_collection_utilities.log( 'End load staging table', 1 );
298:
299: return c_ok;
293: );
294:
295: bis_collection_utilities.log( 'Gather statistics onstaging table', 2 );
296:
297: bis_collection_utilities.log( 'End load staging table', 1 );
298:
299: return c_ok;
300:
301: exception
301: exception
302:
303: when others then
304: x_message := err_mesg( sqlerrm, l_func_name, l_stmnt_id );
305: bis_collection_utilities.put_line( x_message );
306: return c_error;
307:
308: end load_costs_staging;
309:
335: get_missing_rates_rec get_missing_rates_c%rowtype;
336:
337: begin
338:
339: bis_collection_utilities.log( 'Begin currency conversion', 1 );
340:
341: l_stmnt_id := 10;
342: insert
343: into isc_dr_costs_conv_tmp
374: order by func_currency_code, date_closed
375: ) costs;
376:
377: l_rowcount := sql%rowcount;
378: bis_collection_utilities.log( 'Inserted ' || l_rowcount || ' rows into currency conversion table', 2 );
379:
380: l_stmnt_id := 20;
381: l_missing_rate_count := 0;
382:
391:
392: l_missing_rate_count := l_missing_rate_count + 1;
393:
394: if l_missing_rate_count = 1 then
395: bis_collection_utilities.writemissingrateheader;
396: end if;
397:
398: l_stmnt_id := 60;
399: if get_missing_rates_rec.g_conv_rate < 0 then
396: end if;
397:
398: l_stmnt_id := 60;
399: if get_missing_rates_rec.g_conv_rate < 0 then
400: bis_collection_utilities.writemissingrate
401: ( g_global_rate_type
402: , get_missing_rates_rec.func_currency_code
403: , g_global_curr_code
404: , get_missing_rates_rec.date_closed
404: , get_missing_rates_rec.date_closed
405: );
406: elsif get_missing_rates_rec.sg_conv_rate < 0 and
407: g_global_sec_curr_code is not null then
408: bis_collection_utilities.writemissingrate
409: ( g_global_sec_rate_type
410: , get_missing_rates_rec.func_currency_code
411: , g_global_sec_curr_code
412: , get_missing_rates_rec.date_closed
424: if l_missing_rate_count <> c_ok then
425: x_message := 'Missing Currency Conversion Rates';
426: end if;
427:
428: bis_collection_utilities.log( 'There are ' || l_missing_rate_count || ' missing currency conversion rates', 2 );
429:
430: bis_collection_utilities.log( 'End currency conversion', 1 );
431:
432: return l_missing_rate_count;
426: end if;
427:
428: bis_collection_utilities.log( 'There are ' || l_missing_rate_count || ' missing currency conversion rates', 2 );
429:
430: bis_collection_utilities.log( 'End currency conversion', 1 );
431:
432: return l_missing_rate_count;
433:
434: exception
434: exception
435:
436: when others then
437: x_message := err_mesg( sqlerrm, l_func_name, l_stmnt_id );
438: bis_collection_utilities.put_line( x_message );
439: return c_error;
440:
441: end load_costs_conv_rates;
442:
461: l_to_date date;
462:
463: begin
464:
465: bis_collection_utilities.log( 'Begin Initial Load' );
466:
467: l_stmnt_id := 0;
468: if not bis_collection_utilities.setup( g_charges_object_name ) then
469: l_message := isc_depot_backlog_etl_pkg.err_mesg
464:
465: bis_collection_utilities.log( 'Begin Initial Load' );
466:
467: l_stmnt_id := 0;
468: if not bis_collection_utilities.setup( g_charges_object_name ) then
469: l_message := isc_depot_backlog_etl_pkg.err_mesg
470: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
471: , l_proc_name
472: , l_stmnt_id
466:
467: l_stmnt_id := 0;
468: if not bis_collection_utilities.setup( g_charges_object_name ) then
469: l_message := isc_depot_backlog_etl_pkg.err_mesg
470: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
471: , l_proc_name
472: , l_stmnt_id
473: );
474: bis_collection_utilities.put_line( l_message );
470: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
471: , l_proc_name
472: , l_stmnt_id
473: );
474: bis_collection_utilities.put_line( l_message );
475: raise l_exception;
476: end if;
477:
478: l_stmnt_id := 10;
481: ) <> c_ok then
482: raise l_exception;
483: end if;
484:
485: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
486: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
487: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
488: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
489: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
482: raise l_exception;
483: end if;
484:
485: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
486: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
487: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
488: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
489: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
490:
483: end if;
484:
485: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
486: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
487: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
488: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
489: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
490:
491: l_stmnt_id := 20;
484:
485: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
486: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
487: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
488: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
489: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
490:
491: l_stmnt_id := 20;
492: delete
485: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
486: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
487: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
488: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
489: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
490:
491: l_stmnt_id := 20;
492: delete
493: from isc_dr_inc
492: delete
493: from isc_dr_inc
494: where fact_name = 'ISC_DR_CHARGES_F';
495:
496: bis_collection_utilities.log( 'Deleted from table ISC_DR_INC', 1 );
497:
498: l_stmnt_id := 30;
499: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_CHARGES_F';
500:
497:
498: l_stmnt_id := 30;
499: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_CHARGES_F';
500:
501: bis_collection_utilities.log( 'Truncated table ISC_DR_CHARGES_F', 1 );
502:
503: l_stmnt_id := 40;
504: if isc_depot_backlog_etl_pkg.get_last_run_date
505: ( p_fact_name => 'ISC_DR_REPAIR_ORDERS_F'
513: l_message := 'Please launch the Intial Load Request Set for the Depot Repair Management page.';
514: raise l_exception;
515: end if;
516:
517: bis_collection_utilities.log( 'Repair Order To Date: ' || fnd_date.date_to_displaydt(l_ro_last_run_date), 1 );
518: l_to_date := sysdate;
519:
520: l_stmnt_id := 50;
521: insert /*+ append parallel(isc_dr_charges_f) */
605: and rof.ro_creation_date >= g_global_start_date
606: group by rof.repair_line_id;
607:
608: l_rowcount := sql%rowcount;
609: bis_collection_utilities.log( 'Inserted ' || l_rowcount || ' rows into ISC_DR_CHARGES_F' , 1 );
610:
611: l_stmnt_id := 60;
612: commit;
613:
638: , g_program_application_id
639: , g_request_id
640: );
641:
642: bis_collection_utilities.log( 'Inserted into table ISC_DR_INC', 1 );
643:
644: l_stmnt_id := 80;
645: commit;
646:
644: l_stmnt_id := 80;
645: commit;
646:
647: l_stmnt_id := 90;
648: bis_collection_utilities.wrapup( p_status => true
649: , p_period_from => g_global_start_date
650: , p_period_to => l_to_date
651: , p_count => l_rowcount
652: );
652: );
653:
654: retcode := c_ok;
655:
656: bis_collection_utilities.log( 'End Initial Load' );
657:
658: exception
659:
660: when l_exception then
658: exception
659:
660: when l_exception then
661: rollback;
662: bis_collection_utilities.wrapup( p_status => false
663: , p_period_from => g_global_start_date
664: , p_period_to => l_to_date
665: , p_message => l_message
666: );
669:
670: when others then
671: rollback;
672: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
673: bis_collection_utilities.put_line( l_message );
674: bis_collection_utilities.wrapup( p_status => false
675: , p_period_from => g_global_start_date
676: , p_period_to => l_to_date
677: , p_message => l_message
670: when others then
671: rollback;
672: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
673: bis_collection_utilities.put_line( l_message );
674: bis_collection_utilities.wrapup( p_status => false
675: , p_period_from => g_global_start_date
676: , p_period_to => l_to_date
677: , p_message => l_message
678: );
703: l_to_date date;
704:
705: begin
706:
707: bis_collection_utilities.log( 'Begin Initial Load' );
708:
709: l_stmnt_id := 0;
710: if not bis_collection_utilities.setup( g_costs_object_name ) then
711: l_message := isc_depot_backlog_etl_pkg.err_mesg
706:
707: bis_collection_utilities.log( 'Begin Initial Load' );
708:
709: l_stmnt_id := 0;
710: if not bis_collection_utilities.setup( g_costs_object_name ) then
711: l_message := isc_depot_backlog_etl_pkg.err_mesg
712: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
713: , l_proc_name
714: , l_stmnt_id
708:
709: l_stmnt_id := 0;
710: if not bis_collection_utilities.setup( g_costs_object_name ) then
711: l_message := isc_depot_backlog_etl_pkg.err_mesg
712: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
713: , l_proc_name
714: , l_stmnt_id
715: );
716: bis_collection_utilities.put_line( l_message );
712: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
713: , l_proc_name
714: , l_stmnt_id
715: );
716: bis_collection_utilities.put_line( l_message );
717: raise l_exception;
718: end if;
719:
720: l_stmnt_id := 10;
723: ) <> c_ok then
724: raise l_exception;
725: end if;
726:
727: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
728: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
729: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
730: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
731: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
724: raise l_exception;
725: end if;
726:
727: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
728: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
729: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
730: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
731: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
732:
725: end if;
726:
727: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
728: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
729: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
730: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
731: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
732:
733: l_stmnt_id := 20;
726:
727: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
728: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
729: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
730: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
731: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
732:
733: l_stmnt_id := 20;
734: delete
727: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
728: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
729: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
730: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
731: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
732:
733: l_stmnt_id := 20;
734: delete
735: from isc_dr_inc
734: delete
735: from isc_dr_inc
736: where fact_name = 'ISC_DR_COSTS_F';
737:
738: bis_collection_utilities.log( 'Deleted from table ISC_DR_INC', 1 );
739:
740: l_stmnt_id := 30;
741: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_STG';
742:
739:
740: l_stmnt_id := 30;
741: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_STG';
742:
743: bis_collection_utilities.log( 'Truncated table ISC_DR_COSTS_STG', 1 );
744:
745: l_stmnt_id := 40;
746: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_CONV_TMP';
747:
744:
745: l_stmnt_id := 40;
746: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_CONV_TMP';
747:
748: bis_collection_utilities.log( 'Truncated table ISC_DR_COSTS_CONV_TMP', 1 );
749:
750: l_stmnt_id := 50;
751: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_F';
752:
749:
750: l_stmnt_id := 50;
751: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_F';
752:
753: bis_collection_utilities.log( 'Truncated table ISC_DR_COSTS_F', 1 );
754:
755: l_stmnt_id := 60;
756: if isc_depot_backlog_etl_pkg.get_last_run_date
757: ( p_fact_name => 'ISC_DR_REPAIR_ORDERS_F'
765: l_message := 'Please launch the Intial Load Request Set for the Depot Repair Management page.';
766: raise l_exception;
767: end if;
768:
769: bis_collection_utilities.log( 'Repair Order To Date: ' || fnd_date.date_to_displaydt(l_ro_last_run_date), 1 );
770: l_to_date := sysdate;
771:
772: l_stmnt_id := 70;
773: if load_costs_staging
833: and stg.date_closed = rates.date_closed
834: group by stg.repair_line_id;
835:
836: l_rowcount := sql%rowcount;
837: bis_collection_utilities.log( 'Inserted ' || l_rowcount || ' rows into ISC_DR_COSTS_F' , 1 );
838:
839: l_stmnt_id := 110;
840: commit;
841:
867: , g_program_application_id
868: , g_request_id
869: );
870:
871: bis_collection_utilities.log( 'Inserted into table ISC_DR_INC', 1 );
872:
873: l_stmnt_id := 130;
874: commit;
875:
873: l_stmnt_id := 130;
874: commit;
875:
876: l_stmnt_id := 140;
877: bis_collection_utilities.wrapup( p_status => true
878: , p_period_from => g_global_start_date
879: , p_period_to => l_to_date
880: , p_count => l_rowcount
881: );
881: );
882:
883: retcode := c_ok;
884:
885: bis_collection_utilities.log( 'End Inital Load' );
886:
887: exception
888:
889: when l_exception then
887: exception
888:
889: when l_exception then
890: rollback;
891: bis_collection_utilities.wrapup( p_status => false
892: , p_period_from => g_global_start_date
893: , p_period_to => l_to_date
894: , p_message => l_message
895: );
898:
899: when others then
900: rollback;
901: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
902: bis_collection_utilities.put_line( l_message );
903: bis_collection_utilities.wrapup( p_status => false
904: , p_period_from => g_global_start_date
905: , p_period_to => l_to_date
906: , p_message => l_message
899: when others then
900: rollback;
901: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
902: bis_collection_utilities.put_line( l_message );
903: bis_collection_utilities.wrapup( p_status => false
904: , p_period_from => g_global_start_date
905: , p_period_to => l_to_date
906: , p_message => l_message
907: );
930: l_to_date date;
931:
932: begin
933:
934: bis_collection_utilities.log( 'Begin Incremental Load' );
935:
936: l_stmnt_id := 0;
937: if not bis_collection_utilities.setup( g_charges_object_name ) then
938: l_message := isc_depot_backlog_etl_pkg.err_mesg
933:
934: bis_collection_utilities.log( 'Begin Incremental Load' );
935:
936: l_stmnt_id := 0;
937: if not bis_collection_utilities.setup( g_charges_object_name ) then
938: l_message := isc_depot_backlog_etl_pkg.err_mesg
939: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
940: , l_proc_name
941: , l_stmnt_id
935:
936: l_stmnt_id := 0;
937: if not bis_collection_utilities.setup( g_charges_object_name ) then
938: l_message := isc_depot_backlog_etl_pkg.err_mesg
939: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
940: , l_proc_name
941: , l_stmnt_id
942: );
943: bis_collection_utilities.put_line( l_message );
939: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
940: , l_proc_name
941: , l_stmnt_id
942: );
943: bis_collection_utilities.put_line( l_message );
944: raise l_exception;
945: end if;
946:
947: l_stmnt_id := 10;
950: ) <> c_ok then
951: raise l_exception;
952: end if;
953:
954: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
955: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
956: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
957: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
958: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
951: raise l_exception;
952: end if;
953:
954: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
955: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
956: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
957: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
958: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
959:
952: end if;
953:
954: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
955: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
956: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
957: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
958: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
959:
960: l_stmnt_id := 20;
953:
954: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
955: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
956: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
957: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
958: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
959:
960: l_stmnt_id := 20;
961: if isc_depot_backlog_etl_pkg.get_last_run_date
954: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
955: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
956: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
957: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
958: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
959:
960: l_stmnt_id := 20;
961: if isc_depot_backlog_etl_pkg.get_last_run_date
962: ( p_fact_name => 'ISC_DR_REPAIR_ORDERS_F'
970: l_message := 'Please run the Intial Load Request Set for the Depot Repair Management page.';
971: raise l_exception;
972: end if;
973:
974: bis_collection_utilities.log( 'Repair Order From Date: ' || fnd_date.date_to_displaydt(l_ro_last_run_date), 1 );
975:
976: l_stmnt_id := 30;
977: if isc_depot_backlog_etl_pkg.get_last_run_date
978: ( p_fact_name => 'ISC_DR_CHARGES_F'
986: l_message := 'Please run the Intial Load Request Set for the Depot Repair Management page.';
987: raise l_exception;
988: end if;
989:
990: bis_collection_utilities.log( 'Charges From Date: ' || fnd_date.date_to_displaydt(l_charges_last_run_date), 1 );
991:
992: l_to_date := sysdate;
993:
994: l_stmnt_id := 40;
1115: , charges.request_id
1116: );
1117:
1118: l_rowcount := sql%rowcount;
1119: bis_collection_utilities.log( 'Merged ' || l_rowcount || ' rows into ISC_DR_CHARGES_F' , 1 );
1120:
1121: l_stmnt_id := 50;
1122: update isc_dr_inc
1123: set
1130: , program_application_id = g_program_application_id
1131: , request_id = g_request_id
1132: where fact_name = 'ISC_DR_CHARGES_F';
1133:
1134: bis_collection_utilities.log( 'Updated into table ISC_DR_INC', 1 );
1135:
1136: l_stmnt_id := 60;
1137: commit;
1138:
1136: l_stmnt_id := 60;
1137: commit;
1138:
1139: l_stmnt_id := 70;
1140: bis_collection_utilities.wrapup( p_status => true
1141: , p_period_from => l_charges_last_run_date
1142: , p_period_to => l_to_date
1143: , p_count => l_rowcount
1144: );
1144: );
1145:
1146: retcode := c_ok;
1147:
1148: bis_collection_utilities.log( 'End Incremental Load' );
1149:
1150: exception
1151:
1152: when l_exception then
1150: exception
1151:
1152: when l_exception then
1153: rollback;
1154: bis_collection_utilities.wrapup( p_status => false
1155: , p_period_from => l_charges_last_run_date
1156: , p_period_to => l_to_date
1157: , p_message => l_message
1158: );
1161:
1162: when others then
1163: rollback;
1164: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
1165: bis_collection_utilities.put_line( l_message );
1166: bis_collection_utilities.wrapup( p_status => false
1167: , p_period_from => l_charges_last_run_date
1168: , p_period_to => l_to_date
1169: , p_message => l_message
1162: when others then
1163: rollback;
1164: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
1165: bis_collection_utilities.put_line( l_message );
1166: bis_collection_utilities.wrapup( p_status => false
1167: , p_period_from => l_charges_last_run_date
1168: , p_period_to => l_to_date
1169: , p_message => l_message
1170: );
1195: l_to_date date;
1196:
1197: begin
1198:
1199: bis_collection_utilities.log( 'Begin Incremental Load' );
1200:
1201: l_stmnt_id := 0;
1202: if not bis_collection_utilities.setup( g_costs_object_name ) then
1203: l_message := isc_depot_backlog_etl_pkg.err_mesg
1198:
1199: bis_collection_utilities.log( 'Begin Incremental Load' );
1200:
1201: l_stmnt_id := 0;
1202: if not bis_collection_utilities.setup( g_costs_object_name ) then
1203: l_message := isc_depot_backlog_etl_pkg.err_mesg
1204: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
1205: , l_proc_name
1206: , l_stmnt_id
1200:
1201: l_stmnt_id := 0;
1202: if not bis_collection_utilities.setup( g_costs_object_name ) then
1203: l_message := isc_depot_backlog_etl_pkg.err_mesg
1204: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
1205: , l_proc_name
1206: , l_stmnt_id
1207: );
1208: bis_collection_utilities.put_line( l_message );
1204: ( 'Error in BIS_COLLECTION_UTILITIES.Setup'
1205: , l_proc_name
1206: , l_stmnt_id
1207: );
1208: bis_collection_utilities.put_line( l_message );
1209: raise l_exception;
1210: end if;
1211:
1212: l_stmnt_id := 10;
1215: ) <> c_ok then
1216: raise l_exception;
1217: end if;
1218:
1219: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
1220: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
1221: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
1222: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
1223: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
1216: raise l_exception;
1217: end if;
1218:
1219: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
1220: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
1221: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
1222: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
1223: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
1224:
1217: end if;
1218:
1219: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
1220: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
1221: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
1222: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
1223: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
1224:
1225: l_stmnt_id := 20;
1218:
1219: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
1220: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
1221: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
1222: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
1223: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
1224:
1225: l_stmnt_id := 20;
1226: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_STG';
1219: bis_collection_utilities.log( 'Global Start Date: ' || fnd_date.date_to_displaydt(g_global_start_date), 1 );
1220: bis_collection_utilities.log( 'Primary Global Currency: ' || g_global_curr_code, 1 );
1221: bis_collection_utilities.log( 'Primary Global Currency Rate Type: ' || g_global_rate_type, 1 );
1222: bis_collection_utilities.log( 'Secondary Global Currency: ' || g_global_sec_curr_code, 1 );
1223: bis_collection_utilities.log( 'Secondary Global Currency Rate Type: ' || g_global_sec_rate_type, 1 );
1224:
1225: l_stmnt_id := 20;
1226: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_STG';
1227:
1224:
1225: l_stmnt_id := 20;
1226: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_STG';
1227:
1228: bis_collection_utilities.log( 'Truncated table ISC_DR_COSTS_STG', 1 );
1229:
1230: l_stmnt_id := 30;
1231: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_CONV_TMP';
1232:
1229:
1230: l_stmnt_id := 30;
1231: execute immediate 'TRUNCATE TABLE ' || g_isc_schema || '.ISC_DR_COSTS_CONV_TMP';
1232:
1233: bis_collection_utilities.log( 'Truncated table ISC_DR_COSTS_CONV_TMP', 1 );
1234:
1235: l_stmnt_id := 40;
1236: if isc_depot_backlog_etl_pkg.get_last_run_date
1237: ( p_fact_name => 'ISC_DR_REPAIR_ORDERS_F'
1245: l_message := 'Please run the Intial Load Request Set for the Depot Repair Management page.';
1246: raise l_exception;
1247: end if;
1248:
1249: bis_collection_utilities.log( 'Repair Order From Date: ' || fnd_date.date_to_displaydt(l_ro_last_run_date), 1 );
1250:
1251: l_stmnt_id := 50;
1252: if isc_depot_backlog_etl_pkg.get_last_run_date
1253: ( p_fact_name => 'ISC_DR_COSTS_F'
1261: l_message := 'Please run the Intial Load Request Set for the Depot Repair Management page.';
1262: raise l_exception;
1263: end if;
1264:
1265: bis_collection_utilities.log( 'Cost From Date: ' || fnd_date.date_to_displaydt(l_costs_last_run_date), 1 );
1266: l_to_date := sysdate;
1267:
1268: l_stmnt_id := 60;
1269: if load_costs_staging
1363: , costs.request_id
1364: );
1365:
1366: l_rowcount := sql%rowcount;
1367: bis_collection_utilities.log( 'Merged ' || l_rowcount || ' rows into ISC_DR_COSTS_F' , 1 );
1368:
1369: l_stmnt_id := 90;
1370: update isc_dr_inc
1371: set last_run_date = l_ro_last_run_date
1377: , program_application_id = g_program_application_id
1378: , request_id = g_request_id
1379: where fact_name = 'ISC_DR_COSTS_F';
1380:
1381: bis_collection_utilities.log( 'Updated into table ISC_DR_INC', 1 );
1382:
1383: l_stmnt_id := 100;
1384: commit;
1385:
1383: l_stmnt_id := 100;
1384: commit;
1385:
1386: l_stmnt_id := 110;
1387: bis_collection_utilities.wrapup( p_status => true
1388: , p_period_from => l_costs_last_run_date
1389: , p_period_to => l_to_date
1390: , p_count => l_rowcount
1391: );
1391: );
1392:
1393: retcode := c_ok;
1394:
1395: bis_collection_utilities.log( 'End Incremental Load' );
1396:
1397: exception
1398:
1399: when l_exception then
1397: exception
1398:
1399: when l_exception then
1400: rollback;
1401: bis_collection_utilities.wrapup( p_status => false
1402: , p_period_from => l_costs_last_run_date
1403: , p_period_to => l_to_date
1404: , p_message => l_message
1405: );
1408:
1409: when others then
1410: rollback;
1411: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
1412: bis_collection_utilities.put_line( l_message );
1413: bis_collection_utilities.wrapup( p_status => false
1414: , p_period_from => l_costs_last_run_date
1415: , p_period_to => l_to_date
1416: , p_message => l_message
1409: when others then
1410: rollback;
1411: l_message := err_mesg( sqlerrm, l_proc_name, l_stmnt_id );
1412: bis_collection_utilities.put_line( l_message );
1413: bis_collection_utilities.wrapup( p_status => false
1414: , p_period_from => l_costs_last_run_date
1415: , p_period_to => l_to_date
1416: , p_message => l_message
1417: );