cancel
Showing results for 
Search instead for 
Did you mean: 

GRPO and AP Invoice query

former_member224264
Participant
0 Kudos

Greetings of the day Experts,

Does anyone have a query to match the GRPO Value and quantity details between GRPO and AP Invoice?

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mekhala,

Please check below Query.

SELECT T0.DocNum as GRN_No, T1.DocNum as AP_Invoice_No, T3.ItemCode as GRN_Item, T4.ItemCode as Invoice_Item,

T3.Quantity as GRN_Qty, T4.Quantity as Invoice_Qty, T0.DocTotal as GRN_DocTotal, T1.DocTotal as Invoice_DocTotel FROM OPDN T0

INNER JOIN PDN1 T3 ON T3.DocEntry = T0.DocEntry

LEFT JOIN  PCH1 T4 ON T4.BaseEntry = T3.DocEntry AND T4.BaseLine = T3.LineNum

LEFT JOIN OPCH T1 ON T1.DocEntry = T4.DocEntry

WHERE T0.DocDate between  [%0] and [%1]

GROUP BY T0.DocNum, T1.DocNum , T3.ItemCode , T4.ItemCode ,T3.Quantity , T4.Quantity , T0.DocTotal , T1.DocTotal

Hope this helps

--

--

Regards::::

Atul Chakraborty

Answers (2)

Answers (2)

former_member224264
Participant
0 Kudos

Greetings of the day, Manish and Atul,

Wow, appreciate the immediate and prompt response to our help.

Thanks a lot, this would help me a lot.

The problem was i am not aware of joining three or more tables.  if you can share me a guide to it, that would be more helpful in future.

Regards.

former_member184146
Active Contributor
0 Kudos

Hi Mekhala,

                    Thanks & welcome for the appreciation , for SQL Guide please post a new thread as you know this thread is already closed .

--Manish

former_member184146
Active Contributor
0 Kudos

Hi,

     Try the below query

SELECT A.DocDate AS [GRPO DATE],D.DocDate AS [INVOICE DATE],A.DocNum AS [GRPO DOC NO],D.DocNum AS [INVOICE DOCNUM],B.ItemCode ,B.Quantity AS [GRPO QTY],C.Quantity AS [INVOICE QTY]

FROM OPDN A

INNER JOIN PDN1 B ON A.DocEntry=B.DocEntry

LEFT OUTER JOIN PCH1 C ON C.BaseRef=B.TrgetEntry

INNER JOIN OPCH D ON C.DOCENTRY=D.DOCENTRY  LEFT OUTER JOIN ORCT E ON E.DOCENTRY=D.DOCENTRY

GROUP BY  A.DocDate ,D.DocDate ,A.DocNum ,D.DocNum ,B.ItemCode ,B.Quantity ,C.Quantity

--Manish

0 Kudos

Hi I already practice this query but not working.
kindly help me, anyone know what query for check wich GRPO is not invoiced ?

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi there,

You have a question and need help by the community? Instead of posting into an old question thread, it is more helpful for you, if you create your own question. Here is how to get started:

  1. Learn about asking and answering questions in SAP Community with this tutorial: https://developers.sap.com/tutorials/community-qa.html
  2. Ask your detailed question here: https://answers.sap.com/questions/ask.html
  3. Wait for a response.

That's it. Thank you!

Best regards

Jennifer

Your SAP Community moderator