SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

How to Find Internal Table Row Count in ABAP

ABAP programmers can find internal table row count in ABAP using LINES() function or DESCRIBE TABLE command as I shared codes in this ABAP tutorial.

Describe Table statement with used Lines enables ABAP developers to get the number of table rows in an ABAP internal table. ABAP Describe Table command returns an integer value with type i which gives the developer the number of rows in internal table.

An other method which is easier for programmers is to use ABAP Lines function. Lines() function takes internal table name as the only argument.

SAP

I shared the above sample ABAP codes below.
Programmers can realize that the first two sample requires a local variable defined before.
The last sample code is using inline data declaration to store the row counts of internal table.

" variable declaration to store internal table row count
Data LV_RowCnt type i.

DESCRIBE TABLE LT_PROGRAM LINES LV_RowCnt.
write :/ 'Total items count', LV_RowCnt.

LV_RowCnt = LINES( LT_PROGRAM ).
write :/ 'Total items count', LV_RowCnt .

DESCRIBE TABLE LT_PROGRAM LINES DATA(LV_RowCount).
write :/ 'Total items count', LV_RowCount .
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.