Hi,
Please Check this query
Select Distinct A.DocNum as 'SO NO',B.ItemCode as 'SO Item',B.Quantity as 'SO Qty' ,
D.DocNum as 'DO NO',C.ItemCode as 'DO Item',C.Quantity as 'DO Qty',
F.DocNum as 'AR NO',E.ItemCode as 'AR Item',E.Quantity as 'AR Qty'
From ORDR A INNER JOIN RDR1 B ON A.DocEntry=B.DocEntry
INNER JOIN DLN1 C ON B.DocEntry=C.BaseEntry and A.ObjType=C.BaseType
INNER JOIN ODLN D ON C.DocEntry=D.DocEntry
INNER JOIN INV1 E ON C.DocEntry=E.BaseEntry and D.ObjType=E.BaseType
INNER JOIN OINV F ON E.DocEntry=F.DocEntry
Union All
Select Distinct A.DocNum as 'SO NO',B.ItemCode as 'SO Item',B.Quantity as 'SO Qty' ,
'0' as 'DO NO',''as 'DO Item','0' as 'DO Qty',
F.DocNum as 'AR NO',E.ItemCode as 'AR Item',E.Quantity as 'AR Qty'
From ORDR A INNER JOIN RDR1 B ON A.DocEntry=B.DocEntry
INNER JOIN INV1 E ON B.DocEntry=E.BaseEntry and A.ObjType=E.BaseType
INNER JOIN OINV F ON E.DocEntry=F.DocEntry
Thanks,
Nithi