Skip to Content
0
Former Member
Mar 28, 2009 at 05:16 AM

how to make field mandatory

248 Views

Hi all,

i want to make price ,tax code and ware house code in purchase order rows mandatory.

i have designed following Stored procedure..

IF @transaction_type IN (N'A', N'U') AND 
(@Object_type = N'22')

BEGIN 
if exists (SELECT T0.docnum FROM [dbo].[OPOR] T0 INNER 
JOIN [dbo].[POR1] T1 ON T1.DOCENTRY = 
T0.docENTRY
WHERE   T1.[Price] = 0 
and T1.DOCENTRY = @list_of_cols_val_tab_del)

select @Error = 1, @error_message = 
'Enter Price'


else

if exists (SELECT T0.docnum FROM [dbo].[OPOR] T0 INNER 
JOIN [dbo].[POR1] T1 ON T1.DOCENTRY = 
T0.docENTRY
WHERE    T1.[TaxCode] is  null 
and T1.DOCENTRY = @list_of_cols_val_tab_del)
begin
select @Error = 2, @error_message = 
'Enter Tax Code'
end

else if exists (SELECT T0.docnum FROM [dbo].[OPOR] T0 INNER 
JOIN [dbo].[POR1] T1 ON T1.DOCENTRY = 
T0.docENTRY
WHERE    T1.[WhsCode] is  null 
and T1.DOCENTRY = @list_of_cols_val_tab_del)
begin

select @Error = 3, @error_message = 
'Enter Warehouse Code'
end
END

but system checks only for price and not for other two validation .

kindly suggest me way where system will check for all the validation defind in the Stored Procedure.