cancel
Showing results for 
Search instead for 
Did you mean: 

Need a SPT

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi lother

I try like this way, but not Blocking,pls help me

IF @transaction_type IN ('A','U') AND @Object_type = '13'
BEGIN
/*Generate error IF WITHOUT COST CENTER */
IF EXISTS (SELECT INV1.[DocEntry] FROM INV1   INNER JOIN OINV  ON INV1.[DocEntry] = OINV.[DocEntry] 
Inner join OACT on INV1.acctcode = OACT.AcctCode
WHERE OACT.GroupMask = 4
AND OINV.DocType = 'S' and
INV1.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 13, @error_message = 'You had selected Wrong GL CODE, Select The GL Code from Turnover Drawer, For any Clarification Pls contact Finance Department'
END
end
former_member185682
Active Contributor

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

Answers (0)