Start by defining a global variable 'NoSeriesMgt' referring to Codeunit 396. Then, in the OnAfterImportRecord trigger, use the following code (with suitable replacements -- "No." is the field to get the new number, 'XXXX' is the No. Series to use):
"No." := NoSeriesMgt.GetNextNo('XXXX',0D,FALSE);
The FALSE parameter is a trick to delay locking the No. Series Line table -- the NoSeriesMgt codeunit reads the No. Series Line record once on the first call, and then hands out the next number from the series for each subsequent call, but does NOT update the No. Series Line.
Therefore, to update the No. Series Line at the end of the Dataport, you have to code the following in the OnPostDataItem trigger:
I used this code to populate the document no when dataporting in a Gen Jrnl but it gives a new number for every line and will not post as it is out of balance.
Any suggestions to keep the same document number for every line in the journal.
Comments
Therefore, to update the No. Series Line at the end of the Dataport, you have to code the following in the OnPostDataItem trigger:
Thanks you very much, i musted search i little in the 396 Codeunit because the Functions are Named different , but now it works.
regards
Petter
Any suggestions to keep the same document number for every line in the journal.
Thanks
lodger
Or you need something else? :-k
Arhontis
https://forum.mibuso.com/search
Thanks Arhontis
lodger