Jump to content
Stéphane Wierzbicki

Delphi MT940 implementation (reader, writer)

Recommended Posts

Hello,

 

Could someone help me? I'm searching some Delphi code to quicly help me implementing the SWIFT RT940 protocol.

I've so far googled for it but I can't find anything in Pascal/Delphi language.

 

Thanks in advance.

 

Kind regards,

Stéphane

Share this post


Link to post
Posted (edited)

Nothing ... I was wrong

Edited by DelphiUdIT

Share this post


Link to post

I'm interested in it too. Or does anyone know an implementation in C# or Java?

Share this post


Link to post

You'll need to parse the SWIFT messages to extract relevant fields and information. SWIFT messages are structured with specific fields that you need to handle programmatically. If you need to create SWIFT messages (MT940 in your case), you'll need to format the data according to SWIFT standards. RT940 refers to real-time MT940 messages. MT940 is a standard SWIFT message format for transmitting balance and transaction information for accounts. You'll need to parse these messages to extract account information, transactions, balances, and other relevant data.

 

Here’s a basic example of how you might approach parsing an MT940 message in Delphi:

procedure ParseMT940(Message: TStringList);
var
  i: Integer;
begin
  // Assume Message is a TStringList containing lines of the MT940 message
  for i := 0 to Message.Count - 1 do
  begin
    // Example: Parsing the statement line
    if StartsText(':61:', Message) then
    begin
      // Extract transaction details
      // Example: Date, Amount, Transaction Type, etc.
      // Parse fields according to the SWIFT MT940 specification
      // Example:
      // Date := Copy(Message, 5, 6); // Extract date
      // Amount := StrToFloat(Copy(Message, 16, Length(Message)-15));
    end;

    // Example: Parsing the balance line
    if StartsText(':60F:', Message) then
    begin
      // Extract balance details
      // Example: Balance amount, Date, Currency, etc.
      // Example:
      // BalanceAmount := StrToFloat(Copy(Message, 7, Length(Message)-6));
    end;

    // Continue parsing other lines as needed
  end;
end;

 

Share this post


Link to post
On 5/27/2024 at 3:41 PM, Die Holländer said:

Hello, I've sent you both a DM with a basic reader.

Can you send me the reader too? Thx!

Share this post


Link to post

The C# library Raptorious.Finance.Swift.Mt940 has been ported 5 years ago to .NET core at  https://github.com/mjebrahimi/SharpMt940Lib.Core/tree/master 

 

I have used the raptorious one to successfully parse ABN AMRO MT940 files and convert them to CD at https://github.com/jpluimers/MT940-to-CSV

 

It should be relatively straightforward to port them to Delphi. 

 

--jeroen 

  • Like 1

Share this post


Link to post
14 minutes ago, jeroenp said:

The C# library Raptorious.Finance.Swift.Mt940 has been ported 5 years ago to .NET core at  https://github.com/mjebrahimi/SharpMt940Lib.Core/tree/master 

 

I have used the raptorious one to successfully parse ABN AMRO MT940 files and convert them to CD at https://github.com/jpluimers/MT940-to-CSV

 

It should be relatively straightforward to port them to Delphi. 

 

--jeroen 

Thanks!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×