Skip to Content
Former Member
Oct 07, 2005 at 01:06 PM

Autoincremental database fields



I am looking for a way to create autoincremental fields as keys in database tables. It should be a method like "generateID". Each call to "generateId" shall return a unique number which was incremented before. It should work in a multiuser environment, where multiple user demand simultaneously unique id's before creating new records in a table. Furthermore, it should be independent from which database I use and it should be maintainable in the Netweaver Developer Studio.

In several tutorials from SAP e.g. QuickCarRental, there is provided a method "generateID()" which works with a timestamp or so. The authors of the tutorials recommend, NOT to use such a functionality in live systems environments: "Make sure that the method used here, generateId(), is not used to implement an ID in a live system. In this case, we are simply simulating generating an ID. In a live system, always use the correct ID generation process."

But, what is the correct ID generation process ?

Thanks in advance