How to replicate Sales order as now one?

vinceliu666
Member Posts: 51
Hi
I try to create Sales Order Change page for the situation : When user makes sales order change they must entry data in the page (Sales Order Change) and waiting approval by team leader.
For the purpose ,I replicate the Sales Order include Table (SO Line Table ID 37) / Page as new one for Sales Order Change table (SO change Line Table 80001) / page .Then I got the error when complier it ...
Couse for the Rec (ID 80001) not equal Salesline3 (ID 37).
I could use those code to trans it for fix ERROR1
SalesLine3.TRANSFERFIELDS(3);
SalesLine3.INSERT;
But how could I make the Rec := SalesLine3; ?
Because the TRANSFERFIELDS is not a public function in Rec. How could I do ?
Does anyone have any ideal?
LOCAL PROCEDURE SelectItemEntry@8(CurrentFieldNo@1000 : Integer);
VAR
ItemLedgEntry@1001 : Record 32;
SalesLine3@1002 : Record 37;
BEGIN
ItemLedgEntry.SETRANGE("Item No.","No.");
IF "Location Code" <> '' THEN
ItemLedgEntry.SETRANGE("Location Code","Location Code");
ItemLedgEntry.SETRANGE("Variant Code","Variant Code");
IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.",Open);
ItemLedgEntry.SETRANGE(Positive,TRUE);
ItemLedgEntry.SETRANGE(Open,TRUE);
END ELSE BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.",Positive);
ItemLedgEntry.SETRANGE(Positive,FALSE);
ItemLedgEntry.SETFILTER("Shipped Qty. Not Returned",'<0');
END;
+ OnSelectItemEntryOnBeforePageRunmodal(Rec,ItemLedgEntry,CurrentFieldNo)
IF PAGE.RUNMODAL(PAGE::"Item Ledger Entries",ItemLedgEntry) = ACTION::LookupOK THEN BEGIN
SalesLine3 := Rec; --->ERROR1
IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN
SalesLine3.VALIDATE("Appl.-to Item Entry",ItemLedgEntry."Entry No.")
ELSE
SalesLine3.VALIDATE("Appl.-from Item Entry",ItemLedgEntry."Entry No.");
CheckItemAvailable(CurrentFieldNo);
Rec := SalesLine3; --->ERROR2
END;
END;
I try to create Sales Order Change page for the situation : When user makes sales order change they must entry data in the page (Sales Order Change) and waiting approval by team leader.
For the purpose ,I replicate the Sales Order include Table (SO Line Table ID 37) / Page as new one for Sales Order Change table (SO change Line Table 80001) / page .Then I got the error when complier it ...
Couse for the Rec (ID 80001) not equal Salesline3 (ID 37).
I could use those code to trans it for fix ERROR1
SalesLine3.TRANSFERFIELDS(3);
SalesLine3.INSERT;
But how could I make the Rec := SalesLine3; ?
Because the TRANSFERFIELDS is not a public function in Rec. How could I do ?
Does anyone have any ideal?
LOCAL PROCEDURE SelectItemEntry@8(CurrentFieldNo@1000 : Integer);
VAR
ItemLedgEntry@1001 : Record 32;
SalesLine3@1002 : Record 37;
BEGIN
ItemLedgEntry.SETRANGE("Item No.","No.");
IF "Location Code" <> '' THEN
ItemLedgEntry.SETRANGE("Location Code","Location Code");
ItemLedgEntry.SETRANGE("Variant Code","Variant Code");
IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.",Open);
ItemLedgEntry.SETRANGE(Positive,TRUE);
ItemLedgEntry.SETRANGE(Open,TRUE);
END ELSE BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.",Positive);
ItemLedgEntry.SETRANGE(Positive,FALSE);
ItemLedgEntry.SETFILTER("Shipped Qty. Not Returned",'<0');
END;
+ OnSelectItemEntryOnBeforePageRunmodal(Rec,ItemLedgEntry,CurrentFieldNo)
IF PAGE.RUNMODAL(PAGE::"Item Ledger Entries",ItemLedgEntry) = ACTION::LookupOK THEN BEGIN
SalesLine3 := Rec; --->ERROR1
IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN
SalesLine3.VALIDATE("Appl.-to Item Entry",ItemLedgEntry."Entry No.")
ELSE
SalesLine3.VALIDATE("Appl.-from Item Entry",ItemLedgEntry."Entry No.");
CheckItemAvailable(CurrentFieldNo);
Rec := SalesLine3; --->ERROR2
END;
END;
0
Answers
-
Is creating a whole new table necessary to handle this pending approval stage? I think you could add another boolean on the Sales Header/Sales Line table such as "Pending Change Approval". You could subscribe to an event OnBeforePost to prevent the Sales Orders being processed while in this state and create a Cue to provide quick navigation to the Sales Orders in this state. Finance Members could press an action which removes this flag from the order and allows it to be processed again.
0 -
Hi Slider
I want to keep the sales order line field value before and after change. For the purpose, I have to replicate sales order which user want to change as source and let user to modify the field on sales order line .
If I use the flag on Sales Order Line, how could let user's leader know which field has been changed?
0 -
Hallo vinceliu666,
what version are you using?
The Codeunit 6620 - Copy Document Mgt. (Function CopySalesDoc) should help.
As Slider already wrote, do you really need a new table? Another approach would probably, to work with the Sales Order Archive. You could create a new version in the Sales Order Archive, so you don't need a new table and you can use the standard functions and you can see all changes.0 -
Hi Aluan:
Thanks for your suggestion. Navision version is 2016 . I thought Sales Order Archive is a good approach but it's hard to check which field has changed.0 -
Hello, you could also create a sub page which displays change log entries for the Sales Order filtered by any changes made after the last time it was approved.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