849: l_cc_vs_id := r_value_sets.cost_center_vs_id;
850:
851: begin
852:
853: --Use fnd_id_flex_segments to figure out all charts_of_accounts
854: --related to both company/cost center value set IDs:
855: -- if there is no chart_of_accounts found, no change to coa_id;
856: -- if there are charts_of_accounts found, but none of them appears
857: -- in the mapping rule table; no change to coa_id;
861:
862: select coa.coa_id into l_coa_id
863: from
864: (select ID_FLEX_NUM coa_id
865: from fnd_id_flex_segments
866: where APPLICATION_ID = 101
867: and ID_FLEX_CODE = 'GL#'
868: and FLEX_VALUE_SET_ID = l_com_vs_id
869: intersect
867: and ID_FLEX_CODE = 'GL#'
868: and FLEX_VALUE_SET_ID = l_com_vs_id
869: intersect
870: select ID_FLEX_NUM coa_id
871: from fnd_id_flex_segments
872: where APPLICATION_ID = 101
873: and ID_FLEX_CODE = 'GL#'
874: and FLEX_VALUE_SET_ID = l_cc_vs_id
875: intersect