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;
0
Answers
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?
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.
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.