Pessoal,
Se alguém mais passar por isso e precisar, segue um script que lê a LedgerTable e popula a LedgerTableInterval carregando assim os totais (Intervalo de Contas).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
static void createLedgerTableInterval(Args _args)
{
    LedgerTable                 ledgerTable;
    LedgerTableInterval         ledgerTableInterval;
    str                         myAccount, strPos;
    Counter                     i;
    ;
 
 
    while select AccountNum from ledgerTable
      where ledgerTable.AccountPlType == LedgerAccountType::sum
    {
        myAccount = ledgerTable.AccountNum;
        for(i = strlen(myAccount); i > 0; i--)
        {
            strPos = subStr(myAccount, i, 1);
 
            if(strPos == "0")
                continue;
 
            ledgerTableInterval.AccountTableId  = ledgerTable.TableId;
            ledgerTableInterval.AccountRecID    = ledgerTable.RecId;
            ledgerTableInterval.FromAccount     = subStr(myAccount, 1, i);
            ledgerTableInterval.ToAccount       = strfmt("%1z", ledgerTableInterval.FromAccount);
            ledgerTableInterval.insert();
            i = 0;
        }
    }
}

[]s
Pichler