09-19-2007 1:28 PM
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
00001
My next entry then must be
00002
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....
09-19-2007 1: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
09-19-2007 1:40 PM
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
09-19-2007 2: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,
Bart