Automatic Population of Values during Table Maintenance


When we need to maintain values for a custom table in a table maintenance generator, certain situations may arise where we need to automatically populate another field in a table depending on the value of one field. Or we may have some custom requirement like validating a particular entry before it is saved. There can be various other requirements which we may face when we are maintaining data a custom table.

For example say we have a custom table ZTEST_MAT.

Now we can all create the table maintenance generator for this table using menu Path Utilities –> Table Maintenance Generator.

After the TMG is successfully created, open it again in display mode and get the source code name for the TMG. It will be a module pool program.

Open the source code SAPLZTEST_MAT. And open the screen flow logic.

Put your custom module in the PAI Module. Here MODULE MODIFY_RECORD is the module in which we have put our code.

In this custom module we can write our code to, say, automatically populate the material description when the material number is entered.

In the sample code, you would notice we have the internal table ‘TOTAL’ which contains all the table records and also in ‘EXTRACT’, we have the selected records which are being displayed currently. The field <VIM_XTOTAL_KEY> contains the key.

For changing the current record, we need to modify both the corresponding EXTRACT and TOTAL table values.

The <ACTION> field indicates the current user action for that field – INSERT, UPDATE, DELETE.

Also Read: ‘Add events in the table to meet custom requirements’


We have also made the material text field display only. Now in SM30, when we try to maintain new material number. in the table, the corresponding text gets pulled in automatically. Add new entries to the table.

Now when we press Enter.

The material text is populated automatically. This is a simple example of how we can add useful features to the standard table maintenance.

If you want to get more practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

Thank you very much for your time!!

If you liked it, please share it.



Please enter your comment!
Please enter your name here