on 08-20-2012 11:12 AM
Hello,
The requirement is ,
when I add New business partner master data, Business partner code should come automatically, suppose the last customer code was C0024, and if now i add new customer C0025 should come automatically,
How I can achieve this? can I do this with FMS?
Hi,
Try:
If $[OCRD.CardType] in ('C' ,'L')
Select'C'+right(str(isnull(max(substring(T0.CardCode,2,5))+100001),5),'00001')
From OCRD T0
WHERE T0.CardCode LIKE 'C[0-9][0-9][0-9][0-9][0-9]'
else if $[OCRD.CardType] = 'S'
Select'V'+right(str(isnull(max(substring(T0.CardCode,2,5))+100001),5),'00001')
From OCRD T0
WHERE T0.CardCode LIKE 'V[0-9][0-9][0-9][0-9][0-9]'
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My last customer is with BP Code C04863 and last vendor is with bp code V00710.
When I will create new customer it should auto generate customer code C04864 and when i will create new vendor it should auto generate code V00711 and so on , for every new customer and vendor there should be auto increment of Business partner code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try This
declare @n nvarchar(15)
set @n=$[OCRD.CardCode]
If $[OCRD.CardType] in ('C' ,'L')
Select'C'+isnull(right(str(max(substring(c.CardCode,2,5))+1000000001),5),'00001')
From OCRD c
Where c.CardCode like 'C[0-9][0-9][0-9][0-9][0-9]'
else if
Select'V'+isnull(right(str(max(substring(c.CardCode,2,5))+1000000001),5),'00001')
From OCRD c
Where c.CardCode like 'V[0-9][0-9][0-9][0-9][0-9]'
else
select @n
Regards
Kennedy
Hi Punam.........
Try this.......
declare @temp as char(15)
IF ($[OCRD.CardType]) = 'C'
BEGIN
set @temp=(select max(right(cardcode,5)) + 1 from ocrd where (cardtype='C') and (len(cardcode)=6) and (left(cardcode,1)='C'))
set @temp='C'+isnull(replicate(0,5-len(@temp)),'')+@temp
select isnull(cast(@temp as char(15)),'C04864')
END
IF ($[OCRD.CardType]) = 'S'
BEGIN
set @temp=(select max(right(cardcode,5)) + 1 from ocrd where (cardtype='C') and (len(cardcode)=6) and (left(cardcode,1)='V'))
set @temp='V'+isnull(replicate(0,5-len(@temp)),'')+@temp
select isnull(cast(@temp as char(15)),'V00711')
Regards,
Rahul
Try this for Customer Vendor and lead.
declare @n nvarchar(15)
set @n=$[OCRD.CardCode]
If $[OCRD.CardType] in ('C' ,'L')
Select'C'+isnull(right(str(max(substring(c.CardCode,2,5))+1000000001),4),'0001')
From OCRD c
Where c.CardCode like 'C[0-9][0-9][0-9][0-9]'
else if
Select'V'+isnull(right(str(max(substring(c.CardCode,2,5))+1000000001),4),'0001')
From OCRD c
Where c.CardCode like 'V[0-9][0-9][0-9][0-9]'
else
select @n
Regards
Kennedy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Puman Gandhi,
Try this in Fms
You can use this, setting auto refresh when BP name changes:
declare @n nvarchar(15)
set @n=$[OCRD.CardCode]
If $[OCRD.CardType]='C'
Select'C'+isnull(right(str(max(substring(c.CardCode,2,5))+1000000001),4),'0001')
From OCRD c
Where c.CardCode like 'C[0-9][0-9][0-9][0-9]'
else select @n
Regards
Kennedy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.