Stopping certain lines in creating Prod. Orders

LewisTioga
Member Posts: 40
When on a Sales Order and releasing it to a prod order. I have code which would error if the Prod. BOM Version is blank. I've changed this to check if there is any BOM version on the item card, If no then don't error. However By doing this it's still creating a planned production order for the Sales order item with No Prod. BOM version, it shouldn't.
I need to basically state,
1) If there isn't a Prod. BOM version on the sales line, check to see if the item card has an Assebly BOM.
2) If the item does have an Assembly BOM, ERROR.
3) If the item doesn't have an assembly bom, don't error but don't continue to create a planned production order for that sales order line.
4) Carry on creating Planned production Orders for all over lines, normal process basically.
Here is the code so far.
IF recSalesLine.GET(
"Sales Header"."Document Type",
"Sales Header"."No.",
"Sales Line No.") THEN BEGIN
ProductionOrderHeader.VALIDATE("Due Date", recSalesLine."Requested Delivery Date");
Item.RESET;
Item.SETRANGE("No.", recSalesLine."No.");
Item.SETRANGE("Assembly BOM",Item."Assembly BOM"::No);
IF NOT Item.FINDFIRST THEN
ERROR(Text0006); // Check for a blank Version
END ELSE
ProductionOrderHeader.VALIDATE("Due Date", "Sales Header"."Requested Delivery Date");
Rest of code for creating prod order below this line.
Any and all feedback is appreciated!
I need to basically state,
1) If there isn't a Prod. BOM version on the sales line, check to see if the item card has an Assebly BOM.
2) If the item does have an Assembly BOM, ERROR.
3) If the item doesn't have an assembly bom, don't error but don't continue to create a planned production order for that sales order line.
4) Carry on creating Planned production Orders for all over lines, normal process basically.
Here is the code so far.
IF recSalesLine.GET(
"Sales Header"."Document Type",
"Sales Header"."No.",
"Sales Line No.") THEN BEGIN
ProductionOrderHeader.VALIDATE("Due Date", recSalesLine."Requested Delivery Date");
Item.RESET;
Item.SETRANGE("No.", recSalesLine."No.");
Item.SETRANGE("Assembly BOM",Item."Assembly BOM"::No);
IF NOT Item.FINDFIRST THEN
ERROR(Text0006); // Check for a blank Version
END ELSE
ProductionOrderHeader.VALIDATE("Due Date", "Sales Header"."Requested Delivery Date");
Rest of code for creating prod order below this line.
Any and all feedback is appreciated!
0
Best Answer
-
Hi Lewis, I would suggest you to remove the ERROR and ELSE condition and simply ignore the items where "Assembly BOM" = No, Modify the code as shown below,
Item.RESET;
Item.SETRANGE("No.", recSalesLine."No.");
Item.SETRANGE("Assembly BOM",Item."Assembly BOM"::No);
IF Item.FINDFIRST THEN BEGIN
ProductionOrderHeader.VALIDATE("Due Date", "Sales Header"."Requested Delivery Date");
Rest of code for creating prod order below this line.
This code would not give any errors and continue the process.5
Answers
-
Hi Lewis, I would suggest you to remove the ERROR and ELSE condition and simply ignore the items where "Assembly BOM" = No, Modify the code as shown below,
Item.RESET;
Item.SETRANGE("No.", recSalesLine."No.");
Item.SETRANGE("Assembly BOM",Item."Assembly BOM"::No);
IF Item.FINDFIRST THEN BEGIN
ProductionOrderHeader.VALIDATE("Due Date", "Sales Header"."Requested Delivery Date");
Rest of code for creating prod order below this line.
This code would not give any errors and continue the process.5
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