SAP Business One Tax Withholding - tutorial featured image

Publications

SAP Business One Tax Withholding: Configure Withholding Tax and Control It with SQL

Hector Pincheira

Hector Pincheira

CIO | CTO
Digital Strategy & Technology Innovation

items

A mid-sized company discovered during a tax inspection that it had spent fourteen months paying professional fees without applying the corresponding withholding. The amount was not catastrophic and neither was the fine. What hurt was something else: the ERP had the functionality available, half configured, and nobody activated it on the new suppliers. In SAP Business One withholding tax is not a module you install and it works on its own: it is a configuration chain that starts in the tax code and ends in the journal entry. Therefore, if one link is loose, the system does not complain. It simply does not withhold.

This tutorial walks through that entire chain. In addition, it delivers the SQL queries you need to audit it without depending on somebody remembering to check the right box.

Why SAP Business One withholding tax deserves your management attention

A withholding is a tax your company deducts from the payment to a third party and remits to the tax authority on behalf of that third party. As a result, your organization acts as a collection agent. That condition changes the risk profile completely: you are not managing an expense of your own, you are administering somebody else's money with a legal deadline.

When the ERP does not withhold, three things happen in sequence. First, you pay the supplier 100% of the invoice. Second, the tax obligation still exists. Third, the difference comes out of your cash, not the supplier's. This way, a configuration error turns into a direct loss that also drags interest and penalties along with it.

There is a second cost, less visible and more expensive in the long run. With no withholdings recorded in the system, your accounting team builds the withholding ledger in Excel. For example, somebody extracts invoices, cross-checks suppliers, applies rates from memory and produces a file nobody can audit backwards. As a result, the ERP stops being the single source of truth exactly in the process where traceability matters most.

SAP Business One withholding tax - taxable base calculation and withholding rate on vendor payments
The withholding is calculated on a defined taxable base: if the base is badly parameterized, the error replicates in every payment.

Prerequisites before touching the configuration

Before creating the first code, secure these four points. Without them, the configuration moves forward but does not reconcile against accounting.

  • Superuser authorization or explicit permission on Administration > Setup > Financials.
  • G/L accounts created: you need at least one liability account for the withholding payable and, if you apply sales withholdings, an asset account for the withholding borne.
  • Clear legal definition: current rate, calculation base, minimum exempt amount and official code required by your tax authority.
  • Test environment: a copy of the production database. However tempting it may be, never test new rates in production.

A detail that costs dearly: SAP Business One enables the withholding functionality according to the installed country localization. Therefore, first check in Administration > System Initialization > Company Details, Basic Initialization tab, that the withholding tax checkbox is active. That flag is not easily reversed, so decide it with care.

Step-by-step tutorial: complete withholding configuration

Step 1: create the withholding tax code

Navigate to Administration > Setup > Financials > Tax > Withholding Tax. The window that opens feeds directly into the OWHT table, the master of withholding codes. Next, complete the critical fields:

  • Code and name: use a naming convention that speaks for itself, for example RET-HON for professional fees.
  • Category: defines whether the withholding applies to payments (purchases) or to collections (sales). This field determines in which documents the code will appear.
  • Base type: indicates whether the rate is applied on the gross amount, on the net amount or on the tax. In addition, here you define the percentage of the base subject to withholding when the law taxes only a part.
  • Official code: the identifier your tax authority requires in the return. Without it, the legal report is incomplete.
  • G/L account: the liability account where the withholding to be remitted accumulates.

Step 2: define the rate and its effective date

Within the same code, SAP Business One lets you record the rate with an effective date. That information is stored in the WHT1 table, which keeps the full history through the WTCode, EffecDate, Rate and LineNum fields. It is an excellent design decision and very poorly exploited.

The real value appears when the law changes. Instead of editing the current rate and losing the trail, you add a new row with the effective date. This way, historical documents keep the rate that applied and new ones automatically take the updated one. For example, if your country raises the withholding on professional fees every year, you will have one row per year and the withholding ledger of prior periods will still reconcile.

Step 3: enable the business partner

This is where the chain breaks in most implementations. The code exists, the rate is correct, but the supplier was never flagged. Open the business partner master data, go to the Accounting tab, Tax sub-tab, and check the Subject to Withholding Tax box. That field is stored in OCRD.WTLiable.

However, checking the box is not enough. You must also assign the withholding codes allowed for that partner using the corresponding button. That assignment lives in the CRD4 table and is what determines which codes the system will offer when capturing the document. Therefore, a supplier with WTLiable set to Y but with no rows in CRD4 looks configured and withholds nothing.

Step 4: apply the withholding in the document

