Inventory Movement Query

Hi,
I need to create a query like this :
This query will be generated by period, for example I want to collect data for period : Feb-01-2014 'til Feb-28-2014
Beginning Balance = Ending Balance qty at end of January 2014
Ending Balance = Ending Balance qty at Feb-28-2014 and will be beginning balance for March-01-2014
Any clue/tips/guidance to create this query ?
Thanks

Hi Ivan,
Please check below query.
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @Group nvarchar(10)
Declare @Whse nvarchar(10)
Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]')
Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]')
Set @Group = (Select Max(s2.ItmsGrpCod) from dbo.OITB S2 Where S2.ItmsGrpNam = '[%2]')
Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = '[%3]'  )
Select
@Whse as 'Warehouse',
a.Itemcode,
max(a.Dscription) as 'Description',MAX(a.Price) as 'Price',
sum(a.[Opening Balance]) as [Opening Balance],
sum(a.[IN]) as [Receipt],
sum(a.OUT) as [Issue],
((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing,
( MAX(a.Price) *  ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) ) as ClosingValue
from(
Select
N1.Warehouse,
N1.Itemcode,
N1.Dscription,N1.Price,
(sum(N1.inqty)-sum(n1.outqty)) as [Opening Balance],
0 as [IN],
0 as OUT
From dbo.OINM N1
Where
N1.DocDate < @FromDate and N1.Warehouse = @Whse
Group By
N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
Union All
select
N1.Warehouse,
N1.Itemcode,
N1.Dscription,N1.price,
0 as [Opening Balance],
sum(N1.inqty) as [IN],
0 as OUT
From dbo.OINM N1
Where
N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and
N1.Inqty >0
and N1.Warehouse = @Whse
Group By
N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
Union All
select
N1.Warehouse,
N1.Itemcode,
N1.Dscription,N1.price,
0 as [Opening Balance],
0 as [IN],
sum(N1.outqty) as OUT
From dbo.OINM N1
Where
N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and
N1.OutQty > 0
and N1.Warehouse = @Whse
Group By
N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a, dbo.OITM I1
where
a.ItemCode=I1.ItemCode and
I1.ItmsGrpCod = @Group
Group By
a.Itemcode
Order By a.Itemcode
Hope this help
Regards::::
Atul Chakraborty

Similar Messages

  • Inventory Movement Types in 6.0

    Hello -
    We are upgrading to ECC 6.0 and are unsure what to do about losing the config for former transaction OFBW; where we indicated what inventory movement types were budget relevant.  In our 6.0 test client we tested all the goods issue movement types we use and they all update FM as we expect them to and this is without affecting the derivation for the loss of transaction OFBW.  I doubt the system is pulling from this former config that is no longer present in 6.0 (even thought we can still diplay this in 6.0).  Note that I was able to successfully affect the derivation table to now derive the warehouse funds centers, since we lost that config in 6.0 too (former transaction FMLF).
    Should we be concerned that things are working in 6.0 as they have in the past for the movement types without us affecting anything for this to happen?
    Any thoughts?
    Colleen

    Hello Colleen
    You should review this note:
    700485 PSM: Convert customizing for warehouse funds ctr scenarios     
    There is also some useful documentation in the online help, see the attached link , chapter 'Recording Actual and Commitment Data  ->Integration with Materials Management '
    Hope it helps
    Kind regards
    Mar

  • Any Std SAP Report on Inventory Movement Bulk MAterials & Back Flushed item

    Hello
    Is there any  Standard  SAP Report on Inventory Movements for Bulk Materials and Back flushed items ?

    hi
    try
    MC.9 - INVCO: Material Analysis Selection, Stock
    MC.B - INVCO: Material Analysis Selection, Turnover
    MC50 - INVCO: Analysis of Dead Stock
    MC42 - INVCO: Range of Coverage by Usage Value
    MC44 - INVCO:Analysis of Inventory Turnover
    try searching in SAP1 and SAP2 
    regards
    kunal

  • Inventory Movement Report.

    Hi all,
    Could you please provide information for the report -
    Inventory Movement Report.  It require vendor, invoice doc, goods receipt doc, and payment details in report.
    Thanks & Regards
    praveen
    [email protected]

    In which reports you found the details

  • Inventory Ageing query performance

    Hi All,
       I have created inventory ageing query on our custom cube which is replica of 0IC_C03. We have data from 2003 onwards. the performance of the query is very poor the system almost hangs. I tried to create aggregates to improve performance but its failed. What i should do to improve the performance and why the aggregate filling is failed. Cube have compressed data. Pls guide.
    Regards:
    Jitendra

    Inaddition to the above posts
    Check the below points ... and take action accordingly to increase the query performance.
    mainly check --Is the Cube data Compressed. it will increase the performance of the query..
    1)If exclusions exist, make sure they exist in the global filter area. Try to remove exclusions by subtracting out inclusions.
    2)Check code for all exit variables used in a report.
    3)Check the read mode for the query. recommended is H.
    4)If Alternative UOM solution is used, turn off query cache.
    5)Use Constant Selection instead of SUMCT and SUMGT within formulas.
    6)Check aggregation and exception aggregation on calculated key figures. Before aggregation is generally slower and should not be used unless explicitly needed.
    7)Check if large hierarchies are used and the entry hierarchy level is as deep as possible. This limits the levels of the hierarchy that must be processed.
    Use SE16 on the inclusion tables and use the List of Value feature on the column successor and predecessor to see which entry level of the hierarchy is used.
    8)Within the free characteristics, filter on the least granular objects first and make sure those come first in the order.
    9)If hierarchies are used, minimize the number of nodes to include in the query results. Including all nodes in the query results (even the ones that are not needed or blank) slows down the query processing.
    10)Check the user exits usage involved in OLAP run time?
    11)Use Constant Selection instead of SUMCT and SUMGT within formulas.
    12)
    Turn on the BW Statistics: RSA1, choose Tools -> BW statistics for InfoCubes(Choose OLAP and WHM for your relevant Cubes)
    To check the Query Performance problem
    Use ST03N -> BW System load values to recognize the problem. Use the number given in table 'Reporting - InfoCubes:Share of total time (s)' to check if one of the columns %OLAP, %DB, %Frontend shows a high number in all InfoCubes.
    You need to run ST03N in expert mode to get these values
    based on the analysis and the values taken from the above  - Check if an aggregate is suitable or setting OLAP etc.
    Edited by: prashanthk on Nov 26, 2010 9:17 AM

  • Error when trying to run the Inventory Turnover query

    When I try to run the Inventory Turnover query I get the following error message (I can run other queries that I checked):
    <internal error> Receiving from the BW server failed
    BW server raised exception: SYSTEM_FAILURE
    Do you want to see more information
    When I click to see more information the message is
    INCLUDE INCL_INSTALLATION_ERROR
    Error Group
    RFC_ERROR_SYSTEM_FAILURE
    Message
    &INCLUDE INCL_INSTALLATION_ERROR
    Can someone advise? Thanks

    Thanks for that the note was not relevant in this case but ST22 dump indicated:
    The current program had to be terminated because of an              
    error when installing the R/3 System.                               
    The program had already requested 275725392 bytes from the operating
    system with 'malloc' when the operating system reported after a     
    further memory request that there was no more memory space          
    available.                                                          
    Thanks have awarded points

  • Inventory movement using logic script - BPC NW 10

    Hello BPC experts,
    I'm working on inventory movement using logic script. The idea is that the initial stock of the first period equals the final stock of the previous period.
    Here is an example of my inventory report : (Dimension INVT in function of dimension TIME)
                                                  2014.01       2014.02      2014.03        2014.04
    F01 Stock first period                  12            
    F02 Initial Stock                          12                 11              10                 9
    F03 Inventory Inputs                    2                   4                6                   8
    F04 Inventory Outputs                 3                   5                7                   9
    F05 Final Stock                          11                 10               9                   8
    The Stock of the first period is entered
    The initial Stock = Stock first period (12 in our case)
    Inventory inputs and Outputs are entered
    Final Stock = Initial Stock + Inventory Inputs - Inventory Outputs
    I tried the following script but it does not work :
    *XDIM_MEMBERSET TIME = 2014.01 //we should then retrieve the first period of each year which is not necessary the first month of the year
    *WHEN TIME
    *IS 2014.01
    *REC(EXPRESSION = [INVT].[F01], INVT = F02)
    *ENDWHEN
    *SELECT(%TIME_LIST%,"[ID]","TIME","[PREVMEMBER]"<>"") // PREVMEMBER is a property of TIME
    *XDIM_MEMBERSET TIME = %TIME_LIST%
    *XDIM_MEMBERSET INV = F05
    *WHEN TIME
    *IS %TIME_LIST%
    //Something is missing here.. How to retrieve F05 values related to all periods and copy them in F02
    *REC(EXPRESSION =[INVT].[F05],INVT = F02)
    *ENDWHEN
    Please how can I achieve this ?
    Thanks
    Maha

    Hi Vadim,
    Thank you for your reply
    I'm working with BPC NW 10 SP 05 (CPMBPC 801 SP 05), Engine ABAP
    My model contains the following dimensions ACCOUNT (A), TIME (T), CATEGORY (C), ENTITY (E), CURRENCY (R), INVT (User Def)
    In the INVT dimension we have members like (Stock first period, Initial Stock, Inventory Inputs, Inventory Outputs, Final Stock)
    - [INVT].[Stock first period] is entered
    - [INVT].[Initial Stock] = [INV].[Stock first period]
    - [INVT].[Inventory input] and [INVT].[Outputs] are entered
    - [INVT].[Final Stock] = [INVT].[Initial Stock] + [INVT].[Inventory Inputs] - [INVT].[Inventory Outputs]
    We want to calculate Initial Stock in DEFAULT.lgf :
    [INVT].[Initial Stock] when (TIME=2014.01) = [INVT].[Stock First Period] when (TIME= 2014.01)
    [INVT].[Initial Stock] when (TIME=2014.02) = [INVT].[Final Stock] when (TIME= 2014.01)
    [INVT].[Initial Stock] when (TIME=2014.03) = [INVT].[Final Stock]  when (TIME=2014.02)
    [INVT].[Initial Stock] when (TIME=2014.04) = [INVT].[Final Stock]  when (TIME=2014.03)
    When a user enters the values of "Stock first period", "Inventory Inputs" and "Inventory Outputs", Initial Stock and Final stock should be calculated via logic script
    Regards
    Maha

  • OPM Actual Cost Process not selecting all Inventory Movements

    We have completed 27 Move Immediate transactions (TRNI) but only 2 of the transactions appear in the Actual Cost Transactions View so our PMAC cost is not as expected. Those 2 transactions were in Sept '09. All other transactions happened in Apr, May, Jun of 2009. On July 7 the profile option "GMF: Include Inventory Movements in Actual Cost" was changed to YES. Does this mean that the Actual Cost Process will not pick up those move immediate transactions that occured before July 2009?
    Robert Lovell

    Hi Robert
    Yes...exactly, since you have closed all the said periods before u run your Actual cost process, and later you changed your profile option.
    If you want, that all the transactions (TRNI) to be in Actual process as View, Functionally (I mean from front end) it is not possible now, but u can make use of PL/SQL Language by means of technical help then you can open those periods from back end and then do the set up from front end, and then you may able to view those transactions.
    It is purely technical help and require some gud stuff to do this.
    Regards
    Raj

  • Inventory Turnover Query

    I am trying to run the Inventory Turnover Query and get the following messages:
    Warning maximum number of rows (65535) exceeded.  Result is incomplete
    There is not enough space to display all the rows of the query results
    How can I overcome this? Thanks

    hi Niten,
    run the query in browser ('display query on the web'),
    or use web tempate / web reporting.
    ms-excel has limitation max 65535 rows.
    hope this helps.

  • Inventory movement

    hi
    i am implementing obia from e-biz supply chain management.i want to know what is meant inventory movement and from where it is coming
    regards
    mervin

    Hello FICO MOH,
    <b>" then if there has been no movement since 30 days need the valuation of the material."</b>
    This sentence is not clear. Please ellobrate.
    btw, for material movements with batch you can use the MB5B / MB51 report which will give information on material movements. The table you can use for material movements is MSEG and for valuation you can use MBEW and MBEWH (History table for previouse period valuation).
    Hope this helps.
    Regards
    Arif Mansuri

  • Inventory movement takes away delivery note picked qty.

    We have a situation that delivery note is created and picking is saved. 
    Inventory movement such as “MB1A, MB1B, MB1C” or Post Goods Issue, the system will only check available inventory and not worry about confirmed and/or committed quantities.  And take away picked qty from delivery note.  Is this a SAP standard behavier or we are missing some setting?
    Thanks,
    Dori

    Hi,
    It is a standard behaviour of the system : some movements must have priority against sales requirement : if you need to scrap the goods, if you need to return the goods to the vendor, if you want to put the goods from unrestricted stock to quality or blocked stock, ..., idem with a change of storage location, ...
    If you really want to avoid this, there is some customizing in inventory management :(spro + MM + IM + outbound and transfers + availability checks or somethng like this) : like in SD for sales orders and deliveries, you will be able to decide by movement type and transaction what kind of stock you want to take into account.
    But, from what I know, no one excluded sales requirements. But we are in an SD forum
    Rgds,
    Philippe

  • Need Inventory transfer query with bIn location information

    Dear Team,
    Please help me to create the query for inventory transfers with bin location information.
    WTR19 field is empty so that i have checked with tables OINM,OILM,OBTL
    But how can i link this tables..?
    Regards
    Sanu.

    Dear AndakondaRamudu,
    In the mentioned link i had already checked .I need the item movement bin transactions report inventory transfer using a parameter with UDF..
    Regards
    Ajith

  • Physical Inventory Movement Block not Rest at Storage Location Level

    Hi,
    We are facing a typical problem in our Production System and the issue is as follows:
    1. We have created a Physical Inventory Document for a material with Freeze Book Inventory and Posting Block indicators.
    2. We completed the count and entered the same with reference to the PI Document.
    3. We reconciled and posted the differences in the system.
    4. We still find that in Material Master the Physical Inventory block for material movements was not reset automatically at the Storage Location stock view.
    Please help us urgently as all our Goods movements for this material are held up.
    Thanks

    Hi,
    I am able to see 4 PIDs in MI22 for my material.
    2 docs pertaining to the latest Annual Physical Inventory in 2010.
    These documents are for the same material in the same plant but for different Storage Locations. Out of which when i see the Material Master - Storage Location view, i see that the Physical Inventory Block "X" is set for one of the Storage Locations.
    The PID for the Storage Location with this Physical Inventory Block for Movements indicator, is already settled (Count done and no differences in physical and book stock in this storage location).
    The problem persists and i need to remove the posting block which was not reset.

  • INVENTORY INFO - QUERY

    We have inventory at following locations:
    1) Plant
    2) Subcontractors
    3) Storage
    4) In Transit
    How can I create a report which will show me where inventory is and how much it is worth and be able to go back in time and find out where this inventory was?
    Really stuck in a bad jam here so any feedback is appreciated.....
    Thank you

    Hi,
    To ge the Inventory info, In Material Master, We have view called Plant Stock. In this view you can get the stock of that particular material in that plant/ Storage Location. The corresponding table is MARD.
    Now Another view in accounting, you have Moving avg.Price/ Std. Price. Multiply the amount and the quantity at that plant/ Storage location. Then you will get the inventory value of that particular material.
    In the case of subcontracting, Pick up the material documents with the movement type 541(there should not be 101 movement type document for this 541)  and  Sum up them and multiply with price of the material.
    Find the T.codes  MMBE Or MB5T For more clarifications.
    Regards,

  • Inventory: Movement after count with post date before the count date.

    Hi,
    We have stock movements all the days of the week.
    We conduct physical inventories on Sunday mornings. There are not stock movements on Sunday mornings (stock movements on Sunday starts at night).
    Usually we create the SAP Physical Inventory Document on Fridays, assigning Saturday as the Planned Count Date.
    We enter the SAP Physical Inventory Count on Sunday (at the end of the count) or on Monday.
    How you recommend us to use SAPu2019s Physical Inventory feature in order to calculate the Book Inventory considering all stock movements with posting date less than or equal to Saturday?
    Please, suggest us a solution that If we register a movement after we enter the count but with post date before the count date (and the count is not posted yet), the Book inventory is modified accordingly.
    Thanks in advance for your support!!

    SAP takes the book inventory in the moment you enter the count.
    Best you set  block movements , this block will be removed automatically when you enter the count. So you can prevent users from posting until you have entered the count.
    If you set the freeze book inventory, then SAP takes the book inventory in the moment you create the document.
    This is not a good way if you still have movements after inventory document creation and actual count.
    You have to make sure - organisational  wise, outside SAP - that all movements that happened before inventory count  are posted before you start entering the count. There is nothing in SAP that can help you in this case.

Maybe you are looking for