Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Goods Receipt PO

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.

Tags:
Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question