Stored Procedure to block cost center or profit center to present in JE
I have a case where i need to block if either one of the cost center or the Profit Center is not present in the manual journal entry.
Below is my Stored Procedure which i have written....My Problem is that this block allows me to update only if both the Cost Center and the Profit Center is Present and does not allow if any one is present.
IF @object_type='30' AND (@transaction_type='A' or @transaction_type='U')
if(Select Count(*) from OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId=T1.TransId
INNER JOIN OACT T2 ON T2.AcctCode=T1.Account
where T2.ExportCode LIKE '1%' And (isnull(T1.ProfitCode,0)='0' OR ISNULL(T1.OcrCode2,'')='') and
SET @error = 0201
SET @error_message= 'R1'
What could be the problem...?