Quantcast
Channel: Tweaks
Viewing all articles
Browse latest Browse all 66

SAP TMG – No Need to Delete & Regenrate After Change of Table Structure

$
0
0

No Need to Delete and Regenerate the Table Maintenance Generator after Addition or Deletion of New Key or Non-Key Fields in Tables.

Do you know how?

Whenever we need to add a new key field or non-key field to an existing table which already has a TMG (Table Maintenance Generator), most of the developers keep a copy of all the codes written in the Tables Events and related area like PBO/PAI. So that after the new fields are added, they can delete the TMG and regenerate. Once the TMG is regenerated, all the previous codes are lost and the ABAPer has to retrofit the code back to the events from his back up.

FYI – We delete and regenarate the TMG because if we do not do it, the new fields does not get reflected in SM30 T-Code.

But what if, a new developer is in the project. He does not know that there is some custom logic written in the events. And he adds new fields and deletes existing TMG and regenerates the TMG without taking the backup?

This has been a pain in the neck even for seasoned ABAPers with over decades of hands-on experience. Today, we would show how you can add new fields and also make the existing TMG work with some simple steps without deleting the existing TMG.

Let’s start.

This is how the table looks before we add new  fields:

(Assume we have some  Events created for this table, ex:  event 05, event 06 etc…)

Step 1:   I have created a custom table with maintenance with some fields.

tmg

(Maintenance screen before adding the additional fields)

SAP TABLE

(Maintenance table)

SAP TMG

After adding the new fields to the existing table, in general, most consultants (read ABAPers) follow one difficult path of refreshing the table maintenance generator in order to make the new fields visible.

Delete the existing  TMG  and creating a new one with newly added fields to the table. If we have no events, we are lucky, we do not have any issue. But if there were events, then deleting the TMG would fade off all the logic in seconds. Once you deleted you can’t get the code back (though, there are ways to get it back).

Have you been a victim of TMG deletion? Have you ever lost any code because of TMG regeneration? 

Team SAPYard has always tried to provide solutions for the everyday small niggles. So here I come up with the alternative solution. We can get the new fields information without deleting the existing TMG. This would save the valuable time of ABAPers which they can utilize in some other productive actions ( i.e. watching soccer, cricket, stock market or the new kid in town i.e BitCoin). J

Also Read: Save the data in Customizing table without using transport number

Step 1: Added new fields to that table

Events in Table Maintenance Generator ( TMG Events ) |

Step 2: Adjust the table after addition of new fields in T-Code SE14.

Chose Activate and adjust database button and Save data.

Adjust table

Step 3:  Go back to the table (in change mode)  and click on table maintenance generator from Utilities menu item.

What Is Full Form Of TMG In Sap Term

Step  4: You would be able to see the change icon on the maintenance screen.

Click it.

table maintenance generator for standard table

Step 5:  Popup will appear on clicking the change icon.

tmg in sap tables

Step 6:  Here comes the most important section, whether you want to change or delete the fields.

If you want to add additional fields to the TMG, then select New field/sec. table in structure.

Click continue.

You must have realized, if you want to delete the fields from a table, then you need to select Field/sec. table removed from the structure.

Click continue.

Step 7: For our exercise, continuing as adding new fields

So next screen would be:

Step 8:  Here too, you have a very important decision to make. You want to add a key field or normal field?

Whether it is single screen or overview screen?

Here our situation is normal filed, with overview screen.

Click continue.

Step 9: One more popup will appear after you press the continue button.

Simply click on Continue.

Note:  Some processing time will take to activate

Then click on SAVE.

Congratulations you regenerated the TMG successfully without any hassle of deleting the TMG.

What are you waiting for? Go and check your maintenance (SM30).

Here you can see the result. Newly added fields are smiling and waiting for you to populate them.J

Also Read: Automatic Population of Values during Table Maintenance

 Follow the same procedure when you want to:

  • Add new Key fields to the table
  • Delete the fields (key/non-key) from the table

Hope you liked this trick. It might look simple but trust us, many ABAPers do not know this. Next time you change the structure of a Table, you know how to regenerate TMG without any headache. 🙂

If you GENUINELY like our articles then it would be a HUGE help if you shared, subscribed and liked us on FacebookIt might seem insignificant, but it helps more than you might think.

Also Check our Step by Step Tutorials on SAP HANA-ABAP


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>