Tuesday, 25 October 2011

INVOICE_ISSUE_query

SELECT DISTINCT
             mmt.TRANSACTION_ID,
             MTT.TRANSACTION_TYPE_NAME TRANSACTION_TYPE,
         mmt.SOURCE_CODE SOURCE_CODE,
         mmt.TRANSACTION_SOURCE_NAME TRANSACTION_SOURCE,
         OOD.ORGANIZATION_CODE ORGANIZATION_CODE,
         MMT.SUBINVENTORY_CODE SUBINVENTORY_CODE,
         msi.segment1 INVENTORY_ITEM,
         mmt.REVISION REVISION,
         glcc.CONCATENATED_SEGMENTS DISTRIBUTION_ACCT,
         mmt.TRANSACTION_QUANTITY TRANSACTION_QTY,
         mmt.TRANSACTION_UOM TRANSACTION_UOM,
         mmt.TRANSACTION_DATE TRANSACTION_DATE,
         '' LINE,
         mmt.TRANSACTION_COST TRANSACTION_COST,
         '' FM_SERIAL_NUMBER,
         '' TO_SERIAL_NUMBER,
         '' ENTITY_TYPE,
         mmt.FLOW_SCHEDULE FLOW_SCHEDULE,
         '' SCHEDULE_TYPE
  FROM   mtl_material_transactions mmt,
         mtl_transaction_types mtt,
         ORG_ORGANIZATION_DEFINITIONS OOD,
         MTL_SYSTEM_ITEMS_B MSI,
         GL_CODE_COMBINATIONS_KFV GLCC
 WHERE       MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
         AND OOD.ORGANIZATION_ID = MMT.ORGANIZATION_ID
         AND MSI.INVENTORY_ITEM_ID = MMT.INVENTORY_ITEM_ID
         AND MSI.ORGANIZATION_ID = OOD.ORGANIZATION_ID
         AND GLCC.CODE_COMBINATION_ID=MMT.DISTRIBUTION_ACCOUNT_ID
         AND TRUNC (TRANSACTION_DATE) BETWEEN '01-JUL-2011' AND '31-JUL-2011'
         AND OOD.SET_OF_BOOKS_ID = 5
         ORDER BY OOD.ORGANIZATION_CODE

No comments:

Post a Comment