Stock movement report date and warehouse wise

I need this report date wise and warehouse wise...
please help ..
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @Whse nvarchar(10)
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 @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse = '[%2]'
Select @Whse as 'Warehouse',
a.Itemcode,
max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance,
sum(a.INq) as 'IN',
sum(a.OUT) as OUT,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing
--(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
from( Select N1.Warehouse,
N1.Itemcode,
N1.Dscription,
(sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
Where N1.DocDate < @FromDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
sum(N1.inqty) , 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
Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , 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) a, dbo.OITM I1
where a.ItemCode=I1.ItemCode
Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

please advice.. - wrong out put.
Declare @FromDate Datetime
Declare @ToDate Datetime
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
a.Itemcode, a.warehouse,a.price as 'Item Cost',
max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance,((sum(a.OpeningBalance) *a.Price)) as 'Opening STock Value',
sum(a.INq) as 'IN',
sum(a.INq)*a.Price as 'IN Stock Value',
sum(a.OUT) as OUT,
sum(a.OUT)*a.Price as 'OUT Stock Value',
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*a.Price as 'Closing Stock Value'
--(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
from( Select N1.Warehouse,
N1.Itemcode,
N1.Dscription,n1.Price,
(sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
Where N1.DocDate < @FromDate  Group By N1.Warehouse,N1.ItemCode,n1.Price,
N1.Dscription
Union All
select N1.Warehouse, N1.Itemcode, N1.Dscription,n1.Price, 0 as OpeningBalance,
sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
and N1.Inqty >0  Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price
Union All
select N1.Warehouse, N1.Itemcode,N1.Dscription,n1.Price, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0
Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price) a, dbo.OITM I1
where a.ItemCode=I1.ItemCode
Group By a.Itemcode,a.warehouse,a.Price
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

Similar Messages

  • The apple tv is stocked at setting date and time

    I Updated the Apple TV and now it requested to start the configuratio all over again and is stocked at setting date and time, can somebody help me?

    http://appletv2.com/stuck-on-setting-date-and-time-fix/

  • Restriction in event reported date and time

    Dear All,
                We have a requirement where we want to keep check on all the reported events such that none of the events are reported with future date and time.
              We have some 25 reporting events and we have an option to keep the check in Preprocessing  FM but then i have to add the customizing of each of the reported events.
      Do we have any possibility to keep a validation via customizing on Actual Reported Date and time event to be within current date and time i.e. no future event is possible without using preprocessing functionality.
    Thanks,
    Shubh.

    Dear Steffen,
                       Thanks for your reply but what i meant to ask is as below :
                       For an event which I am reporting , I have actual date and time as a field. In this field user  can enter any date and time and this will be treated as reported date and time for that event.
       What I need is the restriction that none of the reported date and time is in future from the time when user is actually reporting the event. I am not considering planned date and time as the criteria for restriction.
    Thanks,
    Shubh.

  • Stock Aging report Whwise & IT group wise

    Hi All,
    I want query for stock aging report Warehouse wise and Itemgroup wise in 0-45, 46-90 and greater then 90 days with value,
    Thanks in advance.
    Thanks & regards,

    Hi,
    Check this...
    SELECT distinct T0.ITEMCODE, T1.itemName,T0.ONHAND as 'Total Qty', T1.ManBtchNum,T1.ManSerNum,
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND END '<45 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND * T0.Avgprice END  '<45 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND END '<45 T0 90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND * T0.Avgprice END  '<45 T0 90 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) >90 THEN T0.ONHAND END '>90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>90 THEN T0.ONHAND * T0.Avgprice END  '>90 Days (Value)'
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD
    left join ibt1 t3 on t3.itemcode = t0.whscode
    WHERE T0.ONHAND >0 AND T0.WhsCode = '[%0]' AND T2.ItmsGrpNam ='[%1]'
    Thanks
    Sachin

  • Work Status Report Date and Time Setting

    Hi all
    We are running BPC10 on servers configured with Central European Time which is currently 2 hours ahead of GMT allowing for Daylight Savings Time.
    From what i can see in BPC10 date and times are now stored in GMT (Zulu time) in the Audit activity tables so when a user updates the work status at say 11:00AM local CET time then a value of 09:00AM GMT is stored in the Audit Activity Header table.
    We have a report in excel that uses the EVLCK formula and will return the correct value of 11:00 am however if we run the Work Status Audit report on the Planning and Consolidation home page with user preferences set to Central European Time +1 then the time is displayed as 10:00am suggesting that daylight savings time is not accounted for. We need to set the time to Eastern European time +2 hours to display the correct figure.
    Can anyone explain why this happens? Has DST been overlooked?
    Rgds
    Alan

    Hi Alan,
    probably it's a bug, I think it's better you open an OSS message to SAP.
    Regards
         Roberto

  • What's the easiest way to move app data and data structures to a server?

    Hi guys,
    I've been developing my app locally with Apex 4.2 and Oracle 11g XE on Windows 7. It's getting close to the time to move the app to an Oracle Apex server. I imagine Export/Import is the way to move the app. But what about the app tables and data (those tables/data like "customer" and "account" created specifically for the app)? I've been using a data modeling tool, so I can run a DDL script to create the data structures on the server. What is the easiest way to move the app data to the server? Is there a way to move both structures and data in one process?
    Thanks,
    Kim

    There's probably another way to get here, but, in SQL Developer, on the tree navigation, expand the objects down to your table, right click, then click EXPORT.. there you will see all the options. This is a tedious process and it sucks IMO, but yeah, it works. It sucks mostly because 1) it's one table at a time, 2) if your data model is robust and has constraints, and sequences and triggers, then you'll have to disable them all for the insert, and hope that you can re-enable constraints, etc without a glitch (good luck, unless you have only a handful of tables)
    I prefer using the oracle command line EXP to export an entire schema, then on the target server I use IMP to import the schema. That way, it's near exact. This makes life messy if you develop more than one application in a single schema, and I've felt that pain -- however -- it's a whole lot easier to drop tables and other objects than it is to create them! (thus, even if the process of EXP/IMP moved more than you wanted to "move".. just blow away what you don't want on the target after the fact..)
    You could use oracle's datapump method too.
    Alternatively, what can be done, IF you have access to both servers from your SQL developer instance (or if you can tnsping them both already from the command line, you can use SQL*PLUS), is run a script that will identify your apex apps' objects (usually by prefix to object names, like EBA_PROJ_%, etc) and do all the manual work for you. I've created a script that does exactly this so that I can move data from dev to prod servers over a dblink. It's tricky because of the order that must be executed to disable constraints and then re-enable them, and of course, trickier if you don't consistently prefix ALL of your "application objects"... (tables, views, triggers, sequences, functions, procs, indexes, etc)

  • Can I move all data and programs from Tungsten C to a Pre?

    I love my Tungsten C and I want to get a Pre as soon as it hits Verizon.  Will I be able to move all my data and programs easily over to the Pre?  (I know I have to get the Classic app to run old Palm programs.)   I can synch to either a Vista or XP computer.  I don't synch email or with Outlook contacts.
    Thanks so much. I hope I posted in the right subforum.
    -Miss Bert
    Post relates to: Tungsten C

    Hello Miss Bert and welcome to the Palm forums.
     As you know, the Pre and Palm webOS are all new offerings from Palm.  You are correct in that you will need MotionApps Classic to run your old Palm OS 5 application on the Pre.  What you should know is that Classic does not sync to Palm Desktop/Outlook.  When you get your Pre, regardless of what carrier it is on, you will be breaking the ties with Palm Desktop and the HotSync Manager.
     There are a few options for migrating your data from the Tungsten C to the Pre.  To learn about those options, check out Palm's Pre Migration web page.
    Alan G

  • What is the best way to move all data and apps from an old ipad to a newq ipad air?

    What is the best way to convert (update) from an original ipad to a new ipad air?

    How to Transfer Everything from an Old iPad to New iPad
    http://osxdaily.com/2012/03/16/transfer-old-ipad-to-new-ipad/
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
    http://support.apple.com/kb/HT2109
    Moving Content to a New iPad
    http://tinyurl.com/qzk2a26
    Transferring your prepaid cellular data account depends on your carrier. AT&T lets you move it yourself when you go to Cellular Data in Settings and log into your account with your previous AT&T user name and password. For iPads with Sprint service, you can set up an account on the new iPad and contact Sprint Customer Care (888-211-4727 and go through the menus) to deactivate the old plan and get credit for unused service. For Verizon, call the company’s customer service number for mobile broadband support (800-786-8419) and ask to have your account transferred.
     Cheers, Tom

  • Stock movement report

    hi , all guru
    I need a summarize report on each material for their quantity/value on particular period . and I can select the information by movement type .
    Our SKU is around 2000 items
    please advice is there any standard report or any table i can grap the information
    many thanks

    Hello,
    Go to Transaction MB52. Here you can have Value/Qty report
    For having list of standard reports in SAP please go to
    transaction code SARPN.
    Regards
    Kedar Kulkarni
    Message was edited by:
            KEDAR KULKARNI

  • How do I reset responses (and summary report data) and use my online form for a new application?

    I created my online form, distributed it and captured the responses - worked well.  Now I want to use the same form and start over (track the responses separately from the first time). How do I reset the results / responses? Thanks for any help you provide. 

    Go to the My Forms tab on the main dashboard (were all of your forms are listed). Select your form and hit the duplicate button. This will make a copy of your form and you have the option to include or not include the responses in the copy.
    Randy

  • Report to show beginning-ending stock on certain dates(as MB5B)

    Hello to everybody,
    we have this requirement:
    MB5B should create a list with the items that are shown on the header part of the list . These items are shown when we tick the field XSUM. This list should be in format of report or alv , in order to be easily transfered to EXCEL.
    We can do that with a  Z report, by I wonder if there is any other report from which we can derive those totals, meaning the beginning stock on certain date, and the total stock at the end of date. MB51 does not include the beginning stock.
    Thanks,
    Irene

    hi,
    MB5B and MB51  are std and fullfill report for stock and valuation in SAP. if your requirement is not ful fill with this report then need to take ABAP help and copy MB5B report program and  make required  Z report as per your requirement. no issue.
    regards,
    sans

  • AP Credit Memo and Good return, creates differences between TB and Stock Audit Report

    Hello Experts,
    Did any one has ever faced an issue, whereby AP Credit Memo and Good Return creates discrepancy between journal entry and the stock audit report?
    Here is the scenario:
    AP Credit Memo
    Description
    Quantity
    Unit Price
    Total
    Item A
                    30
                3,400
       102,000
    Journal Entry :
    Debit
    Business Partner
         105,000
            Credit
                          Stock
         105,000
    Inventory Audit Report
    Description
    Quantity
    Cost
    Transaction Amount
    Item A
                            30
                         3,500
                                                    105,000
    Journal Entry :        
    Debit
    Business Partner
         105,000
            Credit
                          Stock
            105,000
    The difference is actually due to the moving average, but the strange part is why the difference is not posted in the journal entry, in the Price different account?
    This makes the stock account amount to be different from the Trial Balance and the Stock Audit Report.
    And this is applied also on the Good Return transaction.
    Any help is highly appreciated.
    Best Regards
    Cedric Kayitare

    Hi Cedric,
    Price & Item cost are different.
    while making goods return , Direct AP Credit Note, Sales Delivery, Direct AR Invoice, stock is going outside.
    In these transactions Journal entry will happen for Item cost and not Item sales or Purchase price.
    Please enable item cost field in line level and check whether above formulae is matching with Item, cost field.
    Then what is the importance of price in these documents??
    Price is the agreed selling or purchase price for trading with Customer and supplier.
    In your example
    You are returning back material worth 105000(as per moving average price), but supplier is supposed to give only you 102,000.
    Hope you understand
    Thanks
    Unnikrishnan

  • Batch transaction stock aging report

    Hi Experts,
    Can you some one help me with query which give stock aging report base on Batch wise transactions (IBT1).
    Item Code,    Item description  Batch#(Qty which are >0),  Batch Qty,  Stock "IN" creation Date,
    Thanks for your help.
    Regards,
    Suresh

    Dear parneeth,
    As requested please try this Query to fulfill your requirement.
    SELECT T0.docnum,
    T2.BatchNum,T2.ItemCode,T2.Quantity,
    T2.ItemName,T0.CardName as Supplier,
    T2.SuppSerial,T2.IntrSerial,T2.ExpDate,T2.PrdDate,T2.InDate,T2.Located,
    convert(varchar(8000),T2.Notes)
    FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry=T1.DocEntry
    inner join
    OIBT T2 on T1.ItemCode = t2.ItemCode and T0.objtype=T2.basetype and T2.baseentry=T1.Docentry
    inner join
    oitm T5 on T1.Itemcode=T5.Itemcode
    WHERE
    T2.quantity>0
    group by T0.docnum,T2.BatchNum,T2.ItemCode,T2.Quantity,
    T2.ItemName,T0.CardName,
    T2.SuppSerial,T2.IntrSerial,T2.ExpDate,T2.PrdDate,T2.InDate,T2.Located,
    convert(varchar(8000),T2.Notes),T1.Linetotal,T1.Quantity
    REGARDS
    MANGESH PAGDHARE.
    Edited by: MANGESH  PAGDHARE on Jan 9, 2012 6:31 PM

  • Opening Stock + InwardQty + OutwardQty + Price and Closing Balance

    Hi Members,
    needs an SQL query for the " Stock Statement " From OINM Table to display opening stock , InwardQty as 'Receipts', OutwardQty as 'Issue', Price using Date and WareHouse as selection criteria.
    Kindly Help me in this regard,
    Thanks and Regards,
    Venkatesh.R

    used function in sql

  • Stock on posting date in WH

    Hi All,
    Like MB5B is there any t.code or table to see stock on posting date in Warehouse? (like in so and so bin and in that S.type)

    Hi
    You can use transaction LT22 to see all transfer orders to or from a storage type and storage bin.
    In the section Reference you enter if it should be source or destination data that should be taken into account.
    Don't forget to enter the date at the bottom of the screen.
    Br,
    Erik

Maybe you are looking for

  • Help in Sys database query

    Hi, How I can check the log data using the query after finding the databases and then join the table to see the log data if any. How I can run query for all thing in one query. Thanks. Select * from sys.databases where name like '%prt%' BST_PRT CST_P

  • WRT54G v6 Help needed!

    Okay, I have a wrt54g v6 router that I use for 2 computers and an xbox (xbox live). Im getting an intermittent signal on all my devices and I have no clue as to why. All of my devices are connected via ethernet cable so I know its not wireless interf

  • PALLET PROCESS CONFIGURATION - SAP

    Hello Experts, Greeting. I would like to know how can we configure the "Pallet" ini SAP.At the current time we are planning to perform goods receipt for production order at individual pallet (One pallet may have 54 boxes ). A pallet label will be pri

  • Lock for bsis table..

    Hello, this thread is divided into 2 queries that i have, 1 - is their any lock object for  bsis table ? 2 - i want to update a field in both bseg and bsis table. is their any bapi or sum SAP function which updates the whole document or will i have t

  • How to read/write data in Notepad?

    Hi to all, Im creating a simple application to write data in notepad using wireless toolkit 2.5. For that i have created a notepad file(raj.txt) manually and saved in the location "D:\WTK25\appdb\DefaultColorPhone\filesystem\root1\raja.txt". When i r