Insert Line Record - Issue
rajinivm
Member Posts: 42
Hi Guys,
I'm trying to insert a new line record in Sales Line Table from Sales Invoice form. System is throwing a following error.
"You cannot make any changes in the database until a transaction has been started"
Can you please let me know how can i overcome this issue in C/SIDE?
Thanks and Regards
Rajini
I'm trying to insert a new line record in Sales Line Table from Sales Invoice form. System is throwing a following error.
"You cannot make any changes in the database until a transaction has been started"
Can you please let me know how can i overcome this issue in C/SIDE?
Thanks and Regards
Rajini
0
Comments
-
I'm trying to remember because i have seen this - but are you sure the header is properly filled out before adding lines?0
-
Yes Ruiz....First, I have saved Header Level Transactions. and then Im trying to add a new line level record in sales line table. That time I got this issue.0
-
Header Level Transactions? I never heard it put this way before.
Are you doing something other than order entry thru the form?
is this error coming due to a dataport or something?
Have you tried turning on the debugger and seeing where it is stopping?
Also I've seen that 5.0 SP1 fixes..
8/27/2008. KB 954722. Build 27253. "Microsoft Dynamics NAV can crash in certain situations. Some times, you will receive this error message:You cannot make any changes in the database until a transaction has been started."Or, "Error 1247 in module 19". Or, some times the NAV application will just terminate."
edit..
..More info needed on what you are trying to do that causes this error.0 -
Are you trying to modify / insert records from special triggers on the form? Some triggers don't allow changes in the database.0
-
I added a field for FreightAmount in Sales Invoice Form. The new line should be generated in Sales line Window when Im leaving the focus from Freigth Field. I have written a code in Freight Amount - On After Input Trigger.
Code like this:
NVSalesLine.INIT;
NVSalesLine."Document Type":=2;
NVSalesLine."Document No.":='1005';
NVSalesLine."Line No.":=10000;
NVSalesLine.Quantity:=1;
NVSalesLine."Unit Price":=1.55;
NVSalesLine.INSERT(FALSE);
I'm getting error message from last line.0 -
So you can't modify the database from this trigger...
Usually such code is placed on the Table object, on the OnValidate trigger of a field for example. Do you need this code on the form?
Also try other triggers like OnValidate of the field on the form...0 -
Or create a function that you call from a command button or menu item
OnPush()IF Status = Status::Open THEN BEGIN Salesline.RESET; Salesline.SETRANGE(Salesline."Document Type","Document Type"); Salesline.SETRANGE(Salesline."Document No.","No."); IF Salesline.FIND('+') THEN BEGIN Salesline."Line No." := Salesline."Line No."+ 10000; Salesine.Type := Salesline.Type::"Item"; Salesline.VALIDATE(Salesline."No.","Your Set Item #"); Salesline.VALIDATE(Salesline.Quantity,1); Salesline.VALIDATE(Salesline."Direct Unit Cost",1.55); Salesline.INSERT; END; END ELSE BEGIN MESSAGE('Sales Order %1 must be open!',"No."); END;
Note: I would change where you have hardcoded values such as a qty/price/& item# & put it in a setup table where you can change the values if need be.0 -
Thanks to all. It's working fine after moving the code to On Validate Event.
But, Records are not displayed in Invoice Subform (Line Detailes) immediately. Its displayed once I close and open the window.
This is the code I added for displaying the new record.
NVSalesInvoiceSubForm.GETRECORD(NVSalesLine)
Do you know any other method for displaying record?
Thanks,
Rajini0 -
-
Thanks Ruiz....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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 250 Dynamics CRM
- 102 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