0% found this document useful (0 votes)
167 views

Order Management: Query For Duplicate Transaction

The document contains 9 SQL queries that are checking for various conditions in Oracle inventory transaction tables: 1. The first query summarizes transaction data by type, organization, error code, date, and count. 2. The second query filters for transactions where the attribute14 field is null. 3. The third query selects all records from the mtl_parameters table. 4. The remaining queries check for duplicate transactions between different transaction tables and identify closed/cancelled orders or purged orders that have reservations but no transactions.

Uploaded by

Pratik Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views

Order Management: Query For Duplicate Transaction

The document contains 9 SQL queries that are checking for various conditions in Oracle inventory transaction tables: 1. The first query summarizes transaction data by type, organization, error code, date, and count. 2. The second query filters for transactions where the attribute14 field is null. 3. The third query selects all records from the mtl_parameters table. 4. The remaining queries check for duplicate transactions between different transaction tables and identify closed/cancelled orders or purged orders that have reservations but no transactions.

Uploaded by

Pratik Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

For MTL Transaction Interface Table Summary


select transaction_type_id, organization_id, substr(error_code, 1, 30),
substr(error_explanation, 1, 50), to_char(transaction_date, 'YYYY-MM'),
count(*)
from mtl_transactions_interface
group by transaction_type_id, organization_id, to_char(transaction_date,
'YYYY-MM'), substr(error_code, 1, 30), substr(error_explanation, 1, 50);
2. For internal Creation of Item:
select transaction_type_id, organization_id, substr(error_code, 1, 30),
substr(error_explanation, 1, 50), to_char(transaction_date, 'YYYY-MM'),
count(*)
from mtl_transactions_interface
where attribute14 is null
group by transaction_type_id, organization_id, to_char(transaction_date,
'YYYY-MM'), substr(error_code, 1, 30), substr(error_explanation, 1, 50);
3. For Org Parameter Details:
select * from mtl_parameters;
4. Check for Duplicate Transactions MMTT vs. MTI
select * from -- Check for Duplicate Transactions MMTT vs. MTI
mtl_material_transactions_temp b, mtl_transactions_interface a
where a.picking_line_id = b.picking_line_id
and a.trx_source_line_id = b.trx_source_line_id
and a.inventory_item_id = b.inventory_item_id
and b.transaction_type_id = a.transaction_type_id
and b.transaction_source_type_id in (2,8)
and b.picking_line_id is not null ;
5. Check for Duplicate Transactions MMT vs. MTI
select * from -- Check for Duplicate Transactions MMT vs. MTI
mtl_material_transactions b, mtl_transactions_interface a
where a.picking_line_id = b.picking_line_id
and a.trx_source_line_id = b.trx_source_line_id
and a.inventory_item_id = b.inventory_item_id
and b.transaction_type_id = a.transaction_type_id
and b.transaction_source_type_id in (2,8)
and b.picking_line_id is not null ;
6. Check for Duplicate Transactions MMT vs. MMTT
select * from -- Check for Duplicate Transactions MMT vs. MMTT
mtl_material_transactions b, mtl_material_transactions_temp a
where a.picking_line_id = b.picking_line_id
and a.trx_source_line_id = b.trx_source_line_id
and a.inventory_item_id = b.inventory_item_id
and a.organization_id = b.organization_id
and b.transaction_type_id = a.transaction_type_id
and b.transaction_source_type_id in (2,8)
and b.picking_line_id is not null ;
7. Identify Closed or Cancelled orders with Reservations
SELECT * -- Identify Closed or Cancelled orders with Reservations
FROM OE_ORDER_LINES_ALL L, MTL_RESERVATIONS M
WHERE M.PRIMARY_RESERVATION_QUANTITY>0
AND (nvl(L.CANCELLED_FLAG,'N')='Y' or nvl(L.OPEN_FLAG,'Y')='N')
AND L.LINE_ID = M.DEMAND_SOURCE_LINE_ID
AND NOT EXISTS (SELECT NULL FROM MTL_TRANSACTIONS_INTERFACE MTI
WHERE MTI.TRX_SOURCE_LINE_ID = L.LINE_ID
AND MTI.SOURCE_HEADER_ID = L.HEADER_ID
AND MTI.SOURCE_CODE = 'ORDER ENTRY')
AND NOT EXISTS (SELECT 1 FROM WSH_DELIVERY_DETAILS WDD
WHERE WDD.SOURCE_LINE_ID=L.LINE_ID
AND WDD.SOURCE_CODE ='OE'
AND WDD.INV_INTERFACED_FLAG IN ('N','P')
AND WDD.RELEASED_STATUS <> 'D');
8. Identify purged orders with reservations which are orphaned
SELECT * -- Identify purged orders with reservations which are orphaned
FROM MTL_RESERVATIONS MR,
MTL_SALES_ORDERS MSO
WHERE MSO.SALES_ORDER_ID=MR.DEMAND_SOURCE_HEADER_ID
AND MR.DEMAND_SOURCE_TYPE_ID IN (2,8)
AND MR.DEMAND_SOURCE_LINE_ID NOT IN (SELECT LINE_ID FROM OE_ORDER_LINES_ALL
WHERE LINE_ID=MR.DEMAND_SOURCE_LINE_ID );
9. INVCLRMO.sql identification in case of orphan pending transactions
select mtrh.header_id,mmtt.* -- INVCLRMO.sql identification in case of orphan pe
nding transactions
from mtl_material_transactions_temp mmtt,
mtl_txn_request_lines mtrl,
mtl_txn_request_headers mtrh
where mmtt.move_order_line_id IS NOT NULL
AND mmtt.move_order_line_id = mtrl.line_id
AND mtrl.line_status = 7
and mtrl.header_id = mtrh.header_id
and mtrh.move_order_type = 3
and not exists (
select 'Y'
from wsh_delivery_details
where move_order_line_id = mtrl.line_id
and released_status = 'S');

You might also like