cancel
Showing results for 
Search instead for 
Did you mean: 

Non Duplicate Vendor Ref. No. for some BP

krishnam_mathur
Explorer
0 Kudos

I need to place control to allow duplicate Vendor Ref No. in Sales Order for all BPs but 1

Exception is ABC100

if @object_type='17' and @transaction_type in ('A','U')

begin

if not exists ( select numatcard from ORDR where docentry=@list_of_cols_val_tab_del and (CardCode in ('ABC100') and NumAtCard not in (select distinct NumAtCard from ordr)) or (CardCode not in ('ABC100') ) )

begin

set @error=1

set @error_message='Only Non Duplicate Customer Ref. No. for this BP'

end

end

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member287017
Participant

Hi Krishnam Mathur,

Slightly Changed. check this code.

if @object_type='17' and @transaction_type in ('A','U')

begin

if exists ( select numatcard from ORDR where docentry=@list_of_cols_val_tab_del and (CardCode <>'ABC100') and NumAtCard in (select distinct NumAtCard from ordr))

begin

set @error=1

set @error_message='Only Non Duplicate Customer Ref. No. for this BP'

end

end

Regards,

Chella

Johan_H
Active Contributor

Also, I would change this:

(CardCode <>'ABC100')

to this:

(CardCode NOT IN (select CardCode from OCRD where QryGroup1 = 'Y'))

Replace QryGroup1 with the appropriate BP property, and set that property for any BP that this functionality is needed for.