Auto explode Bill of Materials when quote converted to order

hairyjim
Member Posts: 99
Hi all,
We have a situation where we wish to keep BOM's unexploded on quotes but wish to have them exploded on order screens.
Currently the Order Processor has to manually explode any BOMs that are on orders that have been created from quotes.
Could someone point me to the code unit that would require a mod to change this so any BOMs on quotes that are turned into orders are auto exploded on the order.
We have a situation where we wish to keep BOM's unexploded on quotes but wish to have them exploded on order screens.
Currently the Order Processor has to manually explode any BOMs that are on orders that have been created from quotes.
Could someone point me to the code unit that would require a mod to change this so any BOMs on quotes that are turned into orders are auto exploded on the order.
Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.
0
Comments
-
Hi,
One solution you may try is under the Codeunit 86 (Sales-Quote to Order) for sales or Codeunit 96 (Purch.-Quote to order) for purchases
1) Create a new Function to call the Codeunit 63 Sales-Explode BOM (for sales) in CD 86; or call the Codeunit 73 Purch.-Explode BOM (for purchases) in CD 96. (requires record variable parameter passing)
2)After the Quote is converted to Sales Order (At the end of OnRUN() function), add in code to called the function created in (1). (requires record variable parameter passing)0 -
OK. I added at the bototm of the OnRUn function
AutoExplodeBom;
Inside this function I do the following:
Item.GET(SalesOrderLine."No.");
Item.CALCFIELDS("Bill of Materials");
IF NOT Item."Bill of Materials" THEN
EXIT;
CODEUNIT.RUN(CODEUNIT::"Sales-Explode BOM",SalesOrderLine);
Now what is happening is that it only works for the very last item added to the sales lines.
Im not sure how or where I should loop through all the quote lines that are being converted to the order and check for being a BOM and explode or not.
Do you have any further advice to offer?Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
Inside the Function (AutoExplodeBom), you should take the Sales Order No. and declare a new record variable for Sales Order Line.
SalesOrderLine.Reset;
SalesOrderLine.Setrange("Document Type",SalesOrder."Document Type");
SalesOrderLine.Setrange("Document NO.",SalesOrder."No.");
SalesOrderLine.Setrange(Type,SalesOrderLine.Type::Item);
If SalesOrderLine.FIND('-') THEN
Repeat
Item.GET(SalesOrderLine."No.");
Item.CALCFIELDS("Bill of Materials");
IF NOT Item."Bill of Materials" THEN
EXIT;
CODEUNIT.RUN(CODEUNIT::"Sales-Explode BOM",SalesOrderLine);
Until SalesOrderLine.Next = 0;
Remember to indent your codes properly.0 -
Cheers for the help.
I added the code as suggested.
Now when a quote is converted to an order only the first line is exploded if it is a BOM or not, the loop does not seem to then go to the next line and check and explode or not.
If the first line is a BOM then it does explode it but as above it does not then go to the next line and check.
Any other thoughts?Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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