Tax Codes and Tax Calculation

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Almost every invoice a company sends or receives carries a tax, such as value added tax (VAT) in Europe or sales tax in the United States. The tax belongs to the tax office, not to the company, so the books must show it on its own line and on its own account. A clerk should not work it out by hand on every document. SAP solves this with a tax code: a short key that stands for a tax rate and a set of rules, which the system uses to check, calculate and post the tax. This page explains what a tax code holds, how the system calculates the amount from it, how input tax and output tax differ, what happens when part of the tax cannot be reclaimed, and how sales tax in the United States adds a location (the jurisdiction) to the calculation. After reading it you can read a tax line in a document, check the arithmetic, and know which setting to look at when a tax amount or tax account is wrong. It is written against SAP S/4HANA 2025 FPS02 (on premise and Private Edition) and, where stated, SAP S/4HANA Cloud Public Edition 2608. Tax rates and rules differ by country, so the SAP pages cited here use country examples (Germany, Brazil, the United States) and the rates on this page are made up.

Before you read

Key terms

  • Tax code: a short key that stands for a tax rate and its rules, entered on a line item so that the system can check, calculate and post the tax.

  • Input tax: tax a company pays on purchases and expenses, which it can normally claim back from the tax office.

  • Output tax: tax a company charges on sales, which it pays to the tax office.

  • Tax type: the kind of tax a tax code carries, such as input tax, output tax or non-deductible input tax; it decides how the amount is calculated and posted.

  • Tax calculation procedure: the country-specific list of tax types (condition types) and the rules that calculate and post them.

  • Condition type: one line in a calculation procedure; in tax calculation it is a tax type with its base amount and account key.

  • Non-deductible input tax: the part of an input tax that the company cannot claim back and that therefore becomes a cost.

  • Target tax code: the tax code that a deferred tax is moved to when the tax is recognized.

  • Check indicator: a setting on a tax code that decides whether a manually entered tax amount that differs from the calculated one gives a warning or an error.

  • Tax jurisdiction code: a multi-level key for the taxing authorities of a location, used with the tax code to find the tax amount (United States and Brazil).

The running example: Example Trading Co.

Example Trading Co. has company code EX01, books in euro (EUR), reports to a parent that consolidates in British pounds (GBP), and posts to the ledgers 0L and 2L in client 100. The tax lines on this page are ordinary lines of the accounting document, so they are stored for each ledger and currency like every other line (see Ledgers, Currencies and Exchange Rates). All amounts are euro amounts in the company code currency. The tax rates (19 percent, 7 percent and the splits of a non-deductible tax) and the account names are illustrative values chosen for this site, not the legal rates of a country and not SAP defaults. The jurisdiction example near the end is a United States case and so stands outside the euro books of EX01.

What tax on sales and purchases is

SAP describes input and output tax like this: the tax is calculated on revenue or expense items (the base amount), the tax amounts are posted to separate tax accounts, and they are refunded by the tax office (input tax) or paid to the tax office (output tax). The percentage rates vary from country to country and are set when the tax codes are defined. The system posts the tax amount to the same side of the account as the G/L account items of the same document. So an expense with input tax debits both the expense and the input tax account, and a sale with output tax credits both the revenue and the output tax account.

The arithmetic

A tax code carries a rate , and the base amount is , the sum of the revenue or expense items before tax. The tax is

Invoices usually show the gross amount, so the system also works backward. SAP’s description says that the tax is included in the invoice amount: with a rate of 15 percent the invoice amount is 115 percent of the base, so to calculate the tax the invoice amount is divided by 115 and multiplied by 15. In symbols

SAP’s own example posts an invoice of EUR 1,150.00 with 15 percent input or output tax, and the tax is EUR 150.00: . The same SAP topic notes that the base amount is determined "percentage included" almost always (travel expenses in Germany are an exception) and gives the alternative, "percentage separate", as .

Output tax: a sale by EX01

EX01 sells goods for a net amount of EUR 10,000.00 with an illustrative output tax of 19 percent. The tax is and the gross amount is . Going backward from the gross amount gives the same tax, .

