The system uses tables, and a lot of them too. Good thing we have the table maintenance generator, otherwise a lot of coded logic would have to be developed for maintaining content. But the table generator can take things further...
The role of the database table is paramount in the SAP system, so it shouldn't be a surprise that the system lets you generate a table maintenance application for your table or view. The table maintenance generator is embedded in the Data Dictionary of a table, through transaction SE11
. The Abap developer that has never heard of this transaction, hasn't been doing Abap for more than a week or so.
How it works
After you have created your table, by defining key fields and other fields and generating the table, you can populate entries with your own program. From the menu on SE11
the table maintenance generator can be issued for which a function group will need to be supplied. Table maintenance is effectively captured in a series of generated function modules. Through transaction SM30
the table can be edited. But only if table maintenance was generated.
An overview screen an an optional detail screen is made available for the fields on the table. Add new entries, copy existing ones, delete and change. Involve the transport and correction system if you plan to transport your table content. Or ignore the recording routine, which allows editing in the test or production systems.
You have already used this setup countless times. And you can implement it for your own tables. Or views !!
SM30
or SM31
? The SM30
- "Extended table maintenance" is the most recent tcode, yet both transactions call the same SAP module pool.
Enlarge the overview screen.
The standard table maintenance generator will create an editor for your table. One of the first things I like to change for my own tables is the screen size of the overview screen. From the overview screen, new entries can be added and existing ones can be deleted. Non key fields can be altered. But the screen is populated with a minimum screen size, where especially the width makes you feel like you have to work with goggles.
The screen for the overview screen is generated by the table maintenance generator, which will add it to your own Z*
function group. Find the screen and alter it. First adjust the screen properties, to enlarge the screen width and then change the table control size to the width of the screen. Select it, appoint the new "righ bottom" position. Generate the screen. Done.
But wait: there is one thing to remember here: the next time the table maintenance generator is used on your Z-table, the change will be overwritten, and you will have to apply it again. So when a new field is added to your table, don't forget to re-apply these changes. Good reason to keep screen changes to a minimum. This hasn't stopped me from resizing my screens countless times..
Event-controlled changes
If a simple screen change doesn't capture your requirements, there is still no direct need to build your own table editor. The table maintenance generator comes with a very serious list of processing events, which can be used to enrich your editor with Abap logic. The coding that is added to events, stays with these events, even when the table is "regenerated". So in effect, you can add your checks or take things even further by filling in your Abap coding for the event or events listed here:
SE54
-> Enter Table Name (Which table you want) -> Environment -> Events -> Enter -> New Entries -> Under ' T ' -> Press F4. Then you will get below events:
01 Before saving the data in the database 02 After saving the data in the database 03 Before deleting the data displayed 04 After deleting the data displayed 05 Creating a new entry 06 After completely performing the function 'Get original' 07 Before correcting the contents of a selected field 08 After correcting the contents of a selected field 09 After getting the original of an entry 10 After creating the header entries for the change task (E071) 11 After changing a key entry for the change task (E071K) 12 After changing the key entries for the change task (E071K) 13 Exit editing (exit main function module) 14 After lock/unlock in the main function module 15 Before retrieving deleted entries 16 After retrieving deleted entries 17 Do not use. Before print: Event 26 18 After checking whether the data has changed 19 After initializing global variables, field symbols, etc. 20 after input in date subscreen (time-dep. tab./views) 21 Fill hidden fields 22 Go to long text maintenance for other languages 23 Before calling address maintenance screen 24 After restricting an entry (time-dep. tab./views) 25 Individual authorization checks 26 Before creating a list 27 After creation or copying a GUID (not a key field) 28 After entering a date restriction for time-dep. views AA Instead of the standard data read routine AB Instead of the standard database change routine AC Instead of the standard 'Get original' routine AD Instead of the standard RO field read routine AE Instead of standard positioning coding AF Instead of reading texts in other languages AG Instead of 'Get original' for texts in other languages AH Instead of DB change for texts in other languages ST GUI menu main program name AI Internal use only
The events are made available as FORM
routines, which will be called when due. Start the SM30
action and view the main report if you need more information on the overall skeleton program, which will be the function pool report for the function area. Example: you have a ZMYTABLE
table and you let the table maintenance generator create a functional area ZMYTABLES
for this. The main skeleton program for this would be SAPLZMYTABLES
. Capture multiple table maintenance applications in a single function group ? Yes sir, please do. All you need to look out for is the use of screen numbers, which should remain unique.
SAP uses this as well
This is not really a customer toolset, as SAP also utilizes the table maintenance generator. So even if you are not too interested in using this for your own tables, (which would be strange), it's good to realize this setup is used widely. How widely ? Table TVDIR
holds table maintenance settings for a table, if it is filled in, the table maintenance generator was used / is available for the table. It holds 39.308 entries on an example system, excluding Z*
tables. That's how widely this is used.