Updating the purchase line from the result of a lookup
Charleh
Member Posts: 44
I have a routine that allows users to modify the base quantity on the purchase line, which then pops up a form that allows them to select a unit of measure that deals with the outstanding overflow on the balance -
for instance if a user selects a UOM with 128 base units in, and then enters 132 base units instead of 128 into a purchase line, the form will pop up letting them know there are 4 units of overflow. They can then pick a UOM to fit this quantity or create a new one -
The problem I come across is updating the purchase line after the user has clicked the OK button on the form. I've called the form as a lookup using the SETRECORD method to lock the form to the current purchase line - if I modify the purchase line before the form closes, the purchase order form gives an error saying
'Another user has modified the purchase line record etc' and the form does not show the new lines until I open it again.
I want to create a new line with the new UOM and quantity
Line no, UOM Code, Qty, Base Qty
10000, BOX128, 1, 128
user changes Base Qty to 132 (132 - 128 = 4) and then chooses that the new UOM is PCS so a new line should appear with
20000, PCS, 4, 1
I can't figure out the best way of doing this..
I've thought about making a function in which you pass all the parameters to add a new purchase line, but this just seems pointless... too much code for such a small thing
The code that calls the form is in the Purchase Line table like so:
I'm starting to not like Navision because so many things seem to have to be done in a backwards kind of way
Anyone have any suggestions as to how to get the right data into the purchase line after I've run the lookup?
for instance if a user selects a UOM with 128 base units in, and then enters 132 base units instead of 128 into a purchase line, the form will pop up letting them know there are 4 units of overflow. They can then pick a UOM to fit this quantity or create a new one -
The problem I come across is updating the purchase line after the user has clicked the OK button on the form. I've called the form as a lookup using the SETRECORD method to lock the form to the current purchase line - if I modify the purchase line before the form closes, the purchase order form gives an error saying
'Another user has modified the purchase line record etc' and the form does not show the new lines until I open it again.
I want to create a new line with the new UOM and quantity
Line no, UOM Code, Qty, Base Qty
10000, BOX128, 1, 128
user changes Base Qty to 132 (132 - 128 = 4) and then chooses that the new UOM is PCS so a new line should appear with
20000, PCS, 4, 1
I can't figure out the best way of doing this..
I've thought about making a function in which you pass all the parameters to add a new purchase line, but this just seems pointless... too much code for such a small thing
The code that calls the form is in the Purchase Line table like so:
.... some error checking code
// Call form with current purch line
FitQtyInUOMForm.SETRECORD(Rec);
// Check form result
IF FitQtyInUOMForm.RUNMODAL() = ACTION::LookupOK THEN BEGIN
... need to insert new purchase line here
END;
I'm starting to not like Navision because so many things seem to have to be done in a backwards kind of way
Anyone have any suggestions as to how to get the right data into the purchase line after I've run the lookup?
Charleh
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
- 251 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