cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Report by Batch based on GRPO

former_member418241
Active Participant
0 Kudos

Hi Experts, Can anybody guide on query based purchase report by batch based on GRPO document please. I have tried with the following query gives wrong quantities for the batches.

SELECT T0.[DocNum], T1.[DocEntry], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],T2.[BatchNum], T2.[Quantity], T1.[Price], (T2.[Quantity]*T1.[Price]) as 'Row total' FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OIBT T2 ON T2.[BaseEntry] = T1.[DocEntry] WHERE T2.[BaseType] = '20' and T0.[DocNum] ='320047848'

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this query,

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T4.[DistNumber] FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry left join OITL T2 on t1.docentry = T2.[ApplyEntry] and T1.[LineNum] = T2.[ApplyLine] and T2.[ApplyType] = 20 left JOIN ITL1 T3 ON T2.LogEntry = T3.LogEntry left join OBTN T4 on T4.[ItemCode] = T3.[ItemCode] and T3.[MdAbsEntry] = t4.[absentry] WHERE T0.[Docnum] = [%0]

Regards,

Nagarajan