Skip to Content
Author's profile photo Leandro Nascimento

Tax Number Duplicity Restriction (CNPJ, CPF, State Inscription)

Since the companies in Brazil must not have 2 partners to the same CNPJ and/or State Inscription (IE), or CPF, you can prevent that 2 customer master records or 2 vendors created to the same Tax ID using SAP Standard (Configuration). Some time ago, this was only possible with coding / user exit.

First, let me explain about the TAX IDs in Brazil:

-Tax Number 1 (STCD1) – CNPJ — Only for legal entities (companies)

-Tax Number 2 (STCD2) – CPF — Only for Natural Person

-Tax Number 3 (STCD3) – State Inscription — Only for legal entities (companies)
If exempt, must contain word “ISENTO”

-Tax Number 4 (STCD4) – Municipal Inscription — It can contain RG (ID) if vendor is Natural Person
If exempt, must contain word “ISENTO”

-Sole Proprietr (STKZN) – Natural Person indicator — Must be active when vendor is not a legal entity but a Natural Person

tAX iD

To activate the duplicity check, first go to transaction BUPA_TAXNUMTYPE and turn on the Tax ID’s that you want the validation active:


Then go to transaction OBA5 (Change Message Control) to turn the error message on (you can choose between Warning or Error, but it is strongly recommended that you select as an Error when user goes to XK01 or XD01 for example, to create the customer or vendor). You can also select the message behavior based on an user.

You have to select area 8B and message No. 011, 012, 013, 014

If you enter a specific user, for instance, end users receive the standard error message but a user in the SAP Support group only receives a warning and is able to by pass the error.

You may also check transaction OBMSG to the same area 8B and messages and do the following:

Enter the adjustable message types in the “Allowed” column (“S” = success message, “I” = Information message, “W” = warning message, “E” = error message, “A” = termination message; an example entry could be SIWE).


Once those settings are in place, when someone try to create a record for a partner that already exist, it will look like this:

When you try to create the register, the system will show that a customer/vendor already exist to a given Tax ID:
Vendor validation

And then it will issue a message, error or warning, depending on what was configured:
Vendor validation 2

Not having customers and vendors in duplicity is mandatory for SPED Reporting. You can check this information on contributor guide for SPED Fiscal (EFD) and Contributions.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      How can I set up a rule to check only first 9 digits of tax number?

      Author's profile photo Leandro Nascimento
      Leandro Nascimento
      Blog Post Author

      You might be able to do it using the Function FIELD_EXIT_STCD1_2. Just keep in mind that, if you vendor is in Brasil, the CNPJ is unique by vendor master records, and you must not have duplicity, then, you must validate all the 14 digits. Since this field LFA1-STCD1 is used for many other countries, you might be able to use the function above to validate the first 9 digits.

      Leandro da Pia Nascimento

      Author's profile photo Ramires Meneses
      Ramires Meneses

      Congratulations, Leandro. Great document, very helpful.

      I have one question, is there any config that could be done to turn the duplicity restriction for just some vendor´s account groups? As I understood, turning this verification on, all account group will be checked.