Skip to main content

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"))

Some ideas that come to my mind:

  • you haven't defined variable <%=tolerance_high_quantity%>
  • The variable <%=tolerance_high_quantity%> contains either null or an invalid value
  • there is some type mismatch with this part <%=tolerance_high_quantity%>/100.00

 

My advice: use comments to take out parts of the KPI and validate it by parts.

 

HTH

 

Best luck


Reply