A transaction must be started

If you are running a ForNAV report based on version 5.3 or earlier in Business Central 16 or newer, you might run into the following error when you save your report as an Excel document:

A transaction must be started before changes can be made to the database.

Microsoft Excel export problems are typically caused by problems in the exported data or a version mismatch between the loaded and required version of a Microsoft.NET assembly named DocumentFormat.OpenXml.

If it is a data problem, then you can often solve it by following the Excel Troubleshooting guide to collect debug data.

If it is the assembly problem, you can see something similar to the following in your event log on the service tier machine:

The message in the event log is:

The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Solution

Search the Internet for Open XML SDK 2.5 for Microsoft Office. This takes you to the Microsoft website where you can download OpenXMLSDKV25.msi.

https://www.microsoft.com/en-us/download/details.aspx?id=30425

After installing this MSI package, the required assembly in the required version 2.5 is in the Assembly GAC on the computer.

You must RESTART your service tier after installing the package. Otherwise, it will not see the installed file.