X++ code for these Invent transfer and movement journal is available in different blogs and website. The voucher number for these entries is little bit tricky. This Voucher Number is set InventJournalName as fellow screen.
By writing this simple tip I used out of demo vm with contoso data.
So If expand the InventJounralName table we will find this voucher sequence number set in VoucherSequenceNumberTable field.
If we expand the Relation node of InventJournalName table we find its relationship with Sequence Number table based on RecId.
For getting next voucher Number for Journal lines we have to use static method of NumberSeq as
InventJournalName inventJournalName;
NumberSeq _sequence;
num _voucher;
select firstOnly inventJournalName
where inventJournalName.JournalType == InventJournalType::Any
ttsBegin;
_sequence= NumberSeq::newGetNumFromId( inventJournalName.VoucherNumberSequenceTable);
_voucher=_sequence.num();
ttsCommit;