SELECT OOD.ORGANIZATION_CODE 组织,
MSI.SEGMENT1 物料编码,
MSI.DESCRIPTION 物料描述,
MMT.TRANSACTION_DATE 事务处理日期,
MMT.TRANSACTION_QUANTITY 事务处理数量,
MMT.TRANSACTION_UOM 事务处理单位,
MMT.PRIMARY_QUANTITY 主要数量,
MSI.PRIMARY_UOM_CODE 主要单位,
MMT.SUBINVENTORY_CODE 子库存,
--MMT.TRANSFER_SUBINVENTORY 转移子库存,
MMT.TRANSACTION_ID 事务处理标识,
MTST.TRANSACTION_SOURCE_TYPE_NAME 来源类型,
MGD.SEGMENT1 来源,
--MMT.TRANSACTION_SOURCE_NAME 来源,
MTT.TRANSACTION_TYPE_NAME 事务处理类型,
--ML.MEANING TRANSACTION_ACTION ,
MMT.TRANSACTION_REFERENCE 参考,
FU1.USER_NAME 创建者,
--MMT.CREATED_BY,
MMT.CREATION_DATE 创建日期,
FU2.USER_NAME 最后更新者,
--MMT.LAST_UPDATED_BY,
MMT.LAST_UPDATE_DATE 最后更新日期
FROM MTL_MATERIAL_TRANSACTIONS MMT,
MTL_TRANSACTION_TYPES MTT,
MTL_SYSTEM_ITEMS_B MSI,
MTL_TXN_SOURCE_TYPES MTST,
MTL_GENERIC_DISPOSITIONS MGD,
MFG_LOOKUPS ML,
FND_USER FU1,
FND_USER FU2,
ORG_ORGANIZATION_DEFINITIONS OOD
WHERE 1 = 1
--AND MMT.COSTED_FLAG IN ('N', 'E')
--AND TO_DATE('2009-07-28', 'YYYY-MM-DD') <= MMT.TRANSACTION_DATE
--AND MMT.TRANSACTION_DATE < =TO_DATE('2009-07-31', 'YYYY-MM-DD')
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.ORGANIZATION_ID = MSI.ORGANIZATION_ID
AND MMT.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID
AND MMT.TRANSACTION_SOURCE_TYPE_ID = MTST.TRANSACTION_SOURCE_TYPE_ID
AND ML.LOOKUP_TYPE = 'MTL_TRANSACTION_ACTION'
AND MMT.TRANSACTION_ACTION_ID = ML.LOOKUP_CODE
AND MTST.TRANSACTION_SOURCE_TYPE_NAME = 'Account alias'
AND MGD.DISPOSITION_ID = MMT.TRANSACTION_SOURCE_ID
AND MMT.ORGANIZATION_ID = OOD.ORGANIZATION_ID
AND MMT.CREATED_BY = FU1.USER_ID
AND MMT.LAST_UPDATED_BY = FU2.USER_ID
--AND MSI.SEGMENT1='1380FT0000271'
--AND MMT.TRANSACTION_ID=1018704
--ORDER BY MMT.TRANSACTION_DATE