Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt in internal table record count

Former Member
0 Kudos

Hi,

i have an internal table with 5 fields. Last field is flag. In my internal table lot many records are there. i want to count only the records with flag 'E'. How to count the total records with 'E'.

Mohana

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
itab_temp[] = itab[].

delete itab_temp where flag NE 'E'.

describe table itab_temp line lv_lines.
3 REPLIES 3

anuj_srivastava
Active Participant
0 Kudos

Hi,

You can do this by a logic.

Put a loop at table and checking the condition .

Loop at itab.

If itab-field5 is 'E'.

count = count +1.

Endif.

Endloop.

Regards,

Anuj

awin_prabhu
Active Contributor
0 Kudos

Try like this,

Data: c type i.

Loop at itab into wa.

if wa-flag = 'E'.

c = c + 1.

endif.

Endloop.

Write:/ 'Total records', c.

OR

LOOP AT itab WHERE flag = 'E'.

c = c + 1.

ENDLOOP.

Edited by: Sap Fan on Apr 3, 2009 5:21 PM

former_member156446
Active Contributor
0 Kudos
itab_temp[] = itab[].

delete itab_temp where flag NE 'E'.

describe table itab_temp line lv_lines.