Skip to Content

particular user can only cancel the document

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 17, 2017 at 05:45 PM

    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

    Add comment
    10|10000 characters needed characters exceeded