Copy Finished Production Order to a new Production Order

tompynation
Member Posts: 398
Hi, i created a new function in the Finished production order which creates a new Production Order from the Finished Order.
This will be used when the production has failed...
So the copying works just fine but i have a question about showing the newly created Order.
IF CONFIRM(Text001) THEN BEGIN
lv_ProdOrder.INIT;
lv_ProdOrder.VALIDATE(Status,lv_ProdOrder.Status::Planned);
lv_ProdOrder.VALIDATE("No.",'');
lv_ProdOrder.INSERT(TRUE);
lv_ProdOrder."Source Type" := lv_ProdOrder."Source Type"::Item;
lv_ProdOrder.VALIDATE("Source No.",Rec."Source No.");
lv_ProdOrder.VALIDATE(Quantity,Rec.Quantity);
lv_ProdOrder.MODIFY;
// Aanmaken van Product Order Line
ProdOrder.SETRANGE(Status,lv_ProdOrder.Status);
ProdOrder.SETRANGE("No.",lv_ProdOrder."No.");
REPORT.RUNMODAL(REPORT::"Refresh Production Order",FALSE,TRUE,ProdOrder);
COMMIT;
IF CONFIRM(Text002,FALSE,lv_ProdOrder."No.") THEN BEGIN
lv_ProdOrder1.RESET;
lv_ProdOrder1.SETRANGE("No.",lv_ProdOrder."No.");
lv_ProdOrderForm.SETTABLEVIEW(lv_ProdOrder1);
lv_ProdOrderForm.RUN;
END;
END;
The problem is the part in BOLD.
After the Order has been created i ask the user if he would like to see the new Order now...
So with this code this works fine..
But when he is viewing the new order then There is a table Filter on the "No." due to the TABLEVIEW
So he has to remove this filter before he is able to view the other "Planned Production Orders".
And i dont like that... Isnt itn possible to just open the form displaying the newly created order.
But without a filter on the Form? So that he can navigate through all the "Planned Orders" without having the users to remove a filter ? :x
This will be used when the production has failed...
So the copying works just fine but i have a question about showing the newly created Order.
IF CONFIRM(Text001) THEN BEGIN
lv_ProdOrder.INIT;
lv_ProdOrder.VALIDATE(Status,lv_ProdOrder.Status::Planned);
lv_ProdOrder.VALIDATE("No.",'');
lv_ProdOrder.INSERT(TRUE);
lv_ProdOrder."Source Type" := lv_ProdOrder."Source Type"::Item;
lv_ProdOrder.VALIDATE("Source No.",Rec."Source No.");
lv_ProdOrder.VALIDATE(Quantity,Rec.Quantity);
lv_ProdOrder.MODIFY;
// Aanmaken van Product Order Line
ProdOrder.SETRANGE(Status,lv_ProdOrder.Status);
ProdOrder.SETRANGE("No.",lv_ProdOrder."No.");
REPORT.RUNMODAL(REPORT::"Refresh Production Order",FALSE,TRUE,ProdOrder);
COMMIT;
IF CONFIRM(Text002,FALSE,lv_ProdOrder."No.") THEN BEGIN
lv_ProdOrder1.RESET;
lv_ProdOrder1.SETRANGE("No.",lv_ProdOrder."No.");
lv_ProdOrderForm.SETTABLEVIEW(lv_ProdOrder1);
lv_ProdOrderForm.RUN;
END;
END;
The problem is the part in BOLD.
After the Order has been created i ask the user if he would like to see the new Order now...
So with this code this works fine..
But when he is viewing the new order then There is a table Filter on the "No." due to the TABLEVIEW
So he has to remove this filter before he is able to view the other "Planned Production Orders".
And i dont like that... Isnt itn possible to just open the form displaying the newly created order.
But without a filter on the Form? So that he can navigate through all the "Planned Orders" without having the users to remove a filter ? :x
0
Answers
-
Try:
IF CONFIRM(Text002,FALSE,lv_ProdOrder."No.") THEN BEGIN lv_ProdOrder1.RESET; lv_ProdOrder1.SETRANGE("No.",lv_ProdOrder."No."); IF lv_ProdOrder1.FINDFIRST THEN BEGIN lv_ProdOrderForm.SETRECORD(lv_ProdOrder1); lv_ProdOrder1.SETRANGE("No."); END; lv_ProdOrderForm.SETTABLEVIEW(lv_ProdOrder1); lv_ProdOrderForm.RUN; END;
0 -
Think about the filters though...
Maybe you wantlv_ProdOrder1.SETRANGE("No.");
outside the IF block or thelv_ProdOrderForm.SETTABLEVIEW(lv_ProdOrder1); lv_ProdOrderForm.RUN;
inside the IF block...0 -
allright that code solved it. Is there any difference between:
IF CONFIRM(Text002,FALSE,lv_ProdOrder."No.") THEN BEGIN
lv_ProdOrder1.RESET;
lv_ProdOrder1.SETRANGE("No.",lv_ProdOrder."No.");
IF lv_ProdOrder1.FINDFIRST THEN
BEGIN
lv_ProdOrderForm.SETRECORD(lv_ProdOrder1);
lv_ProdOrderForm.RUN;
END;
END;
And:
IF CONFIRM(Text002,FALSE,lv_ProdOrder."No.") THEN BEGIN
lv_ProdOrder1.RESET;
lv_ProdOrder1.SETRANGE("No.",lv_ProdOrder."No.");
IF lv_ProdOrder1.FINDFIRST THEN
BEGIN
lv_ProdOrderForm.SETRECORD(lv_ProdOrder1);
lv_ProdOrder1.SETRANGE("No.");
lv_ProdOrderForm.SETTABLEVIEW(lv_ProdOrder1);
lv_ProdOrderForm.RUN;
END;
END;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