Skip to Content

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

Item wise purchase return query

Dear Expert,

Advance thanks for help...

Pls find below query which one reflect item wise purchase return in these query i want to add vendor code & vendor name and require filter of From Date & To Date option.

SELECT T0.[DocNum][PONO], T1.[ItemCode], T1.[Dscription], T1.[Quantity][Purchased Qty],

T3.[Quantity][Recieved Qty],T5.[Quantity][Returned Qty],  T2.[DocNum][GRPO No], T4.[DocNum][GoodsReturn No]

FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry,

OPDN T2 INNER JOIN PDN1 T3 ON T2.DocEntry = T3.DocEntry,

ORPD T4 INNER JOIN RPD1 T5 ON T4.DocEntry = T5.DocEntry

WHERE T3.[BaseRef] =  T0.[DocNum] and  T5.[BaseRef]  = T2.[DocNum]

GROUP BY T0.[DocNum], T1.[ItemCode], T1.[Dscription], T1.[Quantity],

T3.[Quantity],T5.[Quantity],  T2.[DocNum], T4.[DocNum]

I really appreciate if you kindly help me on this because i am functional person and i want to acquire technical knowledge also.....

Thanks & Regards,

Pratik D. Patel

Tags:
Former Member
replied

Hi,

Above query is not linked correctly. Please try this query and add required fields.

SELECT T0.[CardCode], T0.[CardName], T0.[DocNum], T0.[DocDate], T1.[ItemCode], T1.[Quantity], T3.[DocNum], T3.[DocDate], T2.[Quantity], T5.[DocNum], T5.[DocDate], T4.[Quantity] FROM OPOR T0  INNER JOIN POR1 T1 ON T0.[DocEntry] = T1.[DocEntry] left join  PDN1 T2 on  T2.[BaseEntry]  =  T1.[DocEntry]  and  T2.[BaseLine]  =  T1.[LineNum] INNER JOIN OPDN T3 ON T2.[DocEntry] = T3.[DocEntry] left join  RPD1 T4 on  T4.[BaseEntry]  =  T2.[DocEntry] and  T4.[BaseLine]  =  T2.[LineNum] LEFT JOIN ORPD T5 ON T4.[DocEntry] = T5.[DocEntry] WHERE T0.[DocDate]  between [%0] and [%1]

Thanks

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