When capturing an A/P invoice, press the withholding tax button at the foot of the document. SAP Business One calculates the base according to the defined type, applies the rate in effect on the document date and deducts the amount from the total payable. The header stores the result in OPCH.WTSum, while the breakdown by code stays in the PCH5 table.

A point worth checking in your version: the field that links PCH5 to the header is usually called AbsEntry and points to OPCH.DocEntry. However, some versions name it differently. For example, run a SELECT on a row of PCH5 before building reports on that table and confirm the real structure of your installation.

Step 5: decide where the withholding is generated

SAP Business One supports two moments: when issuing the document or when making the payment. This choice is not technical, it is fiscal, and it defines how the journal entry behaves.

If you withhold on the document, the obligation is born with the invoice. If instead you withhold on the payment, the invoice stays at its full value and the deduction appears in the actual payment, whose detail is stored in VPM6 for outgoing payments. As a result, the OPCH.WTApplied field accumulates what was effectively withheld in payments, while OPCH.WTSum reflects what was declared in the document. The difference between the two is, precisely, the metric that reveals the most discrepancies.

SAP Business One withholding tax - configuring codes and business partners in the ERP
The correct configuration is validated with data, not with memory: every code, every partner and every rate must be queryable.

SQL queries to audit your withholdings

The configuration is done once. The audit, on the other hand, is done every month. These four queries give you real control over the process. Each one comes in a SQL Server version and a SAP HANA version.

Query 1: catalog of codes with the current rate

Before auditing amounts, audit the parameterization. This query joins OWHT with WHT1 and returns the rate actually in effect today for each code, not the first one it finds.

SQL Server

-- Catalog of withholding codes with the rate in force
SELECT
    T0.WTCode        AS [Code],
    T0.WTName        AS [Description],
    T0.Category      AS [Category],
    T0.OffclCode     AS [Official_Code],
    T1.EffecDate     AS [Valid_From],
    T1.Rate          AS [Rate_Pct],
    CASE WHEN T0.Inactive = 'Y' THEN 'INACTIVE' ELSE 'ACTIVE' END AS [Status]
FROM OWHT T0
LEFT JOIN WHT1 T1 ON T1.WTCode = T0.WTCode
WHERE T1.EffecDate = (
        SELECT MAX(T2.EffecDate)
        FROM WHT1 T2
        WHERE T2.WTCode = T0.WTCode
          AND T2.EffecDate <= GETDATE())
ORDER BY T0.WTCode;

SAP HANA

-- Catalog of withholding codes with the rate in force
SELECT
    T0."WTCode"      AS "Code",
    T0."WTName"      AS "Description",
    T0."Category"    AS "Category",
    T0."OffclCode"   AS "Official_Code",
    T1."EffecDate"   AS "Valid_From",
    T1."Rate"        AS "Rate_Pct",
    CASE WHEN T0."Inactive" = 'Y' THEN 'INACTIVE' ELSE 'ACTIVE' END AS "Status"
FROM OWHT T0
LEFT JOIN WHT1 T1 ON T1."WTCode" = T0."WTCode"
WHERE T1."EffecDate" = (
        SELECT MAX(T2."EffecDate")
        FROM WHT1 T2
        WHERE T2."WTCode" = T0."WTCode"
          AND T2."EffecDate" <= CURRENT_DATE)
ORDER BY T0."WTCode";

If a code shows up with no row in WHT1, it means you never defined its validity period. As a result, that code will withhold at the header rate and you will lose the history when the law changes.

Query 2: the silent gap, vendors with activity and no withholding enabled

This is the query that prevents unpleasant tax audits. It cross-checks vendors with invoices in the last twelve months against their WTLiable flag and against the actual code assignment in CRD4.

SQL Server

-- Vendors with activity and incomplete withholding setup
SELECT
    T0.CardCode,
    T0.CardName,
    CASE WHEN T0.WTLiable = 'Y' THEN 'YES' ELSE 'NO' END AS [Withholding_Liable],
    ISNULL(T2.Codigos, 0) AS [Codes_Assigned],
    COUNT(T1.DocEntry)    AS [Invoices_12m],
    SUM(T1.DocTotal)      AS [Amount_12m]
FROM OCRD T0
INNER JOIN OPCH T1 ON T1.CardCode = T0.CardCode
LEFT JOIN (SELECT CardCode, COUNT(*) AS Codigos
           FROM CRD4 GROUP BY CardCode) T2
       ON T2.CardCode = T0.CardCode
WHERE T0.CardType = 'S'
  AND T1.CANCELED = 'N'
  AND T1.DocDate >= DATEADD(MONTH, -12, GETDATE())
