SELECT   SUM (target_qty),
        item_id
FROM     (SELECT   moqv.subinventory_code subinv,
                  moqv.inventory_item_id item_id,
                  SUM (transaction_quantity) target_qty
         FROM     mtl_onhand_qty_cost_v moqv
         WHERE    moqv.organization_id = :org_id
         AND      moqv.inventory_item_id = :item_id
         GROUP BY moqv.subinventory_code,
                  moqv.inventory_item_id,
                  moqv.item_cost
         UNION
         SELECT   mmt.subinventory_code subinv,
                  mmt.inventory_item_id item_id,
                  -SUM (primary_quantity) target_qty
         FROM     mtl_material_transactions mmt,
                  mtl_txn_source_types mtst
         WHERE    mmt.organization_id = :org_id
         AND      transaction_date >= TO_DATE (:hist_date) + 1
         AND      mmt.transaction_source_type_id =
                                              mtst.transaction_source_type_id
         AND      mmt.inventory_item_id = :item_id
         GROUP BY mmt.subinventory_code,
                  mmt.inventory_item_id) oq
GROUP BY oq.item_id
🔹 Join the OracleApps88 Telegram Group - Stay up to date with the latest on Oracle EBS R12 and Oracle Cloud/Fusion Applications. 📌 Telegram Group : https://t.me/OracleApps88
💡 Facing issues copying code/scripts or viewing posts? We're here to help!
📬 Contact on Telegram : https://t.me/apps88
📱 Telegram/WhatsApp: +91 905 957 4321
📧 Email Support: OracleApp88@Yahoo.com
Wednesday, June 22, 2011
On Hand Quantity on any historical date Query
Subscribe to:
Post Comments (Atom)
If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
 

 
 Get Flower Effect
Get Flower Effect
4 comments:
Thanks This really helped me
what is the use of MTL_TXN_SOURCE_TYPE table in the second query?
Thanks...good one
Thanks, very useful query indeed
Post a Comment