How to get sales Line Number after Inserting the Item No,

Hi all,

I am Inserting the sales Itm No , Doc Tyep , Doc No and Sales line No. with My New Line No. Into another table. I Am not getting the sales Line No. …

Please Suggest me, How to get this Sales line No when I am trying to Insert into another table.

I am trying to Insert at the Time of Item selection in the Sales Order.

If you are inserting via code, you have to assign the Line Number yourself. Only informs (with property “AutoSplitKey” set) the Line Number is assigned automatically.


I am Inserting via code only , into the another Table.

But, our Client Select the Item No. Twice. in the same Order. For that Filter. Am tryiing to insert the Sales line No. In the New table along with Item Number.

Please Suggest Me,


The problem here is the DelayedInsert-property of the Sales Order Subform.
The line is not inserted at the time the user enters the Item No., and therefore also has no Line No. assigned yet.

If you want to force the insert, you can use the CurrForm.SAVERECORD command, prior to where you want to insert the record in the other table.
But you have to test thoroughly that this will NOT cause other problems, to insert the record earlier than expected.

As Alexander says, the problem is in the DelayedInsert property.

An other solution which I would advise is to add to table 37 a function which writes the record in your table. The function should exit doing nothing if any of the fields you need (such as “Line No.”, Type, “No.”, ecc…) is not filled in the variable Rec. Call the function in the OnInsert and OnModify triggers.


you mean that, I have to call the New function which Insert into my Table in sales line OnInsert and OnModify Triggers…

Hi Teja,

Please, if any of the replies to your post solved your problem, then please click on the “Verify solution” next to that post. This way we can see that your post is closed and you got the help you needed. If you found another solution to your problem, then please, out of courtisy to the members who helped you here, post the solution here.

first , thanks for all the Replying me…

I am sorry Erik…

On that I was in a hurry to deliver My customization…

And Sorry for the late reply.

actually , I didn’t Understood the repliess I got…

I Solved it by Counting the Sales line by using the sales Line as REC Variable

and One Integer Variable…

I am counting this… while the user is selecting the Item Number in the Sales Line…

Sorry, it seems I missed your request for clarifying. Yes I meant that the function which inserts data in your table should be called in Sales Line OnInsert and OnModify triggers.