Skip to Content
0

how to auto increment a table field

Jun 13, 2017 at 03:00 PM

1.5k

avatar image

hi,

i have a dictionary table with a primary key ( type char10) and i need that when i insert a new row , set the primary key with the max value. In a nutshell auto_increment the primary key . All of this without changing the field type. something like when you create PO with me21n.

so field can be "G000000001" OR "0000000023" .

please help D:

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Lars Hvam
Jun 13, 2017 at 03:28 PM
2
Show 1 Share
10 |10000 characters needed characters left characters exceeded

thanks (Y)

0
SAPEKSH GUPTA Jun 13, 2017 at 04:02 PM
0

Hi Cheikh,

You can try below steps:

1. Go to Table Maintenance Generator (TMG) SE56 in Edit mode .

2. Menu Environment -> Modification -> Events.

3. Click on New Entries.

4. Choose Maintenance Event (T) as '05' or anything from the F4 help as suitable to your needs. Provide a FORM Routine name and click on Editor button in front of it. Write your piece of code to pick the max. value of the key from the table and increment it by 1 and modify the value back in available structures.

PS: You can check the structures to be used in debug mode.

Hope this helps.

Regards,

Sapeksh

Share
10 |10000 characters needed characters left characters exceeded