Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Write protecting Item

I am having the following code in SP_TN that successfully protects changing Items that are used as sample Items and base to duplicate from.

It only can not detect changing of the ItemCode itself.

IF @object_type = '4' AND @transaction_type = 'U'

BEGIN

IF EXISTS (SELECT T0.ItemCode FROM dbo.OITM T0

WHERE T0.ItemCode = @list_of_cols_val_tab_del AND T0.QryGroup64='Y')

BEGIN

IF EXISTS (SELECT T1.ItemCode FROM dbo.AITM T1

WHERE T1.ItemCode = @list_of_cols_val_tab_del AND T1.QryGroup64='Y'

AND T1.LogInstanc = (SELECT MAX(T2.LogInstanc) FROM dbo.AITM T2 WHERE T2.ItemCode = @list_of_cols_val_tab_del))

BEGIN

SET @error = 1

SET @error_message = N'Dies ist ein schreibgeschützter Musterartikel ! - Fragen? Fragen!'

END

END

END

Any suggestions on how to add that it detects every change, including changing the ItemCode?

Thanks

Franz

replied

The problem is that the SBO_SP_TransactionNotification sees the OITM after the deletion and that there is no entry in the AITM for the deleted item.

You might add some standard text at the end of these item codes (e.g. u2018u2013modelu2019) and forbid the deletion such items:

IF @object_type = '4' AND @transaction_type ='D' 
BEGIN
IF  @list_of_cols_val_tab_del like '%-model'
BEGIN
SET @error = 1
SET @error_message = N'Dies ist ein schreibgeschützter Musterartikel ! - Fragen? Fragen!'
END
END

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question