How to get rows count of internal table in abap?

Igal Serban picture Igal Serban · Dec 26, 2008 · Viewed 345k times · Source

How do I get the row count of an internal table? I guess that I can loop on it. But there must be a saner way.

I don't know if it makes a difference but the code should run on 4.6c version.

Answer

user51478 picture user51478 · Jan 5, 2009

There is also a built-in function for this task:

variable = lines( itab_name ).

Just like the "pure" ABAP syntax described by IronGoofy, the function "lines( )" writes the number of lines of table itab_name into the variable.