Error: You cannot make any changes in the database until..
BlueSky
Member Posts: 2
Hi all,
I dont understand why following code perform well in Nav V3.7 but prompt ERROR "You cannot make any changes in the database until a transaction has been started. While open Purchase Order form.
" in V4.3. Please advise.
Thank you, :?
Sky
I dont understand why following code perform well in Nav V3.7 but prompt ERROR "You cannot make any changes in the database until a transaction has been started. While open Purchase Order form.
" in V4.3. Please advise.
Form - OnAfterGetCurrRecord()
CLEAR(purchLine);
CLEAR(TotalPurchLine); //Purchase Line Record
CLEAR(TotalPurchLineLCY); //Purchase Line Record
FOR i := 1 TO 3 DO BEGIN
TempPurchLine.DELETEALL;
CLEAR(TempPurchLine);
CLEAR(PurchPost); //Purch.-Post Codeunit
PurchPost.GetPurchLines(Rec,TempPurchLine,i - 1);
CLEAR(PurchPost);
CASE i OF
1: purchLine.CalcVATAmountLines(0,Rec,TempPurchLine,TempVATAmountLine1); //VAT Amount Line Record
2: purchLine.CalcVATAmountLines(0,Rec,TempPurchLine,TempVATAmountLine2);
3: purchLine.CalcVATAmountLines(0,Rec,TempPurchLine,TempVATAmountLine3);
END;
PurchPost.SumPurchLinesTemp(
Rec,TempPurchLine,i - 1,TotalPurchLine[i],TotalPurchLineLCY[i],
VATAmount[i],VATAmountText[i]);
IF "Prices Including VAT" THEN BEGIN
TotalAmount2[i] := TotalPurchLine[i].Amount;
TotalAmount1[i] := TotalAmount2[i] + VATAmount[i];
TotalPurchLine[i]."Line Amount" := TotalAmount1[i] + TotalPurchLine[i]."Inv. Discount Amount";
TotalAmount2LCY[i] := TotalPurchLineLCY[i].Amount;
TotalAmount1LCY[i] := TotalAmount2LCY[i] + VATAmount[i];
TotalPurchLineLCY[i]."Line Amount" := TotalAmount1LCY[i] + TotalPurchLineLCY[i]."Inv. Discount Amount";
END ELSE BEGIN
TotalAmount1[i] := TotalPurchLine[i].Amount;
TotalAmount2[i] := TotalPurchLine[i]."Amount Including VAT";
TotalAmount1LCY[i] := TotalPurchLineLCY[i].Amount;
TotalAmount2LCY[i] := TotalPurchLineLCY[i]."Amount Including VAT";
END;
END;
Thank you, :?
Sky
0
Comments
-
Ugly... really ugly...copying and pasting without understanding what is being done.
1) Since you copied the code from the statistics form (form 403) maybe you should not just copy the variable names and types, but also the properties... like being a temporary record.
2) Unless you need the three amounts: invoiced, to be shipped and total in the form you should just get the code that you need instead all of it....0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions