Thursday, 2 January 2014

Oracle APPS R12:Daily Stock Ledger Query

The query helps to fetch onhand quantity of the item,average cost of the item,last_receipt_date and last_issue_date of the item.

SELECT msi.segment1 item_code, msi.description, moq.transaction_quantity,
       moq.subinventory_code,
       (SELECT MAX (transaction_date)
          FROM mtl_material_transactions mmt,
               mtl_transaction_types mtt
         WHERE mmt.inventory_item_id = moq.inventory_item_id
           AND mmt.organization_id = moq.organization_id
           AND mmt.transaction_type_id = mtt.transaction_type_id
           AND mtt.transaction_type_name = 'PO Receipt') last_receipt_date,
       (SELECT MAX (transaction_date)
          FROM mtl_material_transactions mmt,
               mtl_transaction_types mtt
         WHERE mmt.inventory_item_id = moq.inventory_item_id
           AND mmt.organization_id = moq.organization_id
           AND mmt.transaction_type_id = mtt.transaction_type_id
           AND mtt.transaction_type_name = 'Move Order Issue')
                                                              last_issue_date,
       msi.attribute15 stores_type, moq.locator_id,
       mil.segment1 || mil.segment2 bin_location, mil.segment3 department,
       cicd.item_cost unit_price,
       (moq.transaction_quantity * cicd.item_cost) value
  FROM mtl_onhand_quantities moq,
       mtl_system_items_b msi,
       mtl_item_locations mil,
       cst_item_cost_details cicd,
       cst_cost_types cct
 WHERE moq.inventory_item_id = msi.inventory_item_id
   AND moq.organization_id = msi.organization_id
   AND moq.locator_id = mil.inventory_location_id(+)
   AND cicd.inventory_item_id = msi.inventory_item_id
   AND cicd.organization_id = msi.organization_id
   AND cicd.cost_type_id = cct.cost_type_id(+)
   AND cct.cost_type(+) = 'AvgRates'
   AND msi.segment1 = 'Test Item'
   AND msi.organization_id = 8031

1 comment:

  1. Please share me a query on material in transit ie, sent from one inv org for another inv org by using ISO but not received at 2nd inv org quantity and value

    ReplyDelete