Upgrade Tips & Tricks Teil 3

Heute gibt es den ersten deutschsprachigen Blogartikel zum Thema Microsoft Dynamics NAV Upgrade Tipps & Tricks.

Die vorherigen beiden Blogartikel zum Thema Upgrade Tipps & Tricks 1 und 2 finden Sie in Englisch auf dem NAV Team Blog.

Best Practices Tips and Tricks for Upgrading to Dynamics NAV 2013 R2 or Dynamics NAV 2015 Best Practices Tips and Tricks for Upgrading to Dynamics NAV 2013 R2 or Dynamics NAV 2015 Part 2

Der dritte Teil beschreibt eine Problematik in NAV 2017, häufiger aufzutreten scheint.

‚UPG Item ist nicht vorhanden‘:

SessionId    : xx
CodeunitId   : 104xxx (abhängig von Version)
FunctionName : UpdateItem
CompanyName  : CRONUSxxxx
StartTime    : xxxxx
Duration     :
State        : FailedPendingResume
Error        : The UPG Item does not exist. Identification fields and values: No.='xxx’

Für Entwickler, die sich mit Upgrade Szenarien beschäftigen, kennen diese Fehlermeldung sicherlich und haben diese schon beheben müssen. Dennoch bleibt die Frage des Warum:

  • Was bedeutet der Fehler?
  • Was kann ich diesen lösen?

Was ist ‚UPG ITem‘ überhaupt?

Alle Tabellen die mit dem Namen UPG* anfangen, sind Hilfstabellen, die in der Upgrade Tool Kit zu finden sind. Sie helfen der Upgrade Logik und den Upgrade Codeunit als temporäre Speicher für das Upgrade von Daten und Strukturen.

UPG Tabellen sind ein Teil der Upgrade FOBs. UPG Tabellen sind Lokalisierungsabhängig.

Was bedeutet ‚UPG Item ist nicht vorhanden?

Wenn man die Upgrade Tool Kit Objekte importiert, werden alle UPG Tabellen automatisch erstellt. Z.B. die Objekte in ‚Upgrade900100.DE.fob‘:

up1 up2

Das bedeutet, auf dem SQL Server ist die Tabelle nun vorhanden:

up3

Was bedeutet nun der Fehler?

Der Fehler erscheint, wenn wir die Schema Sync. ausführen, nachdem wir das Upgrade Toolkit importiert haben. Der Fehler sagt die Tabelle UPG Item ist nicht vorhanden, aber wir können mit Sicherheit sagen, dass die Tabelle vorhanden ist, da wir diese auf dem SQL Server sehen können.

Der Fehler bedeutet, dass die Tabelle physikalisch vorhanden ist, aber keine Datensätze enthält.

up4

Warum sind Daten in der Tabelle wichtig und wieso könnten diese Tabelle geleert worden sein?

Die Daten von T104092 sind für die Upgrade Prozeduren wichtig, die Erklärung finden wir in CU 104075 als Beispiel.

Cu 104075:

[TableSyncSetup] GetTableSyncSetupW1(VAR TableSynchSetup : Record "Table Synch. Setup")

// The purpose of this method is to define how old and new tables will be available for dataupgrade
// The method is called at a point in time where schema changes have not yet been synchronized to
// the database so tables except virtual tables cannot be accessed

// TableSynchSetup."Table ID":
// Id of the table with schema changes (i.e the modified table).

// TableSynchSetup."Upgrade Table ID":
// Id of table where old data will be available in case the selected TableSynchSetup.Mode option is one of Copy or Move , otherwise 0

// TableSynchSetup.Mode:
// An option indicating how the data will be handled during synchronization
// Check: Synchronize without saving data in the upgrade table, fails if there is data in the modified field/table
// Copy: Synchronize with saving data in the upgrade table, the modified table contains data in matching fields
// Move: Synchronize with moving the data in the upgrade table,the changed table is empty; the upgrade logic is handled only by application code
// Force: Synchronize without saving data in the upgrade table, disregard if there is data in the modified field/table

