cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional firing of SP

former_member218051
Active Contributor
0 Kudos

Hi All,

Is it possible to fire a SP only if following occurs

while adding it fires very well.

but, it fires in update mode too.

I want to fire it only when user changes the quantity in sales order.

Thanks

Malhaar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

It can be done validating with the Log table of the Document in update mode.

former_member218051
Active Contributor
0 Kudos

Hi ,

Please explain me how to do it .

Thanks

Malhaar

Former Member
0 Kudos

Hi Malhaar,

You can try:

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

BEGIN

IF exists (SELECT T0.DocEntry, MAX(T1.LogInstanc) from RDR1 T0 INNER JOIN ADO1 T1 ON T1.DocEntry=T0.DocEntry AND T1.Linenum=T0.LineNum AND T1.ObjType=17

where T1.Quantity != T0.Quantity AND T0.DOCENTRY = @list_of_cols_val_tab_del

GROUP BY T1.BaseEntry)

Begin

select @Error = 17, @error_message = 'SO quantity must not be changed'

End

END

Thanks,

Gordon

former_member218051
Active Contributor
0 Kudos

Hi Gordon

Thank you very much. It worked.

Thanks

Malhaar

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Malhaar.......

You can do this when you add but it is not possible to make the system understand when you update a particular field......

So it is not possible for updation command in SP for a particular field......

Regards,

Rahul