Adding line between existing lines

Without using autosplitkey property how to insert a item in sales line between existing lines.

What do you mean? Who should insert this new line? The user or another function?

Unless you have disabled the default autosplitkey function (which I hope not), then I assume you ask in regards to how to insert a line automatically?

If that’s the case, then if you for example need to insert a new line between two existing lines, then start by find the previous line no. and following line number. If the first line number is 10000 and the next is 20000, then you need to give the new line number 15000.

You need to do something like this:

PrevLine := CurrLine;

IF PrevLine.Next(-1) <> 0 THEN

PrevLineLineNo := PrevLine.“Line No.”

ELSE

PrevLineLineNo := 0;

NextLine := CurrLine;

IF NextLine.Next(1) <> 0 THEN BEGIN

… {calculation based on demands} …

END ELSE

CurrLine.“Line No.” := PrevLineLineNo + 10000;

thank you , sorry for late reply this was the logic i had to implement to insert a new line between two lines automatically through a function