// Examples:
// DataUpgradeMgt.SetTableSyncSetup(DATABASE::"Sales Header",DATABASE::"UPG Sales Header",TableSynchSetup.Mode::Copy);
…………
DataUpgradeMgt.SetTableSyncSetup(DATABASE::Item,DATABASE::Table104092,TableSynchSetup.Mode::Copy);
…………

Das bedeutet, für die Schema Sync. spielt es eine Rolle, ob die Tabelle voll oder leer bleibt.

Warum genau ist das so?

Wenn wir die Upgrade Schritte von diesem KB folgen: https://msdn.microsoft.com/en-us/dynamics-nav/upgrading-the-data

Step 10:

##

Task 10: Run the schema synchronization to synchronize the new tables

Similar to task 8, to publish the data schema changes of the newly imported tables to the SQL tables, run the Sync. Schema For All Tables – With Validation option from the development environment or run the Sync-NavTenant cmdlet from the Microsoft Dynamics NAV 2017 Administration Shell.

##

Es ist klar beschrieben, dass die Schema Sync. mit Validierung ausgeführt werden sollte. Oft ist das aber die Ursache des Fehlers.

Im nächsten Schritt führt man ein Sync.– mode Checkonly aus, um herauszufinden, was genaue im Hintergrund passiert.

…..Voila!

PS C:\Windows\system32> Sync-NAVTenant DynamicsNav100 -Mode CheckOnly

