Skip to Content
0

particular user can only cancel the document

Jun 17, 2017 at 06:25 AM

48

avatar image

only particular userid(13) can cancel the document which is above 7 days otherwise it shown an error for otheruser..how to write a sp transaction notification for this?

kindly anyone help to solve this issue.....

Myquery is not working

IF @transaction_type IN ( 'C') AND @object_type = '46'

begin

IF exists(SELECT USERSIGN2 from OVPM T1 WHERE T1.DocEntry = @list_of_cols_val_tab_del and t1.usersign='1'and t1.usersign2='1')

BEGIN IF EXISTS( SELECT T0.DocNum,T0.DocDate FROM OVPM T0 where DATEDIFF(D,T0.[DOCDATE],GETDATE()) >7 AND t0.DocEntry = @list_of_cols_val_tab_del)

BEGIN SELECT @Error = 5, @error_message = 'Cannot cancel document : Time limit exceed !'

END

END

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Jun 17, 2017 at 05:45 PM
0

Hi Manikandan,

Try this query:

IF @transaction_type IN ('C') AND @object_type = '46'
BEGIN
	IF (SELECT CASE WHEN DATEDIFF(D, DocDate,GETDATE()) > 7 AND UserSign2 <> 13 THEN 1 ELSE 0 END FROM OVPM WHERE DocEntry = @list_of_cols_val_tab_del) = 1
	BEGIN
		SELECT @error = 5, @error_message = 'Cannot cancel document : Time limit exceed !'
	END
END

If the user is not 13, please replace with the correct value.

Hope it helps.

Kind Regards,

Diego Lother

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Diego lother,

Thanks for your reply..Superb..Query is working Fine

0