Skip to Content
0
Former Member
Dec 10, 2009 at 03:49 PM

SBO_SP_TransactionNotification for Business Partners

207 Views

I have created the following query and it works really well for @transaction_type = 'A', but not at all for 'D' or 'U'. I was hoping that one of the experts could help me out.

--============================================================================================================
-- Prohibit anyone but Accounting and Contracts from Adding, Updating, or Deleting Business Partners
--============================================================================================================
IF @object_type = 2 AND @transaction_type IN ('A','U','D')
BEGIN
    IF EXISTS (SELECT OCRD.UserSign FROM OCRD WHERE OCRD.UserSign NOT IN (1,4) AND OCRD.CardCode = @list_of_cols_val_tab_del)
        BEGIN
			set @error = -1
            set @error_message = N'ACCOUNTING AND CONTRACTS MUST ADD, UPDATE, OR DELETE BUSINESS PARTNERS'
        END
		IF EXISTS (SELECT OCRD.GroupCode FROM OCRD WHERE OCRD.UserSign = 1 AND OCRD.GROUPCODE <> 117 AND OCRD.CardCode = @list_of_cols_val_tab_del)
			BEGIN
				set @error = -1
				set @error_message = N'PLEASE CHOOSE "PROSPECTIVE VENDORS" AS YOUR GROUP'
			END
			IF EXISTS (SELECT OCRD.GroupCode FROM OCRD WHERE OCRD.UserSign = 1 AND OCRD.CARDTYPE <> 'S' AND OCRD.CardCode = @list_of_cols_val_tab_del)
			BEGIN
				set @error = -1
				set @error_message = N'PLEASE CHOOSE "VENDORS" AS YOUR BUSINESS PARTNER TYPE'
			END
END

Thanks in advance,

Donald

Edited by: DFrantum on Dec 10, 2009 11:03 AM