Query the ON-hand Quantity at spacefic time

hi all
i'm a new to oracle apps
please keeptrack with me the following scenario of transactions on an item(FIFO COST Method) on the mtl_onhand_quantities_detail table
at 30/08/2010 we make receipt to the item x to sub inventory 1 with quantity 22
at 31/08/2010 we make receipt to the item x to sub inventory 1 with quantity 29
at 04/08/2010 we make receipt to the item x to sub inventory 1 with quantity 13
Now if we query the onhand to that item on 04/09/2010 will get 22+29+13 = 64
at 05/09/2010 we make sales order with 3 quanity for this item and make pick release for it from sub inv 1 to stage sub inv now the mtl_onhand_quantities_detail table is like as
30/08 19 for subinv 1
31/08 29 for subinv 1
04/09 13 for subinv 1
05/09 3 for subinv Stage
now i want to get the status of on the onhand for this item at 04/09/2010
by logic at this time i have 22+29+13 = 64
if i make the summation till that day it will decrease 3 from the onhand although i pick the 3 at 05/09
i want a query to get the onhand at 04/09 to result 64 how can i get it?
and if i make order for all quantities for this item and ship confirm it then the table will contain the quantity 0 for this item how can i get the hostirical quantities
thanks ?
Edited by: Marsafy on Sep 5, 2010 10:21 AM

You can get historical quantities by adding up quantities in the mtl_material_transactions table.
select sum(transaction_quantity) from mtl_material_transactions where transaction_date < '05-Sep-2009' and organization_id=&org and inventory_item_id=&itemid
If you don't have index on the transaction_date field, this query will be inefficient. So if you have to do this query multiple times a day, you may have to create an index.
Hope this helps
Sandeep Gandhi
Omkar Technologies Inc.
Independent Techno-functional Consultant
513-325-9026

