"Advanced" COMMIT Management

Belias
Member Posts: 2,998
hi everyone,
I have a question about COMMIT. Here's a code sample
I'm 99% sure of it, but i'd like a second opinion, because the process is critical.
Thanks in advance
I have a question about COMMIT. Here's a code sample
repeat if mycodeunit.run(mytable) then ***** //retrieve mytable values from mycodeunit //do the INSERT/MODIFY of mytable else //retrieve mytable values from mycodeunit //add a log //do the INSERT/MODIFY of mytable COMMIT; until something = true;now, the real catch is in "mycodeunit"
NoSeriesMgt.InitSeries("this is the standard NAV function"); //the function initseries will make the entry number on MYTABLE and modify the number series line table //populate some fields in MYTABLE variable ERROR('something goes wrong, e.g. lock timeout');now, the error should roll back the transaction till *****, thus the number series line will go back by one, isn't it?
I'm 99% sure of it, but i'd like a second opinion, because the process is critical.
Thanks in advance
0
Answers
-
Hi Belias,
yes, it should roll back the no. Series line.
with best regards
Jens0 -
(nothing)Regards
Peter0 -
Hi Belias,
I think CU13 is a good example for this. The Posting Nos. are generated consecutively while the journal lines are posted. And it is rolled back if something bad happens. However, for every No. Series, a different NoSeriesMgt Codeunit is used. So maybe there is a reason for this... some fixing on only one No.Series for one instance of NoSeriesMgt.
with best regards
Jens0 -
Ok thank you. I've solved the bug (the rollback had reset the no. serie back by one number, but i was still inserting the updated no. serie)
e.g.:
- last no. serie used = AAA010
- make no. serie AAA11
- last no. serie used = AAA011
- ERROR
- rollback (last no. serie returns to AAA010
- get the created entry no. (still AAA011)
- create the entry to AAA011 while the last no. used is AAA010
(then, on the second loop, i found the same key of my entry no., so i modify the existing AAA011 instead of creating a new entry)
phew...it was hard to find (nearly impossible to replicate, process running on NAS, and error was random, depending on the locks).
problem solved with a commit after theNoSeriesMgt.InitSeries("this is the standard NAV function");
because missing entry numbers in the sequence are acceptable.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions