NOTE: If you’re having issues getting your statement to import, we have updated the CSV->XML transform XSLT file to handle certain scenarios. This fix can be downloaded from PartnerSource or Lifecycle Services by searching for KB 2964064, or by opening a support request.
AIF inbound port
By legal entity
The inbound port that is used for importing bank statements must be mapped to a legal entity. It is a design requirement that, if there is more than one legal entity for which statements must be imported, each legal entity must have its own inbound port configured for import.
Tip: It is not required to restrict the inbound port to a legal entity if there is only one legal entity for which statements will be imported. In such cases, the statement is imported either manually or by using a batch job.
Steps
Advanced bank reconciliation is a new feature of AX2012, available from R2 onwards.
This new feature allows for the import of bank statements that can be automatically reconciled from within AX2012. This blog shows how to setup the InBound port to import and transform a BAI2 bank statement file.
BAI2 Format – File Layout:
Record Type: 01 – File Header – indicating the beginning of the file
Record Type: 02 – Group Header – identifying the group of accounts – a file may contain multiple groups, and would be followed by a 03 record
Record Type: 03 – Account Identifier & Summary Status – indicating the account number, activity summary and account status information
Record Type: 16 – Transaction Detail – as it says! Transaction detail information such as generic reference information is indicated in this record type (optional record)
Record Type: 49 – Account Trailer – indicating account control totals
Record Type: 98 – Group Trailer – indicating group control totals
Record Type: 99 – File Trailer – end of file indicator
BAI2 file:
Will only ever contain 1 record header (record type 01) and file trailer (record type 99)
Can contain multiple groups, where this happens the record type 02, 03, 16, 49, 98 would be repeated
BAI2 Record Formats:
Note: All of the below fields within a specific record are comma separated
BAI2 Format – File Header – 01
Record code - 01
Sender Id – alphanumeric value
Receiver Id – alphanumeric value
File Creation Date – YYMMDD format
File Identification Number – Unique value to distinguish files sent on the same date
Physical Record length – optional
Block Size – optional
Version Number – 2
BAI2 Format – Group Header – 02
Note: A group header highlights accounts from the same originator with the same as-of date
Record Code – 02
Ultimate Receiver Notification – optional, normally banks put the same value as in Receiver Id from the Header Record
Originator Identification – bank code or SWIFT BIC where the account being reported (in record 3) is held
Group Status:
1 – Update – most commonly used for previous day reporting and same day reporting
2 – Deletion
3 – Correction
4 – Test Only
As of Date – YYMMDD – as of date of all accounts with the group
As of Time – HHMM – in military format i.e. from 0000 – 2359
Currency Code
As of Date Modifier:
1 – Interim previous day data
2 – Final previous day – most commonly used for prior day reporting
3 – Interim same day – most commonly used for intra-day reporting
4 – Final same day
BAI2 Format – Account Identifier & Summary Status – 03
Record Code – 03
Customer Account Number – at the originator financial institution
Currency Code – optional
Type Code – optional* – indicates the type of balance (Summary/Transaction) being reported. - in this record type Account Status & Activity Summary codes are used
Amount – optional
Item Count – optional*
Funds Type – optional*
BAI2 Format – Transaction Detail – 16
Record Code – 16
Type Code – details data type* – indicates the type of balance (Summary/Transaction) being reported. - in this record type Transaction Detail codes only are used
Amount
Funds Type*
Bank Reference - bank assigned reference to help identify the transaction
Customer Reference – as corporates, this is the field we’re interested in. It should contain our reference for reconciliation purposes
Text
BAI2 Format – Continuation Record – 88
If the data in any record type exceeds the physical record size, or if required for any other reason the 88 record type can be used to continue the previous record. A record type 88 can only follow a record type 03 (Account Identifier), 16 (Transaction Detail) 0r 88 (Continuation Record)
Record Code - 88
Next field
BAI2 Format – Account Trailer – 49
Record Code – 49
Account Control Total – Sum of all the Amount fields in the preceding 03 (Account Identifier) and all 16 (Transaction Detail) records
Number of Records – Total number of records for the account – including the 03, all 16 and 88 records and this 49 record
BAI2 Format – Group Trailer – 98
Record Code – 98
Group Control Total – Sum of all control totals in this group
Number of Accounts – The number of 03 records in this group
Number of records – The number of records in this group – including the 02, all 03, 16, 49 and 88 records, and this 98 record
BAI2 Format – File Trailer – 99
Record Code – 99
File Control Total – Sum of all control totals in the file
Number of Groups – The number of 02 records in this file
Number of Records – Total number of records in this file, including this 99 record
BAI2 File Format
The Bank Administration Institute (BAI) file format is used to electronically transmit transaction data from a bank to an organisation. Bank Administration Institute version 2 (BAI2) splits the payment amount into separate invoice references and corresponding payments.
Note : BAI2 files are the file formats not always provided by some banking corporations, and as such bank file formats may need to be developed to suit the customer’s needs. The BAI2 file format is used here for demonstration purposes only.
The BAI2 file format is a structure text file with headers, lines and footer records. Each field is separated by a comma similar to a CSV file.
With a multi date file format, each date must be contained within its own section, with a header and line for each section.
|
Example 1 – Single date file |
|
Example 2 – Multi date file
|
AIF Setup
In the AOT, under the Resources node, locate the BAI2 files. These files translate the electronic bank statements from their original format to a format that Microsoft Dynamics AX can use.
The files that are required are called :
- AOT\Resources\BAI2CSV_to_BAI2XML_xslt
- AOT\Resources\BAI2XML_to_Reconciliation_xlst
Right-click the BAI2CSV_to_BAI2XML_xslt file, and then click Open
In the Preview form, select XML document in the File type field.
Click Export to generate XSLT templates and save the template. Close the form.
Repeat the process for the BAI2XML_to_Reconciliation_xlst file.
Whilst in the development environment, click the Tools menu option and select “Application integration framework > Manage transforms”
Create a new record, give this a name and an appropriate description, ensure that the type = “XSL”, then click load. Load the BAI2CSV_to_BAI2XML_xslt file.
Create a second record and load the BAI2XML_to_Reconciliation_xlst file.
Close the form and close the development environment.
InBound Ports
Before you can receive the BAI2 statement electronically, you must register custom services and adapters, manage operations and inbound transforms, and activate inbound ports.
Browse to System administration > Setup > Services and Application Integration Framework
Click New to create a new inbound port.
In the Port name and Description fields, enter a suitable name and description of the inbound port. In the Adapter field, select File system adapter as the adapter name. In the URL field, enter a path for receiving electronic data.
On the Service contract customisations FastTab, click Service operations to open the Select service operations form.
Add in the following bank service operations to the “Selected service operations” section.
In the Select service operations form, select the following from Remaining service operations and move to Selected service operations:
On the Processing options FastTab, select the Transform all requests check box to include inbound transforms. Then click the “Inbound transforms” button.
Click New to create a transform. Select the first of the transforms that you have already created previously.
Create a second record and add the second transform file that you have created.
These files should be in the following order to process the BAI2 file correctly.
- BAI2CSV_to_BAI2XML_xslt
- BAI2XML_to_Reconciliation_xlst
Close the form.
On the Troubleshooting FastTab, set the logging mode to “Original document”.
On the Security FastTab, select the partition and company that this Inbound port relates to.
Once complete, click the “Activate” button to finish, this may take some minutes to complete. Close the forms when finished.
This completes the InBound port setup and AX2012 R2 is now ready to import and transform a BAI2 file.