on 09-28-2015 11:28 PM
HI All,
I am trying to create a query showing all items received by Goods receipt PO with serial numbers and the main PO number associated to the goods receipt i mean the goods receipt PO which is copied from Purchase order. I need to get good receipt po number, product name, qty, serial number price, purchase order number.
Can someone help me out please.
this works for me
ALTER PROCEDURE
[dbo].[sp_serialesLineas]
(
@DocNum int,
@ItemCode Varchar(20),
@LineNum int
)
AS
DECLARE @SERIES VARCHAR (MAX) = '',
@SERIETEMP varchar(100) = '',
@num int = 0
CREATE TABLE #tblSerie(indice INT, serie VARCHAR(MAX))
INSERT #tblSerie(serie, indice)
SELECT DISTINCT T0.IntrSerial, ROW_NUMBER() OVER(ORDER BY T0.IntrSerial ASC)
FROM [dbo].[OSRI] T0
INNER JOIN [dbo].[SRI1] T1 ON T1.ItemCode = T0.ItemCode
AND T1.SysSerial = T0.SysSerial
INNER JOIN [dbo].[OITM] T2 ON T2.ItemCode = T1.ItemCode
WHERE
(T1.BaseType = 13 )
AND T2.InvntItem = 'Y' AND T2.Canceled <> 'Y'
AND T1.BaseNum >= @DocNum AND T1.BaseNum <= @DocNum
AND T1.ItemCode=@ItemCode
AND T1.BaseLinNum=@LineNum
SELECT @num = MAX(indice) from #tblSerie
WHILE (@num > 0)
BEGIN
SELECT @SERIETEMP = serie FROM #tblSerie
WHERE indice = @num
SET @SERIES = @SERIETEMP + ', ' + @SERIES
SET @num = @num - 1
END
DROP TABLE #tblSerie
SELECT @SERIES
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.