on 05-20-2010 10:58 AM
I have made an xl reporter that generates overview of total stock in all warehouses sorted on itemsgroup with total amount per itemgroup and total amount of units. Now the result is different from the stock report in SAP but that is not sorted on itemgroup and not usefull for reporting.
Now i want to create an query which gives the right data out of SBO.
But how do i get the sum / total of the itemgroups
thx mark
You may start with this:
SELECT T1.ItmsGrpNam, T0.WhsCode, T0.ItemCode, T0.OnHand
FROM dbo.OITW T0
INNER JOIN dbo.OITB T1 On T1.ItmsGrpCod = T0.ItmsGrpCod
WHERE T0.OnHand > 0
UNION ALL
SELECT T1.ItmsGrpNam, "", "", SUM(T0.OnHand)
FROM dbo.OITW T0
INNER JOIN dbo.OITB T1 On T1.ItmsGrpCod = T0.ItmsGrpCod
WHERE T0.OnHand > 0
GROUP BY T1.ItmsGrpNam
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Updated:
SELECT T2.ItmsGrpNam, T0.WhsCode, T0.ItemCode, T0.OnHand
FROM dbo.OITW T0
INNER JOIN dbo.OITM T1 On T1.ItemCode = T0.ItemCode
INNER JOIN dbo.OITB T2 On T2.ItmsGrpCod = T1.ItmsGrpCod
WHERE T0.OnHand > 0
UNION ALL
SELECT T2.ItmsGrpNam, NULL,NULL, SUM(T0.OnHand) Total
FROM dbo.OITW T0
INNER JOIN dbo.OITM T1 On T1.ItemCode = T0.ItemCode
INNER JOIN dbo.OITB T2 On T2.ItmsGrpCod = T1.ItmsGrpCod
WHERE T0.OnHand > 0
GROUP BY T2.ItmsGrpNam
Order BY T2.ItmsGrpNam, T0.WhsCode
Hi Gordon,
That's nice but is it possible to get the following layout of the query. Only 3 columns.
itemgroupname1 total quantity stock total stock in amounts (financial)
itemgroupname2 total quantity stock total stock in amounts (financial)
itemgroupname3 total quantity stock total stock in amounts (financial)
itemgroupname4 total quantity stock total stock in amounts (financial)
TOTAL QUANTITY STOCK TOTAL STOCK IN AMOUNTS
Thanks Again
Mark
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.