126: into l_exists_sc_orgs
127: from sys.dual
128: where exists (
129: select 'There are standard costing orgs'
130: from mtl_parameters
131: where primary_cost_method = 1
132: );
133:
134: -- Find out if there are any Avg/LIFO/FIFO orgs
136: into l_exists_ac_orgs
137: from sys.dual
138: where exists (
139: select 'There are Avg/LIFO/FIFO costing orgs'
140: from mtl_parameters
141: where primary_cost_method <> 1
142: );
143:
144: select FND_GLOBAL.USER_ID
248: cql.layer_id, max(mmt.transaction_id) transaction_id,
249: trunc (mmt.transaction_date) asofdate
250: from mtl_material_transactions mmt,
251: cst_quantity_layers cql,
252: mtl_parameters mp
253: where mp.primary_cost_method <> 1
254: and mp.default_cost_group_id = mmt.cost_group_id
255: and mp.organization_id = mmt.organization_id
256: and mmt.transaction_date >= l_start_date
691: into l_exists_sc_orgs
692: from sys.dual
693: where exists (
694: select 'There are standard costing orgs'
695: from mtl_parameters
696: where primary_cost_method = 1
697: );
698:
699: -- Find out if there are any Avg/LIFO/FIFO orgs
701: into l_exists_ac_orgs
702: from sys.dual
703: where exists (
704: select 'There are Avg/LIFO/FIFO costing orgs'
705: from mtl_parameters
706: where primary_cost_method <> 1
707: );
708:
709: -- Get the cost history for standard costing orgs from cst_elemental_costs
839: cql.layer_id, max(mmt.transaction_id) transaction_id,
840: trunc (mmt.transaction_date) asofdate
841: from mtl_material_transactions mmt,
842: cst_quantity_layers cql,
843: mtl_parameters mp
844: where mp.primary_cost_method <> 1
845: and mp.default_cost_group_id = mmt.cost_group_id
846: and mp.organization_id = mmt.organization_id
847: and mmt.transaction_id > l_processed_txn_id