Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query Where statement issue

Experts,

I have a (distribution) client that needs a query to show duplicate items on PO's with the same row UDF T1.U_MD_02 (Cust. PO#) and different UDF T1.U_L_03 (Cust. PO Line#)

I'm having difficulty with the part where I need to only show records that have different Cust. PO Line#, marked in red. This query below do not filter that part correctly.

SELECT "Repetition Count", "Cust. PO#", CardName, docnum, itemcode, Dscription, Quantity, "Cust. PO Line#" from

(SELECT DISTINCT COUNT(T1."ItemCode") OVER(PARTITION BY T1."U_MD_02", T1."ItemCode")

AS "Repetition Count",T1."U_MD_02" as "Cust. PO#",T0."DocNum" as docnum,T0."CardName" as CardName,T1."ItemCode" as itemcode,T1."Dscription" as Dscription, T1."Quantity" as Quantity, T1."U_NBS_L_03" as "Cust. PO Line#"

FROM OPOR T0  INNER JOIN POR1 T1 ON T0."DocEntry" = T1."DocEntry"

WHERE T1."U_MD_02" = T1."U_MD_02" AND T1."U_L_03" <> T1."U_L_03")

where "Repetition Count" > 1

Your help would be much appreciated.

Marli

Tags:
Not what you were looking for? View more on this topic or Ask a question