Hi, 

  Voucher number is available only in ledgerjournaltrans. 

You can try with this code

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;
}

This code updates unposted journals. 
If you update posted journals, then you should update in ledgertrans 
also. However it is not recommended to update the posted vouchers as 
you need to check for all the tables. ( like vendtrans .....).

Regards
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