Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OPCH - need Item document type, not service

0 Kudos
288
  • SAP Managed Tags:

I have a query to show all items, POs against them, and their corresponding invoices. It's bringing up duplicate DocNum for each PO. Is there a way to limit it to just the invoice rather than all invoice documents?

SELECT T0."ItemCode",T0."Dscription", T1."DocNum" as "PO #", T2."CardName", T1."DocDueDate", T1."DocStatus", T0."Quantity" as "Original Quantity", T0."OpenQty", T3."DocNum" as "Invoice #" FROM "SGL_LIVE"."POR1" T0 INNER JOIN "SGL_LIVE"."OPOR" T1 ON T0."DocEntry" = T1."DocEntry" INNER JOIN "SGL_LIVE"."OCRD" T2 ON T0."BaseCard" = T2."CardCode" INNER JOIN OPCH T3 ON T2."CardCode" = T3."CardCode"

2 REPLIES 2

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
205
  • SAP Managed Tags:

bwyrick

SELECT T0."ItemCode",T0."Dscription", T1."DocNum" as "PO #", T2."CardName", T1."DocDueDate", T1."DocStatus", T0."Quantity" as "Original Quantity", T0."OpenQty", T3."DocNum" as "Invoice #"
FROM "SGL_LIVE"."POR1" T0
INNER JOIN "SGL_LIVE"."OPOR" T1 ON T0."DocEntry" = T1."DocEntry"
INNER JOIN "SGL_LIVE"."OCRD" T2 ON T0."BaseCard" = T2."CardCode"
INNER JOIN OPCH T3 ON T2."CardCode" = T3."CardCode"
WHERE T3.DocType = 'IV'

0 Kudos
205
  • SAP Managed Tags:

I get a system message of "No data was found" with this criteria when I add the where clause.