cancel
Showing results for 
Search instead for 
Did you mean: 

Validate CardCode for Customer and Vendor BP Type

Former Member
0 Kudos

Hi Experts,

I would like to insert some code into the SP so that there is no mismatch between the first letter of the card code and the BP Type. Such that if they try to add the CardCode of c1001 to a vendor type, that a message appears stating that there is a mismatch.

thx,

Richard

Accepted Solutions (1)

Accepted Solutions (1)

former_member204969
Active Contributor
0 Kudos

Try this:

if @object_type = '2' and @transaction_type='A' 
BEGIN 
if exists 
  (Select p.CardCode from ocrd p
    where p.CardCode=@list_of_cols_val_tab_del
      and substring(p.CardCode,1,1) !=
      case when p.CardType='S' then 'S'
           else 'C' end )
begin
set @error =1
set @error_message = 'Partner code should begin with C or S !' 
end
End

Former Member
0 Kudos

Excellent post, tweeked it a bit and works great,

I have another validation that has to be performed. The client has different sequences of ItemCode, the first three digits are the same number that are entered at the begining of the ItmsGrpNam. I would like to have another SP that make sure that they both match.

thx

Richard

Answers (0)