bcquality/microsoft/knowledge/finance/reverse-transactions-by-transaction-number.md
Jesper Schulz-Wedde 7c17aa3ab8 Fix Finance review applicability and ownership boundaries
Remove application-area gating and later VAT-field dependencies, align dynamic shared conventions, separate SCM ownership, and keep journal examples focused on the intended invariant.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-17 18:10:21 +02:00

2.7 KiB

bc-version domain keywords technologies countries application-area
all
finance
reversetransaction
reverseregister
transaction-no
entry-no
reversal-entry
g-l-register
al
w1
all

Pass the transaction number, not a ledger-entry number, to ReverseTransaction

Description

Reversal Entry.ReverseTransaction expects a transaction number, while ReverseRegister expects a G/L register number. Neither parameter means a ledger Entry No.. All are integers, so the compiler accepts the wrong identity; a coincidentally matching integer can select another transaction instead of the posting the user intended to reverse.

Best Practice

When starting from a G/L Entry, fetch that entry and pass its Transaction No. to Reversal Entry.ReverseTransaction, as the sample does. The same identity distinction applies to customer/vendor ledger entries when using their supported transaction-reversal path. If the starting point is a G/L register, use Reversal Entry.ReverseRegister with that register's number. The interactive workflow collects the participating entries and validates reversal eligibility before the user posts the reversal.

Do not infer eligibility from Open alone or bypass a rejection by changing origin, application, or reversal fields. The supported path depends on source and state; some postings require unapplication or a correcting document first. A request to reverse is not a guarantee that reversal will be permitted. This rule concerns the two named Reversal Entry APIs, not routines such as UnApplyCustLedgEntry that legitimately accept a ledger entry number.

See sample: reverse-transactions-by-transaction-number.good.al.

Anti Pattern

Pass a ledger entry's Entry No. or a register number into ReverseTransaction, or pass a ledger-entry/transaction number into ReverseRegister. Require visible value provenance, not merely a suspicious variable name or an arbitrary integer. A correctly sourced transaction number is valid even when the variable is poorly named.

See sample: reverse-transactions-by-transaction-number.bad.al.

References