If you want to get the list here in the Chart of accounts in code is quite simple, here below an example.

static
void FCH_chartOfAccountsList(Args
_args)
{
LedgerChartOfAccountContract
chartOfAccounts = new
LedgerChartOfAccountContract();
DimensionServiceProvider
serviceProvider = new
DimensionServiceProvider();
List
mainAccountsList;
MainAccountContract
contract;
ListEnumerator
mainAccountsListEnumerator;
chartOfAccounts.parmName("COABasic");
mainAccountsList =
serviceProvider.getMainAccountsForLedgerChartOfAccount(chartOfAccounts);
mainAccountsListEnumerator =
mainAccountsList.getEnumerator();
while
(mainAccountsListEnumerator.moveNext())
{
contract =
mainAccountsListEnumerator.current();
info(strFmt('%1 - %2 - %3 -
%4',
contract.parmMainAccountId(),
contract.parmName(),
contract.parmType(),
MainAccountCategory::findAccountCategoryRef(contract.parmAccountCategoryRef()).AccountCategory));
}
}

There is just a little issue you might want to address. As you noticed the list is not in the ordered.
If you need an ordered list, since you can’t order the collection List, we can convert it to a Map, which by default orders by its key value.
static
void FCH_chartOfAccountsListOrderd(Args
_args)
{
LedgerChartOfAccountContract
chartOfAccounts = new
LedgerChartOfAccountContract();
DimensionServiceProvider
serviceProvider = new
DimensionServiceProvider();
List
mainAccountsList;
MainAccountContract
contract;
ListEnumerator
mainAccountsListEnumerator;
Map mainAccountsMap =
new Map(Types::String,
Types::Class);
MapEnumerator
mainAccountsMapEnumerator;
chartOfAccounts.parmName("COABasic");
mainAccountsList =
serviceProvider.getMainAccountsForLedgerChartOfAccount(chartOfAccounts);
mainAccountsListEnumerator =
mainAccountsList.getEnumerator();
while
(mainAccountsListEnumerator.moveNext())
{
mainAccountsMap.insert(
mainAccountsListEnumerator.current().parmMainAccountId(),
mainAccountsListEnumerator.current());
}
mainAccountsMapEnumerator =
mainAccountsMap.getEnumerator();
while
(mainAccountsMapEnumerator.moveNext())
{
contract =
mainAccountsMapEnumerator.currentValue();
info(strFmt('%1 - %2 - %3 -
%4',
contract.parmMainAccountId(),
contract.parmName(),
contract.parmType(),
MainAccountCategory::findAccountCategoryRef(contract.parmAccountCategoryRef()).AccountCategory));
}
}
now it orders by account number.
