Last week one comment in this blog motivated me to write this posting…

The question was around the Jurisdiction Code, aka Tax Jurisdiction, and to be more specific, the combination of Postal Codes and Jurisdiction Codes, that are MANDATORY for all Customers and Vendors (Branches as well) where a Nota Fiscal will be issued/received in Brazil. This code is used for calculating taxes which are defined by the federal level (Brazilian taxes).
The Jurisdiction Code is in the Address data of the Partners. In Brazil, they represent each City/Municipal entity existing (over 5000 cities…)

The steps to have this field correctly (and automatic) assigned to the partner master records are the following:

1 – Maintain Regions – The regions supposed to be standard delivered when the Country Version BR is activated, if not, maintain the Regions using the following customizing path:
SAP Customizing Implementation Guide > SAP NetWeaver > General Settings > Set Countries > Insert Regions (table/view V_T005S)

Currently there are only 27 regions, as below:
V_T005S

2 – Define Brazilian Tax Regions – Here you will maintain tax regions for Brazil assigning a geographical region to each tax region and this is what the system will use to determine the tax regions automatically when maintaining master records for customers, vendors, plants and etc. You can assign a geographical region to more than one tax region (very useful for Free Trade Zone). Use the following customizing path to maintain the entries:
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)

Here is one example:
J_1BTREGV

 

3 – Maintain the Structure for Tax Jurisdiction Code – Here you determine the structure of the tax jurisdiction code.
The Jurisdiction Code has 2 levels:
Level 1 with 3 characters: store the Legal Region
Level 3 with 7 characters: store a code which identify the municipality inside the Legal Region

The correct length is 3 and 7 because the SPED FISCAL will capture 10 digits with the following structure:
SP 3550308 – São Paulo
SP” = Region / State (Attention: it is SP and space)
35 = SP State code according to IBGE
50308 = São Paulo City (Município de São Paulo).

You maintain this structure at the following customizing path:
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 the following entry: Scheme: TAXBRA Length 1: 3 Length 2: 7 Length 3: Leave it empty Length 4: Leave it empty Taxes line by line: X
V_TTXD

4 – Activate External Tax Calculation – Here you will activate the access to the external tax system depending on the tax calculation procedure. You link the used procedure to the external events. Additionally you may choose whether you want the system to automatically re-determine wrong jurisdiction codes or if an error message should be output when the chosen jurisdiction code doesn’t match the address data. For the first behavior, turn on the flag TC. Otherwise, set it off.

Use the following Path to this maintenance:
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)

You’ll need to create the following entry:
Scheme: TAXBRA External system: C All other fields: Leave it empty
V_TXD_E

5 – Define Logical Destination – The logical destination is used for Jurisdiction Code auto-determination and for classic tax calculation (TAXBRJ). So, if you are using TAXBRA, only the entry for event “JUR” is needed. The defined functions are called automatically according to the event. E.g. when creating a vendor master record, after filling in the region and postal code, J_1BTAXJUR_DETERMINE_NEW will be called to automatically determine the right Jurisdiction Code.

You do the maintenance using the following path:
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)

You will need to create the following entries for the external system C:
Event: JUR
Function module: J_1BTAXJUR_DETERMINE_NEW
RFC destination: Leave it empty
TTXC

6 – Define Tax Jurisdiction Codes – The tax jurisdiction code in Brazil consists of two parts: the state code and the city code (municipal). It is a code used for determining tax rates in Brazil; it controls which tax authorities must be paid for a given transaction. The system additionally requires the second part of the tax jurisdiction code, the municipal code, to calculate ISS and for SPED reporting. For ICMS and SubTrib calculation, the tax region is enough.

You maintain the registers using the following customizing path:
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)

Currently, there are more than 5000 entries where each entry represents one city/municipal, and if the business can’t provide you a list, you may want email-me on my gmail account (leandropia) and I will provide you this list.
You can also get it from IBGE and CORREIOS websites, but if you want it free, the information is not that easy, you will have to work on the registers individually. They also sell those registers in one file/database, but to be honest, you don’t need to pay for that…
Enter all required tax jurisdiction codes in this table according to the example below:
J_1BTXJURV

7 – Assign Jurisdiction Codes to Ranges of Postal Codes – Each geographical region can include a number of tax jurisdictions, which, in turn, are defined by its postal codes. Here you will assign a range of postal codes to each tax jurisdiction code. For each tax jurisdiction codes, assign the geographical region and the beginning and ending postal codes. When you maintain Brazilian address data (in master records or transaction data) and enter the postal code and geographical region, the system automatically assigns the correct tax jurisdiction code

Assign the formerly created tax jurisdiction codes to the ranges on postal codes using the following Path:

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)

Here is one example:
J_1BTREG_CITYV

If the business person can’t provide you a list with a fairly updated assignment combination, email me at my gmail (leandropia) or leave a comment in here and I can provide you a list that you can use to mass upload those entries.
One other information that you need to know about that is that the combination changes, but not very often… Sometimes there are new streets or new neighborhoods been opened/created and that requires expanding the range of Postal Codes to a given City (Municipal), and all that you have to do it is update the existing entry.
I would not be worried about track those changes, you will know when something is wrong when someone try to create a register and the jurisdiction code fails been assigned. That will mean the Postal Code Range assigned to the Jurisdiction code is not updated. Then, all that you have to do, is request to the business, to go to “CORREIOS”* website and review the correct postal code range to that city.
*CORREIOS is the postal code institution ruled by Brazilian Government (Similar to USPS in USA).

If you still want to buy it the “official” source for that is in shopping.correios.com.br
There you can look for “Base de CEP” but try to download a sample before buying it to see if the format and content meets your needs.

If not clear, please, contact me, but, no more headaches on this subject, right?