In this blog I am going to give a tutorial of the changes that I made to the standard NACHA file for a client. Modifications to this format is fairly easy and this blog can help you modify a few parts to the NACHA file.
NACHA (National Automated Clearing House Association) is an association that manages the development, administration, and governance of the ACH Network. ACH (Automated Clearing House) is a network for the electronic movement of money and data in the United States.
The ACH-NACHA file format is of 95 characters and it consists of:
- File Header Record
- Batch Header Record
- Detailed transaction records
- Batch Control Record
- File Control Record
In Microsoft Dynamics AX 2012 there is a class named VendOutPyam_Nacha that is used to generate the payments using the ACH Nacha format. The following methods are used to print the lines while generating the file:
CreateACH_HeaderRecord – creates the File Header Record
CreateBatchHeader – creates the Batch Header Record
CreateBatchControlRecord – creates the Batch Control Record
CreateACH_ControlRecord – creates the File Control Record
The method to add Detail Records are present in a different class named VendOutPaymRecord_Nacha_CCD and the name of the method is fillRecord()
The standard ACH Nacha file is shown in below
Editing the standard NACHA file:
Removing the text AX EFT DEPOSIT:
The second line in the above screenshot is generated from the class “VendOutPaym_Nacha” and the method used is “CreateBatchHeaderRecord()”
We can manipulate the macros in the above code snippet to modify the file format. For eg. Instead of AX EFT DEPOSIT we just want a blank space. So to achieve that we will modify the above snippet as follows:
#define.discData(‘AX EFT DEPOSIT ‘)
And we will get the following output
Changing the standard Date format:
In the above picture the red bordered value is the “Effective Entry Date”, this is the default system date but the user has an option to change is. As you can see the format of the date is YYMMdd.
In the above snippet Macros are defined. There are two macros that define the format: DateSeqMDY and DateSeqYMD.
In the above snippet the red bordered value is the format of the date. In the standard format it is YYMMdd. To change it to MMddYY we can do the following:
After doing so we get the following output:
Modifying the Detail Records in a NACHA file:
In the standard NACHA file the detail records have the Journal Number towards the end.
To change this we need to modify a different method.
The above code snippet is in the method “generateTraceNumber()” of the class “VendOutPaymRecord_Nacha”. This method is called when the detail records are being generated. I changed the code. I removed the Journal Number and I put in the BankRoutingNumber.
Following was the output after the code was changed:
We can also modify the whole detail records if we want to. The methods are available in the following two classes VenDOutPaymRecord_Nacha, VendOutPaymRecord_Nacha_CCD. The methods with prefix fillField are used to generate the detail records.
Adding a new line to the NACHA file:
We can also add a custom line in the NACHA file. Suppose we want to add the number Nine 95 times at the end of the file, so what do we do?
We can create a new method which will generate the number Nine and then call that method where the rest of the lines are being generated.
As you can see from the above snippet I have created a new method “createACH_FooterRecord()”,
Now I will call this method in the “Close” method of the class:
After doing so following will be the output:
As you can see a 95 character long Nines are printed at the end of the file.