Generating No: series during posting


Can anyone let me know how to generate an Number series while Posting a sales order (Ship)? This number series should get updated in the sales order after shipment and also in the posted sales invoice after invoice. I have included a field called X for this purpose in sales header , sales shipment header and sales invoice header.

Any help would be appreciated…

Thanks in advance…

Hi Vipin,

you can use something like

“Shipping No.” := NoSeriesMgt.GetNextNo(“Shipping No. Series”,“Posting Date”,TRUE);

where NoSeriesMgt is a variable of type codeunit 396 NoSeriesManagement - the last parameter determines if you update the series or not.

Most likely you will put your mod into codeunit 80

Thanks a lot for your reply. I have already included this code in my codeunit 80.

But that is not working at all. Iam having a confusion in which part I should include this code in codeunit 80.

Please give me your suggestion.

Thanks in advance…

Hi Vipin,

for the shipment - after it insert the shipment header

for the invoice - after it insert the posted invoice header