Query:Opening STock value

hi all,
we want to get the value of opening stock
opening stock value on 1st of each month.
for e.g
Goods are received and issued upto 10th of september.stock is updated.
on 10th sep we want to get the opening stock for 1st sep.
report fileds that client want are:
Month Opening        Received                Issued               Qty        Value         Qty    Value          Qty      Val                
120         200            50     70                40       30                
How to get such report.
Thanks
Neetu

I started query Profiler,clicked on run....
but it is showing many lines.
how i can find the appropriate sql query.
For eg. I started SQL profiler,then i run sap-->>Inventory Adut report.
from where to get the query running behind Inventory adit report in SQL profiler
Thanks,
Neetu

Similar Messages

  • Table name for opening stock value

    Hi,
    Can some body tell me the table name & the field name for opening stock value,
    (This is when you pass the date through LSMW at initial stage and it gets sits in which table)
    For ex. MB5B
    rgds
    Sonu

    There are many stock tables in SAP.
    if you load unrestricted use stock with value, then the quantity is going to MARD, quantity and value to MBEW.
    if material is batch managed, then stock per batch is going to MCHB, but still MARD and MBEW are updated.
    if you load non-valuated stock (material type UNBW), then only MARD is updated, no MBEW entry.
    and much more cases for consignment, sales order stock etc etc.
    If you try to find the values more than a month after the upload, and your materials had movements, then the old stock quantity at period closing is transfered to the history tables MARDH, MBEWH.
    If you load in the beginning of a month, then SAP calculates the opening stock by using the end of period stock and add/subs the material movements.Then you will not find the opening stock as a single number in any table.

  • Stock Ageing Query With Stock Value

    Dear Experts,
    Greeting for the day...!
    I am using Batch wise stock, so consumption done by batch wise.
    Please forward me the query for the Product Code, Products Name, Batch No, Batch Qty (Under respective ageing days), Batch Amount (Under respective ageing days).
    The parameter will be from date & to date & group.
    Thanks in advance.
    Regards
    Datta Kharat

    Hi,
    Please check this thread:
    http://scn.sap.com/thread/3372541
    Thanks & Regards,
    Nagarajan

  • Stock Ledger Report in Day Wise not giving correct values for Opening Stock

    Dear Experts,
    I m working on Sock ledger report to give the day wise data.
    since yesterdays closing Stock will become opening stock of today,
    To get Opening Stock,
    I have restricted the stock key figure with 2 variables on calday        
                                  (DATE FROM var with <=(Lessthan or equal to) and offset -1
                                   DATE TO      var with <=(Lessthan or equal to) and offset -1)
    To get Closing Stock,
    I have restricted the Stock key figure with 2 variables on calday        
                                  (DATE FROM var with <=(Lessthan or equal to)
                                   DATE TO      var with <=(Lessthan or equal to) )
    But in the output Opening stock values are not coming correctly and for given range of dates,
    for last date, opening stock is showing as Zero.
    Could you please tell me how can I achieve the correct values for opening stock.
    Thanks in advance.

    Hi Arjun,
    Seems like you are making it more complicated. What is your selection screen criteria?
    Ideally you should only use the offset.
    You will have say Calday in rows and stock in Column
    ____________Opening Stock_____________Closing Stock
    01/06/2009___(Closing stock of 31/05/2009)_(Stock of 01/06/2009)
    02/06/2009___(Closing stock of 01/06/2009)_(Stock of 02/06/2009)
    03/06/2009___(Closing stock of 02/06/2009)_(Stock of 03/06/2009)
    So, from above scenario, create one RKFs and include Calday in it. Create a replacement path variable on calday and apply the offset as -1.
    So, your Opening Stock will be calculated by closign stock of previous day.
    - Danny

  • Calculation of Opening Stock

    Hello Gurus,
    I am using 0IC_C03 for stocks. Infosource 2LIS_03_BX, 2LIS_03_BF & 2LIS_03_UM is populating data to the cube.
    How do I calculate Opening stock values. I need a column for displaying op. stock.
    pls guide.
    thanks in advance..

    Hi,
    You can check business content query 0IC_C03_Q0012.
    Just to be clear, you want to display opening stock (as on each day, or month, or ??).
    I would think using the keyfigure 0TOTALSTCK (Total stock) or other such KF (for other categories of stocks) would do. System would do the calculation for you as I understand.
    This may also help if you have not looked at it yet
    <i>"How-to..." Paper for Inventory Management Scenarios in SAP BW: SAP offers a document dealing with the special features in implementing SAP BW in the Inventory Management area.
    To display this document, in the SAP Service Marketplace (http://service.sap.com), select the Quick Link /bw, then choose SAP BW InfoIndex in the Navigation area and follow the Non-cumulatives link in the list. The document is named How to...Handle inventory management scenarios in SAP BW 3.x (pdf).</i>
    cheers,

  • Negative Balance in Opening Stock & Closing Stock

    Dear Experts,
                        Below the query which i used to get the Opening Stock,Purchase,Issue,Return and closing stock. Here i face some problem that i get negative inventory for some items and the same has been checked in inventory audit report but there it is showing correct value.And also i understand that those items which shows negative inventory in Opening and closing is previously got changed in Item group after some transactions.Can any one help me to sort out this issue ?
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @ItmsGrpNam varchar(100)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= '[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <= '[%1]'
    select @ItmsGrpNam = max(s2.ItmsGrpNam) from dbo.OITB S2 Where S2.ItmsGrpNam = '[%2]'
    Select distinct a.Itemcode, max(a.Dscription) as ItemName, (Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,a.InvntAct,
    (isnull(( Select distinct sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.DocDate<=@FromDate ),0)- isnull(( Select sum(isnull(outqty,0)) from OINM O1
      where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct and O1.DocDate<=@FromDate),0)) as [Opening Stock],
    (isnull((Select distinct isnull(sum(round(TransValue,0)),0) from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.DocDate<=@FromDate ),0)) as [Opening Stock Value],
    isnull((Select ISNULL((sum(isnull(inqty,0))),0) from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.transtype in (20,18)),0) as [Purchase Quantity],
      isnull((Select isnull(sum(round(TransValue,0)),0) from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.InQty>=0 and O1.JrnlMemo not like '%cancellation%'
      and O1.transtype in (20,18)),0 ) as [Purchase Value],
    isnull((Select sum(isnull(OutQty,0))from OINM O1 where O1.itemcode=a.ItemCode AND O1.InvntAct = a.InvntAct
      and  O1.ApplObj = '202' and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.OutQty>0 and
      O1.transtype = '60'),0) as [Production Issue Quantity],
    isnull((Select isnull(sum(round(TransValue,0)),0)from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
            and  O1.ApplObj = '202' and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.OutQty>0
             and O1.transtype  = '60'),0) as [Production Issue Value],
    isnull((Select sum(isnull(Inqty,0)) from OINM O1 inner join OIGN G1 on O1.BASE_REF = G1.DocNum inner join IGN1 G2 on G1.DocEntry=G2.DocEntry
            where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct and O1.ItemCode = G2.ItemCode
            and  G2.BaseType = '202' and G2.TranType is null and O1.docdate>=@FromDate
            and O1.docdate<=@ToDate and O1.Inqty>0 and O1.transtype = '59'),0) as [Goods Receipt Return Quantity],
    isnull((Select sum(isnull(Inqty,0)) from OINM O1
      inner join OIGN G1 on O1.BASE_REF = G1.DocNum
      inner join IGN1 G2 on G1.DocEntry=G2.DocEntry
      --inner join OITM a on a.itemcode= o1.ItemCode
      --inner join OACT c on c.AcctCode = o1.InvntAct
      where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct and O1.ItemCode = a.ItemCode
      and G2.LineNum = O1.DocLineNum and G2.BaseType = '202' and g2.TranType is null
      and O1.docdate >= @FromDate and o1.DocDate <= @ToDate
      and O1.Inqty>0 and O1.transtype = '59'),0)as [Goods Receipt Return Quantity_1],
    isnull((Select sum(round(TransValue,0))from OINM O1 inner join OIGN G1 on O1.BASE_REF = G1.DocNum inner join IGN1 G2 on G1.DocEntry=G2.DocEntry
            where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct and O1.ItemCode = G2.ItemCode
            and  G2.BaseType = '202' and G2.TranType is null and O1.docdate>=@FromDate
            and O1.docdate<=@ToDate and O1.Inqty>0 and O1.transtype = '59'),0) as [Goods Receipt Return Value],
    (isnull((Select distinct isnull(sum(isnull(inqty,0)),0)from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.DocDate<=@ToDate),0)- isnull((Select isnull(sum(isnull(outqty,0)),0) from OINM O1
      where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct and
      O1.DocDate<=@ToDate),0)) as [Closing Stock],
    (isnull (( Select distinct isnull(sum(round(TransValue,0)),0)from OINM O1 where O1.itemcode=a.itemcode AND O1.InvntAct = a.InvntAct
      and O1.DocDate<=@ToDate),0)) as [Closing Stock Value],
    (Select distinct i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
    (Select distinct b.ItmsGrpNam from OITB b where b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
      from (Select distinct N1.Itemcode, N1.Dscription, isnull((sum(N1.inqty)),0)-isnull((sum(n1.outqty)),0) as OpeningBalance,
      isnull((sum(N1.Transvalue)),0) as OpeningValue,n1.InvntAct,0 as INq,
      0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
      inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
      inner join OACT c on c.AcctCode = n1.InvntAct
      Where N1.DocDate <=@FromDate and i.ItemCode = n1.ItemCode and b.ItmsGrpNam = @ItmsGrpNam and N1.Transtype <> '67'
      Group By N1.ItemCode,N1.Dscription,n1.InvntAct
    Union
      select distinct N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
      n1.InvntAct,sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
      inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
      inner join OACT c on c.AcctCode = n1.InvntAct
      Where N1.DocDate >= @FromDate and N1.DocDate<= @ToDate and N1.Inqty >0 and n1.ItemCode = i.ItemCode
      and b.ItmsGrpNam = @ItmsGrpNam and N1.Transtype <> '67'
      Group By N1.ItemCode,N1.Dscription,n1.InvntAct
    Union
      select distinct N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,n1.InvntAct,0,sum(N1.outqty) as OUT
      From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
      inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
      Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate
      and N1.OutQty > 0 and  b.ItmsGrpNam = @ItmsGrpNam and n1.itemcode = i.itemcode and N1.Transtype <> '67'
      Group By N1.ItemCode,N1.Dscription,n1.InvntAct)a,dbo.OITM I1 ,OITB b1
      where a.ItemCode=I1.ItemCode and I1.ItmsGrpCod = b1.ItmsGrpCod
      Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam,a.InvntAct
      Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
      Order By a.Itemcode
    Thanks & Regads,
    Bhoopathi.K

    Hi,
    Please check SAP notes for why negative values appeared above report.
    2003493 - Stock Ageing Report Displays Negative Inventory
    Values
    1407192 - Negative Stock Handling
    Thanks & Regards,
    Nagarajan

  • How to create a query to see Opening stock and closing stock as on particul

    Hi All,
    How to create a query to see Opening stock and closing stock as on particul.
    Regards
    Albaik

    Hi,
    In BI 0IC_C03 will provide u the  required information and also having standard queries provided by the SAP.
    Plz find the list of Queries provided by the SAP.
    =======================================================================================================
    Inventory turnover      0IC_C01_Q0001
    Range of coverage - quantity      0IC_C01_Q0002
    Range of Coverage - Value      0IC_C01_Q0003
    Range of coverage of finished goods - quantity      0IC_C01_Q0004
    Range of Coverage of Finished Goods - Value      0IC_C01_Q0005
    Range of coverage of raw materials - quantity      0IC_C01_Q0006
    Range of Coverage of Raw Materials - Value      0IC_C01_Q0007
    Obsolete Stock on Hand      0IC_C01_Q0008
    Period-dependent requirement coverage      0IC_C01_Q0009
    Value of stock on hand      0IC_C01_Q0010
    Quantity of stock on hand      0IC_C01_Q0011
    Material consumption      0IC_C01_Q0012
    Material Movements      0IC_C01_Q0013
    Consignment stock: receipts and issues      0IC_C01_Q0014
    Valuated stock: receipts and issues      0IC_C01_Q0015
    Material stock and movements      0IC_C01_Q0016
    Material Movements (Healthcare)      0IC_C01_Q0020
    Material Consumption (Healthcare)      0IC_C01_Q0021
    Material Availability      0IC_C01_Q0022
    Inventory Turnover Frequency (Value)      0IC_C01_Q0023
    Consignment Stock Received and Issued per Unit      0IC_C01_Q0024
    Material Consumption (Quantity)      0IC_C02_Q0001
    Valuated Stock Receipts and Issues (Quantity)      0IC_C02_Q0002
    Range of Valuated Stock (Quantity)      0IC_C02_Q0003
    Inventory Turnover      0IC_C02_Q0004
    Receipt and Issue Consignment Stock at Customer      0IC_C03_Q0001
    Receipt and Issue Quality Inspection Stock      0IC_C03_Q0002
    Vendor Consignment Stock Receipt and Issue      0IC_C03_Q0003
    Receipt and Issue Stock in Transit      0IC_C03_Q0004
    Receipt and Issue of Blocked Stock      0IC_C03_Q0005
    Valuated Stock      0IC_C03_Q0006
    Stock in Quality Inspection      0IC_C03_Q0007
    Stock in Transit      0IC_C03_Q0008
    Blocked Stock      0IC_C03_Q0009
    Vendor Consignment Stock      0IC_C03_Q0010
    Consignment Stock at Customer      0IC_C03_Q0011
    Stock Overview      0IC_C03_Q0012
    Stock Overview (as of 3.1 Content)      0IC_C03_Q0013
    Quantities of Valuated Project Stock (as of 3.1 Content)      0IC_C03_Q0014
    Valuated Stock (as of 3.1 Content)      0IC_C03_Q0015
    Quantities of Valuated Sales Order Stock (as of 2.1 Cont.)      0IC_C03_Q0016
    Inventory Turnover      0IC_C03_Q0017
    Days' Supply      0IC_C03_Q0018
    SUS: Vendor Consignment Stock      0IC_C03_Q0019
    Scrap      0IC_C03_Q0020
    Inventory Aging      0IC_C03_Q0021
    Stock Overview - extended      0IC_C03_Q0022
    Demand Supply Match      0IC_C03_Q0023
    Warehouse Stock Analytics – Inventory Turnover      0IC_C03_Q0024
    Warehouse Analytics - Obsolescence and Variance      0IC_C03_Q0025
    Stock Overview: Materials      0IC_C03_Q0030
    Average Stock Value Over Time      0IC_C03_Q0031
    Stock Overview Over Time      0IC_C03_Q0032
    Range of Coverage Over Time      0IC_C03_Q0033
    ==================================================================================================
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Jan 18, 2010 8:06 AM

  • How To Find Opening Stock And Value For a Material

    Hi Experts,
    How To Find Opening Stock And Value For a Material  in Given Dates
    Moderator Message: Search.
    Edited by: kishan P on Sep 15, 2010 4:05 PM

    Thanks For Answering.....
    But I Need Any Function Module To Get Opening Stock And Value For Given Material With in Dates.

  • Including "Total Stock Qty" and "Total Stock Value" in Slow movingitm Query

    Dear Guys,
                    Regards.I am using the standard "Slow moving Item's Query" based upon the "Slow moving item Multiprovider".The Query design is as follows:
    Filter:
    0CALDAY(PERIOD FROM/PERIOD TO)
    Rows:
    0MATERIAL(VARIABLE-OPTIONAL)
    0MATERIALGROUP(VARIABLE-OPTIONAL)
    Columns:
    Structure>Number of Records(KF)>Restricted upon Characteristic"Infoprovider(0material)".
    ReceiptTotalValue
    IssueTotalValue.
    But when i include the "TotalStock Qty" in the Query design,the system throws an error..(
    Abort system error:RSDRC/FORM CONVERT_SEL_TO_SELC NO CORRESPONDING SFC ENTRY
    Abort System error in program RSDRC_NCUM_ROUTINES and form READ_REF_POINT-1-).
    The client wants the "Stock value" to be displayed as in MC46 Report(R3) in the BW Report aswell.Would appreciate your timely help on this..
    Manythanks
    Arun

    Any sugestions ??

  • Query - Stock Value (On a Selected Date)

    Hi all
    I came up with the below query to display the stock value at a given date in the past.The total value is correct as per the Inventory Audit report. However, it displays the total value for the two warehouses that we have, yet I want it to display the value separately per warehouse. My chart of accounts has only one (general) account defined.
    SELECT T0.[Debit]-T0.[Credit] FROM [dbo].[JDT1]  T0 WHERE T0.[Account] ='XXXX' AND  T0.[RefDate] <='%0'
    Anyone with an idea about how I can I can display the values separately? Thank you.
    Regards,
    Henry

    Hi Gordon,
    Many thanks, it worked great.. I'm able to include warehouse selection too.
    out of curiosity, what does the T0.Cogsval contain?
    Regards,
    Henry

  • Query to show stock value per group

    Hi Experts
    Would it be possible to create a query which would show me the stock value per item group in SAP?   I know this can be done through Stock Audit report etc, but as we have over 300 item groups I would like to see a report which show me only the group name and the stock value within that group.
    Thanks
    Geoff

    Hi Gordon,
    The 2% will be because in almost all cases the query is using Last Purchase Price to calculate the value, but the stock balance on 130000 account in Financials is being generated from the FIFO values of stock.   It is a problem we come up against a lot in calculating stock values - we probably wouldnt have gone down the FIFO route originally had we known!
    Regards
    Geoff

  • How to get Opening /Closing stock value of Non Valuated stock materails

    Hello,
    We would like to know since 95% of our procurement will be for Projects and since the stock is u201CNon-Valuatedu201D stock, is there any method by which we will be in a position to get the  details of Opening Stock, Purchases & Closing Stock?
    Regards
    Sapman man

    hi
    try mb52
    enter maerial type for nonvaluated stock
    then
    execute
    you will  get output
    regards
    vijay

  • BEx Query to display cumulated Stock value..

    Hi,
    I want to display below report o/p in BEx.
    Below is data set:
    Material     Batch     Fiscal year/period     stock value     
    A     A123     005/2011          $1000
         A123     006/2011          $1500
    Report should display o/p as follows:
    Material     Batch     Fiscal year/period     stock value     Cumulated stock value
                             Till today
    A     A123     006/2011          $1500     $2500
    Cumulated stock value is addition of period 005/2011 and 006/2011. How this can be accomplished in BEx if fiscal period/year is required to display in rows.
    Any help is greatly appreciated.
    Thanks,
    Milind

    Hi,
    Create a RKF called cumulated stock values and in this RKF restrict the Fiscal year Period For current year. This will give you the cumulated value of all stock for the entire year.
    Reg,
    Rahul

  • Since updating to Firefox 4, my MSN home page no longer displays hotmail emails or my stock informtion. I have to click on hotmail or stocks to open another window to see if I have email or updated stock values. Why is this happening?

    I recently updated to Firefox 4. Now my Norton password protection does not work; My hotmail view on my MSN home page does not work; and my stock updates to not work. I have to click on "hotmail" to see if I have new e-mails and click on "stock quotes" to see updated stock values. Prior to the "upgrade", my new emails could be viewed on my MSN homepage as well as my stock prices. Does anyone know why this is occurring?

    I was able to fix the issue here. Steps Taken:  From the comand line I ran
    dscl /Search read /Users/jdoe HomeDirectory
    It returned # No such key: HomeDirectory
    This was the big clue.... it should have returned
    HomeDirectory: <home_dir><url>afp://files.hihllc.lan/Users/jdoe</url><path>/</path></home_dir>
    I unbound the Mac from AD and ran the following command in terminal.
    dscacheutil -flushcache
    I then went into OS X sharing preferences and renamed the computer slightly, so it would create a new computer record in AD. I rebound the machine to AD making sure in Directory Utility Advanced, under User Experience that Force local home directory on start up disk was unchecked and Network protocol to be used was AFP.
    I then ran
    dscl /Search read /Users/jdoe HomeDirectory
    and it returned
    HomeDirectory: <home_dir><url>afp://files.hihllc.lan/Users/jdoe</url><path>/</path></home_dir>
    I had the user reboot... which was necessary. When he logged in HomeSync fired up. He had quite a few conflicts, so I told him to select use files on this computer for all conflicts.
    I checked the FileSyncAgent.logs and it was good.
    Let me know if this fixes your issue.
    Thanks,
    Ray

  • Re:Query for Stock Statement for a particular item..!!!!

    Dear SAP Experts,
    I need a stock statement query  for a particular item which contains:
    1.ItemCode
    2.Item Description
    3.Item Price
    4.Opening
    5.Receipts
    6.Issues
    7.Closing
    8. Value
    The selection criteria are:
    1.Warehouse code
    2.Item Name
    3.Posting Date
    Plz give me a good solution for this issue.
    With Regards,
    Revathy

    Check this
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    set @FromDate =
        (Select min(S0.Docdate) from OINM S0 where S0.Docdate >='[%0]')
    set @ToDate =
        (Select max(S1.Docdate) from OINM S1 where S1.Docdate <='[%1]')
    select * from
        SELECT T0.itemcode,
        min(T0.Dscription) as 'Item Description',
        min(B1.ItmsGrpNam) as 'Item Group', W1.Whscode, C1.Location,
        (isnull((
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate<@FromDate ),0)-
        isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate<@FromDate),0)
        ) as [Opening Stock],
        isnull((
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate
            and O1.docdate<=@ToDate and O1.inqty>0
            and O1.transtype in (20,18)),0
        ) as [Purchase Quantity],
        isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate and O1.docdate<=@ToDate
            and O1.outqty>0 and O1.transtype in (21,19)),0
        ) as [Purchase Return Quantity],
       isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.outqty>0
            and O1.transtype in (13,15)),0
        ) as [sale Quatity],
        (isnull
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate<=@ToDate),0
            isnull((
                Select sum(isnull(outqty,0))
                from OINM O1
                where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
                and O1.docdate<=@ToDate),0)
        ) as [Closing Stock]
        FROM OINM T0
        INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
        INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
        INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod
        INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode
        INNER JOIN OLCT C1 ON W1.Location=C1.Code
        Group by T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location
    ) a
    where (a.[Opening Stock]
            +a.[Purchase Quantity]
            + a.[Purchase Return Quantity]
            +a.[sale Quatity]+a.[Closing Stock]
           ) !=0
    Regards,
    Bala

