cancel
Showing results for 
Search instead for 
Did you mean: 

Write protecting Item

former_member370721
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello

Means you want to say that how can i track item code going to change ? am i correct or any other query ?

Thanks

Manvendra Singh Niranjan

former_member370721
Active Participant
0 Kudos

I am having some items that are used by the users like templates with predefined settings to create new items. Usually the user should duplicate the template item and then make his changes and then add it.

Since the users sometimes forgot to duplicate before making their changes the templates always have been overwritten.

The current sql posted prohibits updating if the Flag64 is set for all fields, except for the ItemCode itself. That is waht I want to add now.

Former Member
0 Kudos

Hello

I dont know am i correct or not but i want to suggest that it is better to make master csv file and then use DTW for item master because it is very defficalt to track each & every mistake make by user.

Thanks

Manvendra Signh Niranjan

former_member370721
Active Participant
0 Kudos

This is far from the concept/idea.

How would I know that somebody has overwritten the template? There would be some detection logic ... and this logic is exactly what I need to complete the wrtie protection. If I would know that, then I would not need this whole thing.

Second, somebody would then have to fire DTW - obviously not a normal user - to do what?

Sorry, but this is really is far away from simply having a write protected item as a template.

former_member1269712
Active Contributor
0 Kudos

Hi Franz,

You are right I also faced this problem and I tried through SP notification but not worked as what exactly I want result then I done through SDK addon it is very simple and small code for this. Just take help from technical consultant.

Regards,

Sachin

former_member204969
Active Contributor
0 Kudos

When you rename an item, the system activates the SP with the new item code and U transaction type and with the original item code and D transaction type.

So if you forbid the D transaction type for these items, the SP will forbid renaming them!

former_member370721
Active Participant
0 Kudos

This sounds like a very good idea.

I tried to put that into some SQL ... I seem not to to be able do it right.

Do I have to explicitly use the ItemCodes like 'Template1' in the SP_TN?

I don't get how to check for the QryGroup64 only, without link to the newly created itemcode.

Could you please assist with these lines?

Thanks

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

BEGIN

IF (SELECT T0.QryGroup64 FROM dbo.OITM T0

WHERE T0.DocEntry = @list_of_cols_val_tab_del) = 'Y'

BEGIN

SET @error = 1

............

Edited by: Franz Leu on May 23, 2011 10:38 AM

former_member204969
Active Contributor
0 Kudos

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

former_member370721
Active Participant
0 Kudos

Thanks a lot! Great!

This works so far as I could test in some minutes.

Just for my understanding ... to learn for future use: As I could see it does test for the string in ItemCode only, which is perfect.

So, IF @list_of_cols_val_tab_del like '%-model' does test in ItemCode only, not in all data?

Thanks a lot for your help!

Franz

Former Member
0 Kudos

Hi Franz,

The system variable @list_of_cols_val_tab_del means primary key for the current table. For OITM it is ItemCode only.

Thanks,

Gordon

former_member370721
Active Participant
0 Kudos

Thanks a lot!

Franz

Answers (0)