Sync-NAVTenant : The schema synchronization may result in deleted data. The following destructive changes were detected:

  Table: 18, Customer
 Field: 5001900, No. Entries for Avis: Deleted
 Field: 5055250, Liq. Payment Terms Code: Deleted
 Field: 5157970, Electronic Document Dispatch: Deleted
 Table: 23, Vendor
 Field: 5001900, No. Entries for Avis: Deleted
 Field: 5001901, Direction Code: Deleted
 Field: 5001902, Payment Type: Deleted
 Field: 5055250, Liq. Payment Terms Code: Deleted
 Field: 5157970, Electronic Document Dispatch: Deleted
 Table: 38, Purchase Header
 Field: 99008500, Date Received: Deleted
 Field: 99008501, Time Received: Deleted
 Field: 99008504, BizTalk Purchase Quote: Deleted
 Field: 99008505, BizTalk Purch. Order Cnfmn.: Deleted
 Field: 99008506, BizTalk Purchase Invoice: Deleted
 Field: 99008507, BizTalk Purchase Receipt: Deleted
 Field: 99008508, BizTalk Purchase Credit Memo: Deleted
 Field: 99008509, Date Sent: Deleted
 Field: 99008510, Time Sent: Deleted
 Field: 99008511, BizTalk Request for Purch. Qte: Deleted
 Field: 99008512, BizTalk Purchase Order: Deleted
 Field: 99008520, Vendor Quote No.: Deleted
 Field: 99008521, BizTalk Document Sent: Deleted
 Table: 79, Company Information
 Field: 50000, Ort für Signatur: Length reduced
 Field: 50001, GSF: Length reduced
 Field: 50002, HRB: Length reduced
 Field: 60003, IBAN 2: Length reduced
 Field: 60008, IBAN 3: Length reduced
 Field: 60013, IBAN 4: Length reduced
 Field: 70300, Path scanned Purch. Doc.: Length reduced
 Table: 91, User Setup
 Field: 5310951, CrefoDefaultCustRefConsumer: Length reduced
 Table: 110, Sales Shipment Header
 Field: 5900, Service Mgt. Document: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 99008509, Date Sent: Deleted
 Field: 99008510, Time Sent: Deleted
 Field: 99008515, BizTalk Shipment Notification: Deleted
 Field: 99008519, Customer Order No.: Deleted
 Field: 99008521, BizTalk Document Sent: Deleted
 Table: 120, Purch. Rcpt. Header
 Field: 99008500, Date Received: Deleted
 Field: 99008501, Time Received: Deleted
 Field: 99008507, BizTalk Purchase Receipt: Deleted
 Table: 204, Unit of Measure
 Field: 60000, Inventory Unit PV: Deleted
 Table: 295, Reminder Header
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Table: 297, Issued Reminder Header
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Table: 5107, Sales Header Archive
 Field: 5158202, Archiv DocID: Length reduced
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Field: 99008500, Date Received: Deleted
 Field: 99008501, Time Received: Deleted
 Field: 99008502, BizTalk Request for Sales Qte.: Deleted
 Field: 99008503, BizTalk Sales Order: Deleted
 Field: 99008509, Date Sent: Deleted
 Field: 99008510, Time Sent: Deleted
 Field: 99008513, BizTalk Sales Quote: Deleted
 Field: 99008514, BizTalk Sales Order Cnfmn.: Deleted
 Field: 99008518, Customer Quote No.: Deleted
 Field: 99008519, Customer Order No.: Deleted
 Field: 99008521, BizTalk Document Sent: Deleted
 Table: 5109, Purchase Header Archive
 Field: 99008500, Date Received: Deleted
 Field: 99008501, Time Received: Deleted
 Field: 99008504, BizTalk Purchase Quote: Deleted
 Field: 99008505, BizTalk Purch. Order Cnfmn.: Deleted
 Field: 99008506, BizTalk Purchase Invoice: Deleted
 Field: 99008507, BizTalk Purchase Receipt: Deleted
 Field: 99008508, BizTalk Purchase Credit Memo: Deleted
 Field: 99008509, Date Sent: Deleted
 Field: 99008510, Time Sent: Deleted
 Field: 99008511, BizTalk Request for Purch. Qte: Deleted
 Field: 99008512, BizTalk Purchase Order: Deleted
 Field: 99008520, Vendor Quote No.: Deleted
 Field: 99008521, BizTalk Document Sent: Deleted
 Table: 5900, Service Header
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Table: 5992, Service Invoice Header
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Table: 5994, Service Cr.Memo Header
 Field: 5157970, Electronic Document Dispatch: Deleted
 Field: 5157971, Bill-to E-Mail: Deleted
 Field: 5157972, Send As Copy: Deleted
 Table: 50001, Customizing Setup
 Field: 1040, Shipping Date: Deleted
 Field: 1050, Edit Post. Groups in Gen. Jnl.: Deleted
 Table: 51000, External Entries Setup
 Field: 1, Key: Data type changed
 Table: 75400, Mail Batch
 Field: 50000, Sofortversand: Deleted
 Field: 50001, mit Signatur: Deleted
 Field: 50003, Erstell-Datum: Deleted
 Field: 50004, Sonderbehandlung bei info@: Deleted
 Table: 75401, Mail Batch Line
 Field: 30, CI Name: Length reduced
 Field: 50000, Segment No.: Deleted
 Field: 50001, Salesperson Code: Deleted
 Field: 50002, Suchbegriff Unternehmen: Deleted
 Field: 50003, Contact Company No.: Deleted
 Field: 50004, zHd: Deleted
 Table: 75402, MailIT Setup
 Field: 50000, Quote Report ID: Deleted
 Field: 50002, Order Report ID: Deleted
 Field: 50004, Abnahme Report ID: Deleted
 Field: 50006, Bestellung Report ID: Deleted
 Table: 75403, MailIT Report
 Field: 1, ID: Data type changed
 Field: 3, User ID: Deleted
 Field: 2, Caption: Deleted
 Table: 5157823, Reserved 5157823
 Field: 1, Dummy: Data type changed
 Table: 5157825, Reserved 5157825
 Field: 1, Dummy: Removed from primary key - Data type changed
 Table: 5157917, Reserved 5157917
 Field: 1, Dummy: Data type changed
 Table: 5158202, Document Archive Setup
 Field: 22, Sales Process Nos.: Length reduced
 Field: 23, Purchase Process Nos.: Length reduced
 Table: 5158221, Invoice Monitor Setup
 Field: 2, Default Journal Template Name: Length reduced
 Field: 3, Default Journal Batch Name: Length reduced
 Table: 5158225, DropZone Lookup Values
 Field: 1, Archive Document Type: Data type changed
 Field: 3, Document Type: Data type changed
 Field: 6, Value: Deleted
 Field: 5, Source Type: Deleted

