Мой вопрос:
Как запретить добавление документа с использованием TN Blocking в SAP b1.Если не определенный товар не выбран?
Я попробовал это:
If @object_type='202' and @transaction_type in('A','U')
BEGIN
declare @SlitCount Integer
declare @CountSlit integer
select @SlitCount = (SELECT T1.DocEntry FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.DocEntry = @list_of_cols_val_tab_del AND T1.ItemCode = 'Item One'
GROUP BY T1.DocEntry
Having Count(T0.ItemCode) <= 1)
If exists (SELECT T0.DocEntry,@CountSlit FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.DocEntry= @list_of_cols_val_tab_del AND @CountSlit = 0
)
Begin
Select @error = 101,
@error_message = 'Item One is not selected'
End
END
Спасибо!