I have created two udf's: one at header level and one at row level.
In case if the values in the two udf's is 'Main', then the addition of inventory transfer is to be blocked.
IF @transaction_type IN (N'A', N'U') AND (@Object_type = N'67')
if exists (SELECT T1.DocEntry FROM OWTR T0 inner join WTR1 T1 on T0.docentry = T1.Docentry
WHERE T0.Filler =@list_of_cols_val_tab_del and T0.U_WhsType ='Main'
and T1.U_WhsTyp = 'Main' )
SET @error = 7
SET @error_message = N'Main Warehouse to Main Warehouse Transfer of Stock is not Permitted!! '
This does not work but I would like it to work on the logic provided.