In case you imported records and get duplicate ID errors when creating new records from metasfresh, you can use this SQL to recalculate the sequences:
select dba_seq_check_native();
select update_sequences();
| Important: | 
|---|
| MAKE SURE you are logged in with db user metasfresh when running that command. | 
Hint: If it is not working, please DROP that particular sequence and run the function again.
In case you do not have access to the database, you can run a process to fix native sequence problems from metasfresh directly. To do so, please proceed as follows:
 and enter the process name
 and enter the process name Fix Native Sequences into the search field.
    Note: Use shortcut
Alt+2/⌥ alt+2to open the menu.

Error: Cannot retrieve next ID...
Server error
Cannot retrieve next ID from database for DocumentEntityDescriptor{tableName=Product_Category_Purchase_Group, fields.count=10}