Why do you need this change?
We need additional extensibility in the Spanish localization report 10707 "Make 347 Declaration".
Currently, the report generates the official 347 declaration TXT file internally by building fixed-length text lines and storing them in an internal variable named TextList.
The generated declaration lines are added through the local procedure AppendLine(Content: Text). This procedure only adds the generated content to the internal TextList variable.
Later, the report writes those lines to a file, converts the file encoding, and downloads the final TXT file.
The problem is that extensions cannot access the generated declaration lines before they are written to the file. The TextList variable is internal, AppendLine is local, and there is currently no integration event that exposes the generated line content.
This creates an extensibility limitation in SaaS environments.
We have a custom preview page for the 347 declaration, and we need to display the exact same lines generated by the standard report. Since the standard report does not expose the generated lines, we currently have to duplicate part of the standard calculation logic in a custom object. This is not maintainable because any future change in the standard report logic may cause a mismatch between the preview and the exported official file.
Our main requirement is to capture the generated declaration lines and use them to populate our custom preview page, ensuring that the preview always matches the official TXT file generated by the standard report.
We also need a way to validate and audit the generated declaration lines while preserving the standard calculation logic.
This would benefit other partners as well, because report 10707 contains complex Spanish localization logic and partners should not need to duplicate it only to preview, validate, or audit the generated output.
Without these events, the only available options are to duplicate the standard logic or require the user to manually export and upload the file again. Both options are undesirable.
Adding these events would allow extensions to stay aligned with MicrosoftΓÇÖs standard calculation logic while enabling preview, audit, and validation scenarios.
Describe the request
Object
Report 10707 "Make 347 Declaration"
Main request
We request additional integration events in report 10707 "Make 347 Declaration", mainly to capture the declaration lines generated by the standard report and reuse them in a custom preview page.
The main requirement is to access the lines generated by the standard report before they are written to the final TXT file.
Currently, these lines are built internally as fixed-length text lines and stored in the internal variable TextList.
The local procedure AppendLine(Content: Text) adds each generated line directly to TextList, but there is currently no event that allows an extension to capture this content.
Current behavior
The local procedure AppendLine(Content: Text) adds the generated line directly to TextList.
Main requirement
We need to capture each line generated by the standard report and use it to populate a custom preview page for the Spanish 347 declaration.
This would allow us to preview the same lines generated by the standard report, without duplicating the internal logic of report 10707.
Main requested event
OnAfterAppendLine(Content: Text)
Suggested placement
Inside the AppendLine procedure, immediately after adding Content to TextList.
Suggested implementation
local procedure AppendLine(Content: Text)
begin
TextList.Add(Content);
OnAfterAppendLine(Content);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterAppendLine(Content: Text)
begin
end;
Business purpose of this event
This event would allow extensions to capture the exact line generated by the standard report and store it in a custom table or temporary buffer to display it in a preview page.
This is the main scenario for this request: we need to display the same lines generated by the standard report, without duplicating the internal logic of report 10707.
Optional requested event
Optionally, we also request an event before adding the line to TextList, to allow controlled adjustments if needed in specific scenarios.
OnBeforeAppendLine(var Content: Text)
Suggested placement
Inside AppendLine, before adding Content to TextList.
Suggested implementation
local procedure AppendLine(Content: Text)
begin
OnBeforeAppendLine(Content);
TextList.Add(Content);
OnAfterAppendLine(Content);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeAppendLine(var Content: Text)
begin
end;
Purpose of the optional event
This event would allow the generated line to be adjusted before it is added to TextList.
However, this is not the main requirement. The main requirement is to capture the generated lines for preview purposes.
Additional requested event
We also request an event before the final file is written, to access the complete set of generated lines.
OnBeforeWriteLinesToFile(var TextList: List of [Text])
Suggested placement
After CreateFileHeader() and before WriteLinesToFile().
Suggested implementation
CreateFileHeader();
OnBeforeWriteLinesToFile(TextList);
WriteLinesToFile();
ConvertFileEncoding(FileName, Utf8Lbl, Iso88591Lbl);
[IntegrationEvent(false, false)]
local procedure OnBeforeWriteLinesToFile(var TextList: List of [Text])
begin
end;
Purpose of this event
This event would allow extensions to access the complete set of generated lines before the final TXT file is created.
This would also be useful to populate a preview page or perform validations.
Existing events evaluated
The report currently exposes integration events related to country filtering:
OnAfterIsCountryCodeInSpainOrOutsideEU(CountryCode: Code[10]; var Result: Boolean)
OnBeforeCreateCountryRegionFilter(var CountryRegionFilter: Text; var IsHandled: Boolean)
These events are useful for country filtering, but they do not allow access to the generated 347 declaration lines.
Alternatives evaluated
We evaluated using Report.SaveAs with a Temp Blob and an OutStream, but this does not work for this report because report 10707 is a ProcessingOnly report and the official TXT file is generated manually inside the report using internal file logic.
We also evaluated using the existing SetSilentMode procedure. However, this procedure is marked as OnPrem and is not usable in SaaS extensions. It also depends on server file handling.
We also considered asking the user to export the standard TXT file and upload it again into our custom page. This would allow us to parse the exported file, but it requires unnecessary manual interaction and is not a good user experience.
Finally, we considered duplicating the standard report logic in our custom extension. This was rejected as a long-term solution because report 10707 contains complex logic involving:
customers,
vendors,
VAT entries,
ledger entries,
no taxable entries,
VAT cash regime,
reverse charge VAT,
quarterly amounts,
same VAT registration number grouping,
excluded G/L accounts.
Duplicating this logic creates a maintenance risk with every Business Central update.
Summary of the request
The main need is to add an event that allows extensions to capture each line generated by the standard report 10707.
Main requested event
[IntegrationEvent(false, false)]
local procedure OnAfterAppendLine(Content: Text)
begin
end;
Why this event is important
This event would allow us to store the lines generated by the standard report and show them in a custom preview page.
This would ensure that the preview matches the official TXT file generated by Microsoft.
Additional useful events
[IntegrationEvent(false, false)]
local procedure OnBeforeAppendLine(var Content: Text)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeWriteLinesToFile(var TextList: List of [Text])
begin
end;
Final note
These events would solve the current extensibility limitation and avoid unnecessary duplication of the standard Spanish 347 declaration logic.
Internal work item: AB#636289
Why do you need this change?
We need additional extensibility in the Spanish localization report 10707 "Make 347 Declaration".
Currently, the report generates the official 347 declaration TXT file internally by building fixed-length text lines and storing them in an internal variable named TextList.
The generated declaration lines are added through the local procedure AppendLine(Content: Text). This procedure only adds the generated content to the internal TextList variable.
Later, the report writes those lines to a file, converts the file encoding, and downloads the final TXT file.
The problem is that extensions cannot access the generated declaration lines before they are written to the file. The TextList variable is internal, AppendLine is local, and there is currently no integration event that exposes the generated line content.
This creates an extensibility limitation in SaaS environments.
We have a custom preview page for the 347 declaration, and we need to display the exact same lines generated by the standard report. Since the standard report does not expose the generated lines, we currently have to duplicate part of the standard calculation logic in a custom object. This is not maintainable because any future change in the standard report logic may cause a mismatch between the preview and the exported official file.
Our main requirement is to capture the generated declaration lines and use them to populate our custom preview page, ensuring that the preview always matches the official TXT file generated by the standard report.
We also need a way to validate and audit the generated declaration lines while preserving the standard calculation logic.
This would benefit other partners as well, because report 10707 contains complex Spanish localization logic and partners should not need to duplicate it only to preview, validate, or audit the generated output.
Without these events, the only available options are to duplicate the standard logic or require the user to manually export and upload the file again. Both options are undesirable.
Adding these events would allow extensions to stay aligned with MicrosoftΓÇÖs standard calculation logic while enabling preview, audit, and validation scenarios.
Describe the request
Object
Report 10707 "Make 347 Declaration"
Main request
We request additional integration events in report 10707 "Make 347 Declaration", mainly to capture the declaration lines generated by the standard report and reuse them in a custom preview page.
The main requirement is to access the lines generated by the standard report before they are written to the final TXT file.
Currently, these lines are built internally as fixed-length text lines and stored in the internal variable
TextList.The local procedure
AppendLine(Content: Text)adds each generated line directly toTextList, but there is currently no event that allows an extension to capture this content.Current behavior
The local procedure
AppendLine(Content: Text)adds the generated line directly toTextList.Main requirement
We need to capture each line generated by the standard report and use it to populate a custom preview page for the Spanish 347 declaration.
This would allow us to preview the same lines generated by the standard report, without duplicating the internal logic of report 10707.
Main requested event
OnAfterAppendLine(Content: Text)Suggested placement
Inside the
AppendLineprocedure, immediately after addingContenttoTextList.Suggested implementation
local procedure AppendLine(Content: Text)
begin
TextList.Add(Content);
OnAfterAppendLine(Content);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterAppendLine(Content: Text)
begin
end;
Business purpose of this event
This event would allow extensions to capture the exact line generated by the standard report and store it in a custom table or temporary buffer to display it in a preview page.
This is the main scenario for this request: we need to display the same lines generated by the standard report, without duplicating the internal logic of report 10707.
Optional requested event
Optionally, we also request an event before adding the line to TextList, to allow controlled adjustments if needed in specific scenarios.
OnBeforeAppendLine(var Content: Text)
Suggested placement
Inside AppendLine, before adding Content to TextList.
Suggested implementation
local procedure AppendLine(Content: Text)
begin
OnBeforeAppendLine(Content);
TextList.Add(Content);
OnAfterAppendLine(Content);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeAppendLine(var Content: Text)
begin
end;
Purpose of the optional event
This event would allow the generated line to be adjusted before it is added to TextList.
However, this is not the main requirement. The main requirement is to capture the generated lines for preview purposes.
Additional requested event
We also request an event before the final file is written, to access the complete set of generated lines.
OnBeforeWriteLinesToFile(var TextList: List of [Text])
Suggested placement
After CreateFileHeader() and before WriteLinesToFile().
Suggested implementation
CreateFileHeader();
OnBeforeWriteLinesToFile(TextList);
WriteLinesToFile();
ConvertFileEncoding(FileName, Utf8Lbl, Iso88591Lbl);
[IntegrationEvent(false, false)]
local procedure OnBeforeWriteLinesToFile(var TextList: List of [Text])
begin
end;
Purpose of this event
This event would allow extensions to access the complete set of generated lines before the final TXT file is created.
This would also be useful to populate a preview page or perform validations.
Existing events evaluated
The report currently exposes integration events related to country filtering:
OnAfterIsCountryCodeInSpainOrOutsideEU(CountryCode: Code[10]; var Result: Boolean)
OnBeforeCreateCountryRegionFilter(var CountryRegionFilter: Text; var IsHandled: Boolean)
These events are useful for country filtering, but they do not allow access to the generated 347 declaration lines.
Alternatives evaluated
We evaluated using Report.SaveAs with a Temp Blob and an OutStream, but this does not work for this report because report 10707 is a ProcessingOnly report and the official TXT file is generated manually inside the report using internal file logic.
We also evaluated using the existing SetSilentMode procedure. However, this procedure is marked as OnPrem and is not usable in SaaS extensions. It also depends on server file handling.
We also considered asking the user to export the standard TXT file and upload it again into our custom page. This would allow us to parse the exported file, but it requires unnecessary manual interaction and is not a good user experience.
Finally, we considered duplicating the standard report logic in our custom extension. This was rejected as a long-term solution because report 10707 contains complex logic involving:
customers,
vendors,
VAT entries,
ledger entries,
no taxable entries,
VAT cash regime,
reverse charge VAT,
quarterly amounts,
same VAT registration number grouping,
excluded G/L accounts.
Duplicating this logic creates a maintenance risk with every Business Central update.
Summary of the request
The main need is to add an event that allows extensions to capture each line generated by the standard report 10707.
Main requested event
[IntegrationEvent(false, false)]
local procedure OnAfterAppendLine(Content: Text)
begin
end;
Why this event is important
This event would allow us to store the lines generated by the standard report and show them in a custom preview page.
This would ensure that the preview matches the official TXT file generated by Microsoft.
Additional useful events
[IntegrationEvent(false, false)]
local procedure OnBeforeAppendLine(var Content: Text)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeWriteLinesToFile(var TextList: List of [Text])
begin
end;
Final note
These events would solve the current extensibility limitation and avoid unnecessary duplication of the standard Spanish 347 declaration logic.
Internal work item: AB#636289