Some notes on the MT940 format used by various banks to export transactions
Posted by jpluimers on 2018/07/25
I needed the below links to get a feel on how much effort it would be to convert ABNAMRO transactions from MT940 into CSV or XLS extracting as many useful fields as possible.
Maybe it useful for other people as well.
I know there is CAMT.053 as well, but that puts every transaction into a separate XML file but still spreads the description over a multi-line structured field (like :86:
below).
- [WayBack] SGS MT940.pdf
- [WayBack] MT940 – Wikipedia:
- MT940 is a format used by the SWIFT network to send and receive end-of-day bank account statements.
- [WayBack] MT940 Format Overview – SEPA for Corporates
- [WayBack] ABNAMRO MT940 voorbeeld – Yuki wiki
- MT940 library in C# by Jaco Adriaansen: raptux / SharpMt940Lib — Bitbucket
- SharpMt940Lib is a C# library that allows you to read MT940 formatted files and convert it to in-memory C# objects.This library can be used in financial software or converters to convert to OFX or CSV.Most banks offer a way to download a set of transactions as MT940.Currently the code is tested against data formatted in the style of ABN AMRO data.
- NuGet Gallery | SharpMt940Lib 1.2.0.4
- SharpMT940Lib implements the MT940 format in C# and is based on specifications of multiple banks. You can use it as a base for financial software or for conversions to other formats like CSV or OFX.
- From various banks:
- [WayBack] Swift Formaten MT940 – MT942 OfficeNet Direct – ABN Amro
- [WayBack] SWIFT MT940 – MT942 formats for exporting data from OfficeNet Direct
- [WayBack] SEPA – ABN AMRO – aangepast rapportageformaat
- [WayBack] Deutsche Bank MT940/942 format specifications
- [WayBack] ING FTP Unstructured MT940 and MT942 Format Description
- [WayBack] Rabo Internetbankieren Professional – Verschillen tussen de formaten MT940 Structured en MT940 Unstructured
- [WayBack] MT940 Structured – Rabobank
- [WayBack] Format Description SWIFT MT940 – Rabobank
- [WayBack] Format Description MT940 – Rabobank
- [WayBack] transactiesoortcode-versie-2-8_29842987.pdf
- [WayBack] voorbeeldbestanden-export.zip
Two observations on field :86:
(Information to Account Owner) are:
- Often it is less than 6 lines; I think it should be specified like “as most 6 lines of maximum 65 characters”
- At least ABN AMRO splits up the 65 characters into two columns:
- part 1: 33 characters (almost always having a space in position 33)
- part 2: 32 characters
- At least ABN AMRO uses this format for these lines:
- optional: description not having a semicolon (:) in it
- optional repetition of:
- mandatory keyword followed by a semicolon (:) and not having spaces in it
- mandatory description not having a semicolon (:) in it
- space
Searchable main source file of the library and easy browsing of the rest of the files: [WayBack] Mt940Parser.cs in sharpmt940lib located at /Raptorious.SharpMT940Lib | source code search engine
Background: [Archive.is] Jaco Adriaansen on Twitter: “@jpluimers Op dit moment parse ik 86 niet dieper. De inhoud van 86 is gewijzigd na dat ik het gemaakt heb. Zie: https://t.co/CrMc1OgaB0”
My modified source code is at [Wayback/Archive.is] GitHub – jpluimers/MT940-to-CSV: Convert MT940 files to CSV using C# library SharpMt940Lib with this README.md:
MT940-to-CSV
Convert MT940 files to CSV using C# library SharpMt940Lib
For now the implementation hard coded for ABN AMRO MT940 format expecting
nl-NL
formatting of numbers.Example ABN AMRO MT940 file used for testing from wiki.yuki.nl.
Syntax:
MT940toCSV.exe [MT940-FilePath...]
You supply zero or more
MT940-FilePath
entries.For each entry, it exports CSV by changing the extension of the source file.
Usually the FileName portion of
MT940-FilePath
looks likeMT940170417161106.STA
when downloaded from https://www.abnamro.nl/nl/paymentsreporting/downloadmutations.htmlNote it is still work in progress.
The next step will be parsing the
TransactionDescription
field that is formatted contrary to what is described in “2.3 Verschillen TAG 86 Mutatie Informatie” from 2.3 Verschillen TAG 86 Mutatie Informatie.The slash (
/
) separation described there is not used; in stead some (but not all) fields are in this form:NAME: VALUE
Here:
NAME
cannot have spacesVALUE
starts and ends with a non-space, but can contain spaces in other positions.Observed
NAME
values for now:
OMSCHRIJVING
IBAN
KENMERK
CHECK
FACT.NR
RELATIENR
INCASSANT
BETALINGSKENM.
FACTUUR
BIC
NAAM
CREDITRENTEOVERZICHT
TERMIJN
MACHTIGING
RELATIENR
VLGNR
RENTE
The non-delimited first parts observed until now are:
SEPA ACCEPTGIROBETALING
SEPA IDEAL
SEPA INCASSO ALGEMEEN DOORLOPEND
SEPA OVERBOEKING
SEPA PERIODIEKE OVERB.
–jeroen
Leave a Reply