Query for batchwise remaining stock
Hello
i create the following query that show remaining quantity in that batch the quer are as,
SELECT T0.[ItemCode], T0.[Quantity], T0.[WhsCode], T3.[ItmsGrpNam], T1.[DistNumber] FROM OBTQ T0 INNER JOIN OBTN T1 ON T0.AbsEntry = T1.AbsEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod WHERE T0.[WhsCode] ='WH01' ORDER BY T3.[ItmsGrpNam], T0.[ItemCode]
but i want to more field in that query that it should show purchase price for that batch & remaining quantity
the qurey should display
Item code , Remaining Quantity, Warehouse,ItemGrpName,batch Num, Purchase Price
Hi,
Try:
SELECT T0.ItemCode, (T0.Quantity-T0.CommitQty) 'Remaining Qty', T0.WhsCode, T3.ItmsGrpNam, T1.DistNumber,T2.LastPurPrc
FROM OBTQ T0
INNER JOIN OBTN T1 ON T0.AbsEntry = T1.AbsEntry
INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode
INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod
WHERE T0.WhsCode ='WH01'
ORDER BY T3.ItmsGrpNam, T0.ItemCode
Thanks,
Gordon
Similar Messages
-
Query for item warehouses stock in a row
hi all,
How to retreive item warehouse stock in a row using query ?
SELECT T0.ItemCode, T1.ItemName, T2.ItmsGrpNam,
(Select WhsCode from OITW Where
WhsCode=T0.WhsCode and ItemCode=T0.ItemCode) as 'Wh',
(Select OnHand From OITW Where
Whscode = T0.WhsCode and Itemcode=T0.ItemCode) as 'Whstck'
FROM OITW T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod
WHERE T0.ItemCode NOT IN 'a-item'AND
T2.ItmsGrpNam LIKE '%%test%%'
and T0.Onhand > 0
ORDER BY T0.ItemCode
Anyone correct query so that it will retrieve item warehouse stock in a single row.
Thanks
JeyakanthanI have tested your query, the result is just like you wish. The code can be simplified to:
SELECT T0.ItemCode, T1.ItemName, T2.ItmsGrpNam, T0.WhsCode as 'Wh',T0.OnHand as 'Whstck'
FROM DBO.OITW T0
INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN DBO.OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod
WHERE T0.ItemCode NOT IN ('a-item') AND T2.ItmsGrpNam LIKE '%[%test%]%'
and T0.Onhand > 0
ORDER BY T0.ItemCode, T0.WhsCode
If you want each item has only one row and warehouse on hand column-wised, you have to use as much as SELECT for each column in according to your number of warehouses. It would be look like this one:
SELECT T0.ItemCode, T0.ItemName, T1.ItmsGrpNam,
(SELECT OnHand FROM OITW WHERE ItemCode = T0.ItemCode AND WhsCode Like 'Whs1') AS 'Whs1 On Hand' ,
(SELECT OnHand FROM OITW WHERE ItemCode = T0.ItemCode AND WhsCode Like 'Whs2') AS 'Whs2 On Hand' ,
(SELECT OnHand FROM OITW WHERE ItemCode = T0.ItemCode AND WhsCode Like 'Whs3') AS 'Whs3 On Hand'
FROM DBO.OITM T0
INNER JOIN DBO.OITB T1 ON T1.ItmsGrpCod = T0.ItmsGrpCod
WHERE T0.ItemCode NOT IN ('a-item') AND T1.ItmsGrpNam LIKE '%[%test%]%'
and T0.Onhand > 0
ORDER BY T0.ItemCode
Thanks,
Gordon -
Re:Query for items having Stock for a particular warehouse ..!!!
Dear SAP Members,
I need a query to display a list of items having stock by considering all the marketing documents,goods receipt,BOM,Production Order,etc.
I have written query like this:
SELECT T0.[ItemCode], T0.[ItemName], T1.[ItmsGrpNam],T0.[OnHand],
T0.[IsCommited], T0.[OnOrder] FROM OITM T0 INNER JOIN OITB T1 ON T0.ItmsGrpCod = T1.ItmsGrpCod
WHERE T1.[ItmsGrpNam] ='[%0]' or T0.[DfltWH] ='[%1]'
The issue is
The InStock shows the total by calculating all warehouses stock but i need the total for the default warehouse.
Plz suggest or modify my query if i have missed out any fields.
With Regards,
RevathyHi Revathy,
Try this
SELECT T0.[ItemCode], T0.[ItemName], T1.[ItmsGrpNam],T2.[OnHand],
T0.[IsCommited], T0.[OnOrder] FROM OITM T0 INNER JOIN OITB T1 ON T0.ItmsGrpCod = T1.ItmsGrpCod
inner join OITW T2 on T2.ItemCode =T0.ItemCode
WHERE T1.[ItmsGrpNam] ='[%0]' and T0.[DfltWH] = T2.WhsCode
Or
SELECT T0.[ItemCode], T0.[ItemName], T1.[ItmsGrpNam],T2.[OnHand],
T0.[IsCommited], T0.[OnOrder] FROM OITM T0 INNER JOIN OITB T1 ON T0.ItmsGrpCod = T1.ItmsGrpCod
inner join OITW T2 on T2.ItemCode =T0.ItemCode
WHERE T1.[ItmsGrpNam] ='[%0]' and T2.WhsCode ='[%1]'
Regards,
Bala -
Crystal Query for Opening / Closing Stock
Hi Experts,
i need a query in crystal for Opening and Closing total Stock per date..
i found this querys and need to join them, but o dont now how...
thanks for any tips..
Query 1
=======================
SELECT distinct
T0.[TransType], T0.[DocDate], T0.[InQty], T0.[OutQty], T0.[Dscription], T0.[CalcPrice], T0.[ItemCode] FROM [dbo].[OINM] T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode WHERE T0.[DocDate] >= {?DateInicial} and T0.[DocDate] <= {?DateFinal} and T1.[Canceled] = 'N'
Query 2
=========================
Declare @FromDate Datetime
Declare @ToDate Datetime
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >={?Data1}
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <={?Data2}
Select 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.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 0 as INq, 0 as OUT
From dbo.OINM N1try this
Declare @ItmsGrpNam varchar(100)
Declare @Whse nvarchar(10)
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 @Whse = Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = [%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.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 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 N1.Warehouse = @Whse and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,
N1.Dscription Union All select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
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 N1.Warehouse = @Whse and b.ItmsGrpNam = @ItmsGrpNam Group By N1.ItemCode,N1.Dscription
Union All select N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 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 N1.Warehouse = @Whse 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 -
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,
RevathyCheck 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 -
Query for Price difference account when item is not sold but not on stock
Hi Experts!
One of my clients accountant requires a report which will help for what to do with the balance of the price difference account.
At the and of the year there are some postings on this account, but not every item that hadnt been on stock when A/P Invoice arrived were sold. Some item were waistrel and put into a waistrel warehouse, but not sold.Some item were sent back to the supplier, but not sold.
Is it possibble to make a query for knowing where to post the balance of the price difference account? Not all should be post to the Cost of goods sold.
Thank you in advance!Hi,
The query is possible. However, it is a complicated one. It is also need to involve detailed analysis to your transaction histories. You may start from OINM table to check.
Thanks,
Gordon -
Query for Opening Stock + Purchase Qty + Sales Qty
Hi ,
Can anyboday help me by how to develop a query for the following requirement. If any custom query is available please provide me .We are working on SBO 2007B PL 8. The required report structure is
ItemNo ***OpeningStock**** Purchase ********* Sales****
(Batchwise)** Qty*** Value ****Qty** Value ***Qty***Value
Thanks & Regards
SriniHi Srini,
I found this on the forum, see if it helps you;
select b.Itemcode,b.Item_Description,b.UOM, b.rate as Rate,b.Opening_Stock,b.Receipt,b.Issue, b.Material_Revalue,b.Closing_Stock,b.Closing_Value from (select *,(case closing_stock when 0 then 0 else(Closing_Value/Closing_Stock)end) as Rate from( SELECT T0.Itemcode as 'Itemcode' ,min(T0.Dscription) as 'Item_Description', max(T1.InvntryUom) as UOM, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,59,20,16,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0)+ (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0)))as Opening_Stock, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (20,18)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (67)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (58,59,16,14)),0)) as Receipt, (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (13,15)),0) + isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (67)),0)+ isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (58,60,21,19)),0)) as Issue, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (162)),0) as Material_Revalue, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,59,20,16,14,19,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0))as Closing_Stock, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,18,-2,67,59,20,16,14,15,13,21,19,60,69,162)),0) as Closing_Value 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 where ((B1.ItmsGrpNam>='[%2]' and B1.ItmsGrpNam<='[%3]') or ('[%2]'='' and '[%3]'='')) GROUP BY T1.itemcode,T0.Itemcode )a Where (a.Opening_Stock + a.Receipt + a.Issue + a.Material_Revalue + a.Closing_Stock + a.Closing_Value) <> 0 )b
Thanks,
Joseph -
I would like to know if it is possible to create a query that would display the stocks of all items on a specific date and will display the item cost or the purchase price of each item in stock. Let say for example, today is January 14, 2010. I would like to check how many stocks in my inventory last January 8, 2010. Does anybody knows how to create this?
Thank you.Hi Don Elicor,
Check the below thread, you will be get some idea or Solution.
Inventory Report by Query
Query for Inventory Activity for whse & dates
Item Stock Report
Item Stock Report
Regards,
Madhan. -
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 -
Query for calculating raw material requirements for the remaining quantities in sale order.
Dear SAP Experts,
Clients requirement :
Client wish to know the quantities of raw materials needs to run the production order inorder to complete the remaining quantities in sale order.
Need Clarification:
I"m using the below query for this requirement. I wish to know whether this query suits for my clients requirement or not. If its so, I need to know how to group by T4.[Code] (Raw material Name) and need to get the sum of T4.[Quantity] (BOM quantity) and (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY under each raw material group
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode],T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity] as salesorderQty , T1.[OpenQty], T2.onhand, T4.[Code] as Raw material Name,T4.[Quantity] as BOMQTY, (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OITT T3 ON T2.[ItemCode] = T3.[Code] INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father] WHERE T0.[DocStatus] ='o'You're posting in the Portuguese B1 space.
You might want to post in the English one: SAP Business One Application -
Crosstab Query for Remaining Revenue (Count, If, Date Between )
Hi all, hope you had a great new year.
I am wanting to create a crosstab query for my Projects which shows ProjectID in the row headers and Time Periods split into months quarter or year as the Column Headers using the [DateAgreed] from the Session table.
I have created crosstabs which show revenue from sessions and count of sessions with different time periods but i am trying to make it so that it counts only completed sessions from before the column date, so that i can then multiply by the [SessionCost].
Any ideas guys?
Here's what i have been working with;
TRANSFORM Sum(([tblSession]![SessionCompleted]*[tblProject]![SessionCost])) AS Revenue
SELECT tblProject.ProjectID, tblCompany.CompanyName
FROM (tblSession INNER JOIN tblCompany ON tblSession.CompanyID = tblCompany.CompanyID) INNER JOIN ((tblProject INNER JOIN tblProjectMetrics ON tblProject.ProjectID = tblProjectMetrics.ProjectID) INNER JOIN qryProjectStatus ON tblProject.ProjectID = qryProjectStatus.ProjectID)
ON (tblProject.ProjectID = tblSession.ProjectID) AND (tblCompany.CompanyID = tblProject.CompanyID)
GROUP BY tblProject.ProjectID, tblCompany.CompanyName, tblProject.Total
PIVOT Format([DateAgreed],"yyyy-mm");
Thanks :)Hi Gord0oo,
You could concatenates the data as a result and show in a cell.
TRANSFORM Sum([tblProject]![SessionCost])) & ";" & Sum([tblSession]![SessionCompleted]) AS Revenue
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi all,
i am searching for an queryby using MS Access.I have a table called stock.
Stock Table:
stock_id comp_id prod_id item_id Quantity module
1 100 200 300 10 P
2 101 200 300 20 P
3 100 200 300 5 S
4 101 200 300 4 S
From this table I want to group by comp_id,prod_id and item_id by (sum(quantity) whose module='P' -
sum(quantity) whose module='S'). the result what I am expecting is given below:
comp_id prod_id item_id Quantity
100 200 300 5
101 200 300 16
So please go through and send me the single query for MS-Access.
Edited by: IRALALVIPIN on Oct 4, 2009 10:39 PMSo please find an SQL or MS Access forum and maybe they will do your work for you. This, however, has nothing to do with Java and we wouldn't do your work for you, anyway.
-
Re:Query For Inventory Transfer..!!!
Dear Members,
My Scenario is,
I want to take a report for inventory transfer that contains
1. Itemcode
2.Item description
3.quantity
4.inventory quantity on the previous day.
I have taken the tables owtr,wtr1,oitm and oitw.But the issue is if my document date is like 30.11.2010 i want the inventory quantity value as on 29.11.2010.
I need only query not SAP Reports.Plz suggest a suitable query for this issue.
With Regards,
RevathyHi Revathy,
You have to use OINM table to get your desired Stock on past dates.
Have a look at these queries.
1. Stock per itemwise
select t1.ItemCode,max(t1.dscription) [Name],(sum(isnull(t1.InQty,0)) - sum(isnull(t1.OutQty,0)) ) [ClsStock],(sum(t1.transvalue)) [ClsValue]
from OINM t1
where t1.DocDate <= '[%1]'
group by
t1.ItemCode
2.Stock per item per warehouse wise
select t1.ItemCode,max(t1.dscription) [Name],t1.warehouse [Warehouse],
(select whsname from owhs o1 where ((o1.whscode) = (t1.warehouse))) [WarehouseName],
(sum(isnull(t1.InQty,0)) - sum(isnull(t1.OutQty,0)) ) [ClsStock],(sum(t1.transvalue)) [ClsValue]
from OINM t1
where t1.DocDate <= '[%1]'
group by
t1.ItemCode,t1.warehouse
Regards,
Bala
Edited by: Balakumar Viswanathan on Dec 10, 2010 5:22 PM -
Dear SAP Members,
I need a query that contains
ItemCode,ItemDescription from oitm table and its first child item code,Item Description,Quantity,currency and price from itt1 table.I have taken all the datas but there is no ItemDescription from itt1 table.How to join all these datas.
Please Give suggestions or query for this issue.
With Regards,
RevathyHi try this
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem NVARCHAR(Max),CName NVARCHAR(MAX),Comment NVARCHAR(MAX),onHand Numeric(18,0),[Committed] Numeric(18,0),FreeStock Numeric(18,0),[Status] NVARCHAR(MAX),Quantity numeric(18,0),Price numeric(18,0),Warehouse nvarchar(MAX),Currency nvarchar(MAX))
INSERT Into @BOMDetails
SELECT T1.TreeType ,T0.Father AS [Parent Code], T2.ItemName AS [Parent Description], T0.Code AS [Child Code],
T1.ItemName AS [Child Description], T0.Comment, cast((T1.OnHand ) as Numeric(18,0)) as [Un-Committed Stock],
cast(T1.IsCommited as Numeric(18,0)) AS [Committed Stock], cast((T1.OnHand - T1.IsCommited)as Numeric(18,0)) AS [Free Stock], T2.FrgnName AS [Status],T0.Quantity,T0.Price ,T0.Warehouse,T0.Currency
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
WHERE T0.ChildNum=1
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], '', '', '', 0,0,0 , '',0,0,'','' FROM ITT1 T0 INNER JOIN OITM T1
ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Group By T0.Father,T2.ItemName
ORDER BY T0.Father, T0.Code
update @BOMDetails set PItem='' ,PName='' where TreeType='N' or TreeType='P'
Select PItem as[Parent Code] ,PName as [Parent Description],CItem as [Child Code],CName as [Child Description],Comment,Quantity,Price,Warehouse,Currency from @BOMDetails
thanks,
Neetu -
Stock determination for sales order stock
Hi all,
for our SAP retail solution - we have requirements for moving Consignment stock to Sales order stock for home delivery . Then Sales order stock needs to be withdrawn for inter company 643 movement . The stock determination is maintained as K first & then F with relevent settings in SPRO & article master, for consignment article -when sales order stock exist & delivery is created for intercompany PO with sales order on account assignment to transfer stock from Store to DC, SAP error message is not allowing to post Goods issue.
What settings do we need to maintain for this to happen to withdraw from Sales order stock for consignment article ? Any help or information is highly appreciable.
Thanks
KrishThis is the error message :-
After calling stock determination, a quantity of 1.000 EA remains open
Message no. WRF_CONS013
Diagnosis
During consignment processing in SAP Retail, the system called stock determination in order to decide which stock category should be used to take material 000000001000009740. However, the stock determination routine did not find enough stock in the relevant stock categories (as defined in the strategy). A quantity of 1.000 EA remains open.
Please note that stock determination ignores the Negative Stocks Allowed setting.
Procedure
Check your stocks and settings for stock determination for material 000000001000009740 in plant 3001. Post stock transfers if necessary
Maybe you are looking for
-
How can I remove my traded-in phone from my iCloud account?
I sent my old iPhone back to Verizon as part of a trade-in agreement for a new phone. I followed their instructions for removing "Find my phone" from my old phone before trading it in. Now, when I log into iCloud I still see my old traded-in phone in
-
When I am trying to open forms I am getting the following error. "Planning is Unable to obtain a connection to Hyperion Essbase. If this problem persists, please contact your administrator" My case is a bit different from the other threads on the sim
-
HP Pavillion dv6 Notebook PC with Windows 8 Pro
-
Need to add Excel as option on SAP report view (currently only ALV layout)
Some users currently have the option to view a report in either the standard ALV layout view or as Excel (example output - transaction VA05). They also have the Excel icon on their toolbar. Our issue is that not all users have this option in their
-
Sap quick viewer - Invoice reporting
Hi, I wanted to create a report to show the invoice number and posting date for a particular purchase order by vendor, material group. What are the tables i should use in quickviewer to generate such a report. Thank you, Regards, Karthik