How to delete a sales ordre with associated purchase order
lagersjef
Member Posts: 57
Hi,
--Using NAV 4.0 SP2--
My issue is that I am not allowed to delete a sales order because a sales line on the order is referring to a purchase order.
Steps to reproduce:
1. Create a sales order
2. Add an item to a sales line
3. Create a purchase order
b. refer the purchase order to the sales line just created
4. Try to delete the sales order. You will get a message saying:
You cannot delete the order line because it is associated with purchase order %1 line %2.
5. Next thing I do is to delete the purchase order. This goes well
6. Then I try to delete the sales order again, but still get the same message
7. I go into the Object designer and run the Sales Line table and see that there is still a reference to the purchase order that no longer exist. From here, I am not allowed to delete the reference either
Does anyone have any tips for how I can delete the sales order?
I have been looking for a concatenation table between the sales line and purchase order table, but cannot seem to find it.
Any help appreciated!
--Using NAV 4.0 SP2--
My issue is that I am not allowed to delete a sales order because a sales line on the order is referring to a purchase order.
Steps to reproduce:
1. Create a sales order
2. Add an item to a sales line
3. Create a purchase order
b. refer the purchase order to the sales line just created
4. Try to delete the sales order. You will get a message saying:
You cannot delete the order line because it is associated with purchase order %1 line %2.
5. Next thing I do is to delete the purchase order. This goes well
6. Then I try to delete the sales order again, but still get the same message
7. I go into the Object designer and run the Sales Line table and see that there is still a reference to the purchase order that no longer exist. From here, I am not allowed to delete the reference either
Does anyone have any tips for how I can delete the sales order?
I have been looking for a concatenation table between the sales line and purchase order table, but cannot seem to find it.
Any help appreciated!
0
Comments
-
the fields are probably not visible on the sales line but they exist.
if you click on a slaes line & ZOOM you will see the PO# & PO line No filled.
You need to clear those fields (if they are not editable, make them) then you can delete.0 -
I saw the fields with zoom and also directly in the table through object designer. I am however not allowed to delete the value. The purchase order is just a look-up field (got an Up-arrow right of the field) in the Sales Line table0
-
We have this problem all the time. We buy parts for a customer and then they say they don't need it.
Instead of making the fields editable (I don't like changing field definitions back and forth), just write a report / codeunit, set your filters, assign values to the fields, and modify the records. Works like a charm every time.0 -
If this is something you're going to do on a regular basis how about a Command Button on the Sales Header call it ClearPO or something.
Example/Text Constant - Question - Would you like to Clear the Purchase Order Fields?
OnPush()IF NOT DIALOG.CONFIRM(Question,TRUE) THEN EXIT ELSE SalesLine.RESET; SalesLine.SETRANGE("Document Type","Document Type"); SalesLine.SETRANGE("Document No.","No."); IF SalesLine.FIND('-') THEN REPEAT ClearPurchaseLineSO; ClearSalesLinePO; UNTIL SalesLine.NEXT = 0;
ClearSalesLinePO()CLEAR(SalesLine."Special Order Purchase No."); CLEAR(SalesLine."Special Order Purch. Line No."); CLEAR(SalesLine."Purchase Order No."); CLEAR(SalesLine."Purch. Order Line No."); SalesLine.MODIFY(TRUE);
ClearPurchaseLineSO()IF Purchline.GET("Document Type",SalesLine."Special Order Purchase No.",SalesLine."Special Order Purch. Line No.") THEN BEGIN CLEAR(Purchline."Special Order Sales No."); CLEAR(Purchline."Special Order Sales Line No."); Purchline.MODIFY(TRUE); END;
I'm clearing the SPECIAL order purchase no - but assign the field that you are filling if it's different.
NOTE this is good for completely clearing ALL links not just 1 line0 -
Thanks the quick and good help!
I'll give this a try and revert with the results0
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
