Skip to Content
author's profile photo Former Member
Former Member


I have a table which I have created...

However I have a field in the Table called group ID.

Now I want the value for this field to be assigned automatically everytime I go to add a new entry using SM30.

So for example my first entry will be


My next entry then must be


and then

00003 and so on...

So Basically as you can see I want the group ID to increment in values of 1 everytime a new entry is made.

So in effect the Group ID will act as an Index....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Sep 19, 2007 at 12:33 PM

    hi Ricardo,

    if you have SM30 that means that you created a maintenance view for this table. What you can do is to change the function group behind this maintenance view, so it will add the values you need.

    Just go to the screen where you created the maintenance view, double click on the funciton module name and modify accordingly.

    hope this helps

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      What exactly do you mean... I have gone to the function group in the maintenance view of SE11 and all I get are loads of Include programs...

      Where exactly could I make this happen?

      Do you have an example of the code?

      Is it not possible to simply define this when I define the table in SE11

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 01:16 PM

    Hello Ricardo,

    You can use an event of the maintenance screen for this. When you are in table maintenance generator, goto "environment-modification-events" in the menu.

    There, you can enter one or more events that will be triggered when maintaining the table. You can add one with they type of event you want (when saving, when entering, ....), and a name of the subroutine to be created. Save and push the blue icon that will appear in this table. Than SAP will create a subroutine in the function group used for the maintenance screen. In there, you can add your code.

    Internal table <tablename>_TOTAL is available in the subroutine. This table contains all entries of the table, plus the newly added entries (field action contians 'I' for insert). Just change the fields you want to change for the newly added records. Change will be reflected in the database.

    Please reward points if helpfull.

    Kind Regards,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.