Skip to Content

Purchase Report by Batch based on GRPO

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'

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 28, 2017 at 04:53 AM

    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

    Add comment
    10|10000 characters needed characters exceeded