Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rows count of internal table in abap?

Tags:

abap

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.

like image 757
Igal Serban Avatar asked Dec 26 '08 22:12

Igal Serban


People also ask

How can find number of rows in internal table in ABAP?

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.

How do you count lines in SAP ABAP?

You can simply try this. data : lv_count type i. lv_count = lines( lt_itab ).

How do I find the number of records in a table in SAP?

Well, for SAP permanent tables, standard or self-developed, you just have to go to SE16N and push on 'Number of entries' button.

What is the use of select count in SAP ABAP?

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.


2 Answers

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.

like image 129
user51478 Avatar answered Sep 17 '22 22:09

user51478


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 .

like image 26
Thorsten Avatar answered Sep 17 '22 22:09

Thorsten