预期 END 找到 B1 验证配置

Expected END found B1 Validation Configuration

这可能很简单,但我看不到答案。

我正在使用 b1 可用性包并尝试在字段上设置验证配置以提供查询吐出的值。我在 SAP B1 的查询生成器中 运行 查询没有任何问题(给我 '5')但是当我在 B1 验证配置中使用相同的代码时它给我错误“错误:发现预期结束”

代码如下;

@STORE1 = SQL(
SELECT TOP 1
SUM(
CASE WHEN (T4.[ItmsGrpNam] LIKE '%%Ind%%' OR T3.ItemName LIKE '%%Industrial%%' OR T2.ItemName LIKE '%%Industrial%%') THEN 1.0
WHEN (T4.[ItmsGrpNam] LIKE '%%ENV%%' OR T2.[itemName] LIKE '%%ENV%%') THEN 0.5
WHEN (T2.ItemName LIKE '%%WATER%%') THEN 0.5
WHEN (T3.[ItemName] LIKE '%%Comm%%' OR T4.[ItmsGrpNam] LIKE '%%Comm%%') THEN 0.50
WHEN (T3.[ItemName] LIKE '%%IRON%%' OR T4.[ItmsGrpNam] LIKE '%%IRON%%' OR T2.[itemName] LIKE '%%IB42310%%') THEN 1.00 
END
)
FROM OCRD T0 
INNER JOIN [dbo].[@SWA_CT_SUBSCR]  T1 ON T1.U_CardCode = T0.CardCode
INNER JOIN OINS T2 ON T0.[CardCode] = T2.[customer]
INNER JOIN OITM T3 ON T2.[itemCode] = T3.[ItemCode]
INNER JOIN OITB T4 ON T3.ItmsGrpCod = T4.ItmsGrpCod 
WHERE T2.[status] = 'A' AND  
T2.[itemName] NOT LIKE '%%Printer%%' AND  
T2.[itemName] NOT LIKE '%%Label%%' AND  
T3.[ItemName] NOT LIKE '%%IRON%%' AND  
T3.[ItemName] NOT LIKE '%%FILTER%%' AND 
T2.[itemCode] NOT LIKE '%%PYO%%' AND
T2.[itemCode] NOT LIKE '%%ONYX%%' AND
T2.[itemCode] NOT LIKE '%%TOPAZ%%' AND
T2.[itemCode] NOT LIKE '%%NUTEK OZONE%%' AND
T2.[itemCode] NOT LIKE '%%OLS OZONE%%' AND
T0.CardCode = $[.0.0]
);
IF(@STORE1 <> '')
BEGIN
Set($[$SWA_CT_BT.0.NUMBER]|@STORE1);
END

关于为什么会给我这个错误有什么想法吗?

即使我简化了查询,我也遇到了同样的错误,

尝试将 SQL(所有 sql 文本)放在一行中,例如:

@STORE1 = 
SQL(SELECT Cardname FROM OCRD T0 WHERE T0.CardCode = $[.0.0]); 
IF(@STORE1 <> '')
BEGIN
Set($[.0.0]|@STORE1)
END