In Dynamics 365 F&O or AX 2012, if you want to get next sequence number sequence through x++ code using just number sequence code and no reference (no edt creation, etc..) you can use the following snippet:
NumberSeq numSeq;
MyTable mTable;
numberSeq = NumberSeq::newGetNumFromCode('NumSeqCode', NumberSeqScopeFactory::createDefaultScope(), false, true);
if (numberSeq)
{
mTable.ProjId = numberSeq.num();
}
In ‘NumSeqCode’ you need to put the string that represent the number sequence code as highlighted in the picture below: