SAP - AP Invoice vs AP Reserve Invoice in SQL
SELECT T0.CardCode, T0.CardName, T0.DocNum, T0.DocDate, T1.ItemCode, T1.Dscription, T1.Quantity, T1.Price, T1.LineTotal
from OPCH T0
INNER JOIN PCH1 T1 ON T1.DocEntry = T0.DocEntry
WHERE T1.LineStatus = 'O' AND T0.DocStatus = 'O' AND T0.IsIns = 'Y'
There is a filed "isIns" in OPCH table which differs b/w AP Invoices and AP Reserve Invoices 'Y' denotes for reserve invoice.
SELECT T0.DocNum,T0.CardCode ,T0.CardName ,T1.ItemCode,T1.Dscription ,T1.Quantity ,T1.Price,T1.OpenQty , T0.DocTotal FROM OPCH T0 INNER JOIN PCH1 T1 on T0.DocEntry=T1.DocEntry WHERE T0.DocStatus='O' and T0.InvntSttus='O' and T0.isIns='Y'