on 02-01-2017 1:23 PM
Hi experts
i have some data in Business partner Data >> Global Local Number
the data what has been enter in that field should not be Removed for Edited by any of the End user, same time selected Super user only should be able to edit or delete or add
in that fields,
pls any one could share me the SPT code.
Regards
Hello,
Did you tried my code?
Thanks
Engr. Taseeb Saeed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Try this now
If @object_type = '2' And @transaction_type in ('A','U')
BEGIN
DECLARE @prvValue NVARCHAR(100)
DECLARE @crValue NVARCHAR(100)
DECLARE @user SMALLINT
SELECT TOP 1
@prvValue = ISNULL(T1.LicTradNum,'') -- Change Field Name here
,@crValue = ISNULL(T0.LicTradNum,'') -- Change Field Name here
,@user = t0.UserSign
FROM dbo.OCRD T0
LEFT OUTER JOIN dbo.ACRD T1 ON t0.CardCode = t1.CardCode
WHERE t0.CardCode = @list_of_cols_val_tab_del
ORDER BY t1.LogInstanc DESC
IF @prvValue <> @crValue AND @user IN (1,2,3) --Give User ID of those which would be restricted
BEGIN
SET @error = '381'
SET @error_message = 'You are not permitted to change ABC field'
END
END
Thanks
Engr. Taseeb Saeed
Hello
Please update previous code and only apply that for Update i.e. @transaction_type in ('U')
and add following code
If @object_type = '2' And @transaction_type in ('A')
BEGIN
DECLARE @Value NVARCHAR(100)
DECLARE @user SMALLINT
SELECT @Value = ISNULL(T0.LicTradNum,'') -- Change Field Name here
,@user = t0.UserSign
FROM dbo.OCRD T0
WHERE t0.CardCode = @list_of_cols_val_tab_del
IF LEN(@Value) > 0 AND @user IN (1,2,3) --Give User ID of those which would be restricted
BEGIN
SET @error = '381'
SET @error_message = 'You are not permitted to Add ABC field'
END
END
Thanks
Engr. Taseeb Saeed
Do you want block when field is empty?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rajan
yes its blocking and allowing to add, but one more issue, if i try to remove all the data it is allowing, where if i try to remove some character or number it will block
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, it will not block if GLN field is added first time. Please check it again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you checked my TN?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this,
IF @transaction_type in ('U') AND (@OBJECT_TYPE='2')
BEGIN
If exists
( SELECT T2.[CardCode]
FROM ACRD T0 left join ACRD T1 on t0.[CardCode] = T1.[CardCode] and t0.loginstanc-1 = t1.loginstanc-1 left JOIN OCRD T2 ON T0.cardcode = T2.CardCode WHERE T2.[GlblLocNum] <> T1.[GlblLocNum]and T2.Cardcode = @list_of_cols_val_tab_del)
Begin
SET @error = 10
SET @error_message = 'Not allowed to update GLN value. Contact sys admin'
End
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi taseeb
This TP works , but if my user try to delete all the Character or Numbers expect one (1) it will block
for example: if i have a data like 'Taseeb'. and if my user try to delete other than 'T' , he will be blocked, where if he delete the entire 'Taseeb', it will allow the user to remove and also allow to add the new one like 'Taseeb 1'
Regards
Hi Shahan,
Go through Edit Form UI
1. Open Business Partner Master Data
2 . Tools ---> Edit FORM UI ---> Right Click on GLN Field ----> Select Disable option ----> save
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can achieve this by following ways
Thanks
Engr. Taseeb Saeed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Please replace your relevant field name where i have commented in following code
If @object_type = '2' And @transaction_type in ('A','U')
BEGIN
DECLARE @prvValue NVARCHAR(100)
DECLARE @crValue NVARCHAR(100)
DECLARE @user SMALLINT
SELECT TOP 1
@prvValue = T1.LicTradNum -- Change Field Name here
,@crValue = T0.LicTradNum -- Change Field Name here
,@user = t0.UserSign
FROM dbo.OCRD T0
LEFT OUTER JOIN dbo.ACRD T1 ON t0.CardCode = t1.CardCode
WHERE t0.CardCode = @list_of_cols_val_tab_del
ORDER BY t1.LogInstanc DESC
IF @prvValue <> @crValue AND @user IN (1,2,3) --Give User ID of those which would be restricted
BEGIN
SET @error = '381'
SET @error_message = 'You are not permitted to change ABC field'
END
END
Thanks
Engr. Taseeb Saeed
User | Count |
---|---|
100 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.