Skip to Content

how to auto increment a table field

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:

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 13, 2017 at 03:28 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Jun 13, 2017 at 04:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded