cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How prevent to remove a bill of material?

Cherry_Tran
Participant
0 Kudos
653

Dear Experts,

How can I prevent someone remove a bill of material in the system? I user Sap business One ver. Hana.

Accepted Solutions (0)

Answers (3)

Answers (3)

mgregur
Active Contributor

Hi,

I would suggest using a TransactionNotification. You can try with the following code:

IF :object_type = N'4' AND :transaction_type = N'U' THEN
	SELECT IFNULL(COUNT(T0."ItemCode"), 0) INTO BoM_cnt
	FROM OITM T0
	INNER JOIN AITM T1 ON T0."ItemCode" = T1."ItemCode" AND T1."LogInstanc" = (SELECT MAX(A0."LogInstanc") FROM AITM A0 WHERE A0."ItemCode" = T0."ItemCode")
	WHERE T0."TreeType" = 'N' AND T1."TreeType" != 'N'
	
	if :BoM_cnt > 0 THEN
		begin
		error := 1;
		error_message := N'Bill of Materials cannot be deleted';
		end;
   end if;
end if;<br>

BR,

Matija

Cherry_Tran
Participant
0 Kudos

Dear Mr mgregur ,

Thank you so much for your help.

sumama92
Explorer
0 Kudos

Just try this, 100% working.

IF :object_type = '66' AND :transaction_type = 'D' THEN
error := 672;
error_message := 'You are not authorised to Delete BOM';

END IF;

former_member4887
Participant
0 Kudos

Hey

Please refer to these link for more information about your query.

https://answers.sap.com/questions/2581004/deletion-of-bom.html

(Above link explain activation of change management for BOM object)

https://answers.sap.com/questions/669006/unable-to-mark-bom-for-deletion.html

( This link will explain all ways of bom deletion which could be controlled through authorization restriction or screen variant to hide field which allows deletion flag etc.)

Cherry_Tran
Participant
0 Kudos

Dear nidaanwaar ,

Thank you for your reply but I want to ask for Sap business One. I will correct my question clearly.