GROUP BY T0.CardCode, T0.CardName, T0.WTLiable, T2.Codigos
HAVING SUM(T1.DocTotal) > 0
ORDER BY SUM(T1.DocTotal) DESC;

SAP HANA

-- Vendors with activity and incomplete withholding setup
SELECT
    T0."CardCode",
    T0."CardName",
    CASE WHEN T0."WTLiable" = 'Y' THEN 'YES' ELSE 'NO' END AS "Withholding_Liable",
    IFNULL(T2."Codigos", 0) AS "Codes_Assigned",
    COUNT(T1."DocEntry")    AS "Invoices_12m",
    SUM(T1."DocTotal")      AS "Amount_12m"
FROM OCRD T0
INNER JOIN OPCH T1 ON T1."CardCode" = T0."CardCode"
LEFT JOIN (SELECT "CardCode", COUNT(*) AS "Codigos"
           FROM CRD4 GROUP BY "CardCode") T2
       ON T2."CardCode" = T0."CardCode"
WHERE T0."CardType" = 'S'
  AND T1."CANCELED" = 'N'
  AND T1."DocDate" >= ADD_MONTHS(CURRENT_DATE, -12)
GROUP BY T0."CardCode", T0."CardName", T0."WTLiable", T2."Codigos"
HAVING SUM(T1."DocTotal") > 0
ORDER BY SUM(T1."DocTotal") DESC;

Sort the result by amount and review the first twenty rows. Also, pay particular attention to vendors with Withholding_Liable set to YES and Codes_Assigned at zero: those are the ones that look configured and are not.

Query 3: withholding book for the period

This is the report your accountant builds by hand every month. Below, the version the ERP produces in two seconds and that always reconciles.

SQL Server

-- Withholding book by document and code
SELECT
    T0.DocNum      AS [Invoice],
    T0.DocDate     AS [Date],
    T0.CardCode,
    T0.CardName,
    T0.DocTotal    AS [Document_Total],
    T2.WTCode      AS [Withholding_Code],
    T3.WTName      AS [Withholding_Description],
    T3.OffclCode   AS [Official_Code],
    T0.WTSum       AS [Document_Withholding]
FROM OPCH T0
INNER JOIN PCH5 T2 ON T2.AbsEntry = T0.DocEntry
INNER JOIN OWHT T3 ON T3.WTCode   = T2.WTCode
WHERE T0.CANCELED = 'N'
  AND T0.DocDate BETWEEN '20260801' AND '20260831'
ORDER BY T0.DocDate, T0.DocNum;

SAP HANA

-- Withholding book by document and code
SELECT
    T0."DocNum"      AS "Invoice",
    T0."DocDate"     AS "Date",
    T0."CardCode",
    T0."CardName",
    T0."DocTotal"    AS "Document_Total",
    T2."WTCode"      AS "Withholding_Code",
    T3."WTName"      AS "Withholding_Description",
    T3."OffclCode"   AS "Official_Code",
    T0."WTSum"       AS "Document_Withholding"
FROM OPCH T0
INNER JOIN PCH5 T2 ON T2."AbsEntry" = T0."DocEntry"
INNER JOIN OWHT T3 ON T3."WTCode"   = T2."WTCode"
WHERE T0."CANCELED" = 'N'
  AND T0."DocDate" BETWEEN '20260801' AND '20260831'
ORDER BY T0."DocDate", T0."DocNum";

Before publishing it as an official report, validate the PCH5 column names in your version. Also, if your installation does not use that detail table, drop the join and work with the header alone: OPCH.WTSum gives you the total withheld per document and is usually enough for the book.

Query 4: mismatch between withholding declared and withholding paid

This query catches the most expensive error of all: documents that declared a withholding that was never applied at payment, or the other way around. The difference between WTSum and WTApplied is your traffic light.

SQL Server

-- Mismatch between document withholding and applied withholding
SELECT
    T0.DocNum   AS [Invoice],
    T0.DocDate  AS [Date],
    T0.CardCode,
    T0.CardName,
    T0.WTSum    AS [Document_Withholding],
    T0.WTApplied AS [Applied_Withholding],
    T0.WTSum - T0.WTApplied AS [Difference],
    CASE T0.DocStatus WHEN 'O' THEN 'OPEN' ELSE 'CLOSED' END AS [Status]
FROM OPCH T0
WHERE T0.CANCELED = 'N'
  AND T0.WTSum <> 0
  AND ABS(T0.WTSum - T0.WTApplied) > 0.01
  AND T0.DocDate >= DATEADD(MONTH, -6, GETDATE())
