A reader’s comment last week prompted this post.
The question was about the Jurisdiction Code (Tax Jurisdiction), and specifically the combination of postal code and jurisdiction code. Both are mandatory for every customer, vendor and branch that issues or receives a Nota Fiscal in Brazil, and the code is used to calculate Brazilian taxes.
The Jurisdiction Code sits in the partner’s address data. In Brazil, each code represents one city (municipality), and there are over 5,000 of them.
These are the steps to have the field assigned correctly and automatically in partner master records.
1. Maintain regions
Regions should be delivered as standard when country version BR is activated. If they are missing, maintain them here:
SAP Customizing Implementation Guide > SAP NetWeaver > General Settings > Set Countries > Insert Regions (table/view V_T005S)
There are 27 regions:

2. Define Brazilian tax regions
Here you create the tax regions for Brazil and assign a geographical region to each one. The system uses this to determine the tax region automatically when you maintain customers, vendors, plants and other master records. A geographical region can be assigned to more than one tax region, which is very useful for the Free Trade Zone.
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > Brazil > Define Brazilian Tax Regions and Assign to Geograph. Regions (table/view J_1BTREGV)
An example:

3. Maintain the structure for the tax jurisdiction code
The Jurisdiction Code has two levels:
- Level 1, 3 characters: the legal region.
- Level 2, 7 characters: the code that identifies the municipality within that region.
The lengths must be 3 and 7 because SPED Fiscal reads 10 characters in this structure, for example SP 3550308 (São Paulo):
- SP = region/state (note: SP followed by a space)
- 35 = São Paulo state code according to IBGE
- 50308 = São Paulo city (Município de São Paulo)
Maintain the structure here:
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > Specify Structure for Tax Jurisdiction Code (table/view V_TTXD)
Add this entry: Scheme TAXBRA, Length 1 3, Length 2 7, Length 3 empty, Length 4 empty, Taxes line by line X.

4. Activate external tax calculation
This activates access to the external tax system for the tax calculation procedure and links the procedure to the external events. You also choose what happens when the jurisdiction code doesn’t match the address data. Turn on the TC flag to have the system re-determine wrong codes automatically, or leave it off to get an error message instead.
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > External Tax Calculation > Activate External Tax Calculation (table/view V_TXD_E)
Create this entry: Scheme TAXBRA, External system C, all other fields empty.

5. Define the logical destination
The logical destination is used for jurisdiction code determination and for classic tax calculation (TAXBRJ). If you use TAXBRA, you only need the entry for event JUR. The functions are called automatically by event. For example, when you create a vendor and fill in the region and postal code, J_1BTAXJUR_DETERMINE_NEW determines the right jurisdiction code.
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > External Tax Calculation > Define Logical Destination (table/view TTXC)
Create this entry for external system C:
- Event: JUR
- Function module: J_1BTAXJUR_DETERMINE_NEW
- RFC destination: empty

6. Define tax jurisdiction codes
The Brazilian tax jurisdiction code has two parts, the state code and the municipal code. It determines tax rates and which tax authorities are paid for a transaction. The municipal part is required to calculate ISS and for SPED reporting. For ICMS and SubTrib, the tax region is enough.
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > Brazil > Define Tax Jurisdiction Codes (table/view J_1BTXJURV)
There are more than 5,000 entries, one per municipality. If the business can’t give you a list, email me and I’ll send one. IBGE and Correios also publish the data, but the free versions take work to assemble record by record. They sell it as a single file too, though you don’t really need to pay for it.
Enter the codes as in this example:

7. Assign jurisdiction codes to postal code ranges
Each geographical region contains several tax jurisdictions, and each jurisdiction is defined by its postal codes. For every jurisdiction code, assign the geographical region and the first and last postal code of its range. From then on, when you enter a postal code and region in Brazilian address data (master records or transactions), the system assigns the right jurisdiction code automatically.
SAP Customizing Implementation Guide > Financial Accounting (New) > Financial Accounting Global Settings (New) > Tax on Sales/Purchases > Basic Settings > Brazil > Assign Postal Codes to Tax Jurisdiction Codes (table/view J_1BTREG_CITYV)
An example:

If the business can’t provide a reasonably current list, email me or leave a comment and I can send one you can mass upload.
The ranges do change, but not often. New streets or neighborhoods sometimes extend a city’s postal code range, and you simply update the existing entry. I wouldn’t track these changes actively. You’ll know when someone creates a record and the jurisdiction code isn’t assigned, which means the range is out of date. Ask the business to check the city’s correct range on the Correios website. (Correios is the government postal service, similar to USPS in the US.)
If you still want to buy the official data, it’s sold at shopping.correios.com.br as “Base de CEP”. Download a sample first to check the format and content meet your needs.
If anything is unclear, contact me. No more headaches on this one.



Leave a Reply