Closing Stock Query
Hi Members,
We Want a report for closing stock according to the following parameters,
1-Date from
2-Date to
3-Warehouse
4-Document Series
Query Report should contain with,
Item Code - Item Description - Inventory UOM - Quantity - Item cost(FIFO Value) - Value
(Inventory Audit Report can not use with document Series)
Thank You
Saman
Hi Rahul,
thank you for reply. You are correct. but in our company we use only 10 document series. under this 10 series all type of
documents are available . so when we select a one series it is containing all of SAP B1 document type.
Example-
Series A- (Delivery , GRN, Return, A/P invoice,A/R Invoice, Payment .....ect)
Series B- (Delivery , GRN, Return, A/P invoice,A/R Invoice, Payment .....ect)
Series C- (Delivery , GRN, Return, A/P invoice,A/R Invoice, Paymet .....ect)
So Results of this Query will be a meaning full One.
Can You Suggest a Query for my requirement. I Hope Your Idea.
Saman
Similar Messages
-
Opening +Receipts-isseue =Closing Stock Query
Dear Experts,
I need a query with condition from to date for stock movement.
Following Column I required in Query
Item code, Item description, Opening +Receipts-issue =Closing Stock Query
Thanks in Advance.
Regards
MANGESH PAGDAHRE.
Edited by: MANGESH PAGDHARE on Dec 2, 2011 11:04 AMHi
Here is the query
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
Regards,
Sudhir B. -
Opening & Closing Stock - Query Correction
Dear Experts,
Please find the below query, where I need IN quantity & values , OUT quantity& values should pick only from Standard Production Order , whereas it should not pick from special Production Order. Rest all in the same is sufficient for me.
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 a.Itemcode, max(a.Dscription) as ItemName,
(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,
sum(a.OpeningBalance) as OpeningBalance,
sum(a.OpeningValue) as OpeningValue,
sum(a.INq) as 'IN',
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >= @FROMDATE
AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
sum(a.OUT) as OUT,
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >= @FROMDATE
AND T100.DOCDATE <= @TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(select SUM(T100.TRANSVALUE) from oinm T100 WHERE
T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
(((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*
ISNULL((SELECT CASE WHEN
X.PRICE = 0
THEN
(SELECT DISTINCT MAX(ISNULL(P.PRICE,0)) AS PRICE FROM ITM1 P WHERE PRICELIST = 1 )
ELSE
X.PRICE
END
FROM (SELECT
DISTINCT MAX(ISNULL(B.PRICE,0)) AS PRICE
FROM OITM T
LEFT JOIN PCH1 B ON T.ITEMCODE = B.ITEMCODE
INNER JOIN OPCH C ON B.DOCENTRY = C.DOCENTRY
WHERE B.DOCENTRY = (SELECT DISTINCT (MAX(D.DOCENTRY)) FROM OPCH D WHERE C.DOCENTRY = D.DOCENTRY
AND C.DOCDATE <= @ToDate )
AND A.ITEMCODE = T.ITEMCODE) X ),0))
--(Select i.LstEvlPric from OITM i where i.ItemCode=a.Itemcode))
as 'Closing Value',
(Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
--(Select i.LstEvlDate from OITM i where i.ItemCode=a.Itemcode) as 'Last Issue Date',
--(Select i.ItmsGrpCod from OITM i where i.ItemCode=a.Itemcode) as 'Group code',
(Select b.ItmsGrpNam from OITB b where b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance,
(sum(N1.Transvalue))
as OpeningValue,
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
Where N1.DocDate <@FromDate and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
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
Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
and N1.Inqty >0 and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 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.Transtype != 67
and N1.DocDate <=@ToDate and N1.OutQty > 0 and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
where a.ItemCode=I1.ItemCode
and I1.ItmsGrpCod = b1.ItmsGrpCod
Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
Order By a.Itemcode
Thanks in Advance,
Bhoopathi.KHi,
Try this:
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 a.Itemcode, max(a.Dscription) as ItemName,
(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,
sum(a.OpeningBalance) as OpeningBalance,
sum(a.OpeningValue) as OpeningValue,
sum(a.INq) as 'IN',
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >= @FROMDATE
AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
sum(a.OUT) as OUT,
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >= @FROMDATE
AND T100.DOCDATE <= @TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(select SUM(T100.TRANSVALUE) from oinm T100 WHERE
T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
(((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*
ISNULL((SELECT CASE WHEN
X.PRICE = 0
THEN
(SELECT DISTINCT MAX(ISNULL(P.PRICE,0)) AS PRICE FROM ITM1 P WHERE PRICELIST = 1 )
ELSE
X.PRICE
END
FROM (SELECT
DISTINCT MAX(ISNULL(B.PRICE,0)) AS PRICE
FROM OITM T
LEFT JOIN PCH1 B ON T.ITEMCODE = B.ITEMCODE
INNER JOIN OPCH C ON B.DOCENTRY = C.DOCENTRY
WHERE B.DOCENTRY = (SELECT DISTINCT (MAX(D.DOCENTRY)) FROM OPCH D WHERE C.DOCENTRY = D.DOCENTRY
AND C.DOCDATE <= @ToDate )
AND A.ITEMCODE = T.ITEMCODE) X ),0))
--(Select i.LstEvlPric from OITM i where i.ItemCode=a.Itemcode))
as 'Closing Value',
(Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
--(Select i.LstEvlDate from OITM i where i.ItemCode=a.Itemcode) as 'Last Issue Date',
--(Select i.ItmsGrpCod from OITM i where i.ItemCode=a.Itemcode) as 'Group code',
(Select b.ItmsGrpNam from OITB b where b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance,
(sum(N1.Transvalue))
as OpeningValue,
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
Where N1.DocDate <@FromDate and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
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
Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
and N1.Inqty >0 and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 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 left join OWOR t0 on t0.docentry = N1.[AppObjAbs]
Where N1.DocDate >= @FromDate and N1.Transtype != 67
and N1.DocDate <=@ToDate and N1.OutQty > 0 and b.ItmsGrpNam = @ItmsGrpNam and T0.[Type] = 's'
Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
where a.ItemCode=I1.ItemCode
and I1.ItmsGrpCod = b1.ItmsGrpCod
Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
Order By a.Itemcode
Thanks & Regards,
Nagarajan -
Query for Opening And Closing Stock
Hi Experts...
I need a report for Opening and Closing stocks and Goods Receipt and Goods Issue for Raw Materials and Finished Goods and Consumbles ..instead of going for different reports for each we need a combined report which can display for all Raw Materials, Finished Goods and Consumbles and we need it for a specific date range Material type(Raw MAterials,Finished Goods, Consumbales)
and below is the format i needed.
RAW MATERIALS /FINISHED GOODS/CONSUMBALES
Opening Stock Closing Stock Goods Receipt Goods Issue
Qty Value Qty Value Qty Value Qty Value
Item Name
Regards,
Vamsi.Hi Guys.
I need an Inventory stock report with Item name, Opening Stock,Goods issue Quantity,Goods Received ,Item Price,Location ,(Closing Stock)Total Value.
We need the input by Date Range and Item Group and Location(if Possible) Below is the Code i used to run the report.
Pls Update the 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), sum(a.[Opening Balance]) as [Opening Balance], sum(a.[IN]) as [IN], sum(a.OUT) as OUT,max(a.Price) as 'Price', ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing from dbo.OITM I1
Left JOIN (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 ON a.ItemCode=I1.ItemCode
where I1.ItmsGrpCod = @Group
Group By a.Itemcode
Order By a.Itemcode
Regards,
Vamsi. -
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
AlbaikHi,
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 -
Query for Closing Stock goes beyond a particular value.
Hi,
The query for the following requirement:
The Closing Stock goes beyond a particular value. The Closing Value of items crosses the pre-defined value.Hi,
Yes it is related to the user selected date and stock level. Not answered Closing the thread.
Edited by: Neela M B on Aug 28, 2010 3:08 PM -
MB5B Report table for Open and Closing stock on date wise
Hi Frds,
I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
Thanks
Mohan MHi,
Please check the below links...
Query for Opening And Closing Stock
Inventory Opening and Closing Stock
open stock and closing stock
Kuber -
Opening Stock and Closing Stock Calculation
Hi,
My report requirement is to display the material, opening stock for the lower date, closing stock for the higher date and the in between all stock operations..how to fetch the opening stock and closing stock for a particular material ???.. what are the tables and fields for calculating them??..
Thanks,
Sri
Edited by: Sri on Feb 13, 2009 8:33 AMHi
We have done a similar reports. One showing opening stock/Closing stock and another one showing all the transactions for a particular day. What we did was we developed a program to fetch data from MARD table for unrestricted, blocked & Qulaity stock(Our requirement talks only about these 3 stocks). And we scheduled the program exactly at system time 00.00 hrs with A class job.(today's closing day stock is nothing but tomorrow's opening stock)
And for the second report which needs to pick all the transaction for a particular day, we picked it from MB51 entries. It is nothing but query between MKPF and MSEG.
I hope this helps. -
Closing stock report with GRPO
Hai all
Please help me to write this query,
For example
I have query to take closing stock report ,but my requirement is ,i want split up for Closing stock and closingvalue
like, if i have 40 closing stock means i want details how 40 is arrived
for example i run closing stock report as on 2009-03-31
means i want this format
Itemcode ClosingStock Closing value
ITM001 40 460
ITM002 20 210.......
ItemCode GRPOno. VendorCode quantity Rate GRPO Date
ITM001 10001 V0001 10 10 2009-02-01
ITM001 10002 V0002 20 11 2009-03-15
ITM001 10003 V0003 10 14 2009-03-31
ITM002 10021 V0011 10 10 2009-02-11
ITM002 10022 V0015 10 11 2009-03-14Hai Jeyakanthan A
I want small change in your query
SELECT T0.ItemCode,T0.TransType, SUM(T0.InQty)-SUM(T0.OutQty) AS 'Closing Stock',SUM(T0.OpenValue) as 'Balance' FROM OINM T0
*where docdate <= '[%0]'*
GROUP BY T0.ItemCode,T0.TransType
Having
T0.TransType = 20 ORDER BY T0.ItemCode,T0.TransType
I tried this query for taking closing stock for given date, its giving me correct result
SELECT T0.ItemCode, T0.Ref1, T0.CardCode, T0.InQty, T0.Price, T0.DocDate FROM OINM T0 WHERE T0.TransType = 20 AND
(T0.DocDate >= '[%0]' AND
T0.DocDate <= '[%1]') ORDER BY T0.ItemCode, T0.Ref1, T0.CardCode, T0.InQty, T0.Price, T0.DocDate
In this query i want only the GRPO no,date,price.... for closing stock quantity
Edited by: Prasanna s on May 14, 2009 12:39 PM -
Inventory opening and closing stock with value report
Hi All,
Is it possible to get details of both opening and closing stock with value of each items of last financial year (2009-10) in inventory report?
MizanHi..
you can try this query
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,
Bhavank -
Opening and Closing Stock -Calendar Day Interval
Dear All,
Regards.I got a requirement where I need to calculate the Opening and Closing stock -Daywise..Did checked the related threads which stated to create 2 Restricted KF's upon Calmonth.Hence i tried the same replacing Calmonth with Calday,but those 2 Restricted KF's are empty at the Query output level!!!!!!!!(Note : 0TotalQtystock shows the Closing stock by default)..It would be really helpful if someone could take time to update on this..
Manythanks
ArunHi,
Stock key figures are normally set to calculate closing stock with respect to time. e.g. day end stock, week end stock, month end stock.
To calculate Opening balance -
1. create a new calculated KF on your stock key figure with no calculations.
2. Set exception aggregation as "First Value" for this calculated key figure in the query definition.
3. Use this calculated key figure instead of main key figure.
This setting works for all the time characteristics present in the cube.
Regards,
Anup -
Opening & Closing closing Stock
Dear Experts,
Please find the below query for Opening and Closing Stock of RM, where in I have been trying to arrest the Inventory Transfer quantity & Value in IN QTY & OUT QTY. I used Transtype<> 67 to arrest but the same is not working out for me...
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 a.Itemcode, max(a.Dscription) as ItemName,
(Select i.InvntryUom from OITM
i where i.ItemCode=a.Itemcode) as UOM,
sum(a.OpeningBalance) as OpeningBalance,
sum(a.OpeningValue) as OpeningValue,
sum(a.INq) as 'IN',
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >=
@FROMDATE
AND T100.DOCDATE <=
@TODATE AND T100.INQTY
<> 0) AS [IN Stock Value],
sum(a.OUT) as OUT,
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
AND T100.DOCDATE >=
@FROMDATE
AND T100.DOCDATE <=
@TODATE AND T100.OUTQTY
<> 0)*-1 AS [OUT Stock Value],
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(select SUM(T100.TRANSVALUE) from oinm T100 WHERE
T100.ITEMCODE
= A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
(Select i.LastPurDat from OITM
i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
(Select b.ItmsGrpNam from OITB
b where
b.ItmsGrpCod =
I1.ItmsGrpCod) as 'Group Name'
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as
OpeningBalance,
(sum(N1.Transvalue))
as
OpeningValue,
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
Where N1.DocDate <@FromDate
and b.ItmsGrpNam
= @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
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
Where N1.DocDate >=
@FromDate and N1.DocDate
<= @ToDate
and N1.Inqty >0 and b.ItmsGrpNam =
@ItmsGrpNam
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 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.Transtype = '67'
Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
where a.ItemCode=I1.ItemCode
and I1.ItmsGrpCod = b1.ItmsGrpCod
Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
Order By a.Itemcode
Thanks,
Bhoopathi.KHi,
Removed transtype 67 from above query. Try this:
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 a.Itemcode, max(a.Dscription) as ItemName, (Select i.InvntryUom from OITM
i where i.ItemCode=a.Itemcode) as UOM, sum(a.OpeningBalance) as OpeningBalance, sum(a.OpeningValue) as OpeningValue,sum(a.INq) as 'IN',
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND t100.transtype <> '67' and T100.DOCDATE >= @FROMDATE
AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
sum(a.OUT) as OUT,
(select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND t100.transtype <> '67' and T100.DOCDATE >= @FROMDATE AND T100.DOCDATE <=
@TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(select SUM(T100.TRANSVALUE) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
(Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
(Select b.ItmsGrpNam from OITB b where b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty)) as
OpeningBalance,
(sum(N1.Transvalue)) as
OpeningValue,
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
Where N1.DocDate <@FromDate
and b.ItmsGrpNam
= @ItmsGrpNam and N1.Transtype <> '67'
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
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
Where N1.DocDate >=
@FromDate and N1.DocDate
<= @ToDate
and N1.Inqty >0 and b.ItmsGrpNam =
@ItmsGrpNam and N1.Transtype <> '67'
Group By N1.ItemCode,N1.Dscription
Union All
select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 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.Transtype <> '67'
Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
where a.ItemCode=I1.ItemCode
and I1.ItmsGrpCod = b1.ItmsGrpCod
Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
Order By a.Itemcode
Thanks & Regards,
Nagarajan -
Opening and Closing Stock Monthwise
hi,
I need to display month wise Stock details like below
month-year Opening-Stock STock-In Stock-Out closing-Stock
I have made the query, but this query gives only monthwise stock-in and stock-out. How do i get Opening-Stock and closing-Stock.
SELECT e.STORE, months.month,
SUM( (CASE WHEN trunc(e.MAT_IN_DATE,'MM') = months.month THEN MVALUE ELSE 0 END) )
Mat_Rcvd,
SUM( (CASE WHEN trunc(E.MAT_OUT_DATE,'MM') = months.month THEN MVALUE ELSE 0 END) ) Mat_Out
FROM
SELECT STORE,ITEM_CODE, SUM(NVL(MQTY,0)) M_QTY, SUM(NVL(MVALUE,0)) MVALUE,
MAT_OUT_DATE, MAT_IN_DATE
FROM
SELECT GD.TO_STORE STORE , GD.ITEM_CODE,
GD.QUANTITY MQTY, GD.AED_RATE * GD.QUANTITY MVALUE, NULL MAT_OUT_DATE , GRN_DATE MAT_IN_DATE
FROM GRN_DETAILS GD , GRN_MASTER GM
WHERE GD.GRN_NO = GM.GRN_NO
UNION ALL
SELECT MI.STORE, MI.ITEM_CODE, (NVL(MI.QUANTITY,0)) MQTY,
MI.QUANTITY * UNIT_RATE MVALUE , mi.ISSUE_DATE MAT_OUT_DATE , NULL MAT_IN_DATE
FROM MATERIAL_ISSUE MI , MINR_MASTER MM
WHERE MI.MIN_NO = MM.MIN_NO
WHERE STORE='ABC'
GROUP BY STORE, ITEM_CODE, MAT_OUT_DATE, MAT_IN_DATE
) E ,
(SELECT add_months( date '2007-07-01', level ) month,
FROM dual
WHERE add_months( date '2007-07-01', level ) < SYSDATE
CONNECT BY level <= 30 )months
GROUP BY e.STORE, months.month
ORDER BY MONTH
/Please consider the following when you post a question. This would help us help you better
1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
You can use the following query and do a copy past of the output.
select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
that are asked the answer is already there.
3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
I have the following table called sales
with sales
as
select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
union all
select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
select *
from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
For example in the above sales table, I want to know the total quantity and number of invoice for each product.
The output should look like this
Prod_id sum_qty count_inv
1 145 2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
use the {noformat}{noformat} tags.
The usage of the tag is like this.
<place your code here>\
7. If you are posting a *Performance Related Question*. Please read
{thread:id=501834} and {thread:id=863295}.
Following those guide will be very helpful.
8. Please keep in mind that this is a public forum. Here No question is URGENT.
So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude. -
Opening Closing Stock in transit Report
Hi,
I have to get the ABAP development of Stock Report. Report would have following fields
Opening Stock
Opening Stock in Transit Quantity
GR Quantity
Purchase Value
Sold Quantity
Rejection Quantity
Closing Quantity
Closing Stock in Transit Quantity
Consumption Quantity
In Closing quantity , It should be without stock in transit quantity.
Could you please help me to understand ,Exact Opening Stock ,Closing sock, In Transit Stock etc? How would these be calculated? from which tables all these data would come from. Thanks in advance.
Regarda,
SantoshSantoshArya wrote:
Hi,
>
> I have to get the ABAP development of Stock Report. Report would have following fields
>
> Opening Stock
> Opening Stock in Transit Quantity
> GR Quantity
> Purchase Value
> Sold Quantity
> Rejection Quantity
> Closing Quantity
> Closing Stock in Transit Quantity
> Consumption Quantity
>
> In Closing quantity , It should be without stock in transit quantity.
>
> Could you please help me to understand ,Exact Opening Stock ,Closing sock, In Transit Stock etc? How would these be calculated? from which tables all these data would come from. Thanks in advance.
> Regarda,
> Santosh
Hi,
You can also check these standard reports before you proceed to develop a report..
MB52 - List of Warehouse Stocks on Hand
MB53 - Display Plant Stock Availability
MB5B - Stocks for Posting Date
MB5C - Pick-Up List
MB5L - List of Stock Values: Balances
MB5W - List of Stock Values
MB5T - Stock in transit CC
MC.9 - INVCO: Material Analysis Selection, Stock
MC.A - INVCO: Material Analysis Selection, Rec/Iss
MC.B - INVCO: Material Analysis Selection, Turnover
You can also consider building a query report which wil also serve your purpose quickly...
Regards
Shiva -
Closing stock as off a particular date
How to write a query for closing stock (in quantity) for all items by group by warehouse for a particular date?
Thank you.the standard stock count in SAP B1 (Inventory>> Inventory Transaction >> Initital Quantity, Inventory Tracking, Stock Posting) is "real time" and not back-dated and the screen will display all items irrespective whether there is stock balance in the system. Anyone has a query where able to have the stock balance generated at any cut-off date, i.e. the stock count can be back-dated and only display those items with quantity (in the system) as at that cut-off date .
Thank you.
Maybe you are looking for
-
Max memory allocation in Windows 2000
Hi, I want to allocate more than 1.6GB of memory to JVM. So, I use: "%JAVA_HOME%\bin\java" -server -ms1024m -mx1680m I get following error while starting weblogic server: "Error occurred during initialization of VM Could not reserve enough space for
-
How to edit a column in web dynpro table
Hi All, i am facing problem in editing a single column in my table. on selecting a row and clicking of a button the complete row is appearing as editable , i am using read only property for this , but i am unable to keep some rows as editable and som
-
Automatic Updates in iOS 7 not happening on mobile data
In iOS 7 I have tunded on Automatic Updates on the iTunes & App Store. The Updates is Showing as On. Also i would like the app updates automatically updating over my mobile data and so that setting is ON too. Still the apps only download over wifi an
-
Video in itunes video folder but will not sync to iPad
So I have a few vidoes in iTunes on my computer, I plug my iPad in, it syncs but only puts files from my iPad to the computer. It will not go the other way. It does not look like it put music i bought in itunes on my computer either. Anyone know w
-
I have an Epson cx3650 and my driver seems to be missing and I need to scan a document and I'm desperate, epson says that the page is no longer available for download (my luck ) does anyone know where I can get a driver (reliable ) from ? Thank you a