How to add new record lines with code

Hello Everyone,

I’m trying to insert new sales line with code. For example, if first sales line has an item number 1000, then it should automatically add a new sales line with item number 1100 for example. How can it be achieved with C/Al code?.

there are lot of examples in standard NAV itself.
check how the extended text feature is working
or check copy documents functionality etc.