Hi,
Try this query for AP invoice:
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T1.[ItemCode], T1.[WhsCode], T3.[IntrSerial] FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry left join SRI1 T2 on T2.[ItemCode] = T1.[ItemCode] INNER JOIN OSRI T3 ON T2.SysSerial = T3.SysSerial and T3.[ItemCode] = T2.[ItemCode] WHERE T2.[BaseType] = [%0] and T0.[DocDate] between [%1] and [%2] GROUP BY T0.[DocNum], T0.[DocDate], T0.[CardCode], T1.[ItemCode], T1.[WhsCode], T3.[IntrSerial]
Hope helpful
Regards,
Nagarajan