It looks like this may be your issue:
Subject:
Existing users, roles, and company codes are overwritten when new entries are created in User Maintenance, Role Maintenance, or Company Maintenance, if the 'Nextsurrogate$' value in SY_SURROGATE matches the 'Userkey$' value for any record other than the last record.
Steps to Duplicate:
Notes:
This issue can be duplicated with user logons, roles, and company codes. The following steps affect the user logon (SY_USER).
Use caution when working with Data File Display and Maintenance (DFDM). Always make a backup first. If necessary, seek the assistance of a qualified Sage Software business partner or Sage Software Customer Support analyst.
Create three users:
Open Library Master / Main / User Maintenance.
Create the following three user logons and assign them to roles:
USER1
USER2
USER3
Print the User Listing and close User Maintenance.
Change the value of 'nextsurrogate$' in SY_SURROGATE.
Note: This section is only necessary to force the issue to occur. The actual cause of the incorrect 'nextsurrogate$' field is not known.
Open Library Master / Utilities / Data File Display and Maintenance (DFDM), and select file SY_USER.
Select each user code create above and note the value in the 'userkey$' field. In this example, the values are as follows:
USER1: Userkey$ = 00000000003
USER2: Userkey$ = 00000000004
USER3: Userkey$ = 00000000005
Select file SY_SURROGATE, and select the 'SY_USER' record.
Click the 'Edit' button, and select ""01. nextsurrogate$"" from the 'Field Number' drop-down list. The value in the 'Change' field should match the 'Userkey$' value of the last user code created (00000000005 in this example).
Change the value to 00000000003 (user code ""USER1"").
Close DFDM.
Open User Maintenance again, create user logon ""USER4"", and click 'Accept'.
Click the 'User Logon' lookup button.
Note that USER2 is missing.
Open SY_USER in DFDM again, and browse to the 'USER4' record.
Note that the 'Userkey$' field displays ""00000000004"" (the user key for USER2).
Notes:
If this issue occurs with roles, users assigned to the original role are now assigned to the new role, with access to the any and programs associated with the new role.
If this issue occurs with company codes, the data still exists for the original company, but cannot be accessed.
Expected Behavior:
New users, roles, and companies should not overwrite existing records.
Possible Workaround:
In Data File Display and Maintenance (DFDM), change the value in the 'Nextsurrogate$' field to match the 'Userkey$' field in the last record of the affected file (SY_USER, SY_ROLE, or SY_COMPANY).
Note: Use caution when working with this task. Always make a backup first. If necessary, seek the assistance of a qualified Sage Software business partner or Sage Software Customer Support analyst.
Open DFDM, and select the appropriate file in the 'File Name' field:
SY_COMPANY (missing company code)
SY_ROLE (missing role)
SY_USER (missing user code)
Click the 'Last Record' navigation button to go to the last record.
Note the value in the 'Userkey$' field (for example: 00000000005).
Select file SY_SURROGATE in the 'File Name' field.
Select the appropriate record:
[SY_COMPANY] (missing company code)
[SY_ROLE] (missing role)
[SY_USER] (missing user code)
Click the 'Edit' button, and select ""4. Nextsurrogate$"" field from the 'Field Number' drop-down list.
In the 'Change' field, enter the value of the 'Userkey$' field noted above (the last record).
Close DFDM.
Recreate the missing record in the appropriate task.