Skip to Content
avatar image
Former Member

Need to block editing, deleting adding the Global Location Number Field in Business Master data

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Feb 02, 2017 at 05:28 AM

    Hello,

    You can achieve this by following ways

    1. Active this field only for the user you want deactivate it for others through form settings.
    2. Active this field only for the user you want deactivate it for others through Form UI.
    3. You can write a TN code for this as well.

    Thanks

    Engr. Taseeb Saeed

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Feb 02, 2017 at 07:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 07:42 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Feb 02, 2017 at 12:24 PM

    Have you checked my TN?

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 12:47 PM

    No, it will not block if GLN field is added first time. Please check it again.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 01:10 PM

    Do you want block when field is empty?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      No if its empty then don't block, if a data is enter for the first time, then it should not be removed, where here am able to remove if i try to remove the entire data, if it partial its blocking

      also the same in Modification should not be allowed

      Regards

  • avatar image
    Former Member
    Feb 02, 2017 at 01:03 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 05, 2017 at 11:47 AM

    Hello,

    Did you tried my code?

    Thanks

    Engr. Taseeb Saeed

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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