Application Development and Automation 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: 
Read only

Database Table with increment Primarey key???

Former Member
0 Likes
617

Hello at all,

i have a database table ZTEST and there are 2 Primarey keys:

MANDT & ID.

But the ID key must declared as increment.

If i insert a row in my table ZTEST, than the SYSTEM must automaticly increment the Primarey key ID.

How can i realize this in ABAP???

With kind regards

ETN

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
581

Use u201Cselect max(id)u201D to get the higest value from table. Then increment it and save the data to table.

Regards

Prajwal K.

4 REPLIES 4
Read only

Former Member
0 Likes
582

Use u201Cselect max(id)u201D to get the higest value from table. Then increment it and save the data to table.

Regards

Prajwal K.

Read only

0 Likes
581

>

> Use u201Cselect max(id)u201D to get the higest value from table. Then increment it and save the data to table.

> Prajwal K.

This is useless, consider paralell processing. You dont have any enqeue/deqeue processes, so two (or more) paralell reports can get the same number.

Read only

Former Member
0 Likes
581

Hello

You need to create a number range and use FM NUMBER_GET_NEXT for generate next value.

How to do this ?

Check: http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=50004015

Read only

Former Member
0 Likes
581

Thank you for help.