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.
You can use the LINES function to get the number of rows in an internal table. Use the following syntax to call the function: DESCRIBE TABLE <Internal Table Name> LINES <Variable Name> Once the function is executed the variable will hold the number of rows in the internal table.
You can simply try this. data : lv_count type i. lv_count = lines( lt_itab ).
Well, for SAP permanent tables, standard or self-developed, you just have to go to SE16N and push on 'Number of entries' button.
COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group. COUNT( * ) (or COUNT(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
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.
You can use the following function:
DESCRIBE TABLE <itab-Name> LINES <variable>
After the call, variable contains the number of rows of the internal table .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With