Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3316

Re: Goods Receipt PO

$
0
0

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


Viewing all articles
Browse latest Browse all 3316

Trending Articles