---
id: object/codeunit/6785
type: object
title: Codeunit 6785 "Withholding Tax Mgmt."
summary: Codeunit 6785 "Withholding Tax Mgmt." in WithholdingTax (Microsoft.WithholdingTax). 29 public procedures. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - withholdingtax
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: cebc3d61422a7a42381517f2ab674d8878c075b77395c8a69d0f1b1a6ef2eec5
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/WithholdingTax/app/src/Purchase/Transaction/WithholdingTaxMgmt.Codeunit.al
    title: src/Apps/W1/WithholdingTax/app/src/Purchase/Transaction/WithholdingTaxMgmt.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/10869
    - change/bcapps/10545
    - change/bcapps/10631
    - change/bcapps/10352
    - change/bcapps/9865
    - change/bcapps/9481
    - change/bcapps/9650
    - change/bcapps/9515
object_type: codeunit
object_id: 6785
name: Withholding Tax Mgmt.
namespace: Microsoft.WithholdingTax
app: WithholdingTax
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 42
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 3
  called_by: 2
  implements: 0
---

# Codeunit 6785 "Withholding Tax Mgmt."

> Codeunit 6785 "Withholding Tax Mgmt." in WithholdingTax (Microsoft.WithholdingTax). 29 public procedures. Introduced in BC29, still in BC30.

WithholdingTax · Microsoft.WithholdingTax · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/WithholdingTax/app/src/Purchase/Transaction/WithholdingTaxMgmt.Codeunit.al) · facts from BC29

## Procedures