Maybe you are looking for

  • The STOP statement was used outside a report flow.

    Hi Gurus, when i am executing this program it is going to short dump. pls help me out. thanks in advance. Runtime Errors         STOP_NO_REPORT Date and Time          06.10.2008 12:10:06 Short text The STOP statement was used outside a report flow. W

  • How to manually backup bit-locker key to AD

    Hello, How can I manually backup bit-locker key to AD for couple of users from my machine. (I do have their ID and key) I am able to do that by running this command on end user machine, manage-bde.exe -protectors -adbackup c: -id { but how can I do t

  • Clearing account code FR3

    hi, 1) may i know what tcode i can see the custom clearing or freight clearing account posted during GR? If obyc, then what is the transaction code column? for example, custom clearing FR3, I do not see FR3 in M/06. so where is the link for FR3? 2) a

  • Settlement of process order in G/L account

    Dear Guru In our client scenario for FG we are using "V" as price control. During settlement of process order the variance amount is hitting in the "stock of fg produce" + and "cogm"  - ve entry. but our client need the variance (balance) of order to

  • User Name/Password for SQL*Plus

    I installed the Oracle 8i Personal Version in my PC. I have been trying to log on to the Oracle SQL*Plus screen, which asks me for the User Name, Password and the Host String. Does anybody out there know what I should use here to log on to this scree