In ABAP, if we want to use code to find out how many records there are in a database table, the general practice is to use SELECT COUNT.

If you’re using a HANA database, there’s a new way to do the same. The HANA database has a system view named M_TABLES that stores the metadata of the database tables.

Refer to the SAP help documentation for detailed instructions on this system view.

I wrote a tool that can query M_tables to batch obtain the number of records and storage space occupied by a series of database tables.

You can get the source code for my tool at this link. For more of Jerry’s original technical articles, please follow the public account “Wang Zixi” or scan the following QR code: