cancel
Showing results for 
Search instead for 
Did you mean: 

Validation to block cancellation of AR invoice for specific users

Swathy
Explorer
0 Kudos
263

Hi,

I want to block few users from cancelling AR invoice document. I have tried the following Transaction Notification on HANA database.

 

If ((:transaction_type='L') and :object_type = '13')  THEN 
SELECT
  COUNT(*) INTO temp_var_0
FROM
(
SELECT A."DocEntry"
FROM INV1 A
INNER JOIN OINV B ON A."DocEntry"=B."DocEntry"
LEFT OUTER JOIN OUSR C ON B."UserSign" = C."USERID"
WHERE C."U_NAME" NOT IN ('cwi01','cwi03','cwi04') AND 
A."DocEntry" =:list_of_cols_val_tab_del
 
)R;
 
IF :temp_var_0>0 THEN 
OutPut1:=1;
error_no:=503;
error_text:='Cancellation is not allowed';
END IF;
END IF;
 

It is not working.

Could you please help on this.

Accepted Solutions (0)

Answers (1)

Answers (1)

ManishPant
Participant

Hi @Swathy ,

If ( :object_type = '13' AND :transaction_type = 'A')  
THEN 
			DECLARE temp_var_0 INT := 0; 
			SELECT COUNT(B."DocEntry") INTO temp_var_0
			FROM OINV B 
			LEFT OUTER JOIN OUSR C ON B."UserSign" = C."USERID"
			WHERE B.CANCELED IN ('C','Y') AND  C."U_NAME" NOT IN ('cwi01','cwi03','cwi04') AND B."DocEntry" =:list_of_cols_val_tab_del;
 
			IF :temp_var_0>0 
			THEN 
						error:=503;
						error_message:='Cancellation is not allowed';
			END IF;
END IF;

When you try to cancel the AR Invoice document, a cancellation document is added therefor the transaction type will be [A]dd.

For Cancellation you can check the CANCELED column.

 

Thanks.

Manish.

Swathy
Explorer
Hi, Thanks for your time and response. We have handled this process through General authorisation - Cancel Marketing Documents by Generating Cancelation Documents option. We set this option to No authorization.