Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for a better way to set a self-increasing key in DB table

Former Member
0 Kudos

Hi,

I have created a table in SE11 and one of the primary keys is a sequence No like 1,2,3...

When other PKs of two records are the same, then the unique way to differentiate them is the sequence no.

It is also required to create, modify and delete records.

Does SAP provide a solution which can do this automatically?

If I do this manually, I need someone to give me some advice, thank you.

3 REPLIES 3

Former Member
0 Kudos

Hi

To create a new number range object in tcode SNRO, every time you insert a new record, read a number from this object.

This will not be synchronized, if you manually change the number in db level.

regards,

Archer

0 Kudos

Why not read table to get the current max no and add 1 to that?

0 Kudos

For good performance, if you go to SNRO to see a standard number range object, there are a column 'current number', so don`t need you read table.

regards,

Archer