The upgrade wizard for SAP (We are not sure if other versions are also affected) unfortunately has a bug that incorrectly detects that the B1UP table @BOY_B1UP_TRANSLINE has duplicate records.
Scenario
When running the upgrade wizard you might get an error around duplicate records in one or more tables. This will point you to the note 1343077 from SAP.
Attached to this note you will find a SQL script that can be used to check for duplicated records. The script will identify the following:
This is however due to an incorrect SQL from SAP and we suspect the same SQL is used in the upgrade wizard. The issue is that SAP cast the Code to a NVARCHAR(20) instead of 50 as would be correct. This leads to it detecting the above as it truncates the data as we have a second record called BusinessPartnerGroups that is truncated to BusinessPartnerGroup and this now collides with the entry BusinessPartnerGroup. If you change it to correctly cast to 50 instead of 20 there are no duplicate records.
You can also confirm that there are no duplicate records by simply looking in the table.
We have reported the issue to SAP and are awaiting a reply from SAP support - SAP Ticket number is 288992 / 2017.
Workaround 1)
Attached are a small program that can rename the record that SAP incorrectly detects as a duplicate. Download the zip folder and extract it on the server. Run the FixDuplicates.exe. Input the login credentials:
If the database is affected you will get a prompt:
Press "Yes" to rename the records.
After the rename is done the SQL provided by SAP no longer detects any duplicates. This should now allow you to upgrade the database.
Workaround 2)
Upgrade to B1UP 2017.07 (When it is released) where it will auto-fix the issue on startup.