I am new to SAP development, bear with me if I make any mistake.
I am trying to get the serial number of an Item on an Invoice. The code I am using is
select T2.DocNum, T3.ItemCode as 'Item Number', s1.intrSerial as 'Serial Number',
T3.Dscription as description, T3.vendorNum as 'Vendor Model No',
T3.Quantity as 'Qty Sold',
T3.whscode as 'From Warehouse', lastpurprc as 'Last Purchase price',
O2.Price as 'MSRP', T3.Price as 'Sold price',
inDate as 'Date First Recd', convert(varchar(10),T2.DocDate,101) as 'Date Sold'
FROM OINV T2, INV1 T3,
OITM O1, ITM1 O2,OSRI S1
where T3.ItemCode = O1.ItemCode
and O1.ItemCode = O2.ItemCode
and T2.DocEntry = T3.DocEntry
and T2.DocNum ='2201'
and O2.pricelist =1
and O1.ItemCode = S1.ItemCode
and O2.ItemCode = S1.ItemCode
and S1.whscode=T3.whscode
and convert(varchar(10),T2.DocDate,120) = '2008-09-01'
The problem is that I am getting 9 rows instead if 1 because there is no one-to-one relation to OSRI table which keeps the SerialNumber.
Please guide me
Thanks
Ramesh