Duplicate vendor Ref. no By Vendor Wise In SAP B1
How to Prevent to duplicate vendor Ref.no by vendor wise By SP Notification in sap B1. (FOR AP Invoice )
Vendor Code Ref,no
So SP should work like this.
my SP as following
if @object_type = '18'
and (@transaction_type = 'A' or @transaction_type = 'U')
declare @venno as varchar (100)
declare @vennam as varchar (100)
if (@object_type = '18')
select @venno = NumAtCard from OPCH T0 where docentry = @list_of_cols_Val_tab_del
select @vennam = CardCode from OPCH T0 where docentry = @list_of_cols_Val_tab_del
if (@venno is not null)
if 1!= (select count (docentry) from OPCH with (nolock)where (NumatCard = @venno) and (cardcode = @vennam))
select @error = 2
select @error_message = 'Duplicate Vendor Ref Number!'