Working on MT940 importer

Best, Jan-Pascal van j.p.vanbest at tbm.tudelft.nl
Fri Sep 12 14:06:28 CDT 2003


> >>Yes, I've read those. I looked at the OpenHBCI C API at
> >>http://openhbci.sourceforge.net/doc/api/group__HBCI__APIg.html
> >>but didn't find anything in there to parse MT940 files directly,
> >>so I kind of gave up on that.
> > 
> > Well, the current implementation of the SWIFT parser 
> expects a string which 
> > contains the MT940. You could read a whole file into a 
> string and pass it on 
> > to the method SWIFTparser::readMT940().

That should do nicely. By the way, does this handle the case (my 
bank does this) of statements for multiple days in a single file? 
I'll just try it anyway, and see what happens.

[snap]
> >>It doesn't seem like there is a C wrapper
> >>function available, at least not in core/swiftparser.h. Would it
> >>be possible to create one?
> > 
> > Yes, that should not be too hard to perform.
> 
> And in fact this is quite easy. I think I will add C wrappers 
> later today.

That would be great. I have a skeleton importer in place (it creates
a new entry under File/Import/, which asks for a filename, starts reading
it, and then finishes without doing anything more...), I'll have it call 
the parser and see what happens.

> >>Some more things: is the booking code (you call it 
> "transaction key")
> >>interpreted somewhere? Is there a possibility to allow unstructured
> >>
> >>:86: fields (my bank has them)? Maybe the bank-specific 
> parsing should
> > 
> > That code is not interpreted by the parser (I can't tell 
> whether Christian's 
> > GNUCash-HBCI-code makes use of it, though).
> 
> I don't think it is being used in gnucash, too.

Okay. For my bank, it tells what kind of transaction it is (transfer,
automatic transfer, cash withdrawal, etc.). Not documented, of course. 
I've asked the bank Wednesday, but I haven't had a response yet.

My :86: fields contain things like this (I've anonymized some names&numbers).
It's almost completely unstructured. Maybe in combination with the booking 
code there's a logic to it. It would be a good thing to be able to interpret at
least part of it, since they often contain the destination accounts for transfers.

If you want, I can send you a larger mt940 file by private mail.

ABNANL2A
940
ABNANL2A
:20:ABN AMRO BANK NV
:25:111111112
:28:18801/1
:60F:C030704EUR260,42
:61:0306300707C25,04N591NONREF
:86:RENTEAFSLUITING
CREDITRENTE               25,04C
:62F:C030707EUR285,46
-
ABNANL2A
940
ABNANL2A
:20:ABN AMRO BANK NV
:25:111111113
:28:17601/1
:60F:C030624EUR373,49
:61:0306250625D16,42N411NONREF
:86: 11.11.11.116 HM WIFESNAME CJ
MEEGROEIVERZEKERING MYNAME
:61:0306250625C1234,56N195NONREF
:86: 22.22.22.221
TECHNISCHE UNIVERSITEIT
SALARIS                 JUNI
2003 TUDELF
:62F:C030625EUR1234,56
-

Something completely different: when balancing imports, gnucash seems to build some
kind of table and guessing what to do. Is it possible to edit this table by hand,
so that I can say, for instance, "any credit transaction with the text 'SALARIS'" 
in it should be balanced with the "Salary" account?

Jan-Pascal


More information about the gnucash-devel mailing list