Line Debit Credit

Customer

11,900.00

Revenue

10,000.00

Output tax account

1,900.00

The document balances: 11,900.00 on the debit side, on the credit side. The customer line holds the invoice amount including tax, and the tax line is added automatically to the output tax account.

Input tax: a purchase by EX01

EX01 receives a supplier invoice for EUR 5,000.00 net of consulting services with the same illustrative rate. The tax is and the gross amount is EUR 5,950.00.

Line Debit Credit

Consulting expense

5,000.00

Input tax account

950.00

Supplier

5,950.00

Again the tax is on the same side as the expense. The supplier is credited with the gross amount that EX01 owes. The input tax account later offsets the output tax account when the tax return is prepared; this page ends at the posting.

Several rates on one invoice

A document can contain lines with different tax codes, and the tax is calculated for each code. A supplier invoice for EX01 has two lines: goods of EUR 600.00 net with the illustrative 19 percent and printed material of EUR 400.00 net with an illustrative 7 percent. The tax is and , together EUR 142.00, so the supplier is credited with . The system posts one tax line per tax code and account, which is what lets the tax return show each rate separately.

Tax codes

What a tax code does

SAP lists five jobs of a tax code: it checks the tax amount in the document, calculates the tax automatically on request, calculates the non-deductible part of an input tax, checks whether a tax account with a given tax type may be posted to, and determines the tax account. You define a tax code by entering a two-character code (the SAP pages use examples such as S0, S1, J9 and I9) that represents a tax percentage rate, plus technical specifications:

Characteristic Meaning

Tax type

Input tax or output tax. The system proposes the tax types that are relevant to the country, which it knows from the country key you enter when defining the code.

Target tax code

The code a deferred tax moves to when the tax is recognized (see below).

Check indicator

Whether the system gives a warning or an error when a tax amount entered by hand differs from the calculated one.

EU indicator

Blank means not EU-relevant. The value 1 marks a goods delivery within the EU, shown in the EC sales list. The value 2 is services within the EU, 3 is subcontracting within the EU, and 9 is acquisition tax.

SAP does not limit a code to one rate: you can specify rates for several tax types in one code. SAP’s example is an input tax of 15 percent with a non-deductible portion of 40 percent. The tax code then carries 9 percent under the tax type "Input tax" and 6 percent under "Nonded.input tax", because and .

Tax type, and which accounts accept which tax

The tax type states whether a tax is input or output. The system uses it to check that you post to an account with an allowed code, and it raises an error otherwise. SAP’s example is entering an input tax code while posting to a customer account for which only output tax codes are allowed. The allowed kinds are held in the master record of the G/L account in the field Tax category: a minus sign allows input tax codes only, a plus sign allows output tax codes only and an asterisk allows all of them. The page on business partners describes the same setting for the reconciliation accounts of customers and suppliers.

The check indicator

The system compares a tax amount entered by hand with the amount it calculates from the tax code. SAP explains the two settings by the two directions of posting. For output tax you set the check indicator so that a wrong amount is an error and must be corrected, which keeps a wrong tax from being invoiced. For input tax you leave it off, so that the system only warns, because the tax amount printed on the supplier’s invoice has to be taken over even if it differs slightly. A message is always issued when the difference, in the smallest currency unit, is greater than the number of G/L account and asset posting items in the document. SAP’s example: eight such items carry the same tax code and the variance is EUR 0.09, which is more than 8 cents, so the system issues an error message.

Exempt and zero-rate sales

For a sale that is tax-exempt you can create a tax code with a rate of zero percent. It is entered on the line, stored with it, and lets the advance tax return show these sales separately. SAP also allows a posting without a tax code if the G/L account master record has the indicator Posting without taxes allowed selected. This matters most for countries that calculate tax with jurisdiction codes, because otherwise a dummy jurisdiction code would be needed on each posting. A posting without a tax code produces no tax information, so tax reporting programs do not include it, and posting to a tax-relevant account without a tax code gives a warning that Customizing can switch off.

Never change a code that has been used

