Skip to Content
0

Need modification SPT

Nov 20, 2016 at 07:10 AM

41

avatar image

Hi experts

i need to some modification in SPT

In this SPT i need either Cost center or Project, any one should be Noted in the JE, when i add using OR its not working

the below given is the SPT Coding

pls guid to sort it out

Regards

IF (@Object_Type='30') AND (@transaction_type in ('A', 'U'))
BEGIN 
	IF (EXISTS (SELECT T0.Account FROM JDT1 T0 INNER JOIN OACT T1 ON T0.Account = T1.AcctCode WHERE T1.GroupMask IN ('4','5','6','7') and ISNULL(T0.ProfitCode, '') = '' AND  T0.TransId = @list_of_cols_val_tab_del))
	BEGIN 
		SET @error = 10 SET @error_message = N'Its Mandatory to Choose The Cost Center Code / Project Code, For any Clarification Please Contact Finance Department'
	END
END
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Nov 20, 2016 at 11:55 PM
0

Hi Shahan

You need add the new field in your where clause.

IF (@Object_Type='30') AND (@transaction_type in ('A', 'U'))
BEGIN 
	IF (EXISTS (SELECT T0.Account FROM JDT1 T0 INNER JOIN OACT T1 ON T0.Account = T1.AcctCode 
		WHERE T1.GroupMask IN ('4','5','6','7') AND 
		(ISNULL(T0.ProfitCode, '') = '' OR  ISNULL(T0.Project, '') = '') AND  T0.TransId = @list_of_cols_val_tab_del))
	BEGIN 
		SET @error = 10 SET @error_message = N'Its Mandatory to Choose The Cost Center Code / Project Code, For any Clarification Please Contact Finance Department'
	END
END

Kind Regards,

Diego Lother

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

Dear Lother

i again try with the same NEW SPT you provided, and i try to add a JE with giving Project insted of Cost Center

but still blocking

Regards

0

Hi Shahan

I understood that Cost Center and Project are mandatory. In my previous query the two fields should be filled.

If what you need is that Cost Center OR Project should be filled, this is the correct query:

IF (@Object_Type='30') AND (@transaction_type in ('A', 'U'))
BEGIN 
	IF (EXISTS (SELECT T0.Account FROM JDT1 T0 INNER JOIN OACT T1 ON T0.Account = T1.AcctCode 
		WHERE T1.GroupMask IN ('4','5','6','7') AND 
		(ISNULL(T0.ProfitCode, '') = '' AND  ISNULL(T0.Project, '') = '') AND  T0.TransId = @list_of_cols_val_tab_del))
	BEGIN 
		SET @error = 10 SET @error_message = N'Its Mandatory to Choose The Cost Center Code / Project Code, For any Clarification Please Contact Finance Department'
	END
END

Kind Regards,

Diego Lother

1