ORDER BY ABS(T0.WTSum - T0.WTApplied) DESC;

SAP HANA

-- Mismatch between document withholding and applied withholding
SELECT
    T0."DocNum"   AS "Invoice",
    T0."DocDate"  AS "Date",
    T0."CardCode",
    T0."CardName",
    T0."WTSum"    AS "Document_Withholding",
    T0."WTApplied" AS "Applied_Withholding",
    T0."WTSum" - T0."WTApplied" AS "Difference",
    CASE T0."DocStatus" WHEN 'O' THEN 'OPEN' ELSE 'CLOSED' END AS "Status"
FROM OPCH T0
WHERE T0."CANCELED" = 'N'
  AND T0."WTSum" <> 0
  AND ABS(T0."WTSum" - T0."WTApplied") > 0.01
  AND T0."DocDate" >= ADD_MONTHS(CURRENT_DATE, -6)
ORDER BY ABS(T0."WTSum" - T0."WTApplied") DESC;

Every row with a positive difference is money you declared as withheld and probably paid out in full. Consequently, this query should run before every month-end close, not after.

Variations and use cases

The four queries above are a starting point, not a destination. Below, four adaptations that solve common needs.

  • Sales withholding: replace OPCH with OINV, PCH5 with INV5 and filter OCRD.CardType equal to C. This way you get the withholdings your customers apply to you.
  • View by vendor and period: group Query 3 by CardCode and by month. That is how you spot the vendor whose withholding dropped to zero from one month to the next with no explanation.
  • Automatic alert: set Query 2 up as an Alert under Administration > Alerts Management and schedule it to run weekly. The system therefore warns you about the misconfigured vendor before you issue the payment.
  • Withholding on payments: if your model withholds at payment, bring in OVPM together with VPM6 to get the detail per payment made and compare that total against what was declared on the invoices.
SAP Business One withholding tax - withholding book and monthly accounting reconciliation
The withholding book stops being a manual spreadsheet the moment the ERP generates it with full traceability.

Best practices and common mistakes

Do not edit the rate, add a validity period. Changing the rate of an existing code contaminates the history. A new row in WHT1 with an effective date, by contrast, preserves traceability and lets you rebuild any prior year.

Include withholding in vendor onboarding. The most frequent error is not a configuration error, it is a process error: the new vendor gets created without the flag. Therefore, add the check to your onboarding procedure and, better still, back it up with an alert that reviews records created in the last week.

Reconcile the withholding account monthly. The balance of the liability account has to match the sum of the withholding book for the period. If it does not match, you have cancelled documents, partial payments or codes pointing at the wrong accounts.

Watch out for cancellations. Cancelling an invoice with withholding does not always reverse the entry the same way in every localization. However, Query 4 reveals those cases if you filter on cancelled documents.

Document the criteria, not just the setup. Write one page on why each code exists, what regulation backs it and who approved the rate. When the audit arrives, that document is worth more than any screen in the system.

Official SAP resources

To go deeper into the definition and the legal report, review the official documentation:

Conclusion: control is not in the checkbox, it is in the query

Configuring SAP Business One withholding tax takes an afternoon. Keeping that configuration alive for three years, with new vendors, rates that change and staff that rotates, takes discipline. That is the difference between an ERP that complies and an ERP that also protects you.

My recommendation is straightforward: run Query 2 against your production database today. If even one vendor shows up with activity and no codes assigned, you have just found a leak that had been open for months. Then schedule the four queries as part of the month-end close. That way, control stops depending on somebody remembering.

Technology does not eliminate tax risk. It does, however, make it visible, measurable and actionable before it turns into a fine. That is the job.

This tutorial is part of the exclusive content of the Círculo Estratégico. If you want the rest of the SAP Business One series applied to business decisions, you already have access.

Most Read

QlikSense Hierarchy: parent-child chart of accounts expanded by levels
QlikSense Hierarchy: the Chart of Accounts That Doesn't Add Up
QlikSense Sum TOTAL: share of each family over the total
QlikSense Sum TOTAL: the Percentage That Changes When You Filter
SAP Business One Inventory Revaluation - featured image of the tutorial
SAP Business One Inventory Revaluation: Fix Wrongly Loaded Costs
Empty chamber with wooden benches: the counterweight that required being present to be used
The Veto You Had to Say in Person: Your Decisions With No Counterweight
SAP Business One customizations - featured image of the pre-upgrade audit tutorial
SAP Business One Customizations: Pre-Upgrade Audit
SAP Business One Customer Concentration - featured image of the tutorial
SAP Business One Customer Concentration: Measure Your Risk with SQL

RELATED ARTICLES