SAP states that a tax code and its definition must not be deleted or changed once items have been posted with it. The tax amounts would otherwise be shown on the advance return with wrong rates, and a tax adjustment for payments would be wrong. In the case of a tax increase you create a new entry with the new rate instead of changing the old one. The exception is a definition with a jurisdiction code whose percentage rates are date-dependent. In Customizing the codes are maintained in the activity Define Tax Codes for Sales and Purchases, and for the jurisdiction procedure SAP says to use that menu path or transaction FTXP, never SM31 except to display, because the links to other tables are not maintained.

Deferred tax and the target tax code

Some countries recognize a tax later than the posting. SAP’s Customizing for deferred taxes uses two tax codes for each form of tax: a deferred tax code for the deferred item and a target tax code for the normal item once it is recognized. You define the target code first, then the deferred code, and on its rates screen you enter the target code in the Target Tax Code field. The program Deferred Tax Transfer then moves the amounts from the deferred tax accounts to the target tax accounts.

Cloud Public Edition

In SAP S/4HANA Cloud Public Edition you do not use the Implementation Guide. SAP’s country pages say that tax codes are delivered for some countries, such as Peru and Saudi Arabia, and that you add new ones or edit the delivered ones in the configuration activity Define Tax Codes for Sales and Purchases (ID 101016) in your configuration environment. The Saudi Arabian codes are listed with a tax procedure (0TXSA), a code such as S2 or V2 and a description such as "SA Output VAT 5% for domestic goods supplies", so one country has one tax procedure and its codes are sorted into output and input tax.

The read model of a tax code is the CDS view I_TaxCode. Its important fields include TaxCalculationProcedure, TaxCode, TaxType, TargetTaxCode, EUTaxClassification and TaxCodeIsInactive. SAP lists constraints for the Public Edition: several fields of the view, for example the EU acquisition target codes, the tax return country and the One Stop Shop fields, must always be empty, and the target tax code is used only where deferred tax is active. A tax code that you deactivate with the Inactive field no longer appears in the field search help. The view I_TAXCODERATE joins codes with their rates, validity periods, tax calculation procedure and condition types.

The tax calculation procedure

A tax code does not carry the arithmetic itself. A calculation procedure is defined for each country, and it holds the specifications to calculate and post tax on sales and purchases. A procedure contains several tax types, which are called condition types inside it. When you define a tax code, the system proposes the condition types of the country. A condition type says on which base amount the tax is calculated and which account key posts it. The base can be the total of the expense and revenue items or a subtotal: incoming acquisition tax, for example, is calculated on the tax amount of outgoing acquisition tax, and the column Fr.level (from level) holds the step whose amount is the base.

For each tax type the procedure answers four questions, according to SAP:

  • What is the base amount: the expense or revenue amount, or a tax amount (as with sales equalization tax in Belgium)?

  • Is the percentage included in the amount or separate? Normally it is included.

  • To which side of the account does the tax post? Input and output tax follow the G/L account items. Acquisition and investment tax, for example, post to the opposite side.

  • Is a non-deductible tax expense posted separately or shared among the G/L account and asset line items?

The same condition technique as pricing

In Materials Management (MM) and Financial Accounting (FI) the calculation procedure replaces a pricing procedure and uses the condition technique, the search method of the page on account determination. SAP’s description of tax calculation for a United States procedure says that every condition type of the procedure has the same access sequence, MWST, with two parameters: country and tax code. The tax condition records are created in a central place for tax code condition records, so for an MM or FI document the country of the company code and the tax code entered form the key of the tax condition record. If the tax code is not entered by hand in MM, an automatic tax code determination is needed. The calculation procedure also determines the G/L accounts to which tax liability is posted, which needs correct account determination.

In Sales and Distribution (SD), SAP states that tax codes are the link between the pricing procedure and the tax calculation procedure. In the example of the external-system procedure TAXUSX, the pricing procedure carries the tax rates and amounts in condition types XR1 to XR6, while the tax accounts are not in the pricing procedure but in the tax calculation procedure, so the condition type names must coincide in both. When SD finds the tax code through condition records of the condition type UTXJ, the code and the departure country read the tax condition record kept in FI.

