cancel
Showing results for 
Search instead for 
Did you mean: 

particular user can only cancel the document

former_member440545
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

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

former_member440545
Participant
0 Kudos

Hi Diego lother,

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

Answers (0)