Was wäre der nächste Schritt? Einfach Sync. mit Force oder? BITTE NICHT…. Das wäre ein Fehler!

Das ist genaue was wir nicht wünschen, da wir nicht genaue wissen, welche Daten mit der Force Option gelöscht werden könnten.

Sogar wenn die Tabelle Item, nicht in dieser List ist, weiß man nicht genaue, was mit der Force Option genaue gelöscht wird, Grund sind Tabellenrelationen zwischen den Tabellen in der obigen Liste und andere Tabellen die bestehen und ggf. und angepasst wurden.

Was ist nun zu tun?

Bitte nehmen Sie Abstand von einem Sync. mit der Option Force, wenn es nicht wirklich sein muss.

Diesen Fehlern sollten erst behoben werden, dann können wir die Schema Sync. mit Validierung weiter ausführen.

Wie können wir den Fehler beheben?

1. Entweder schreibt man eigene Upgrade Codeunit, wie zu sehen in der Codeunit 104075, um zu erklären, was NAV mit den gelöschten Feldern tun soll. Das Upgrade Codeunit Konzept haben wir erst ab NAV 2015 präsentiert. Eine Erklärung mit Beispiel finde Sie z.B. hier: https://vjeko.com/upgrade-codeunits-in-nav-2015/ Und auch als Video: https://community.dynamics.com/nav/b/navvideos/archive/2014/11/05/how-do-i-synchronize-database-schema-using-upgrade-codeunits-in-microsoft-dynamics-nav-2015

 

So kann man als Beispiel die CU 104xxx anpassen:

 DataUpgradeMgt.SetTableSyncSetup(DATABASE::"G/L Account", DATABASE::"MyUPG G/L Account",TableSynchSetup.Mode::Copy);
 DataUpgradeMgt.SetTableSyncSetup(DATABASE::Customer, DATABASE::"MyUPG Customer",TableSynchSetup.Mode::Copy);
 DataUpgradeMgt.SetTableSyncSetup(DATABASE::Vendor, DATABASE::"MyUPG Vendor",TableSynchSetup.Mode::Copy);

Wo “MyUPGxxx” Tabelle, ist die wo wir die alten Strukturen und Daten temporär sichern möchten, der Rest von der Anpassung ist in der oben genannten Artikel erklärt.

2. Eine weitere Möglichkeit wäre ein einfachere Merge mit Cronus Objekte aus der neuen Version

Einfach die alten Objekte z.b. Cutomer und Vendor Tabellen nehmen und einen Compare-Merge mit selben Tabelle aus der neue Version durchführen.

Danach exportiert man die Merge Ergebnisse als fob aus der neuen Version.

Wenn nun die FOB importiert wurde, sollte die Schema Sync mit Validierung einwandfrei ausgeführt werden können und nur dann es ist garantiert, dass dieser Fehler nicht mehr auftaucht.

up5 up6 up7

Das Upgrade ist nun erfolgreich ausgeführt worden:

up8

 

Mit freundlichen Grüßen,

Abdelrahman Erlebach
Microsoft Dynamics Germany

Special Thanks for Duilio Tacconi for his great contribution in the area of schema Sync. and data Upgrade.

Disclaimer Because some jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the limitation and disclaimer set out below may not apply. ACCEPTANCE AND DISCLAIMER OF WARRANTY The software contained in this communication is provided to the licensee “as is” without warranty of any kind. The entire risk as to the results, usefulness and performance of the software is assumed by the licensee. Microsoft disclaims all warranties, either express or implied, including but not limited to, implied warranties or merchantability, fitness for a particular purpose, correspondence to description, title and non-infringement. Further, Microsoft specifically disclaims any express or implied warranties regarding lack of viruses, accuracy or completeness of responses, results, lack of negligence, and lack of workmanlike effort, for the software. LIMITATION OF LIABILITY In no event shall Microsoft be liable for any direct, consequential, indirect, incidental, or special damages whatsoever, including without limitation, damages for loss of business profits, business interruption, loss of business information, and the like, arising out of the performance, use if, or inability to use, all or part of either the software, even if Microsoft has been advised of the possibility of such damages.