Hi,

Can you try out this?. Anyway it is not recommended to change the 
voucher for posted entries as you need to change multiple tables.

static void add_VoucherSpace(Args _args)
{
LedgerJournalTable _ledgerJournalTable;
LedgerjournalTrans _ledgerJournalTrans;

;
ttsbegin;
while select forupdate _ledgerJournalTrans where 
_ledgerJournalTrans.Voucher like 'AP-OP*'
{
    Select _ledgerjournaltable where _ledgerJournalTable.JournalNum 
== _ledgerjournaltrans.JournalNum;
    if ( _ledgerjournaltable.Posted == NoYes::No)
    {
   _ledgerJournalTrans.Voucher = 'AP-OP '+ substr
(_ledgerjournaltrans.Voucher,6,strlen(_ledgerjournaltrans.Voucher)-5);
   _ledgerJournalTrans.update();
   }
}
ttscommit;
}

Kalaiarasi


--- In [email protected], "mchiat" <[EMAIL PROTECTED]> 
wrote:
>
> Hi all,
> 
> I would like to know how to add a space in between a voucher number,
> e.g. from 'AP-OP00000001' to 'AP-OP 00000001'.  Hope someone can 
shed
> any light on it. Thanks in advance. 
> 
> Herewith my code:
> static void remove_VoucherSpace(Args _args)
> {
>     LedgerJournalTable      _ledgerJournalTable;
>     LedgerJournalTrans      _ledgerJournalTrans;
>     str                      txt;
>   
>     ;
>     ttsbegin;
>     while select forupdate _ledgerJournalTrans where
> _ledgerJournalTrans.Voucher == 'APOP*'
>     {
>         if
> (LedgerJournalTable::find
(_ledgerJournalTrans.JournalNum).JournalName
> like 'AP-OP')
>         {
>             _ledgerJournalTrans.Voucher = 'APOP ';
>             _ledgerJournalTrans.update();
>         }
>     }
>     ttscommit;
>     info(strfmt("Update completed as of %1", systemdateget()));
> }
>


Reply via email to