The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id=31
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id=31
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID, mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id=31
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id=31
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_comp_qty',
p_total1 => total_qty,
selector => 1,
success => status);
/* edw_log.put_line('Insert_update_push_log'); */
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_comp_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_comp_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_comp_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (1,27,33,34)
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (1,27,33,34)
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (1,27,33,34)
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (1,27,33,34)
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_issue_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_issue_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_issue_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_issue_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id=32
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id=32
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id=32
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id=32
AND mmt.transaction_source_type_id=5
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_assy_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_assy_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_assy_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'wip_assy_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (1,27,29)
AND mmt.transaction_source_type_id=1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id, MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (1,27,29)
AND mmt.transaction_source_type_id=1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id, MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (1,27,29)
AND mmt.transaction_source_type_id=1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id, MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (1,27,29)
AND mmt.transaction_source_type_id=1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id, MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'po_del_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'po_del_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'po_del_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'po_del_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (3,12)
AND mmt.primary_quantity > 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (3,12)
AND mmt.primary_quantity > 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (3,12)
AND mmt.primary_quantity > 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (3,12)
AND mmt.primary_quantity > 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'from_org_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'from_org_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'from_org_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'from_org_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mmt.organization_id=mta.organization_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mmt.organization_id=mta.organization_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'to_org_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'to_org_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'to_org_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'to_org_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (1,27)
AND mmt.transaction_source_type_id in (2,8,12)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (1,27)
AND mmt.transaction_source_type_id in (2,8,12)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (1,27)
AND mmt.transaction_source_type_id in (2,8,12)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mmt.transaction_action_id in (1,27)
AND mmt.transaction_source_type_id in (2,8,12)
AND mta.accounting_line_type = 1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT TRANSACTION_DATE,
ORGANIZATION_ID,
INVENTORY_ITEM_ID,
COST_GROUP_ID,
REVISION,
SUBINVENTORY_CODE,
LOCATOR_ID,
sum(BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM
(
/* Regular Sales Transactions (no logical flow)*/
SELECT trunc(mmt.TRANSACTION_DATE)TRANSACTION_DATE,
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
AND mmt.TRANSACTION_ACTION_ID IN (1,27)
AND mmt.TRANSACTION_SOURCE_TYPE_ID IN (2,8,12)
AND mmt.TRANSACTION_DATE >= p_from_date
AND mmt.TRANSACTION_DATE <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE), mmt.ORGANIZATION_ID, mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID, mmt.REVISION, mmt.SUBINVENTORY_CODE, mmt.LOCATOR_ID
UNION
/* Sales Orders and RMA Receipts in Internal Drop Ship to Customer*/
SELECT trunc(mmt1.TRANSACTION_DATE)TRANSACTION_DATE,
mmt1.ORGANIZATION_ID,
mmt1.INVENTORY_ITEM_ID,
mmt1.COST_GROUP_ID,
mmt1.REVISION,
mmt1.SUBINVENTORY_CODE,
mmt1.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt1, --Parent Physical Txns
MTL_MATERIAL_TRANSACTIONS mmt2, --Logical (Child) Txns
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt1.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt1.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt1.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt1.TRANSACTION_ACTION_ID IN (1, 27)
AND mmt1.TRANSACTION_SOURCE_TYPE_ID IN (2, 12)
AND mmt1.TRANSACTION_DATE >= p_from_date
AND mmt1.TRANSACTION_DATE <= p_to_date
AND mmt2.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
/* logical txn triggered by this parent txn*/
AND mmt2.PARENT_TRANSACTION_ID = mmt1.TRANSACTION_ID
AND mmt2.TRANSACTION_TYPE_ID IN (11, 14)
AND mmt2.ORGANIZATION_ID = Org_id
GROUP BY trunc(mmt1.TRANSACTION_DATE), mmt1.ORGANIZATION_ID, mmt1.INVENTORY_ITEM_ID,
mmt1.COST_GROUP_ID, mmt1.REVISION, mmt1.SUBINVENTORY_CODE, mmt1.LOCATOR_ID
)
GROUP BY TRANSACTION_DATE, ORGANIZATION_ID, INVENTORY_ITEM_ID, COST_GROUP_ID, REVISION, SUBINVENTORY_CODE, LOCATOR_ID;
SELECT TRANSACTION_DATE,
ORGANIZATION_ID,
INVENTORY_ITEM_ID,
COST_GROUP_ID,
REVISION,
LOT_NUMBER,
SUBINVENTORY_CODE,
LOCATOR_ID,
sum(BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM
(
/* Regular Sales Transactions (no logical flow)*/
SELECT trunc(mmt.TRANSACTION_DATE)TRANSACTION_DATE,
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.TRANSACTION_ID = mtln.TRANSACTION_ID
AND msi.LOT_CONTROL_CODE = 2
AND mmt.TRANSACTION_ID = mta.TRANSACTION_ID
AND mmt.TRANSACTION_ACTION_ID IN (1,27)
AND mmt.TRANSACTION_SOURCE_TYPE_ID in (2,8,12)
AND mta.ACCOUNTING_LINE_TYPE = 1
AND mmt.TRANSACTION_DATE >= p_from_date
AND mmt.TRANSACTION_DATE <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE), mmt.ORGANIZATION_ID, mmt.INVENTORY_ITEM_ID, mmt.COST_GROUP_ID,
mmt.REVISION, mtln.LOT_NUMBER, mmt.SUBINVENTORY_CODE, mmt.LOCATOR_ID
UNION
/* Sales Orders and RMA Receipts in Internal Drop Ship to Customer*/
SELECT trunc(mmt1.TRANSACTION_DATE)TRANSACTION_DATE,
mmt1.ORGANIZATION_ID,
mmt1.INVENTORY_ITEM_ID,
mmt1.COST_GROUP_ID,
mmt1.REVISION,
mtln.LOT_NUMBER,
mmt1.SUBINVENTORY_CODE,
mmt1.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt1, --Parent Physical Txns
MTL_MATERIAL_TRANSACTIONS mmt2, --Logical (Child) Txns
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt1.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt1.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt1.ORGANIZATION_ID=Org_id
AND mmt1.TRANSACTION_ID = mtln.TRANSACTION_ID
AND msi.LOT_CONTROL_CODE = 2
AND mmt1.TRANSACTION_ACTION_ID IN (1,27)
AND mmt1.TRANSACTION_SOURCE_TYPE_ID IN (2,12)
AND mmt1.TRANSACTION_DATE >= p_from_date
AND mmt1.TRANSACTION_DATE <= p_to_date
AND mmt2.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
/* logical txn triggered by this parent txn*/
AND mmt2.PARENT_TRANSACTION_ID = mmt1.TRANSACTION_ID
AND mmt2.ORGANIZATION_ID=Org_id
AND mmt2.TRANSACTION_TYPE_ID IN (11,14)
GROUP BY trunc(mmt1.TRANSACTION_DATE), mmt1.ORGANIZATION_ID, mmt1.INVENTORY_ITEM_ID, mmt1.COST_GROUP_ID,
mmt1.REVISION, mtln.LOT_NUMBER, mmt1.SUBINVENTORY_CODE, mmt1.LOCATOR_ID
)
GROUP BY TRANSACTION_DATE, ORGANIZATION_ID, INVENTORY_ITEM_ID, COST_GROUP_ID,
REVISION, LOT_NUMBER, SUBINVENTORY_CODE, LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_cust_ship_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_cust_ship_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_cust_ship_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_cust_ship_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_action_id in (4,8)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_action_id in (4,8)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND mmt.transaction_action_id in (4,8)
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND mmt.transaction_action_id in (4,8)
AND mta.accounting_line_type = 1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'inv_adj_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'inv_adj_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'inv_adj_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'inv_adj_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND ( (mmt.transaction_action_id in (1,2,3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_source_type_id <> 1)
OR (mmt.transaction_action_id = 27
AND mmt.transaction_source_type_id in (5,12)) )
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND ( (mmt.transaction_action_id in (1,2,3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_source_type_id <> 1)
OR (mmt.transaction_action_id = 27
AND mmt.transaction_source_type_id in (5,12)) )
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND ( (mmt.transaction_action_id in (1,2,3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_source_type_id <> 1)
OR (mmt.transaction_action_id = 27
AND mmt.transaction_source_type_id in (5,12)) )
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND ( (mmt.transaction_action_id in (1,2,3,21)
AND mmt.primary_quantity < 0
AND mmt.transaction_source_type_id <> 1)
OR (mmt.transaction_action_id = 27
AND mmt.transaction_source_type_id in (5,12)) )
AND mta.accounting_line_type = 1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT TRANSACTION_DATE,
ORGANIZATION_ID,
INVENTORY_ITEM_ID,
COST_GROUP_ID,
REVISION,
SUBINVENTORY_CODE,
LOCATOR_ID,
sum(BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM
(
/* Regular Sales Transactions (no logical flow)*/
SELECT trunc(mmt.TRANSACTION_DATE) TRANSACTION_DATE,
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE) BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
AND ((mmt.TRANSACTION_ACTION_ID IN (1,2,3,21)
AND mmt.PRIMARY_QUANTITY < 0
AND mmt.TRANSACTION_SOURCE_TYPE_ID <> 1)
OR (mmt.TRANSACTION_ACTION_ID = 27
AND mmt.TRANSACTION_SOURCE_TYPE_ID IN (5,12)))
AND mmt.TRANSACTION_DATE >= p_from_date
AND mmt.TRANSACTION_DATE <= p_to_date
AND mmt.ORGANIZATION_ID = NVL(mmt.OWNING_ORGANIZATION_ID, mmt.ORGANIZATION_ID)
AND NVL(mmt.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE), mmt.ORGANIZATION_ID, mmt.INVENTORY_ITEM_ID, mmt.COST_GROUP_ID,
mmt.REVISION, mmt.SUBINVENTORY_CODE, mmt.LOCATOR_ID
UNION
/* Sales Orders and RMA Receipts in Internal Drop Ship to Customer*/
SELECT trunc(mmt1.TRANSACTION_DATE)TRANSACTION_DATE,
mmt1.ORGANIZATION_ID,
mmt1.INVENTORY_ITEM_ID,
mmt1.COST_GROUP_ID,
mmt1.REVISION,
mmt1.SUBINVENTORY_CODE,
mmt1.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt1, -- Parent Physical Txns
MTL_MATERIAL_TRANSACTIONS mmt2, -- Logical (Child) Txns
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt1.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt1.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt1.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt1.TRANSACTION_ACTION_ID IN (1, 27)
AND mmt1.TRANSACTION_SOURCE_TYPE_ID IN (2, 12)
AND mmt1.TRANSACTION_DATE >= p_from_date
AND mmt1.TRANSACTION_DATE <= p_to_date
AND mmt2.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
/* logical txn triggered by this parent txn*/
AND mmt2.PARENT_TRANSACTION_ID = mmt1.TRANSACTION_ID
AND mmt2.TRANSACTION_TYPE_ID IN (11, 14)
AND mmt2.ORGANIZATION_ID = Org_id
GROUP BY trunc(mmt1.TRANSACTION_DATE), mmt1.ORGANIZATION_ID, mmt1.INVENTORY_ITEM_ID, mmt1.COST_GROUP_ID,
mmt1.REVISION, mmt1.SUBINVENTORY_CODE, mmt1.LOCATOR_ID
)
GROUP BY TRANSACTION_DATE, ORGANIZATION_ID, INVENTORY_ITEM_ID, COST_GROUP_ID, REVISION, SUBINVENTORY_CODE, LOCATOR_ID;
SELECT TRANSACTION_DATE,
ORGANIZATION_ID,
INVENTORY_ITEM_ID,
COST_GROUP_ID,
REVISION,
LOT_NUMBER,
SUBINVENTORY_CODE,
LOCATOR_ID,
sum(BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM
(
/* Regular Sales Transactions (no logical flow)*/
SELECT trunc(mmt.TRANSACTION_DATE)TRANSACTION_DATE,
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.TRANSACTION_ID = mtln.TRANSACTION_ID
AND msi.LOT_CONTROL_CODE = 2
AND mmt.TRANSACTION_ID = mta.TRANSACTION_ID
AND ((mmt.TRANSACTION_ACTION_ID IN (1,2,3,21)
AND mmt.PRIMARY_QUANTITY < 0
AND mmt.TRANSACTION_SOURCE_TYPE_ID <> 1)
OR (mmt.TRANSACTION_ACTION_ID = 27
AND mmt.TRANSACTION_SOURCE_TYPE_ID IN (5,12)))
AND mta.ACCOUNTING_LINE_TYPE = 1
AND mmt.TRANSACTION_DATE >= p_from_date
AND mmt.TRANSACTION_DATE <= p_to_date
AND mmt.ORGANIZATION_ID = NVL(mmt.OWNING_ORGANIZATION_ID,mmt.ORGANIZATION_ID)
AND NVL(mmt.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE), mmt.ORGANIZATION_ID, mmt.INVENTORY_ITEM_ID, mmt.COST_GROUP_ID,
mmt.REVISION, mtln.lot_number, mmt.SUBINVENTORY_CODE, mmt.LOCATOR_ID
UNION
/* Sales Orders and RMA Receipts in Internal Drop Ship to Customer*/
SELECT trunc(mmt1.TRANSACTION_DATE)TRANSACTION_DATE,
mmt1.ORGANIZATION_ID,
Mmt1.INVENTORY_ITEM_ID,
Mmt1.COST_GROUP_ID,
Mmt1.REVISION,
mtln.LOT_NUMBER,
Mmt1.SUBINVENTORY_CODE,
Mmt1.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)BASE_TRANSACTION_VALUE
FROM MTL_MATERIAL_TRANSACTIONS mmt1, --Parent Physical Txns
MTL_MATERIAL_TRANSACTIONS mmt2, --Logical (Child) Txns
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt1.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt1.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt1.ORGANIZATION_ID=Org_id
AND mmt1.TRANSACTION_ID = mtln.TRANSACTION_ID
AND msi.LOT_CONTROL_CODE = 2
AND mmt1.TRANSACTION_ACTION_ID IN (1,27)
AND mmt1.TRANSACTION_SOURCE_TYPE_ID IN (2,12)
AND mmt1.TRANSACTION_DATE >= p_from_date
AND mmt1.TRANSACTION_DATE <= p_to_date
AND mmt2.TRANSACTION_ID = mta.TRANSACTION_ID
AND mta.ACCOUNTING_LINE_TYPE = 1
/* logical txn triggered by this parent txn*/
AND mmt2.PARENT_TRANSACTION_ID = mmt1.TRANSACTION_ID
AND mmt2.TRANSACTION_TYPE_ID IN (11,14)
AND mmt2.ORGANIZATION_ID=org_id
GROUP BY trunc(mmt1.TRANSACTION_DATE), mmt1.ORGANIZATION_ID, mmt1.INVENTORY_ITEM_ID, mmt1.COST_GROUP_ID,
mmt1.REVISION, mtln.LOT_NUMBER, mmt1.SUBINVENTORY_CODE, mmt1.LOCATOR_ID
)
GROUP BY TRANSACTION_DATE, ORGANIZATION_ID, INVENTORY_ITEM_ID, COST_GROUP_ID,
LOT_NUMBER, REVISION, SUBINVENTORY_CODE, LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_issues_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_issues_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_issues_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'tot_issues_val_b',
p_total1 => total_value,
selector => 1,
success => status);
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mmt.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND ( (mmt.transaction_action_id in (2,3,12)
AND mmt.primary_quantity >0 )
OR ( mmt.transaction_action_id in (4,8))
OR (mmt.transaction_action_id in (27,29)
AND mmt.transaction_source_type_id in (3,6,13,1))
OR (mmt.transaction_action_id in (31,32)
AND mmt.transaction_source_type_id=5)
OR (mmt.transaction_action_id =1 and mmt.transaction_source_type_id =1))
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mtln.PRIMARY_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.transaction_id = mtln.transaction_id
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 2
AND ( (mmt.transaction_action_id in (2,3,12)
AND mmt.primary_quantity >0 )
OR ( mmt.transaction_action_id in (4,8))
OR (mmt.transaction_action_id in (27,29)
AND mmt.transaction_source_type_id in (3,6,13,1))
OR (mmt.transaction_action_id in (31,32)
AND mmt.transaction_source_type_id=5)
OR (mmt.transaction_action_id =1 and mmt.transaction_source_type_id =1))
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND msi.LOT_CONTROL_CODE = 1
AND mmt.transaction_id = mta.transaction_id
AND mta.accounting_line_type = 1
AND ( (mmt.transaction_action_id in (2,3,12)
AND mmt.primary_quantity >0 )
OR ( mmt.transaction_action_id in (4,8))
OR (mmt.transaction_action_id in (27,29)
AND mmt.transaction_source_type_id in (3,6,13,1))
OR (mmt.transaction_action_id in (31,32)
AND mmt.transaction_source_type_id=5)
OR (mmt.transaction_action_id =1 and mmt.transaction_source_type_id =1))
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
SELECT trunc(mmt.TRANSACTION_DATE),
mmt.ORGANIZATION_ID,
mmt.INVENTORY_ITEM_ID,
mmt.COST_GROUP_ID,
mmt.REVISION,
mtln.LOT_NUMBER,
mmt.SUBINVENTORY_CODE,
mmt.LOCATOR_ID,
sum(mta.BASE_TRANSACTION_VALUE)
FROM MTL_MATERIAL_TRANSACTIONS mmt,
MTL_SYSTEM_ITEMS msi,
MTL_TRANSACTION_LOT_NUMBERS mtln,
MTL_TRANSACTION_ACCOUNTS mta
WHERE mmt.INVENTORY_ITEM_ID=msi.INVENTORY_ITEM_ID
AND mmt.ORGANIZATION_ID=msi.ORGANIZATION_ID
AND mmt.ORGANIZATION_ID=Org_id
AND mmt.transaction_id = mtln.transaction_id
AND msi.LOT_CONTROL_CODE = 2
AND mmt.transaction_id = mta.transaction_id
AND ( (mmt.transaction_action_id in (2,3,12)
AND mmt.primary_quantity >0 )
OR ( mmt.transaction_action_id in (4,8))
OR (mmt.transaction_action_id in (27,29)
AND mmt.transaction_source_type_id in (3,6,13,1))
OR (mmt.transaction_action_id in (31,32)
AND mmt.transaction_source_type_id=5)
OR (mmt.transaction_action_id =1 and mmt.transaction_source_type_id =1))
AND mta.accounting_line_type = 1
AND mmt.transaction_date >= p_from_date
AND mmt.transaction_date <= p_to_date
AND MMT.organization_id = NVL(MMT.owning_organization_id,MMT.organization_id)
AND NVL(MMT.OWNING_TP_TYPE,2) = 2
GROUP BY trunc(mmt.TRANSACTION_DATE),mmt.ORGANIZATION_ID,mmt.INVENTORY_ITEM_ID,mmt.COST_GROUP_ID,
mmt.REVISION,mtln.lot_number,mmt.SUBINVENTORY_CODE,mmt.LOCATOR_ID;
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'total_rec_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'total_rec_qty',
p_total1 => total_qty,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'total_rec_val_b',
p_total1 => total_value,
selector => 1,
success => status);
Insert_update_push_log(
p_trx_date => l_trx_date ,
p_organization_id => l_organization_id,
p_item_id => l_item_id,
p_cost_group_id => l_cost_group_id,
p_revision => l_revision,
p_lot_number => l_lot_number,
p_subinventory => l_subinventory,
p_locator => l_locator,
p_col_name1 => 'total_rec_val_b',
p_total1 => total_value,
selector => 1,
success => status);
PROCEDURE Insert_update_push_log
----------------------------------------------*/
PROCEDURE Insert_update_push_log(
p_trx_date IN Date,
p_organization_id IN Number,
p_item_id IN Number default NULL,
p_cost_group_id IN Number default NULL,
p_revision IN Varchar2 default NULL,
p_lot_number IN Varchar2 default NULL,
p_subinventory IN Varchar2 default NULL,
p_locator IN Number default NULL,
p_item_status IN Varchar2 default NULL,
p_item_type IN Varchar2 default NULL,
p_base_uom IN Varchar2 default NULL,
p_col_name1 IN Varchar2 default NULL,
p_total1 IN Number default NULL,
p_col_name2 IN Varchar2 default NULL,
p_total2 IN Number default NULL,
p_col_name3 IN Varchar2 default NULL,
p_total3 IN Number default NULL,
p_col_name4 IN Varchar2 default NULL,
p_total4 IN Number default NULL,
p_col_name5 IN Varchar2 default NULL,
p_total5 IN Number default NULL,
p_col_name6 IN Varchar2 default NULL,
p_total6 IN Number default NULL,
selector IN Number default NULL,
success OUT nocopy Number)
IS
l_pk varchar2(100):=null;
SELECT 1
FROM opi_ids_push_log
WHERE IDS_KEY=l_pk;
SELECT physical_location_id
FROM mtl_item_locations
WHERE organization_id = p_organization_id
AND inventory_location_id <> physical_location_id
AND inventory_location_id = p_locator;
SELECT nvl(PROJECT_REFERENCE_ENABLED,2) into pjm_org
FROM mtl_parameters
WHERE organization_id = p_organization_id;
IF(selector = 1) then
l_query := 'UPDATE opi_ids_push_log SET push_flag = 1,' || p_col_name1
|| ' = ' || 'nvl(:p_total1,0) WHERE IDS_KEY = :l_pk ';
l_query := 'UPDATE opi_ids_push_log SET push_flag = 1, '
|| p_col_name1 || ' = nvl(:p_total1,0),' || p_col_name2 ||
' = nvl(:p_total2,0), ' || p_col_name3 || ' = nvl( :p_total3,0), '
|| p_col_name4 || ' = nvl(:p_total4,0), '|| p_col_name5 ||
' = nvl(:p_total5,0), '|| p_col_name6 || ' = nvl(:p_total6,0) '
|| ' WHERE IDS_KEY = :l_pk ';
l_query := 'INSERT INTO opi_ids_push_log(IDS_KEY,trx_date,organization_id,Push_flag';
IF(selector = 1) then
l_query := l_query || ' ,' || p_col_name1;
IF(selector = 1) then
l_query := l_query || ', Nvl(:p_total1,0) )';
edw_log.put_line('Error in Insert_update_push_log prodedure ');
END Insert_update_push_log;