Sales orders Blocked while importing sales Lines.

delaghettodelaghetto Member Posts: 89
edited 2014-03-14 in NAV Three Tier
Hi All!

I've developed a CodeUnit that imports about 10000 Sales Lines in 6 different sales order. The customers wants it this way, so I can't do anything about it. So the code loop does something like:

Read All lines into ExcelBuffer
Create Header 1
Create Sales Line 1
Create Sales Line 2
Create Sales Line 3
...
Create Sales Line 2000
Create Header 2
... etc.

Anyway, while importing the lines, which takes about 1 hour, the other users can't create new Sales Order. We get an error when trying to get a new Sales No. for the order. It says that the serial lines table is blocked.

Is there any workaround, so I can make sales orders while importing? I was reading about COMMIT, but not sure if this will help in my situation.

Thanks.

Comments

  • vijay_gvijay_g Member Posts: 884
    You can do as Copy Document functionality running on sales or purchase document in standard NAV. I haven't checked it but it should solve your locking issue.
  • bbrownbbrown Member Posts: 3,268
    "Copy Document" is intended for the purpose of copying existing NAV documents. Hence the name. How would this help in this situation where the process is importing sales line data from Excel? "Copy Document" has no functionality to handle that. Besides, it would have the same locking issues if dealign with this much data.

    Yes, COMMIT will be part of your solution. You need to design a process to break this into smaller recoverable steps. Using COMMIT to end each step and commit the changes to the database. You must structure the process so it can recover from a failure without failing or creating duplicate orders or order lines. The smaller the steps, the shorter the locking events will be.

    You might also need to some performance tuning.
    There are no bugs - only undocumented features.
Sign In or Register to comment.