on 06-17-2017 7:25 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.