Hello!.
I need to get records count of internal table with condition.
for example like loop works:
LOOP AT int_table WHERE row > 0.
ENDLOOP.
but I don't need to get records of table, I just need to count it.
Do you know how to get it ?
Describe table <table name> lines <vlines>
As I understand DESCRIBE TABLE operator count lines of all table,
and I need to count just number of records with WHERE condition.
Hi there..
int_table_1[] = int_table[]. delete int_table_1 where row > 1. describe table int_table_1 lines lv_lines. refresh int_table_1[].
Hi J@Y.
I have an internal table with large number records..
creation of new table, copying of contents and then deletion of unnecessary records is very complicated, do you know much simpler way to do that ?
data: int_table_1 type standard table of int_table. "<< this is easy int_table_1[] = int_table[].
hits very less on the performance.. Infact very very little.. dont bother much about this... ABAP has some limitations.. you got to over come that with performance.. ABAP 7.0 is gonna over come with all these issue..
what is the large number you are talking about..? how big is the number?
J@Y
>> what is the large number you are talking about..? how big is the number?
I meant many records in the table ![]()
thank you for your answer, I thought it is not less on the performance )).
So I will use your advise.
you can try this as well:
DATA : count TYPE i. LOOP AT itab WHERE condition TRANSPORTING NO FIELDS. count = count + 1. ENDLOOP.
Try with sy-index.
if you don't want to copy to another table
then you have to use loop with condition
otherwise while making SELECT from table itself you need to use WHERE conditon
a®s
Hi Paul,
To count number of records based upon any condition, use code:-
DATA : lines_count TYPE i. "for counting number of lines LOOP AT itab WHERE condition TRANSPORTING NO FIELDS. "this will not move any records into work area lines_count = lines_count + 1. "increment counter ENDLOOP. WRITE : / 'Lines :', lines_count. "print
Hope this solves your problem.
Thanks & Regards
Tarun Gambhir