Generation of Account Code on the basis of Group, Sub-Group and Classification

In Sage X3, using auto numbering feature we can generate document numbers for most of the transaction and masters like Purchase or Sales document numbers or Customer or Supplier numbers etc. But there is no provision to generate account code automatically so we did an add-on customization where Account code gets generated automatically on the basis on certain criteria. So in this blog we will see how we can achieve this.

One of our client has requested that they required auto generation of account codes on the basis of Classification, Group and Sub Group fields on the account screen. Classification is the Account class field which is based on Legislation and which is stored in Setup -> Finance Account -> Classes. Also Group and Sub Group field which is present in Account screen. So using the combination of the above three fields we have written logic for different account code numbering sequence.

First we will consider the Classification code i.e. a single digit number which will be concatenated with the Group and then Sub group field i.e. 2 digit numbers and further we will concatenate the incremented sequence value to it.

Let’s take up an example for better understanding:

New Stuff:

[Account Master - Example 1]
[Account Master – Example 1]

In the above screenshot, Classification field value is 1, Group Value is 04 and Sub-Group value is 02. So the account code starts with “10402”. If this account code sequence is not generated before then we will concatenate 001 to it making the account code as “10402001”.

Now will see another scenario, if the sequence is already generated then program finds the latest value that was auto generated in it and then increment it by 1. In the below screenshot the classification code is 1 and Group is 04 and Sub-Group 02. As we know that this sequence was already generated so now it will generate the new sequence by checking in the database and it will increment the account code by 1 making it as “10402002”.

[Account Master - Example 2]
[Account Master – Example 2]

So whenever new Account code will be generated with this combination, only sequence counter will get incremented and append to the combination of above three fields.

In this way each combination will have their separate sequence counter and will be generated Account code likewise on the basis of Classification code, Group code and Sub-group code.