In this Document

 Goal
 Solution
 References

APPLIES TO:

Oracle Inventory Management - Version 11.5.10 and later
Information in this document applies to any platform.
This document includes all versions of 11i and R12 and later

Checked for relevance on 29-JUN-2014

GOAL

How to link the TRANSACTION_SOURCE_ID to TRANSACTION_SOURCE_TYPE_ID of table MTL_MATERIAL_TRANSACTIONS and MTL_MATERIAL_TRANSACTIONS_TEMP?

How to understand the value of TRANSACTION_SOURCE_ID, in order to join it to prymary source table (ex Sales Order, Purchase Order)?

SOLUTION

See the correnpondances below:
a)TRANSACTION_SOURCE_ID: Job or Schedule WIP_ENTITIES.WIP_ENTITY_ID
TRANSACTION_SOURCE_TYPE_ID = 5

b) TRANSACTION_SOURCE_ID: Sales Order MTL_SALES_ORDERS.SALES_ORDER_ID
TRANSACTION_SOURCE_TYPE_ID = 2, 8, 12, 13

c) TRANSACTION_SOURCE_ID: Account Alias MTL_GENERIC_DISPOSITIONS.DISPOSITION_ID
TRANSACTION_SOURCE_TYPE_ID = 6

d) TRANSACTION_SOURCE_ID: Purchase Order PO_HEADERS_ALL.PO_HEADER_ID
TRANSACTION_SOURCE_TYPE_ID = 1

e) TRANSACTION_SOURCE_ID: Account GL_CODE_COMBINATIONS.CODE_COMBINATION_ID
TRANSACTION_SOURCE_TYPE_ID = all others

A useful select to find the specific source number and link it to TRANSACTION_SOURCE_ID is:

SELECT MMTT.TRANSACTION_SOURCE_ID,
CASE WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 1 THEN (SELECT 'RSH_NUMBER: ' || RCV.SHIPMENT_NUM 
FROM RCV_SHIPMENT_HEADERS RCV,
RCV_TRANSACTIONS RCVT
WHERE RCV.SHIPMENT_HEADER_ID = RCVT.SHIPMENT_HEADER_ID
AND RCVT.TRANSACTION_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 2 THEN (SELECT 'SO_NUMBER: ' || SEGMENT1
FROM MTL_SALES_ORDERS
WHERE SALES_ORDER_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 4 THEN (SELECT 'MO_NUMBER: ' || REQUEST_NUMBER
FROM MTL_TXN_REQUEST_HEADERS
WHERE REQUEST_NUMBER = TO_CHAR(MMTT.TRANSACTION_SOURCE_ID))
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 5 THEN (SELECT 'WIP_NUMBER: ' || WIP_ENTITY_NAME
FROM WIP_ENTITIES
WHERE WIP_ENTITY_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 7 THEN (SELECT 'INT_REQ_NUMBER: ' || RCV.SHIPMENT_NUM 
FROM RCV_SHIPMENT_HEADERS RCV,
RCV_TRANSACTIONS RCVT
WHERE RCV.SHIPMENT_HEADER_ID = RCVT.SHIPMENT_HEADER_ID
AND RCVT.TRANSACTION_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 8 THEN (SELECT 'INT_SO_NUMBER: ' || SEGMENT1
FROM MTL_SALES_ORDERS
WHERE SALES_ORDER_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 10 THEN (SELECT 'PHY_NAME: ' || PHYSICAL_INVENTORY_NAME
FROM MTL_PHYSICAL_INVENTORIES
WHERE PHYSICAL_INVENTORY_ID = MMTT.TRANSACTION_SOURCE_ID)
WHEN MMTT.TRANSACTION_SOURCE_TYPE_ID = 13 THEN (SELECT 'WIP_NUMBER: ' || WIP_ENTITY_NAME
FROM WIP_ENTITIES
WHERE WIP_ENTITY_ID = MMTT.TRANSACTION_SOURCE_ID)
ELSE 'NULL' END SRC_NUMBER 
FROM MTL_MATERIAL_TRANSACTIONS_TEMP MMTT.

05-11 13:42