PAGE.RUNMODAL ERROR
poppins
Member Posts: 647
Hi everyone,
I am trying to run some code and hit the following error:
I am trying to run some code and hit the following error:
Microsoft Dynamics NAV --------------------------- The following C/AL functions are limited during write transactions because one or more tables will be locked. Form.RunModal is not allowed in write transactions. Codeunit.Run is allowed in write transactions only if the return value is not used. For example, 'OK := Codeunit.Run()' is not allowed. Report.RunModal is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'Report.RunModal(...,FALSE)' is allowed. XmlPort.RunModal is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'XmlPort.RunModal(...,FALSE)' is allowed. Use the COMMIT function to save the changes before this call, or structure the code differently. --------------------------- OK ---------------------------By debugging, I got the line which caused the error:
Rollback := NOT (CheckAvailability.RUNMODAL = ACTION::Yes);What shall I do to avoid it?
0
Comments
-
use CheckAvailability.RUN instead of CheckAvailability.RUNMODAL.
regardsbest regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/0 -
Well ... could be, but it all depends on the context in which you are calling this, and what you are trying to achieve. Apparently (as the message says) you are changing something in the database (i.e. making your process a write transaction). So while changing something in the database, why are you having a PAGE.RUNMODAL execution?archer89 wrote:use CheckAvailability.RUN instead of CheckAvailability.RUNMODAL.0 -
What I am doing is that I am modifying a writing a custom function to explode all the BOMs in a given sales order and calling codeunit 63 in my code.lvanvugt wrote:
Well ... could be, but it all depends on the context in which you are calling this, and what you are trying to achieve. Apparently (as the message says) you are changing something in the database (i.e. making your process a write transaction). So while changing something in the database, why are you having a PAGE.RUNMODAL execution?archer89 wrote:use CheckAvailability.RUN instead of CheckAvailability.RUNMODAL.
The CheckAvailability .RUNMODAL is a call to page 342 CheckAvailability to check the availability of each item (this call already exists in codeunit 311, I didn't add it myself).
So, how can I go around this???0 -
You should separate the two process: (1) checking availability (2) modifying the data. I.e. based on the result of (1) you can then execute (2).
Of course, technically, you could with the process you have coded already, but can then only call PAGE.RUNMODAL after you have committed the modifications first 9allowing you to execute PAGE.RUNMODAL), but most probably that's functionally not what you want.0 -
Poppins, I wonder if you ever found a good solution for this one? I am having the same issue in NAV 2013, and just using the explode BOM function on a sales line for an item with insufficient inventory it errors with a runmodal error. At the same point in CU 311:
Rollback := NOT (CheckAvailability.RUNMODAL = ACTION::Yes);
I noticed there was a KB to fix it, and downloaded NAV.7.0.40118.AU object set and merged in the changes related to the inventory check. That fixed the issue when copying document, and in other cases. However the issue is still occuring when exploding BOM's. Very hesitant to put a COMMIT in there so would love to know how you or anyone else fixed this.0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 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

