cancel
Showing results for 
Search instead for 
Did you mean: 

Prohibit users to cancel a Sales Order if there is a pick note linked to it

0 Kudos

Hi guys,

Wondering if anyone can give some pointers. In our system, we want to prohibit users from canceling a sales order if there is already a picknote linked to the document. Or maybe a warning to pop up to notify them that the Sale order they want to cancel has a pick note linked to it.

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Mohd Danish and thank you for your help.

I`ve tried your code, but since we are not using the PickRmrk field, when I implemented the code, it wouldn`t allow to cancel any orders, no matter if they were on pick lists or not. So I`ve replaced the PickRmrk field with PickStatus from RDR1, but with the new code it allows to cancel. Below is your code with my amends:

IF :Object_Type ='17' AND (:Transaction_Type = 'L' or :Transaction_Type = 'C')

THEN declare SOCL_var_0 varchar(100);

SELECT (SELECT Count (T0."DocEntry")

FROM ORDR T0 INNER JOIN OUSR T1 ON T0."UserSign" = T1."USERID" INNER JOIN RDR1 T2 ON T0."DocEntry" = T2."DocEntry"

WHERE T2."PickStatus"='R' and T0."DocEntry" = :list_of_cols_val_tab_del)

INTO SOCL_var_0 FROM DUMMY;

IF :SOCL_var_0 > 0 THEN SELECT 5076, 'Order has been release to pick list' INTO error, error_message FROM DUMMY;

END IF;

END IF;

Answers (2)

Answers (2)

MD1
Active Contributor
0 Kudos

Dear

Paul Constantin Marin

try this TN

SAP HANA

IF :Object_Type ='17' AND (:Transaction_Type = 'L' or :Transaction_Type = 'C') THEN
declare SOCL_var_0 varchar(100);
SELECT
(SELECT Count (T0."DocEntry")
FROM ORDR T0
INNER JOIN OUSR T1 ON T0."UserSign" = T1."USERID"
WHERE T0."PicRmrk" IS NULL and T0."DocEntry" = :list_of_cols_val_tab_del) INTO SOCL_var_0 FROM DUMMY;
IF :SOCL_var_0 > 0 THEN
SELECT 5076, 'Cancelled/Close Remarks is must' INTO error, error_message
FROM DUMMY;
END IF;
END IF;

Danish

agustin_marcoscividanes
Active Contributor
0 Kudos

Hi

the easiest way is using the Transaction Notification store procedure.

Kind regards

Agustín