Hi
I have created Stored Procedures that looks at Projects and BP Ref. No.; (1) will be if the Project field on Line level has been left as Null the SP prompts you to select a Project on line level, (2) will be if the Project field on Header Level has been left as Null the SP prompts you to select a Project on Header level, (3) we have certain projects that need blocking and others need to be selected, the SP prompts you to select another project than the one selected, (4) the final SP checks to see if the BP Ref. No field has been left as NULL, if so the SP prompts you to fill this in.
Now I have an issue with consistency on when this SP is run meaning (I have 15 databases) , it runs the SP for JE & AR on one database but then only JE on the other, I am not to sure what may be the issue, I have taken the Blocked Project SP and put it into the Select Project SP's it seems to work but I would like to seperate them so the user gets an understanding of what went wrong as the seperate Stored Procedures work fine on my Local Laptop with SBO on it, the issue is on the server, SP below:
IF @transaction_type='A' AND @Object_type = '13'
BEGIN
--AR Invoice Cust Inv. No.
IF EXISTS (SELECT T0.DocEntry FROM [dbo].[OINV] T0 WHERE T0.NumAtCard ='0' OR T0.NumAtCard IS NULL AND T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SET @Error = 10
SET @error_message = 'AR Invoice - Please define the Customer Invoice Number within Cust. Inv. No. Field'
END
END
IF @transaction_type='A' AND @Object_type = '13'
BEGIN
--AR Invoice Header
IF EXISTS (SELECT T0.DocEntry FROM [dbo].[OINV] T0 WHERE T0.Project ='0' OR T0.Project IS NULL AND T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SET @Error = 10
SET @error_message = 'AR Invoice - Please select Project Code under Accounting Tab > BP Project'
END
END
IF @transaction_type='A' AND @Object_type = '13'
BEGIN
--AR Invoice Lines
IF EXISTS (SELECT T0.DocEntry FROM dbo.INV1 T0
WHERE (T0.Project ='' OR T0.Project IS NULL) AND T0.DocEntry = @list_of_cols_val_tab_del)
Begin
SET @Error = 10
SET @error_message = 'AR Invoice - Please set Project Code on every line !'
End
END
IF @transaction_type='A' AND @Object_type = '13'
BEGIN
--AR Invoice Header
IF EXISTS (SELECT T0.DocEntry FROM [dbo].[OINV] T0 WHERE T0.Project ='100000' OR T0.Project ='100001' OR T0.Project ='102001' OR T0.Project ='104000' AND T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SET @Error = 10
SET @error_message = 'AR Invoice Header - This Project is blocked please select the correct one'
END
END
IF @transaction_type='A' AND @Object_type = '13'
BEGIN
--AR Invoice Lines
IF EXISTS (SELECT T0.DocEntry FROM dbo.INV1 T0
WHERE (T0.Project ='100000' OR T0.Project ='100001' OR T0.Project ='102001' OR T0.Project ='104000') AND T0.DocEntry = @list_of_cols_val_tab_del)
Begin
SET @Error = 10
SET @error_message = 'AR Invoice Lines - This Project is blocked please select the correct one'
End
END
The above is for AR Invoices, I also have for 14 - AR Credit Notes, 18 AP Invoices, 19 - AP Credit Notes and 30 - Manual Journal Entries.
Let me know where I may be going wrong.
Yours Sincerely
Kurt Walters