5️⃣
TMG Events
1. Introduction
Event is always triggered by a specific action or a specific occurrence ( when a particular
time has been reached ).
The example of specific actions are mouse click, pressing a key etc. The example of
specific occurrence is running out of memory etc.
The same concept of events is applicable to TMG events and Some events trigger by
specific user action and some events trigger at specific occurrence.
2. How to go for TMG Events
Depending upon our requirement, we can add our own custom code using these TMG
events.
We can navigate to TMG events through SE11 or SE54 transaction code.
Utilities → Table Maintenance Generator → Environment → Modification → Events.
TMG Events 1
3. Requirement
Whenever a new entry is created on our Employee Table, then the manager should be by
default ‘AMRIT RAJ’.
Implementation :-
Step 1 :- Go to SE54 transaction code and give the name of your table and select the radio
button events.
Step 2 :- Click on create button.
TMG Events 2
Click on create entries.
Step 3 :- We will select this create a new entry event.
Step 4 :- Give a name for your form routine and press enter.
TMG Events 3
Ass soon as you will press enter, an editor option will automatically appear where you
can write your code.
Click on save button and click on back button.
Step 5 :- Now, to write the logic we will click on editor button and a pop up screen will
appear where you will press enter so that a include program can be created.
Step 6 :- In the program section, we will give the name of our sub routine that we have
given.
TMG Events 4
Step 7 :- Now we will write the logic to get our manager name.
Step 8 :- Activate your whole program.
Testing the implementation :-
Go to SM30 and click on maintain button for our table.
click on new entries and enter a new employee id and press enter.
TMG Events 5
You can see the data is automatically populating.
4. Avoid Deletion of TMG Events Code
Whenever you delete the TMG of your table, the logic written inside the TMG events will
be reset and removed.
Before deleting the TMG always go and check if there is any TMG event available for that
table or not.
TMG Events 6
click on no, so when you will regenerate your TMG function group and TMG event will
not be deleted.
5. Function Group not processed
Whenever, you get below kind of error, always go to SE80 and activate the function group.
TMG Events 7