Skip to Content
avatar image
Former Member

Need a SPT

Hi Experts

My users should only allow to add AR Invoice (Service Type) using GL code from . OACT.GroupMask = 4.

If any of the users try to add AR Invoice (Service Type) by selecting GL code which does not belongs to Group Mask = 4 , then they should be blocked by SPT

This in need to be applicable only for Service type AR invoice

pls help me with SPT, to solve this issue

Regrads

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 19, 2016 at 11:49 AM

    Hi Shahan

    For achieve what you need use this:

    IF (@Object_Type='13') AND (@transaction_type in ('A', 'U')) BEGIN
    	--Do your validation here
    	-- To validate if is a Service Type document, look the field DocType = 'S'
    END
    

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Shahan,

      There is a small mistake in your validation.

      IF @transaction_type IN ('A','U') AND @Object_type = '13'
      BEGIN
      /*Generate error IF WITHOUT COST CENTER */
      	IF EXISTS (SELECT T0.DocEntry FROM INV1 T0 INNER JOIN OINV T1 ON T1.DocEntry = T1.DocEntry
      				INNER JOIN OACT T2 ON  T0.acctcode = T2.AcctCode
      				WHERE T2.GroupMask <> 4 AND T1.DocType = 'S' and
      				T0.DocEntry = @list_of_cols_val_tab_del)
      	BEGIN
      		SET @error = 13
      		SET @error_message = 'You had selected Wrong GL CODE, Select The GL Code from Turnover Drawer, For any Clarification Pls contact Finance Department'
      	END
      END

      For your purpose in where clause you should use GroupMask <> 4.

      Kind Regards,

      Diego Lother