Hi,
In one of the Apps, I got the logic for the KPI -3-way match. But when I tried to fix I am getting the error as below- Can you please help me? Please find the error first and then the logic I used -
Error:
Syntax error near r<] after reading g (((1.0*"EKPO"."MENGE") - (1.0*PU_SUM("EKPO","EKBE"."MENGE","EKBE"."VGABE"='1' AND "EKBE"."SHKZG" = 'S'))) >= (-1*((1.0*"EKPO"."MENGE") *(] at line 21. Please refer to PQL documentation for available syntax.
Logic:
100*(1.0*COUNT( DISTINCT
CASE
-- No quantity match if order quantity is 0
WHEN "EKPO"."MENGE" = 0 THEN NULL
WHEN
-- Quantity match
--Order Quantity = GR Quantity
(((1.0*"EKPO"."MENGE") - (1.0*PU_SUM("EKPO","EKBE"."MENGE","EKBE"."VGABE"='1' AND "EKBE"."SHKZG" = 'S'))) >= (-1*((1.0*"EKPO"."MENGE") *(<%=tolerance_high_quantity%>/100.00))))
AND (((1.0*"EKPO"."MENGE") - (1.0*PU_SUM("EKPO","EKBE"."MENGE","EKBE"."VGABE"='1' AND "EKBE"."SHKZG" = 'S'))) <= (((1.0*"EKPO"."MENGE")*(<%=tolerance_low_quantity%>/100.00))))
-- Order Quantity = IR Quantity
AND (((1.0*"EKPO"."MENGE") - (1.0*PU_SUM("EKPO","RSEG"."MENGE"))) >= (-1*((1.0*"EKPO"."MENGE") *(<%=tolerance_high_quantity%>/100.00))))
AND (((1.0*"EKPO"."MENGE") - (1.0*PU_SUM("EKPO","RSEG"."MENGE"))) <= (((1.0*"EKPO"."MENGE")*(<%=tolerance_low_quantity%>/100.00))))
-- IR Quantity = GR Quantity (with tolerance of Order Quanitty)
AND (((1.0*PU_SUM("EKPO","RSEG"."MENGE")) - (1.0*PU_SUM("EKPO","EKBE"."MENGE","EKBE"."VGABE"='1' AND "EKBE"."SHKZG" = 'S'))) >= (-1*((1.0*"EKPO"."MENGE") *(<%=tolerance_high_quantity%>/100.00))))
AND (((1.0*PU_SUM("EKPO","RSEG"."MENGE")) - (1.0*PU_SUM("EKPO","EKBE"."MENGE","EKBE"."VGABE"='1' AND "EKBE"."SHKZG" = 'S'))) <= (((1.0*"EKPO"."MENGE")*(<%=tolerance_low_quantity%>/100.00))))
-- Value match
--(Price per Unit (PO) - Price per Unit (Invoice) >= -price increase tolerance (diff is negative when price increases)
--and Price per Unit (PO) - Price per Unit (Invoice) <= price decrease tolerance (diff is positive when price decreases))
AND(((<%=netwr%>/EKPO.MENGE) - (PU_SUM("EKPO","RSEG"."WRBTR")/PU_SUM("EKPO","RSEG"."MENGE"))) >= (-1*((<%=netwr%>/EKPO.MENGE)*(<%=tolerance_high_price%>/100.00))))
AND (((<%=netwr%>/EKPO.MENGE) - (PU_SUM("EKPO","RSEG"."WRBTR")/PU_SUM("EKPO","RSEG"."MENGE"))) <= (((<%=netwr%>/EKPO.MENGE)*(<%=tolerance_low_price%>/100.00))))
THEN "EKPO"."MANDT"||"EKPO"."EBELN"||"EKPO"."EBELP"
ELSE NULL
END)/COUNT_TABLE("EKPO"))