[Main]-Payment XML file generated from EB Payment Journal upon selecting "FCY Symbol" includes currency text#9356
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the Belgian SEPA payment XML export so that the <InstdAmt> element contains a strictly numeric value (no currency symbol/text) even when General Ledger Setup “Show Currency” is configured to show FCY symbols.
Changes:
- Update
InstdAmtXML value formatting to use an explicit numeric format string (<Precision,2:2><Standard Format,9>) in the EUR SEPA export. - Apply the same explicit numeric formatting in the Non-Euro SEPA export.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Layers/BE/BaseApp/Local/BankMgt/Payment/FileSEPAPayments.Report.al | Forces numeric-only formatting for <InstdAmt> in the EUR SEPA payment XML. |
| src/Layers/BE/BaseApp/Local/BankMgt/Payment/FileNonEuroSEPAPayments.Report.al | Forces numeric-only formatting for <InstdAmt> in the non-EUR SEPA payment XML. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); | ||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>'), '', XMLNewChild); |
Agentic PR Review - Round 1Recommendation: Request ChangesWhat this PR doesThis PR changes the InstdAmt value in File SEPA Payments and File Non Euro SEPA Payments from Format(PmtJnlLine.Amount, 0, 9) to an explicit numeric format. For these two reports, this fixes the reported problem: the XML amount node stays numeric, while the currency remains in the Ccy attribute (EUR for SEPA, or the ISO currency code for non-euro SEPA). The normal non-FCY output should stay compatible because the new format matches the existing BE test helper expectation for InstdAmt. The fix is not complete because the exposed pain.001.001.09 SEPA reports still use the old amount format. SuggestionsS1 - Update all SEPA XML exports S2 - Add an XML regression test Risk assessment and necessityRisk: This is payment export XML, so a bad value can create a bank-rejected payment file or a malformed payment amount. The changed reports keep the currency in the correct XML attribute and do not change public APIs, but the same old formatting remains in the pain.001.001.09 BE SEPA reports. Necessity: The bug is valid and has clear repro steps: selecting FCY Symbol Only in General Ledger Setup makes the exported amount include currency text. Without a fix, users must change the display setting before export, which is not a safe workaround for payment processing. The change is needed, but the scope and tests need to cover the equivalent exposed export reports.
|
Copilot PR ReviewIteration 6 · Outcome: completed
Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 0 knowledge-backed · 2 agent findings. Orchestrator pre-filter (2 file(s) excluded)
Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives. |
…Journal-upon-FCY-Symbol-include-currency-text
| GeneralLedgerSetup.Modify(true); | ||
| end; | ||
|
|
||
| local procedure SetShowCurrencyToLCYAndFCYSymbol() |
There was a problem hiding this comment.
SetShowCurrencyToLCYAndFCYSymbol, added in this PR, is never called anywhere in the codeunit or repository.
It configures General Ledger Setup for an 'LCY and FCY Symbol' scenario that the new test VerifyInstdAmtIsNumericWhenShowCurrencyIsFCYSymbolOnly does not exercise (it only calls SetShowCurrencyToFCYSymbolOnly).
Recommendation:
- either delete the unused procedure, or add the missing test scenario that exercises the 'LCY and FCY Symbol' Show Currency option if that coverage was intended.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
…ol-include-currency-text' of https://github.com/neeleshsinghal/BCApps into bugs/Bug-641821-Export-EB-Payment-Journal-upon-FCY-Symbol-include-currency-text
| [Test] | ||
| [HandlerFunctions('SuggestVendorPaymentsReportHandler,FileSEPAPaymentsReportHandlerNonEuro')] | ||
| procedure VerifyInstdAmtIsNumericWhenShowCurrencyIsFCYSymbolOnly() |
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); | ||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>'), '', XMLNewChild); |
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); | ||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>'), '', XMLNewChild); |
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); | ||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>'), '', XMLNewChild); |
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); | ||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>'), '', XMLNewChild); |
Agentic PR Review - Round 2Recommendation: AcceptWhat this PR doesSince round 1, the PR updates the two pain.001.001.09 SEPA export reports to write Status of previous suggestions
New observations (commits since round 1)None - changes only addressed prior suggestions. Risk assessment and necessityRisk: This remains payment export XML, so incorrect formatting can create bank-rejected files. The round-2 changes are narrow: they only change amount formatting in the two remaining reports, add a focused regression test, and remove an unused test helper. No public API or event signature changes are involved. Necessity: The linked bug is still valid and important. Without this fix, users can get currency text inside an XML amount node when
|
| local procedure SetShowCurrencyToFCYSymbolOnly() | ||
| var | ||
| GeneralLedgerSetup: Record "General Ledger Setup"; | ||
| begin | ||
| GeneralLedgerSetup.Get(); | ||
| GeneralLedgerSetup.Validate("Show Currency", GeneralLedgerSetup."Show Currency"::"FCY Symbol Only"); | ||
| GeneralLedgerSetup.Modify(true); | ||
| end; |
| local procedure SetShowCurrencyToFCYSymbolOnly() | ||
| var | ||
| GeneralLedgerSetup: Record "General Ledger Setup"; | ||
| begin | ||
| GeneralLedgerSetup.Get(); | ||
| GeneralLedgerSetup.Validate("Show Currency", GeneralLedgerSetup."Show Currency"::"FCY Symbol Only"); | ||
| GeneralLedgerSetup.Modify(true); | ||
| end; | ||
|
|
||
| local procedure SetCurrencySymbol(CurrencyCode: Code[10]) |
| // Preparation: create settings | ||
| SetShowCurrencyToFCYSymbolOnly(); | ||
| CountryCode := FindCountryRegion(); |
…Journal-upon-FCY-Symbol-include-currency-text
Agentic PR Review - Round 3Recommendation: AcceptWhat this PR doesSince round 2, the new commit only changes the automation. It removes the separate Status of previous suggestions
New observations (commits since round 2)None - the automation change keeps the regression coverage and does not weaken the product fix. Risk assessment and necessityRisk: This is still payment export XML, so wrong formatting can create bank-rejected payment files. The round-3 change is limited to test code. It keeps the same assertions for Necessity: The linked bug remains a valid payment export defect. The automation change is reasonable because it avoids a duplicate test while preserving the FCY Symbol Only regression scenario in an existing multi-currency XML coverage path.
|
…Journal-upon-FCY-Symbol-include-currency-text
| AddElement(XMLNodeCurr, 'Amt', '', '', XMLNewChild); | ||
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); |
There was a problem hiding this comment.
Same pattern as in FileNonEuroSEPAPayments.Report.al: Format(PmtJnlLine.Amount, 0, '<Precision,2:2><Standard Format,9>') hardcodes 2 decimal digits for the InstdAmt element.
This report (File FCY SEPA 001.001.09 Pmts) also uses a dynamic ISOCurrCode, so it exports payments in arbitrary foreign currencies whose configured 'Amount Decimal Places' may differ from 2, risking silent rounding/padding of the transferred amount in the generated ISO 20022 file. Capped at minor pending a BCQuality knowledge article on currency-aware amount formatting; consider deriving the precision from the currency's own decimal-places setting rather than a fixed '2:2'.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| AddElement(XMLNodeCurr, 'Amt', '', '', XMLNewChild); | ||
| XMLNodeCurr := XMLNewChild; | ||
|
|
||
| AddElement(XMLNodeCurr, 'InstdAmt', Format(PmtJnlLine.Amount, 0, 9), '', XMLNewChild); |
There was a problem hiding this comment.
The fix for the currency-symbol leak now formats PmtJnlLine.Amount with the hardcoded format string '<Precision,2:2><Standard Format,9>', forcing exactly 2 decimal digits.
The previous code (Format(PmtJnlLine.Amount, 0, 9)) rendered the value with whatever decimal precision the amount actually carried. This report (File Non Euro SEPA Payments) explicitly supports arbitrary foreign currencies via a dynamic ISOCurrCode/'Ccy' attribute, and Business Central currencies can be configured with an 'Amount Decimal Places' other than 2 (e.g. 0 or 3 decimals). Hardcoding 2 decimals means the InstdAmt element in the exported ISO 20022 payment file will silently round or pad amounts for any such currency instead of reflecting the currency's configured precision, which is a real-money correctness risk in a bank payment export. If the underlying impact materializes it would warrant major severity, but this is capped at minor here because there is no BCQuality knowledge article backing it yet; consider formatting with the currency's own decimal-places precision (e.g. via Currency."Amount Decimal Places") instead of a fixed '2:2', and this should be promoted to a knowledge-backed rule once confirmed.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Fixes AB#641821
Workitem :- Bug 641821: [master] [all-e]Payment XML file generated from EB Payment Journal upon selecting "FCY Symbol" includes currency text