Automatic Population of Values during Table Maintenance

www.dreamstime.com
Share on Facebook7Share on LinkedIn4Tweet about this on TwitterShare on Google+0
Please Share!!

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.

Post-1-Pic-1
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.

Post-1-Pic-2
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’

[adToAppearHere]

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.

Post-1-Pic-3
Now when we press Enter.

Post-1-Pic-4
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.

Share on Facebook7Share on LinkedIn4Tweet about this on TwitterShare on Google+0
Please Share!!

About the Author

Biswadeep Roy
Biswadeep Roy
Qualification: B.Tech, M.Tech from IIT Kharagpur, India. SAP ABAP Experience since 2006. Find more about him on LinkedIn.

1 Comment on "Automatic Population of Values during Table Maintenance"

  1. Thank u so much

Leave a comment

Your email address will not be published.


*