cancel
Showing results for 
Search instead for 
Did you mean: 

Stored procedure for UDF Update

Former Member
0 Kudos

Hi Tam,

pls help me a stored procedure for blocking a UDF in Purchase Invoice

when first we create the purchase invoice user select the UDF field and post the document..

My requirement is further update to the field to be blocked..

i am using SP is

IF @object_type  = N'18' and @transaction_type IN (N'U')

Begin

Declare @INV1 as Nvarchar(200)

Select @INV1=U_assignedfor From OPCh  Where DocEntry=@list_of_cols_val_tab_del

Declare @INV2 as Nvarchar(200)

Select @INV2=U_assignedfor from PCH1 T1 Inner Join OPCH T0 ON T0.Docentry=T1.Docentry where T1.DocEntry=1

    if @INV2 NOT IN (@INV1)

 

Begin

        Set @error =207

      Set @error_message =(CONVERT(nvarchar(20), @INV2))+(CONVERT(nvarchar(20), @INV1))

    End

End

But in this SP @inv1 and @inv2 Take the same value

Yours AjiAlukkal

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member217514
Active Contributor
0 Kudos

Declare @INV1 as Nvarchar(200)

Select @INV1=U_assignedfor From OPCh  Where DocEntry=@list_of_cols_val_tab_del

Declare @INV2 as Nvarchar(200)

Select @INV2=U_assignedfor from PCH1 T1 Inner Join OPCH T0 ON T0.Docentry=T1.Docentry where T1.DocEntry=1

That is because you are setting them to the same value.  The second query only adds the PCH1 table to you OPCH query.

Did you set the U_assignedfor in the current AP Invoice the same value as the very first AP Invoice entered?