Hi,
I need to do a check that the correct price is being used in a document. The reason is that we are having a formatted search in the unit price field, which can be affected by the refreshing of two different fields on line level.
We created an UDF on the Warehouse to indicate the correct price list to use.
My TXN however returns an error due to one of the sub queries returning more than one result.
I have marked the two problem areas in red.
Your help will be appreciated.
Thanks
Jacques
if @object_type = '17' AND @transaction_type IN ('A','U')
begin
if(select count(*) from RDR1 (nolock) where RDR1.Price <> (Select ISNULL( ITM1.Price,0)
From ITM1 (NOLOCK) INNER JOIN RDR1 (NOLOCK) ON ITM1.ITEMCODE = RDR1.ITEMCODE
WHERE ((ITM1.ItemCode = RDR1.ItemCode) AND (RDR1.docentry = @list_of_cols_val_tab_del)) AND (ITM1.PriceList = (Select OWHS.U_mainpersonPL
From OWHS (NOLOCK) where OWHS.WHSCODE = (Select RDR1.WhsCode from RDR1 WHERE RDR1.docentry = @list_of_cols_val_tab_del)))
AND
(RDR1.docentry = @list_of_cols_val_tab_del))) <> 0
begin
set @error=1
set @error_message='BK - PLEASE UPDATE THE UNIT PRICE ACCORDING THE WAREHOUSE'
end
end