flowchart TD L["Invoice line: net 1,000.00 and tax code of the line"] --> C["Tax code: rate, tax type, check indicator"] C --> P["Tax calculation procedure of the country of the company code"] P --> T["Condition types: tax types with base amount and account key"] T --> A["G/L accounts found by account determination"] A --> D["Tax line item in the accounting document"]

A country, a procedure, a choice of method

For the United States SAP offers three methods to calculate sales and use tax, set by the calculation procedure assigned to the country, so every company code in the country uses the same method: the non-jurisdiction method (percentage rates are assigned to tax codes; SAP calls it seldom used), the jurisdiction method (you define the jurisdiction of every region), and the jurisdiction method with an external tax calculation system. SAP says that once you choose with or without jurisdiction codes it is difficult to switch, and one SAP topic says the decision cannot be reversed, so decide it before the first posting. SAP recommends an external system to avoid manual data entry.

Non-deductible input tax

Sometimes a company cannot claim back all or part of an input tax. SAP says that you can post the non-deductible amount to a separate expense account or distribute it to the G/L account and asset line items. You enter the rates of the deductible and the non-deductible portion under one shared tax code. If the whole tax is non-deductible, the tax code has to say that zero percent input tax is calculated. SAP’s own example is an invoice of EUR 1,200.00 whose included tax is EUR 200.00 (20 percent), made of 12 percent input tax (EUR 120.00) and 8 percent non-deductible tax (EUR 80.00).

Here is the same idea for EX01, with illustrative numbers. A supplier invoice has a net amount of EUR 1,000.00 and a tax code with 19 percent tax of which 25 percent is non-deductible. The deductible rate is percent and the non-deductible rate percent. So

and the two together are . The gross amount is EUR 1,190.00. The two ways to post the non-deductible part give two documents. Variant A posts it to its own account:

Line (variant A) Debit Credit

Expense

1,000.00

Input tax account

142.50

Non-deductible input tax expense account

47.50

Supplier

1,190.00

Variant B spreads it over the expense line, so there is no separate tax expense line:

Line (variant B) Debit Credit

Expense

1,047.50

Input tax account

142.50

Supplier

1,190.00

Both documents balance (1,000.00 + 142.50 + 47.50 = 1,190.00 and 1,047.50 + 142.50 = 1,190.00). In variant B the cost of the expense includes the tax that could not be claimed. When none of the tax is deductible there is no input tax line at all, and the whole 190.00 is a cost.

Jurisdiction-based taxes

Why a location enters the calculation

In the United States the tax rate depends on where the goods are delivered, and there are more than 55,000 taxing jurisdictions, according to SAP. A jurisdiction is the authority that imposes the tax, and the tax jurisdiction code is a key that, together with the tax code and other parameters, determines the tax amount and how the total is divided among the tax authorities. SAP’s page on entering taxes says jurisdiction codes are used in the USA and Brazil.

A jurisdiction code is a freely definable field of up to 15 characters with up to four levels, such as state, county and city. For the standard procedure TAXUSJ the structure is 2, 3 and 4 characters, nine in all. SAP’s examples are PA0000000 for the state of Pennsylvania, PA0010000 for Allegheny county and PA0010100 for the city of Pittsburgh. The procedure TAXUSJ has you enter the jurisdiction codes and percentages by hand, and TAXUSX calculates in an external system that holds the codes and rates and supports up to six levels.

Where the code comes from

The jurisdiction code is defined in key master records. For sales it is determined from indicators on the customer and the material. For purchasing, for simple tax scenarios, it comes from indicators on the material. For asset postings SAP gives a search order: the code in the asset master record first, then the one of the cost center entered there, then the one of the company code. In sales, condition records of the condition type UTXJ for country US give the tax code from the region, the tax classification of the customer and the tax classification of the material (each 0 or 1). SAP says even an exempt status needs a tax code, with a rate of 0.0 percent. SAP’s example for the state of Pennsylvania gives code S0 for the combinations 0/0, 1/0 and 0/1, and S1 for 1/1.

