SAP Knowledge Base Article - Public

# 3170431- Error 'Tax number is invalid' Occurs When Adding Tax Number in Account Master Data - Spain

### Symptom

In account master data, you want to add a tax number of type NIF Number with country as Spain. However, error 'Tax number is invalid' occurs.

### Reproducing the Issue

1. Go to Receivables work center.
2. Go to Customers view.
3. Search the account/customer in question.
4. Click on Edit and select Financial Data.
5. View Tax Data tab.
7. Select Country/Region: ES - Spain, Tax Number Type: NIF Number.
8. Enter tax number(for example G37528246).
9. Click on Save.
10. Error 'Tax number is invalid' occurs.

### Cause

The tax number is not correct as per the validation rules.

Below is the validation rule as per the applicability on the tax number.

Take G37528246 as an example.

1. We remove the first and the last position of the tax number.

G and check digit 6 are removed.

Check digit calculated on basis of (A): 37528246

2. We add up the even digits:

Sum on all even places in the above : (B) 7 + 2 + 2 = 11

3. We multiply each individual odd digit by 2 and add up each individual result. Finally, we add up the result.
Multiple all even digits by 2
3 * 2 = 6
5 * 2 = 10 -> 1+0 -> 1
8 * 2 = 16 -> 1+6 -> 7
4 * 2 = 8
Sum of all even calculation (C) = 6 + 1 + 7 + 8 = 22

4. We add up the result of the previous steps (step 2 and step 3)

Sum of odd + even (D) = 33

5. We take the last digit of the previous step (D) 33 -> (E) = 3

6. We subtract 10 from the number of the previous step (E)
(F) = 10 – 3 = 7 and here we have our check digit. Check digit is '7'.

Now this calculated check digit is compared with the initial check digit i.e. 6(the last digit of the tax number is the check digit).

Since the calculated check digit is not as expected, system throws an error.

### Resolution

The user needs to recheck the correctness of the tax number.

### Keywords

Tax number is invalid, NIF Number, Spain, Tax Number , KBA , SRD-FIN-GLO-TAX , GLO - Tax Declaration , Problem