Skip to Content
0

Prevent user from updating the Payment Term in Business Partner Master Data

Jun 27, 2017 at 03:47 PM

32

avatar image

Hi experts,

I do have a transaction notification that blocks specific user from changing the payment term but the weird thing is it is only working for Vendors. Everytime a user edit a customer, any field other than the payment term, the system blocks it from updating. See code below, is there something wrong with this? Thanks

IF @TRANSACTION_TYPE IN ('A', 'U') AND (@OBJECT_TYPE = '2')

BEGIN IF EXISTS (SELECT T1.CARDCODE FROM OCRD T1

INNER JOIN ( SELECT MAX(TA.LogInstanc) as LogInstan ,TA.CARDCODE,TA.GroupNum FROM ACRD TA group by TA.CARDCODE,TA.GroupNum) T0 ON T0.CARDCODE = T1.CARDCODE

INNER JOIN DBO.OUSR T2 ON T1.USERSIGN2=T2.USERID

WHERE T1.CARDCODE = @LIST_OF_COLS_VAL_TAB_DEL AND (T0.[GroupNum] <> T1.[GroupNum]) and T1.USERSIGN2 not in ('96' ) )

BEGIN SELECT @ERROR = 81, @ERROR_MESSAGE = 'You are not permitted to ADD/CHANGE the Payment Terms'

END

END

Thanks,

Maria

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

1 Answer

Best Answer
Danilo Kasparian Jun 27, 2017 at 04:01 PM
0

You can do sth like this below

if (@object_type = '2' and @transaction_type in ('A','U'))
begin
	declare @currPayment int
	declare @oldPayment int


	select @currPayment = GroupNum FROM OCRD WHERE CardCode = @list_of_cols_val_tab_del
	select TOP(1) @oldPayment = GroupNum FROM ACRD WHERE CardCode = @list_of_cols_val_tab_del ORDER BY LogInstanc DESC


	if @currPayment <> @oldPayment
	begin
		set @error = 1234
	end
end
Share
10 |10000 characters needed characters left characters exceeded