When you create a jurisdiction tax code, you enter a percentage for each jurisdiction level, and the percentages of the levels are added together when applied. SAP’s example sets up a code J9 as input tax (type V) for accounts payable sales tax.

An illustration with made-up rates

Suppose a US sale of USD 1,000.00 net to a customer whose code has three levels with the illustrative rates 6 percent (state), 1 percent (county) and 2 percent (city). The three amounts are

so the sales tax is and the gross amount is USD 1,090.00. The system posts the tax by level, so the payment can be divided among the authorities. When you enter taxes by hand on a document, SAP lets you enter either the amount for the entire jurisdiction code, which is the default, or the amounts one by one for the state, county and city code.

Settings to check, requires an SAP system; not run here

Everything in this table is Customizing or master data that needs an SAP system with access to the Implementation Guide (on premise) or the configuration environment (Public Edition). It was not run here; the menu path is the one SAP states on the cited page.

Question Where SAP says to look

Which tax codes exist, and with which rates and tax type?

Implementation Guide for Financial Accounting, Financial Accounting Global Settings, Tax on Sales/Purchases, Calculation, Define Tax Codes for Sales and Purchases; or transaction FTXP. Public Edition: configuration activity Define Tax Codes for Sales and Purchases (ID 101016).

Which calculation procedure does the country use, and which steps does it hold?

Financial Accounting Global Settings, Tax on Sales/Purchases, Basic Settings, Check Calculation Procedure, Define Procedures.

Which jurisdiction structure applies to TAXUSJ?

Financial Accounting Global Settings, Tax on Sales/Purchases, Basic Settings, Specify Structure for Tax Jurisdiction Code.

Which kind of tax may a G/L account take?

G/L account master record, Control data, field Tax category.

Why does a sales document get a tax code?

Condition records of condition type UTXJ (menu Logistics, Sales and Distribution, Master Data, Conditions, Create, Taxes, Canada/USA, or transaction VK11).

What can go wrong

Symptom Cause and check

Error when posting a tax code to a customer or supplier account

The tax type of the code (input or output) is not allowed by the Tax category of the account. Check the master record, as in the section on tax type above.

Error or warning "tax amount differs"

The manually entered tax differs from the calculated one by more than the permitted difference. The check indicator on the tax code decides between error and warning.

Warning when posting to a tax-relevant account without a tax code

The account expects a tax code. Use a zero-rate code for an exempt sale or select Posting without taxes allowed in the account’s master record.

Wrong tax amounts on the advance return after a rate change

A code that had postings was changed instead of replaced. Create a new code with the new rate.

Tax determination in purchasing finds no tax code

In MM the tax code is determined automatically when it is not entered. The determination is part of Customizing and has to be set up.

Cannot switch between the jurisdiction methods later

SAP says the choice is difficult or impossible to reverse. Decide it before the first posting.

Summary

  • A tax code is a short key for a tax rate and its rules. It checks the tax amount, calculates it on request, calculates a non-deductible part, checks that a tax account accepts the tax type and determines the tax account.

  • The tax is on the base amount and the gross amount is . From a gross amount the tax is . A sale of EUR 10,000.00 net at an illustrative 19 percent gives EUR 1,900.00 output tax and a gross amount of EUR 11,900.00.

  • Input tax is claimed back from the tax office and output tax is paid to it. Both post to the same side of the account as the G/L items, and the tax type and the tax category of an account must agree.

  • The tax calculation procedure of a country holds the tax types as condition types, with a base amount and an account key, and uses the condition technique with the access sequence MWST in FI and MM. In SD the tax code links the pricing procedure to the tax procedure.

  • A non-deductible part is posted to its own expense account or spread over the G/L and asset lines. A jurisdiction code adds the location, and with it the split among tax authorities, to the calculation for the United States and Brazil.

  • A tax code that has been used must not be changed. In the Public Edition tax codes are maintained in a configuration activity and read through the CDS view I_TaxCode.