SQL Query for SAP Business one to get Serial Number of Item as comma separated value
(SELECT DISTINCT
t4.DistNumber + ', ' As'data()'
FROM ORIN T0
INNER JOIN RIN1 T1 on T1.DocEntry = T0.DocEntry
INNER JOIN OITL T2 ON T2.DocEntry = T1.DocEntry AND T2.DocLine = T1.LineNum AND T2.DocType = T1.ObjType
INNER JOIN ITL1 T3 ON T3.LogEntry = T2.LogEntry
INNER JOIN OSRN T4 ON T4.AbsEntry = T3.MdAbsEntry AND T4.ItemCode = T3.ItemCode
INNER JOIN OSRQ T5 ON T4.SysNumber = T5.SysNumber AND T4.AbsEntry = T5.MdAbsEntry
WHERE T0.DocEntry =provide docentry
FOR XML PATH(''))Dist
(SELECT DISTINCT
t4.DistNumber + ', ' As'data()'
FROM ORIN T0
INNER JOIN RIN1 T1 on T1.DocEntry = T0.DocEntry
INNER JOIN OITL T2 ON T2.DocEntry = T1.DocEntry AND T2.DocLine = T1.LineNum AND T2.DocType = T1.ObjType
INNER JOIN ITL1 T3 ON T3.LogEntry = T2.LogEntry
INNER JOIN OSRN T4 ON T4.AbsEntry = T3.MdAbsEntry AND T4.ItemCode = T3.ItemCode
INNER JOIN OSRQ T5 ON T4.SysNumber = T5.SysNumber AND T4.AbsEntry = T5.MdAbsEntry
WHERE T0.DocEntry =provide docentry
FOR XML PATH(''))Dist