Similar Messages

  • How to get the current On-Hand Quantity of an item?

    Hi,
    I want to get the on-hand quantity of items from backend,
    When i use the table mtl_onhand_quantities :
    SELECT msi.segment1, msi.organization_id, SUM (moq.transaction_quantity)
    FROM mtl_system_items_b msi, mtl_onhand_quantities moq
    WHERE moq.organization_id(+) = msi.organization_id
    AND moq.inventory_item_id(+) = msi.inventory_item_id
    and moq.ORGANIZATION_ID = 1006
    and msi.SEGMENT1 = '14003-0063'
    GROUP BY msi.segment1, msi.organization_id
    I get a quantity that is different than the one i get from front end. (On-Hand Quantity Screen)
    The mtl_onhand_quantities shows quantities when received only , but it doesn't count the transactions done on the item.
    How can i get the correct current on hand quantity of an item ?
    Thanks,
    Joe

    I think you guys in this way are getting only the on hand quantity that we inserted when we first created the item...
    I think we should also calculate whatever transactions happened on that item ..
    i found this little program, please let me know if you think it's the correct way :
    FUNCTION CF_LAST_BALFormula RETURN NUMBER IS
    v_onhand_qty NUMBER;
    v_last_qty NUMBER;
    v_target_qty NUMBER;
    BEGIN
    SELECT SUM(transaction_quantity)
    INTO v_onhand_qty
    FROM mtl_onhand_quantities_detail
    WHERE inventory_item_id = :inventory_item_id
    AND organization_id = :organization_id
    AND subinventory_code = :Subinventory;
    SELECT NVL(SUM(Transaction_quantity),0)
    INTO v_last_qty
    FROM mtl_material_transactions
    WHERE inventory_item_id = :inventory_item_id
    AND organization_id = :organization_id
    AND subinventory_code = :Subinventory
    AND trunc(creation_date)>= :p_last_date;
    v_target_qty:=(v_onhand_qty)-(v_last_qty);
    RETURN( v_target_qty);
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 0;
    END;

  • On-hand quantity.

    Hi All,
    When i query to see the on-hand quantity for a item, it does not show me any. The form was doing that earlier but it does not do now.
    Was wondering if any profile option/role has anything to do with it. M on R12
    Ashish

    I have OHQ in all of the sub-inventory for the items.
    But some how it would not enable the buttons on the form to view the availability...
    I checked the tables they look perfect, but the form is greyed and it would not show up any data.
    THis is not specific to one sub-inventory its happening for all of them..
    Any suggestions...
    Ashish

  • View On-Hand Quantity in various kind of UOM

    Hi all. I need to know if I can view the on hand quantity in diferent UOM (primary-secondary and all conversions configured by item)
    thanks a lot
    11.5.10

    Can you post a link?

  • I had to change my Hard Drive, now I want to work on files in iWeb, but can't access Time Machine before yesterday. The dates are there on the right hand side but are greyed out before yesterday when I changed my HD. How do I access anything from before.

    I had to change my Hard Drive, now I want to work on files in iWeb, but can't access Time Machine before yesterday. The dates are there on the right hand side but are greyed out before yesterday when I changed my HD. How do I access anything from before?

    Start with B5/6 in the 1st linked article.
    Time Machine Troubleshooting
    Time Machine Troubleshooting Problems

  • How do i get the bookmarks showing all the time on the left hand side of my screen?

    I used to have my bookmarks showing in a coloumn on the left hand side of my screen all the time. My niece managed to get rid of it. how do i get it back?

    Press F10 or tap the Alt key to bring up the "Menu Bar" temporarily if the Menu Bar is hidden.

  • Hi i  insttalled the free trial 3O days MacScan on OsX10.5 is it normal that for full scaning it takes so long time more even than one day?! on the other hand this application hasn't any uninstaller on image disc ,so how can i uninstal it from my hard?

    Hi i  insttalled the free trial 3O days MacScan on OsX10.5 is it normal that for full scaning it takes so long time more even than one day?! on the other hand this application hasn't any uninstaller on image disc ,so how can i uninstal it from my hard?Thanks

    Get rid of the tracking cookies. They are used to profile and track your browsing history. While they are privacy invading, by calling them spyware, MacScan is being a little dramatic in trying to sell you its crap. And in the future, for whatever browser you use, don't allow third-party cookies.
    To prevent tracking, get Ghostery. In addition to having Ghostery and forbidding third-party cookies, I clear out all cookies from one browsing session to another. If you always do that, you won't have any tracking cookies to worry about, so you won't need MacScan to find them for you. Btw, MacScan finds the tracking cookies in the first few minutes of scanning; if you want to use it for that, then that's all the time you need to run it for. But, as I said, you won't have any tracking cookies around if you just remove all cookies and don't allow third-party cookies. As soon as you visit a site that needs them, you'll just get new ones. No problem.
    Read all about cookies here.
    http://en.wikipedia.org/wiki/HTTP_cookie

  • Just upgraded...why can't I see the information section on the left hand side anymore in iphoto '11? I used it all the time.

    I've just upgraded from iphoto '08 to iphoto '11 and I'm really missing the information pane on the bottom left hand side (under where events, album, libraries etc are).  I used to use this all the time when importing photos to sort them into Events and now I can't seem to get it back.  Does it not exist in the new iphoto?  Thanks, Hellen

    That info section is a drawer on the right hand side of the iPhoto window.  Click on the Info button at the lower right corner:
    Click to view full size
    OT

  • How to query the Date/Time Dataype

    Hi,
    I am trying to query the database with Data/Time Datatype.
    String date=request.getParameter("date");
    String month=request.getParameter("month");
    String year=request.getParameter("year");
    String tosearch=month+"/"+date+"/"+year;
    String getTable="select * from tableRes where dmy='"+tosearch+"'";I would like to know why it is not working?
    I ran through tomcat and it appeared this error:
    Data type mismatch in criteria expression.
    Thanks!

    pramudya81 wrote:
    Rock,
    May I know more detail on your specs?
    What is your DB? Or how is exactly you execute the sql.
    to_date is anyway an Oracle syntax.
    So I guess your DB might be an SQL Server.
    to_date for oracle is equivalent as Convert in SQL Server
    example Select Convert(datetime ,'2002/01/01')
    Hope it works nowBad idea. See reply 1.

  • OTL I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?

    Hi
    I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?
    I basically need person name who submitted, date - time it was submitted for approval, then the person who approved it and the date - time that it was approved
    Thanks
    Ruby

    Ruby,
    you can start with HXC_TIMECARD_SUMMARY table for submitter detail. But for approver details, i think you need WF tables to get the data for item type HXCEMP.

  • How to Query the Employment Status of an Employee in Time Evaluation

    Hi SAPGurus,
    Does any one have an idea as to how to query an employee's Employment Status in Time Evaluation.
    Looking forward to hear from you soon.
    Regards,
    Aslam

    Arun,
    Thanks, for your reply. I was looking for a way to query the Field: P0000-STAT2 ie: employment status in Time Evaluation. I am aware of the way I can query an employee's Time management status ie: P0007-ZTERF. Would be great if you know a way to query it in Time Evaluation.
    Thanks Again.
    Regards,
    Aslam

  • Item on hand quantity in Webtools why does it not mirror the qty in Sap

    When you look in web tools administration catalogue and items and find an item under financials it is showing the on hand qty which is different from the on hand qty in SAP Business One.
    Even after synchronisation please can you advise the reason for this. My customer is about to go live and is worried about this.
    Paulo at SAP suggested I post this out to you as I need  a solution

    Elaine, the standard functionality for webtools provides only for the 'available quantity' to be synchronised across from SAP Business One.
    The available quantity is a calculation as follows:
    Sum of ( On Hand Qty + Supplier Order Qty - Customer Order Qty ) for all warehouses
    If you want to base the stock availability flag shown in Webtools upon anything other than available quantity you will have to provide some form of custom update via SQL from B1 to Webtools and then modify the part detail page to refer to the required data for the current item.

  • When clicking a link normally - a new tab would open, but in this version a new window opens and there are 2 blue bars - the bar at the top of the browser and on the left hand side is a orange firefox button - Next time i start firefox it crashes!!!

    This window looks weird: there are 2 blue bars(the upper blue bar - normally there is 1, with the current page name and - Mozilla Firefox written in white inside of the bar) plus in the 2nd bar there is an orange firefox button, on the left hand side.
    I have already asked this question and was adviced to start in safe mode - this did not help either.
    Please help me quickliy, it is really annoying.
    Thanks
    Richard

    '''Firefox Crash'''
    Create a New Profile as a test to check if your current profile is causing the problems.
    -> Basic Troubleshooting: Make a New Profile
    * https://support.mozilla.com/en-US/kb/Basic%20Troubleshooting#w_8-make-a-new-profile
    -> If that New Profile works then you can recover your Bookmarks and Passwords from the Old Profile.
    -> Recovering important data from an old profile
    * https://support.mozilla.com/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile
    '''Opening Links in New Tab'''
    -> click '''Firefox''' button and click '''Options''' (or Tools Menu -> Options) -> Tabs panel -> place Checkmark on '''Open New Window in a New Tab instead''' -> click OK
    Check and tell if its working.

  • In Firefox 29.0, how can I pin the bookmarks so they are all displayed on the left hand side (all the time)?

    Before the Firefox 29.0 upgrade, I had my bookmark list constantly displayed on the left-hand side of the Firefox screen. How can I get that in version29.0?
    Right now I have to click on the bookmark button and then on Bookmark menu to get to see my bookmarks. I want them permanently "pinned" to the left-hand side of the screen. Just moving the bookmark button is not enough.

    You can find the "View Bookmarks Sidebar" in the drop-down list of the "Show your bookmarks" button that is the dropmarker part of the star on the Navigation Toolbar to bookmark the current page.
    There is also a "Show Sidebars" icon in the Customize palette that you can drag on a toolbar or the "3-bar" Firefox menu to have access to the same items that you see in "View > Sidebars" (tap the Alt key or press F10 to show the Menu bar).

  • HT1338 I am a 20 year Mac user.  I just downloaded a book for the first time using iTunes.  When I go to "Books" in the left hand margin of iTunes and click on the new book I downloaded, nothing happens. It gets hi-lighted, but  it doesn't open?

    I am a 20 year Mac user.  I downloaded a book from iTunes moments ago.  in iTunes, under the left hand margin "Books" when I select the book and double click on it, it doesn't open.  How do I read this book?  It won't give me an option to open with other apps, but isn't there a built in app?

    iBooks can not be read on macs, only on iDevices.

Maybe you are looking for