This article provides a comprehensive guide on creating TMG (Transaction, Module Pool, and Generation) events in SAP ABAP. It offers step-by-step instructions and explanations to help developers understand the process of designing and implementing these events effectively. By following this guide, readers will gain valuable insights into leveraging TMG events to enhance their ABAP applications within the SAP environment.
Contents
2.Create Event
On the screen that opens, the ‘New Entries’ button is clicked and the ’05’ ‘Creating a new entry’ option is selected. Then we name the Event Name as ‘Create’. (Figure-7)
By selecting the Editor button, we can proceed with the instructions depicted in Figure 8.
In the given situation, our objective is to automatically populate the Material Description (Maktx) field when we enter data in the Material (Matnr) field. To achieve this, you can utilize the provided code snippet.
Figure-9 illustrates the significance of saving and activating objects after performing this crucial step. It is essential to remember to save the changes made before proceeding further.
In our given situation, it is necessary for the Maktx field to be in a non-editable state. This is because once Matnr has been selected, the Maktx field will automatically populate with the corresponding information. To achieve this requirement…
We open the Layout tab. We open the Material description field with a double click and remove the ‘Input Field’ Tick under the program tab. In this way, the option to manually fill in the material definition field in our ‘ZEB_EVENTS’ table is turned off.(Figure-12)
Next, we can navigate to the SM30 transaction code and evaluate the Create event. To do this, follow these steps:
After choosing a material and pressing the enter key, we can observe that the description of the material is populated automatically (Figure-14).
Creating TMG Events in SAP ABAP
Now there is the Update event next. In this event, we will use the ‘Controlfield’ and ‘Clearfield’ fields that we created earlier in our Table.
When our Control Field field is selected as ‘A’, the inside of our Clearfiel field will be cleared.
To begin, we can initiate the creation of our Update event. Once we access our table (SE11), we can proceed further.
To create the TMG event in SAP ABAP, we can start by navigating through a specific path. By selecting the Figure 14 Editor button, we will be able to enter the code as shown below.
Ensure that all inactive objects are activated and remember to save any changes made. Once the activation processes have been completed, proceed to test the update event by accessing the maintenance table through the SM30 T-code.
The data we previously generated can be seen in Figure 15.
As we can see, the line where we wrote ‘A’ in our ‘Controlfield’ cleared the ‘Clearfield’ field.
4. Delete Event
In this event, we want to save the log information in another table. When we delete an item from our “ZEB_EVENTS” table that we have created before.
We go to SE11 and enter the name of our table and press the “Create” button.(Figure-17)
We configure the table by adding the necessary fields, as shown in Figure-18. In this step, we include the fields that were previously deleted from our table but are important to retain, such as material code, material description, user who performed the deletion, and deletion date (refer to Figure 18). Once we have made these changes, we save our table and proceed further.
We open the “ZEB_EVENTS” Table, which is the first table we created.(SE11) and we are following the path again.
The necessary codes to be written in the event are as mentioned below.
Retrieve the data from table lt_event and store it in ls_data using the index value.
Add the contents of table lt_data to the zeb_events_log, allowing duplicate keys to be accepted.
Ensure that all inactive objects are activated. Remember to save your progress before proceeding. Once the activation processes have been completed, we can proceed with testing the delete event. To do this, navigate to the maintenance table using the SM30 transaction code (as shown in Figure-20).
We can choose a row, remove it, and then save the changes (Figure-21).
To review the information in our log table, we can navigate to the SE16n transaction code and input the name of the table. (Figure-22)
Upon executing the table, we observe that it retains a record of the recently deleted data in its logs (Figure-23).
Make sure to remove and save the data individually for this particular instance. I have provided straightforward examples to help you understand these events better and apply them in your own situations. Hopefully, you found it beneficial.
What events occur in TMG?
There are several instances in SAP ABAP where TMG (Transaction Management) events can be created to perform specific actions. One such instance is before saving the data in the database. This event allows developers to execute custom logic or validations just before the data is saved, ensuring that all necessary checks are performed accurately.
Another important TMG event occurs after saving the data in the database. This event provides an opportunity for additional processing or triggering of subsequent actions based on the successful completion of data storage. It enables developers to implement post-save operations like sending notifications, updating related records, or performing any other required tasks.
Additionally, there are TMG events available for handling deletion operations as well. Before deleting displayed data, a pre-deletion event can be utilized to carry out any necessary verifications or cascading deletions if needed. On the other hand, an after-deletion event allows developers to perform further actions once a record has been successfully removed from display.
Apart from these basic TMG events related to save and delete operations, there are other scenarios where they can be employed effectively. For example, when creating a new entry in SAP ABAP applications, a specific TMG event can be used to execute custom code before initializing default values or setting up initial configurations for the newly created record.
Creating a table event in SAP: What is the process?
To create custom tables in SAP ABAP, follow these steps. First, click on the “Utilities” option and navigate to the “Table Maintenance Generator.” Then, enter the necessary details for the function group and propose screen numbers. Finally, click on save to complete the process. Make sure to provide a package name for your custom table.
List:
1. Click on Utilities and go to Table Maintenance Generator.
2. Enter details like function group and proposed screen numbers.
3. Save your changes with a specified package name.
4. To create TMG events: Go to Environment > Modifications > Events.
5. Define various events related to Table Maintenance Generator (TMG).
6. Use these events for adding extra functionality during table maintenance operations.
Table events in SAP: What do they entail?
The onColSelect event is triggered when a column is selected in SAP ABAP. This event allows developers to perform specific actions or implement custom logic based on the selected column.
The onCustomFilter event, on the other hand, is only called for WDUIGUIDELINE=GL20 and if the “Adjust” option was chosen in the table header menu. It provides an opportunity to handle custom filtering requirements and apply additional filters based on user selections.
Moving onto the next event, onDrop occurs when an item is dropped onto a designated area within a SAP ABAP application. This event can be utilized to process dropped items and perform relevant operations accordingly.
Similarly, the onFilter event is triggered when a filter operation takes place in SAP ABAP. Developers can use this event to respond to filter changes made by users and update data accordingly.
Next up is the onLeadSelect event which gets triggered when a leading entry (usually indicated by checkboxes) in a table or list view is selected. This enables developers to handle lead selection events and execute necessary actions based on user interactions.
When it comes to onSelect, this particular event fires whenever an item or row selection occurs within SAP ABAP applications. It allows developers to respond promptly with appropriate actions based on user-selected items or rows.
Lastly, we have the onSort event which triggers whenever sorting operations are applied within SAP ABAP applications. Developers can leverage this functionality to customize sorting behavior according to their specific requirements.
P.S: The above information has been provided keeping English language preferences for India in mind while strictly adhering that markdown formatting should not be used.
Creating a function group in SAP: How is it done?
In the Object Navigator (transaction SE80), select Function Group as the object type. Then, input the desired name for the new function group and press Enter. Confirm by selecting Yes.
Next, provide a description for the new function group in the Short Text field and save your changes. Remember to click on Save after entering the description.
Creating a custom event in SAP: How can it be done?
To create TMG events in SAP ABAP, follow these steps:
1. Go to the Events management area of the CMC (Central Management Console).
2. Locate and open the Custom Events folder.
3. Select “Manage New Event”.
4. Enter a name for the event in the Event Name box.
5. Provide a description of the event in the Description box.
By following these steps, you can create new TMG events in SAP ABAP that will allow you to manage and track specific actions or triggers within your system.
In simple terms, creating TMG (Task Manager Gateway) events in SAP ABAP allows you to define and monitor specific actions or triggers within your system. These events help streamline processes by providing notifications or executing certain tasks when predefined conditions are met.
Creating an event type in SAP: A step-by-step guide
Similarly, redefining event types for SAP business objects allows for customization and adaptation of standard SAP functionality according to specific organizational requirements. By modifying existing event types associated with SAP-provided business objects, businesses can tailor their systems to better suit their operational needs.
2) Defining Event Types for Customer-Specific Business Objects:
3) Redefining Event Types for SAP Business Objects:
Redefinition of pre-existing event types associated with standard SAP functionality enables businesses to adapt them according to their own operational needs. By modifying these predefined settings provided by SAP itself, organizations can customize their systems further while still leveraging core functionalities offered by the software.
4) Customization Benefits: