Showing posts with label voucher number sequence d365. Show all posts
Showing posts with label voucher number sequence d365. Show all posts

Monday, 11 January 2021

X++ code to generate ledger voucher number sequence in AX 2012 & D365

 

X++ code to generate ledger voucher number sequence in AX 2012 & D365


NumberSeq numberSeq;
NumberSequenceTable numSeqTable;
Voucher voucher;

select firstOnly numSeqTable
where numSeqTable.RecId == LedgerJournalName::find(ledgerJournalTable.JournalName).NumberSequenceTable;
if (numSeqTable && !voucher)
{
numberseq = numberseq::newGetVoucherFromCode(numSeqTable.NumberSequence);
voucher = numberseq.voucher();
}

ledgerJournalTrans.Voucher = voucher;

Thanks & Regards
Sindhu