23: BEGIN
24:
25: -- set up the global
26: if (p_log_level_rec.statement_level) then
27: fa_debug_pkg.add(l_calling_fn, 'p_claling_fn', p_calling_fn, p_log_level_rec => p_log_level_rec);
28: end if;
29: --exit from the function if intercompany posting not allowed fapost enhancement strat
30: if (nvl(fa_cache_pkg.fazcbc_record.intercompany_posting_flag,'Y') = 'N')then
31: if (p_log_level_rec.statement_level) then
28: end if;
29: --exit from the function if intercompany posting not allowed fapost enhancement strat
30: if (nvl(fa_cache_pkg.fazcbc_record.intercompany_posting_flag,'Y') = 'N')then
31: if (p_log_level_rec.statement_level) then
32: fa_debug_pkg.add(l_calling_fn, 'Intercompany posting not allowed exiting', p_calling_fn, p_log_level_rec => p_log_level_rec);
33: end if;
34: return TRUE;
35: end if;
36: --fapost enhancement end
36: --fapost enhancement end
37: if (p_calling_fn = 'fa_group_reclass_pvt.do_grp_reclass' or
38: p_calling_fn = 'fa_group_process_groups_pkg.do_rcl') then
39: if (p_log_level_rec.statement_level) then
40: fa_debug_pkg.add(l_calling_fn, 'group reclass mode', 'TRUE', p_log_level_rec => p_log_level_rec);
41: end if;
42: g_group_reclass := TRUE;
43: else
44: if (p_log_level_rec.statement_level) then
41: end if;
42: g_group_reclass := TRUE;
43: else
44: if (p_log_level_rec.statement_level) then
45: fa_debug_pkg.add(l_calling_fn, 'group reclass mode', 'FALSE', p_log_level_rec => p_log_level_rec);
46: end if;
47: g_group_reclass := FALSE;
48: end if;
49: -- call the sob cache to get the table of sob_ids
193: l_account_flex := fa_cache_pkg.fazcbc_record.ACCOUNTING_FLEX_STRUCTURE;
194: --exit from the function if intercompany posting not allowed fapost enhancement strat
195: if (nvl(fa_cache_pkg.fazcbc_record.intercompany_posting_flag,'Y') <> 'Y')then
196: if (p_log_level_rec.statement_level) then
197: fa_debug_pkg.add(l_calling_fn, 'Intercompany posting not allowed exiting', p_calling_fn, p_log_level_rec => p_log_level_rec);
198: end if;
199: return TRUE;
200: end if;
201: --fapost enhancement end
232: -- raise interco_err;
233: -- end if;
234:
235: if (p_log_level_rec.statement_level) then
236: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Segment Number', l_bal_segnum, p_log_level_rec => p_log_level_rec);
237: end if;
238:
239:
240: l_status := fnd_flex_apis.get_segment_info(
251: raise interco_err;
252: end if;
253:
254: if (p_log_level_rec.statement_level) then
255: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Column Name', l_column_name, p_log_level_rec => p_log_level_rec);
256: fa_debug_pkg.add(l_calling_fn, 'processing', 'source', p_log_level_rec => p_log_level_rec);
257: end if;
258:
259:
252: end if;
253:
254: if (p_log_level_rec.statement_level) then
255: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Column Name', l_column_name, p_log_level_rec => p_log_level_rec);
256: fa_debug_pkg.add(l_calling_fn, 'processing', 'source', p_log_level_rec => p_log_level_rec);
257: end if;
258:
259:
260: -- not needed
339: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 1, l_balancing_seg);
340: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 2, l_sum_amount);
341:
342: if (p_log_level_rec.statement_level) then
343: fa_debug_pkg.add(l_calling_fn, 'balancing_seg for first source tbl: ', l_balancing_seg, p_log_level_rec => p_log_level_rec);
344: fa_debug_pkg.add(l_calling_fn, 'sum_amount for first source tbl: ', l_sum_amount, p_log_level_rec => p_log_level_rec);
345: end if;
346:
347:
340: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 2, l_sum_amount);
341:
342: if (p_log_level_rec.statement_level) then
343: fa_debug_pkg.add(l_calling_fn, 'balancing_seg for first source tbl: ', l_balancing_seg, p_log_level_rec => p_log_level_rec);
344: fa_debug_pkg.add(l_calling_fn, 'sum_amount for first source tbl: ', l_sum_amount, p_log_level_rec => p_log_level_rec);
345: end if;
346:
347:
348: -- add these values to the table
354: DBMS_SQL.CLOSE_CURSOR(l_cursor_id);
355:
356:
357: if (p_log_level_rec.statement_level) then
358: fa_debug_pkg.add(l_calling_fn, 'source table count', l_src_tbl.count, p_log_level_rec => p_log_level_rec);
359: end if;
360:
361:
362:
363: -- and now for each destination
364: if (p_dest_trans_rec.transaction_header_id is not null) then
365:
366: if (p_log_level_rec.statement_level) then
367: fa_debug_pkg.add(l_calling_fn, 'processing', 'destination', p_log_level_rec => p_log_level_rec);
368: end if;
369:
370: l_dest_asset_hdr_rec := p_dest_asset_hdr_rec;
371: l_dest_trans_rec := p_dest_trans_rec;
452: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 1, l_balancing_seg);
453: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 2, l_sum_amount);
454:
455: if (p_log_level_rec.statement_level) then
456: fa_debug_pkg.add(l_calling_fn, 'balancing_seg for first dest tbl: ', l_balancing_seg, p_log_level_rec => p_log_level_rec);
457: fa_debug_pkg.add(l_calling_fn, 'sum_amount for first dest tbl: ', l_sum_amount, p_log_level_rec => p_log_level_rec);
458: end if;
459:
460: -- add these values to the table
453: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 2, l_sum_amount);
454:
455: if (p_log_level_rec.statement_level) then
456: fa_debug_pkg.add(l_calling_fn, 'balancing_seg for first dest tbl: ', l_balancing_seg, p_log_level_rec => p_log_level_rec);
457: fa_debug_pkg.add(l_calling_fn, 'sum_amount for first dest tbl: ', l_sum_amount, p_log_level_rec => p_log_level_rec);
458: end if;
459:
460: -- add these values to the table
461: l_dest_tbl(l_dest_count + 1).balancing_segment := l_balancing_seg;
465:
466: DBMS_SQL.CLOSE_CURSOR(l_cursor_id);
467:
468: if (p_log_level_rec.statement_level) then
469: fa_debug_pkg.add(l_calling_fn, 'dest table count', l_dest_tbl.count, p_log_level_rec => p_log_level_rec);
470: end if;
471:
472:
473: else
475: l_dest_asset_hdr_rec := p_src_asset_hdr_rec;
476: l_dest_trans_rec := p_src_trans_rec;
477:
478: if (p_log_level_rec.statement_level) then
479: fa_debug_pkg.add(l_calling_fn, 'not processing', 'destination', p_log_level_rec => p_log_level_rec);
480: end if;
481:
482: end if;
483:
486: -- sum all accounts into a single amount per balancing segment
487: -- first create a new table indexed by balancing segment
488:
489: if (p_log_level_rec.statement_level) then
490: fa_debug_pkg.add(l_calling_fn, 'summing', 'source amounts', p_log_level_rec => p_log_level_rec);
491: end if;
492:
493: for l_src_count in 1..l_src_tbl.count loop
494:
515:
516: end loop;
517:
518: if (p_log_level_rec.statement_level) then
519: fa_debug_pkg.add(l_calling_fn, 'source summary table count', l_src_summary_tbl.count, p_log_level_rec => p_log_level_rec);
520: end if;
521:
522:
523:
523:
524: -- now do the same for the destination
525:
526: if (p_log_level_rec.statement_level) then
527: fa_debug_pkg.add(l_calling_fn, 'summing', 'dest amounts', p_log_level_rec => p_log_level_rec);
528: end if;
529:
530: for l_dest_count in 1 ..l_dest_tbl.count loop
531:
553:
554: end loop;
555:
556: if (p_log_level_rec.statement_level) then
557: fa_debug_pkg.add(l_calling_fn, 'dest summary table count', l_dest_summary_tbl.count, p_log_level_rec => p_log_level_rec);
558: end if;
559:
560:
561: -- remove all the 0 amount rows
559:
560:
561: -- remove all the 0 amount rows
562: if (p_log_level_rec.statement_level) then
563: fa_debug_pkg.add(l_calling_fn, 'removing', 'source 0 amounts', p_log_level_rec => p_log_level_rec);
564: end if;
565:
566: -- BUG# 3537535
567: -- changing this loop. since its count is changing, that
607: end loop;
608: end loop;
609:
610: if (p_log_level_rec.statement_level) then
611: fa_debug_pkg.add(l_calling_fn, 'source summary table count', l_src_summary_tbl.count, p_log_level_rec => p_log_level_rec);
612: end if;
613:
614:
615:
615:
616: -- same for dest
617:
618: if (p_log_level_rec.statement_level) then
619: fa_debug_pkg.add(l_calling_fn, 'removing', 'dest 0 amounts', p_log_level_rec => p_log_level_rec);
620: end if;
621:
622: l_loop := TRUE;
623:
656:
657: end loop;
658:
659: if (p_log_level_rec.statement_level) then
660: fa_debug_pkg.add(l_calling_fn, 'after', 'removing 0 cost dest rows', p_log_level_rec => p_log_level_rec);
661: fa_debug_pkg.add(l_calling_fn, 'dest summary table count', l_dest_summary_tbl.count, p_log_level_rec => p_log_level_rec);
662: end if;
663:
664:
657: end loop;
658:
659: if (p_log_level_rec.statement_level) then
660: fa_debug_pkg.add(l_calling_fn, 'after', 'removing 0 cost dest rows', p_log_level_rec => p_log_level_rec);
661: fa_debug_pkg.add(l_calling_fn, 'dest summary table count', l_dest_summary_tbl.count, p_log_level_rec => p_log_level_rec);
662: end if;
663:
664:
665:
664:
665:
666: -- now find the matches
667: if (p_log_level_rec.statement_level) then
668: fa_debug_pkg.add(l_calling_fn, 'finding', 'balancing segment matches', p_log_level_rec => p_log_level_rec);
669: end if;
670:
671: if (l_src_summary_tbl.count = 0 and
672: l_dest_summary_tbl.count = 0) then
672: l_dest_summary_tbl.count = 0) then
673:
674: -- no interco effects at all
675: if (p_log_level_rec.statement_level) then
676: fa_debug_pkg.add(l_calling_fn, 'no intercompany impacts found' ,'', p_log_level_rec => p_log_level_rec);
677: end if;
678:
679: raise done_exception;
680:
681: elsif (l_dest_summary_tbl.count = 0) then
682:
683: -- one sided
684: if (p_log_level_rec.statement_level) then
685: fa_debug_pkg.add(l_calling_fn, 'found: ', 'source intercompany impacts only', p_log_level_rec => p_log_level_rec);
686: end if;
687:
688: l_summary_tbl := l_src_summary_tbl;
689:
708: elsif (l_src_summary_tbl.count = 0) then -- THIS SHOULDN'T HAPPEN!!!!!!!!!!
709:
710: -- one sided
711: if (p_log_level_rec.statement_level) then
712: fa_debug_pkg.add(l_calling_fn, 'found: ', 'dest intercompany impacts only', p_log_level_rec => p_log_level_rec);
713: end if;
714:
715: l_summary_tbl := l_dest_summary_tbl;
716:
720: -- cross asset intercompany effects
721: -- need to determine overall impacts
722:
723: if (p_log_level_rec.statement_level) then
724: fa_debug_pkg.add(l_calling_fn, 'found: ', 'source and destination intercompany impacts', p_log_level_rec => p_log_level_rec);
725: end if;
726:
727: l_summary_tbl := l_src_summary_tbl;
728:
741: --
742: -- but this premise wouldn't work for intra-asset effects (like add/adj)
743:
744: if (p_log_level_rec.statement_level) then
745: fa_debug_pkg.add(l_calling_fn, 'combining: ', 'source and destination impacts', p_log_level_rec => p_log_level_rec);
746: end if;
747:
748:
749: for l_dest_summary_count in 1..l_dest_summary_tbl.count loop
799:
800: end loop;
801:
802: if (p_log_level_rec.statement_level) then
803: fa_debug_pkg.add(l_calling_fn, 'summary table count', l_summary_tbl.count, p_log_level_rec => p_log_level_rec);
804: end if;
805:
806:
807:
806:
807:
808: -- remove all the 0 amount rows
809: if (p_log_level_rec.statement_level) then
810: fa_debug_pkg.add(l_calling_fn, 'removing: ', '0 amount summary intercompany lines', p_log_level_rec => p_log_level_rec);
811: end if;
812:
813:
814: l_loop := TRUE;
848:
849: end loop;
850:
851: if (p_log_level_rec.statement_level) then
852: fa_debug_pkg.add(l_calling_fn, 'summary table count', l_summary_tbl.count, p_log_level_rec => p_log_level_rec);
853: end if;
854:
855: end if;
856:
855: end if;
856:
857: -- load the constant values for each asset
858: if (p_log_level_rec.statement_level) then
859: fa_debug_pkg.add(l_calling_fn, 'setting up for: ', 'faxinaj calls', p_log_level_rec => p_log_level_rec);
860: end if;
861:
862:
863: l_interco_ar_acct := fa_cache_pkg.fazcbc_record.ar_intercompany_acct;
898: l_dest_source_type_code := 'ADJUSTMENT';
899: end if;
900:
901: if (p_log_level_rec.statement_level) then
902: fa_debug_pkg.add(l_calling_fn, 'src source_type_code', l_src_source_type_code, p_log_level_rec => p_log_level_rec);
903: fa_debug_pkg.add(l_calling_fn, 'dest source_type_code', l_dest_source_type_code, p_log_level_rec => p_log_level_rec);
904: end if;
905:
906: l_adj.period_counter_created := fa_cache_pkg.fazcbc_record.last_period_counter + 1;
899: end if;
900:
901: if (p_log_level_rec.statement_level) then
902: fa_debug_pkg.add(l_calling_fn, 'src source_type_code', l_src_source_type_code, p_log_level_rec => p_log_level_rec);
903: fa_debug_pkg.add(l_calling_fn, 'dest source_type_code', l_dest_source_type_code, p_log_level_rec => p_log_level_rec);
904: end if;
905:
906: l_adj.period_counter_created := fa_cache_pkg.fazcbc_record.last_period_counter + 1;
907: l_adj.period_counter_adjusted := fa_cache_pkg.fazcbc_record.last_period_counter + 1;
928: -- and destination. If the src and destination share even a portion
929: -- between the same segment, the interco values will cascade to all of them
930:
931: if (p_log_level_rec.statement_level) then
932: fa_debug_pkg.add(l_calling_fn, 'looping: ', 'through summary interco records', p_log_level_rec => p_log_level_rec);
933: fa_debug_pkg.add(l_calling_fn, 'summary_tbl.count: ', l_summary_tbl.count , p_log_level_rec => p_log_level_rec);
934: end if;
935:
936: for l_summary_count in 1..l_summary_tbl.count loop
929: -- between the same segment, the interco values will cascade to all of them
930:
931: if (p_log_level_rec.statement_level) then
932: fa_debug_pkg.add(l_calling_fn, 'looping: ', 'through summary interco records', p_log_level_rec => p_log_level_rec);
933: fa_debug_pkg.add(l_calling_fn, 'summary_tbl.count: ', l_summary_tbl.count , p_log_level_rec => p_log_level_rec);
934: end if;
935:
936: for l_summary_count in 1..l_summary_tbl.count loop
937:
935:
936: for l_summary_count in 1..l_summary_tbl.count loop
937:
938: if (p_log_level_rec.statement_level) then
939: fa_debug_pkg.add(l_calling_fn, 'looping through summary records, count: ', l_summary_count, p_log_level_rec => p_log_level_rec);
940: fa_debug_pkg.add(l_calling_fn, 'summary amount', l_summary_tbl(l_summary_count).amount);
941: end if;
942:
943: l_dist_tbl.delete;
936: for l_summary_count in 1..l_summary_tbl.count loop
937:
938: if (p_log_level_rec.statement_level) then
939: fa_debug_pkg.add(l_calling_fn, 'looping through summary records, count: ', l_summary_count, p_log_level_rec => p_log_level_rec);
940: fa_debug_pkg.add(l_calling_fn, 'summary amount', l_summary_tbl(l_summary_count).amount);
941: end if;
942:
943: l_dist_tbl.delete;
944: l_dist_tbl_count := 0;
1001: if DBMS_SQL.FETCH_ROWS(l_cursor_id) = 0 then
1002:
1003:
1004: if (p_log_level_rec.statement_level) then
1005: fa_debug_pkg.add(l_calling_fn, 'dist cursor: ', 'no more rows fetched', p_log_level_rec => p_log_level_rec);
1006: end if;
1007:
1008: -- get total units
1009: l_total_units := 0;
1011: l_total_units := l_total_units + l_dist_tbl(l_dist_count).units;
1012: end loop;
1013:
1014: if (p_log_level_rec.statement_level) then
1015: fa_debug_pkg.add(l_calling_fn, 'dist cursor: ', 'looping through dists', p_log_level_rec => p_log_level_rec);
1016: end if;
1017:
1018: for l_dist_count in 1..l_dist_tbl.count loop
1019: -- process the rows into fa_adj for that balancing segment
1019: -- process the rows into fa_adj for that balancing segment
1020: -- call faxinaj to insert the amounts (flush them too)
1021:
1022: if (p_log_level_rec.statement_level) then
1023: fa_debug_pkg.add(l_calling_fn, 'inside ', 'dist loop', p_log_level_rec => p_log_level_rec);
1024: end if;
1025:
1026: l_adj.code_combination_id := l_dist_tbl(l_dist_count).code_combination_id;
1027: l_adj.distribution_id := l_dist_tbl(l_dist_count).distribution_id;
1026: l_adj.code_combination_id := l_dist_tbl(l_dist_count).code_combination_id;
1027: l_adj.distribution_id := l_dist_tbl(l_dist_count).distribution_id;
1028:
1029: if (p_log_level_rec.statement_level) then
1030: fa_debug_pkg.add(l_calling_fn, 'l_summary_tbl(l_summary_count).amount', l_summary_tbl(l_summary_count).amount);
1031: fa_debug_pkg.add(l_calling_fn, 'l_total_prorated_amount',l_total_prorated_amount, p_log_level_rec => p_log_level_rec);
1032: fa_debug_pkg.add(l_calling_fn, 'l_total_units', l_total_units, p_log_level_rec => p_log_level_rec);
1033: fa_debug_pkg.add(l_calling_fn, 'l_dist_tbl(l_dist_count).units', l_dist_tbl(l_dist_count).units);
1034: end if;
1027: l_adj.distribution_id := l_dist_tbl(l_dist_count).distribution_id;
1028:
1029: if (p_log_level_rec.statement_level) then
1030: fa_debug_pkg.add(l_calling_fn, 'l_summary_tbl(l_summary_count).amount', l_summary_tbl(l_summary_count).amount);
1031: fa_debug_pkg.add(l_calling_fn, 'l_total_prorated_amount',l_total_prorated_amount, p_log_level_rec => p_log_level_rec);
1032: fa_debug_pkg.add(l_calling_fn, 'l_total_units', l_total_units, p_log_level_rec => p_log_level_rec);
1033: fa_debug_pkg.add(l_calling_fn, 'l_dist_tbl(l_dist_count).units', l_dist_tbl(l_dist_count).units);
1034: end if;
1035:
1028:
1029: if (p_log_level_rec.statement_level) then
1030: fa_debug_pkg.add(l_calling_fn, 'l_summary_tbl(l_summary_count).amount', l_summary_tbl(l_summary_count).amount);
1031: fa_debug_pkg.add(l_calling_fn, 'l_total_prorated_amount',l_total_prorated_amount, p_log_level_rec => p_log_level_rec);
1032: fa_debug_pkg.add(l_calling_fn, 'l_total_units', l_total_units, p_log_level_rec => p_log_level_rec);
1033: fa_debug_pkg.add(l_calling_fn, 'l_dist_tbl(l_dist_count).units', l_dist_tbl(l_dist_count).units);
1034: end if;
1035:
1036: if (l_dist_count = l_dist_tbl.count) then
1029: if (p_log_level_rec.statement_level) then
1030: fa_debug_pkg.add(l_calling_fn, 'l_summary_tbl(l_summary_count).amount', l_summary_tbl(l_summary_count).amount);
1031: fa_debug_pkg.add(l_calling_fn, 'l_total_prorated_amount',l_total_prorated_amount, p_log_level_rec => p_log_level_rec);
1032: fa_debug_pkg.add(l_calling_fn, 'l_total_units', l_total_units, p_log_level_rec => p_log_level_rec);
1033: fa_debug_pkg.add(l_calling_fn, 'l_dist_tbl(l_dist_count).units', l_dist_tbl(l_dist_count).units);
1034: end if;
1035:
1036: if (l_dist_count = l_dist_tbl.count) then
1037:
1051:
1052: end if;
1053:
1054: if (p_log_level_rec.statement_level) then
1055: fa_debug_pkg.add(l_calling_fn, 'l_adj.adj_amount', l_adj.adjustment_amount, p_log_level_rec => p_log_level_rec);
1056: fa_debug_pkg.add(l_calling_fn, 'setting up ', 'local variables', p_log_level_rec => p_log_level_rec);
1057: end if;
1058:
1059: if (l_summary_tbl(l_summary_count).type = 'SRC') then
1052: end if;
1053:
1054: if (p_log_level_rec.statement_level) then
1055: fa_debug_pkg.add(l_calling_fn, 'l_adj.adj_amount', l_adj.adjustment_amount, p_log_level_rec => p_log_level_rec);
1056: fa_debug_pkg.add(l_calling_fn, 'setting up ', 'local variables', p_log_level_rec => p_log_level_rec);
1057: end if;
1058:
1059: if (l_summary_tbl(l_summary_count).type = 'SRC') then
1060: if (p_log_level_rec.statement_level) then
1057: end if;
1058:
1059: if (l_summary_tbl(l_summary_count).type = 'SRC') then
1060: if (p_log_level_rec.statement_level) then
1061: fa_debug_pkg.add(l_calling_fn, 'processing', 'src', p_log_level_rec => p_log_level_rec);
1062: end if;
1063:
1064: l_adj.transaction_header_id := p_src_trans_rec.transaction_header_id;
1065: l_adj.asset_id := p_src_asset_hdr_rec.asset_id;
1068: l_adj.adjustment_type := 'INTERCO AR';
1069: l_adj.account_type := 'AR_INTERCOMPANY_ACCT';
1070: l_adj.account := l_interco_ar_acct;
1071: if (p_log_level_rec.statement_level) then
1072: fa_debug_pkg.add(l_calling_fn, 'source_type_code', l_src_source_type_code, p_log_level_rec => p_log_level_rec);
1073: end if;
1074:
1075: l_adj.source_type_code := l_src_source_type_code;
1076:
1075: l_adj.source_type_code := l_src_source_type_code;
1076:
1077: else
1078: if (p_log_level_rec.statement_level) then
1079: fa_debug_pkg.add(l_calling_fn, 'processing', 'dest', p_log_level_rec => p_log_level_rec);
1080: end if;
1081:
1082: -- need to use locals for intra-assets
1083: -- Bug7496364:modified account type correctly to AP
1092: l_adj.source_type_code := l_dest_source_type_code;
1093: end if;
1094:
1095: if (p_log_level_rec.statement_level) then
1096: fa_debug_pkg.add(l_calling_fn, 'calling: ', 'faxinaj', p_log_level_rec => p_log_level_rec);
1097: end if;
1098:
1099: if not FA_INS_ADJUST_PKG.faxinaj
1100: (l_adj,
1110:
1111: end if;
1112:
1113: if (p_log_level_rec.statement_level) then
1114: fa_debug_pkg.add(l_calling_fn, 'populating: ', 'values from dist cursor', p_log_level_rec => p_log_level_rec);
1115: end if;
1116:
1117: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 1, l_distribution_id);
1118: DBMS_SQL.COLUMN_VALUE(l_cursor_id, 2, l_code_combination_id);
1197:
1198: begin
1199:
1200: if (p_log_level_rec.statement_level) then
1201: fa_debug_pkg.add(l_calling_fn, 'inside', 'validate interco code', p_log_level_rec => p_log_level_rec);
1202: end if;
1203:
1204: l_account_flex := fa_cache_pkg.fazcbc_record.ACCOUNTING_FLEX_STRUCTURE;
1205:
1234: -- raise interco_err;
1235: -- end if;
1236:
1237: if (p_log_level_rec.statement_level) then
1238: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Segment Number', l_bal_segnum, p_log_level_rec => p_log_level_rec);
1239: fa_debug_pkg.add(l_calling_fn, 'transaction type code', p_trans_rec.transaction_type_code, p_log_level_rec => p_log_level_rec);
1240: end if;
1241:
1242:
1235: -- end if;
1236:
1237: if (p_log_level_rec.statement_level) then
1238: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Segment Number', l_bal_segnum, p_log_level_rec => p_log_level_rec);
1239: fa_debug_pkg.add(l_calling_fn, 'transaction type code', p_trans_rec.transaction_type_code, p_log_level_rec => p_log_level_rec);
1240: end if;
1241:
1242:
1243: l_status := fnd_flex_apis.get_segment_info(
1259: if (p_asset_dist_tbl.count = 0) then
1260:
1261:
1262: if (p_log_level_rec.statement_level) then
1263: fa_debug_pkg.add(l_calling_fn, 'loading', 'dist table', p_log_level_rec => p_log_level_rec);
1264: end if;
1265:
1266: open c_asset_distributions;
1267:
1281: close c_asset_distributions;
1282:
1283: else
1284: if (p_log_level_rec.statement_level) then
1285: fa_debug_pkg.add(l_calling_fn, 'using', 'provided dist table', p_log_level_rec => p_log_level_rec);
1286: end if;
1287:
1288: l_asset_dist_tbl := p_asset_dist_tbl;
1289: end if;
1316: ' from gl_code_combinations glcc ' ||
1317: ' where code_combination_id in (' || l_ccid_string || ')';
1318:
1319: if (p_log_level_rec.statement_level) then
1320: fa_debug_pkg.add(l_calling_fn, 'executing', 'first dynamic sql', p_log_level_rec => p_log_level_rec);
1321: end if;
1322:
1323:
1324: -- execute the statment
1362: -- from transfers/unit adjustments, not additions
1363:
1364:
1365: if (p_log_level_rec.statement_level) then
1366: fa_debug_pkg.add(l_calling_fn, 'setting', 'second dynamic sql', p_log_level_rec => p_log_level_rec);
1367: end if;
1368:
1369:
1370: if (p_asset_type_rec.asset_type = 'GROUP') then
1434:
1435: end if;
1436:
1437: if (p_log_level_rec.statement_level) then
1438: fa_debug_pkg.add(l_calling_fn, 'executing', 'second dynamic sql', p_log_level_rec => p_log_level_rec);
1439: end if;
1440:
1441:
1442: -- execute the statment
1467: DBMS_SQL.CLOSE_CURSOR(l_cursor_id);
1468:
1469:
1470: if (p_log_level_rec.statement_level) then
1471: fa_debug_pkg.add(l_calling_fn, 'looking', 'for mismatches', p_log_level_rec => p_log_level_rec);
1472: end if;
1473:
1474:
1475: -- look for any mismatches
1552:
1553: x_interco_impact := FALSE;
1554:
1555: if (p_log_level_rec.statement_level) then
1556: fa_debug_pkg.add(l_calling_fn, 'inside', 'validate interco code', p_log_level_rec => p_log_level_rec);
1557: end if;
1558:
1559: l_account_flex := fa_cache_pkg.fazcbc_record.ACCOUNTING_FLEX_STRUCTURE;
1560:
1589: -- raise interco_err;
1590: -- end if;
1591:
1592: if (p_log_level_rec.statement_level) then
1593: fa_debug_pkg.add(l_calling_fn, 'GL Balancing Segment Number', l_bal_segnum, p_log_level_rec => p_log_level_rec);
1594: end if;
1595:
1596:
1597: l_status := fnd_flex_apis.get_segment_info(
1613: -- using the distirbution table parameter and flex api
1614: for i in 1..2 loop
1615:
1616: if (p_log_level_rec.statement_level) then
1617: fa_debug_pkg.add(l_calling_fn, 'loading', 'dist table', p_log_level_rec => p_log_level_rec);
1618: end if;
1619:
1620: if i = 1 then
1621: l_asset_id := p_src_asset_hdr_rec.asset_id;
1640:
1641: close c_asset_distributions;
1642:
1643: if (p_log_level_rec.statement_level) then
1644: fa_debug_pkg.add(l_calling_fn, 'building', 'ccid string', p_log_level_rec => p_log_level_rec);
1645: end if;
1646:
1647: for l_ccid_tbl_count in 1..l_ccid_tbl.count loop
1648:
1661: ' from gl_code_combinations glcc ' ||
1662: ' where code_combination_id in (' || l_ccid_string || ')';
1663:
1664: if (p_log_level_rec.statement_level) then
1665: fa_debug_pkg.add(l_calling_fn, 'executing', 'first dynamic sql', p_log_level_rec => p_log_level_rec);
1666: end if;
1667:
1668: -- execute the statment
1669: l_cursor_id := DBMS_SQL.OPEN_CURSOR;
1698: end loop; -- this ends the fixed two time loop (src and dest)
1699:
1700:
1701: if (p_log_level_rec.statement_level) then
1702: fa_debug_pkg.add(l_calling_fn, 'looking', 'for mismatches', p_log_level_rec => p_log_level_rec);
1703: end if;
1704:
1705: -- look for any mismatches
1706: for l_bal_tbl1_count in 1..l_bal_tbl1.count loop