X++ NumberSequence Code to generate numbers

Axapta uses following classes for generating numbers against numberseq code.

1.NumberSeq class--> Main class which will generate,assigns numbers and vouchers for
references.
2.NumberSeqReference--> Used to find the reference.

static void numberSeq_Demo(Args _args)
{

NumberSeq numberSeq;
;
numberSeq = numberSeq::newGetNum
(NumberSeqReference::findReference
(typeid2extendedtypeid(typeid(vendAccount))));

info(numberSeq.num());
}

How it works
1.NumberSeq Table act as master table for numberseq code , which stores
format to be generated , next sequence etc.
2.NumberSequenceReferences stores all the references and their corresponding
numberseq codes.
3.As shown in the above code , NumberSeq class needs numberseqreference ,
i,e "EDT. Unique Id for the Process " So first get the references by
passing an EDT as parameter to the findReference method of numberseqreference
class.Than you can call numberSeq.num() method to generate the number
for you.
4.Use NumberSeqFormHandler class if you want to use the numbersequencs on form.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.