cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Increment Cardcode on BP in SAP Business One

former_member325743
Participant
0 Kudos

Hi everyone, I´m looking to do the auto increment on the business partners cardcode. I found some code on this thread https://archive.sap.com/discussions/thread/3224396 and there´s this code that seems like what I need

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]' 

But where I´m supposed to put it? Also found this guide. https://es.scribd.com/document/329988517/How-to-Auto-Increment-Business-Partner-Code-for-SAP-Busines...

But it looks like the code only works with numeric cardcode and I have mine like 'C00001' for clients and 'P0001' for suppliers Anyone knows how can I do the auto increment? or how could I implement the code above?

Best Regards!

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor

Hi Anderson,

Did you try to setup Document Numbering for Business Partner?

Go to -> Administration->System Initialization -> Document Numbering

The two first lines is related to Business partners.

Double click on the first column in first line. A new form will be opened.

Set up your Series like the second line in the screenshot. After create new series click on the button "Set as Default".

When you click on "Set as Default" button, SAP will ask you how to apply new configuration.

Do the same thing for the second line (Business Partners - Vendor).

The result:

Hope it helps.

Kind Regards,

Diego Lother

former_member325743
Participant
0 Kudos

Wow, that´s way easier! Thanks a lot Diego!

Answers (1)

Answers (1)

0 Kudos

Hello @diego.lother

Hope you are doing good.
I am facing the same issue we have set the above setting in SAP portal and its working fine. but when I am trying to create the Business partner using DI Server api, It is required to pass the cardcode. How it can be autogenerated. Can you please help me regarding this?

Thank you