Linking of Sales Invoice

I’m using external means to create a Sales invoice within Navision (SQL Server version). I’m creating the Sales Invoice Header, with the Sales Invoice Lines, GL Entries, Customer Ledger Entries, Detailed Customer Ledger Entries and VAT Entries as required. My problem is that on posting these entries I need to obtain the next available Document Number to link the records together with. By using external means - am I able to make use of Navision code or should I interogate the SQL Server tables related to the number series (for Sales Invoice posting) ? Is it just the Document No. that links the entries together ? Or is it more than that ? Any help would be appreciated. Thanks in advance Steve [email : steven.keclik@s3t.co.uk]

Update fields [Last No_ Used] and [Last Date Used] in the table $No_ Series Line. Just make sure that [Last Date Used] does not contain any time part. Should be ok.

Also remember to call the validate code on every relevant field or you will REALLY mess the data up!

Steven, First yes it is the document number that links all the data items. Second, if you create a Sales Header (order or invoice) with null document no., then insert into table using INSERT(TRUE) Navision will automatically allocated the number for you based on the numebr series on the S & R Setup table. Third, if you create a sales header and lines and then post (ship and invoice) then all of the posting will be done by Navision: this is smart becasue Navision will check all the data and make sure that it is valid. You could have save yourself some work here. If