- `CheckApplicationPurchWithholdingTax(var PurchHeader: Record "Purchase Header")`
- `CheckApplicationGenPurchWithholdingTax(var GenJnlLine: Record "Gen. Journal Line")`
- `InsertVendInvoiceWithholdingTax(var PurchInvHeader: Record "Purch. Inv. Header")`
- `InsertVendCreditWithholding(var PurchCreditHeader: Record "Purch. Cr. Memo Hdr."; AppliesID: Code[50])`
- `InsertVendJournalWithholdingTax(var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `CheckWithholdingCalculationRule(TotalInvoiceAmountLCY: Decimal; WithholdingPostingSetup: Record "Withholding Tax Posting Setup"): Boolean`
- `IsWithholdingTaxApplicable(InvoiceAmount: Decimal; WithholdingTaxPostingSetup: Record "Withholding Tax Posting Setup"): Boolean`
- `InsertWithholdingTax(TransType: Option Purchase,Sale): Integer`
- `NextEntryNo(): Integer`
- `CheckPmtDisc(PostingDate: Date; PmtDiscDate: Date; Amount1: Decimal; Amount2: Decimal; Amount3: Decimal; Amount4: Decimal): Boolean`
- `InitWithholdingTaxEntry(TempWithholdingTaxEntry: Record "Withholding Tax Entry"; AppldAmount: Decimal; PaymentAmount1: Decimal; var WithholdingTaxEntry3: Record "Withholding Tax Entry")`
- `InsertVendPrepaymentInvoiceWithholding(var PurchInvHeader: Record "Purch. Inv. Header"; var PurchHeader: Record "Purchase Header")`
- `InsertVendPrepaymentCrMemoWithholding(var PurchCrMemoHeader: Record "Purch. Cr. Memo Hdr."; var PurchHeader: Record "Purchase Header")`
- `InsertPrepaymentUnrealizedWithholding(TransType: Option Purchase,Sale): Integer`
- `WithholdingAmountJournal(var GenJnlLine1: Record "Gen. Journal Line"; Post: Boolean): Decimal`
- `CalcVendExtraWithholdingForEarliest(var GenJnlLine: Record "Gen. Journal Line"): Decimal`
- `CalcAppliedWithholdingTaxAmount(var VendorLedgerEntry: Record "Vendor Ledger Entry"; AppliedAmountWithholding: Decimal; WithholdingTaxPercent: Decimal; ExitLoop: Boolean): Decimal`
- `ABSMin(Decimal1: Decimal; Decimal2: Decimal): Decimal`
- `PrintWHTSlips(var GLReg: Record "G/L Register"; ScheduleInJobQueue: Boolean)`
- `ApplyVendInvoiceWHT(var VendLedgerEntry: Record "Vendor Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"): Integer`
- `ProcessPayment(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer; AmountWithDisc: Boolean): Integer`
- `InsertWithholdingTaxPostingBuffer(var WithholdingTaxEntryGL: Record "Withholding Tax Entry"; var GenJnlLine: Record "Gen. Journal Line"; Source: Option Payment,Refund; Oldest: Boolean)`
- `RoundWithholdingTaxAmount(Amount: Decimal): Decimal` (internal)
- `ProcessManualReceipt(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer): Integer`
- `ApplyVendInvoiceWHTPosted(var VendLedgerEntry: Record "Vendor Ledger Entry"; var GenJnlLine: Record "Gen. Journal Line"; TransNo: Integer): Integer`
- `ProcessPaymentPosted(var GenJnlLine: Record "Gen. Journal Line"; TransactionNo: Integer; EntryNo: Integer; Source: Option Vendor,Customer): Integer`
- `CheckVendorWithholdingTaxLiable(GenJnlLine: Record "Gen. Journal Line"): Boolean`
- `InitTextVariable()`
- `FormatNoText(var NoText: array[2] of Text[80]; No: Decimal; CurrencyCode: Code[10])`

Plus 13 local procedures.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Page 456 "No. Series"](../page/456.md) (5 calls: `InitWithholdingTaxEntry → (object)`, `InsertWithholdingTax → (object)`, `PrintWHTSlips → (object)`, …)
- [Codeunit 1373 "Batch Posting Print Mgt."](../codeunit/1373.md) (1 call: `PrintWHTSlips → SchedulePrintJobQueueEntry`)
- [Codeunit 444 "Purchase-Post Prepayments"](../codeunit/444.md) (1 call: `InsertVendPrepaymentInvoiceWithholding → PrepmtAmount`)

## Called by

- [Codeunit 6786 "Withholding Tax Jnl Subscriber"](../codeunit/6786.md) (37 calls: `ApplyVendLedgEntryOnBeforeOldVendLedgEntryModify → ProcessPayment`, `ApplyWHT → ApplyVendInvoiceWHTPosted`, `AssignBalGLAccValue → CheckVendorWithholdingTaxLiable`, …)
- [Codeunit 6784 "Wthldg Tax Purch. Subscribers"](../codeunit/6784.md) (9 calls: `CheckWithholdingApplication → CheckApplicationPurchWithholdingTax`, `OnBeforePostBalancingEntry → CheckVendorWithholdingTaxLiable`, `PostPrepmtInvLineBuffer → CheckVendorWithholdingTaxLiable`, …)

## Recent changes

- 2026-09-17 [#10869 [29.x]-[WHT] Inconsistency with the Payments](../../changes/bcapps/10869.md) (releases/29.x, BC29, fix)
- 2026-09-17 [#10545 [Master] - Bug 647253: [WHT] Inconsistency with the Payments](../../changes/bcapps/10545.md) (main, BC30, fix)
- 2026-08-26 [#10631 Integration/main to releases 29.x 31a860b5](../../changes/bcapps/10631.md) (releases/29.x, BC29, feature)
- 2026-08-21 [#10352 [Master]-Bug 646964: Withholding Tax Prod. Posting Group is missing o…](../../changes/bcapps/10352.md) (main, BC30, fix)
- 2026-08-19 [#9865 [Main] - 'Greater Than' Withholding Tax Calculation Rule is not app…](../../changes/bcapps/9865.md) (main, BC30, fix)
- 2026-07-29 [#9481 [Withholding Tax] FCY documents get wrongly rounded to LCY precision …](../../changes/bcapps/9481.md) (main, BC30, fix)
- 2026-07-22 [#9650 [Master] -Revert Changes- 'Greater Than' Withholding Tax Calculation Rule is not applied correctly in Withholding Tax Posting Setup.](../../changes/bcapps/9650.md) (main, BC30, other)
- 2026-07-20 [#9515 [Master] - 'Greater Than' Withholding Tax Calculation Rule is not applied correctly in Withholding Tax Posting Setup.](../../changes/bcapps/9515.md) (main, BC30, fix)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Withholding Tax Mgmt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
