Skip to Content
0

Need a SPT

Nov 19, 2016 at 06:28 AM

44

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Nov 19, 2016 at 11:49 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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
0

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

1