SAP ABAP Tutorial – Create Custom table with Auto Increment Field

  1. Create a Custom table ZTAB_EMAIL using Transaction Code SE11 (ABAP Data Dictionary)

2. Choose Delivery Class and Data Browser/Table View Editing in Delivery and Maintenance Tab. Write Short Description.

3, Go To Fields tab and add below fields. Create New Data Element ZAUTO with NUMC4 type.

4. Activate Table and Go to Utilities > Table Maintenance Generator.

5. Create TMG as below with Function Group ZFG_EMAIL

6. Go to Environment > Modification > Events. Ignore Warning.

7. Create New Entries as below to create FORM routine and to run a code whenever new entry gets created in table.

8. Click on Editor button and Use the same Subroutine name as given in above step. Create Include in FG.

9. Write below code.

10. Go to Transaction SNRO. Create New Number Range Object ZAUTO.

11. Edit Intervals

12. Give Range from 0001 to 9999.

13. Go to Transaction SM30 to maintain / create new entries in table ZTAB_EMAIL.

14. It creates entries with Auto Increment numbers automatically based on our number range ZAUTO.

Thanks for reading. Share with others to help them learning.


1 Comment

  1. Jackson
    May 14, 2022

    good, it does work on sm30, but I need to insert a new line in abap program, the serial_no column is always 0. How to make the abap program work as well?

Leave a Comment