Another user has changed the definition of the Field table after the activity was started.

Hi all,

I am using 4.0SP3 25143 build and Sql server 2008 as back end. I have created field Production BOm in Purchase order and written following code to get the data in purchase line by creating menuitem in " Order Command Button"

ProductionBOMLine.RESET; ProductionBOMLine.SETRANGE(“Production BOM No.”,“Production BOM”);
IF PurchLine.FINDLAST THEN
Lno:=PurchLine.“Line No.”
ELSE
Lno:=0;
IF ProductionBOMLine.FINDSET THEN REPEAT
PurchLine.INIT;
PurchLine.VALIDATE(“Document Type”,“Document Type”);
PurchLine.VALIDATE(“Document No.”,“No.”);
PurchLine.VALIDATE(“Buy-from Vendor No.”,“Buy-from Vendor No.”);
PurchLine.VALIDATE(Type,PurchLine.Type::Item);//ProductionBOMLine.Type); when i keep this line it is taking as glacc not item
PurchLine.VALIDATE(“No.”,ProductionBOMLine.“No.”); Lno+=10000;
PurchLine.VALIDATE(“Line No.”,Lno);
IF ProductionBOMLine.“Purchase Quantity”<>’’ THEN
EVALUATE(PurchLine.Quantity,ProductionBOMLine.“Purchase Quantity”);
PurchLine.INSERT(TRUE); UNTIL ProductionBOMLine.NEXT=0;
COMMIT;

It is sucess fully inserting but while deleting the lines i am getting following error

Another user has changed the definition of the Field table after the activity was started.

I am only the person who is accessing the that db

sorry for the double post accidentaly posted but cancelled first one but it posted, I

Start again.

Never Use Commit in Nav Coding.

I found one post that stating that commit should be used http://dynamicsuser.net/forums/p/1415/6317.aspx . in the above code

I am using this code PurchLine.VALIDATE (Type,PurchLine.Type::Item); intead of

PurchLine.VALIDATE(Type,ProductionBOMLine.Type); though Production bom line is Item it taking as GL. I am getting error as gl account doesn’t exist

25143 has a lot of issues, try upgrading your test system to 26565. Make sure to do performance testing before putting in live of course.

Hello David,

How to update platform build and how to do performance testing. any links available? I found 30698(build no!) number under 4.0 in waldo’s Blog

Since you are writing code I assumed you were a partner, if you are an end user, I would discuss this with your partner, they are trained and know how to do this.

I have recently joined the company which is gold certified partner . It is mainly into AX and CRM. They want to enter in NAV. They are not partner in NAV that’s why I posted in this forum

Hi Amol,

If the COMMIT command it was never to be used, then I’m sure that the command had already been removed.

When that has been said then I agree that the COMMIT command is something that must be used with care. A lot of care! Because if you don’t then you might end breaking the consistency of NAV transactions.

One of the great things with NAV is it’s ability to roll back a whole transaction (in fact a whole stream of transactions) generated for example by posting a whole journal. If the system while posting the journal finds an error, then the whole journal is rolled back and nothing is posted. If a commit had been done for example after each line, then your system could end up in an inconsistency state, if the line that was posted was part of a multi-line transaction (ie. debit vs credit lines).

There are many other situations where a COMMIT serves a good purpose. But it’s still a command that I would call an ADVANCED COMMAND to be used with care and only by developers who really knows 100% what the function they use it in is doing.

Dear Erik,

Thanks for information.

Hello

I agree with Erik, an COMMIT is not necessary to be avoided but used with care.

In this case the Commit is actually not needed as the commit is in the last line of a OnPush-trigger on a form. The solution to the problem has to be found somewhere else, and stated earlier by others this is a really old build.You should either check partnersource for a newer build or look at waldos blog - right here: http://dynamicsuser.net/blogs/waldo/archive/2012/07/02/platform-updates-overview-3-70-b-nav2013-updated-1.aspx

Good advice! The problem is solved! Keep doing that Dave!