cancel
Showing results for 
Search instead for 
Did you mean: 

Goods Receipt PO

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (0)