Application Development and Automation 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: 
Read only

Doubt in internal table record count

Former Member
0 Likes
610

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
Read only

former_member156446
Active Contributor
0 Likes
580
itab_temp[] = itab[].

delete itab_temp where flag NE 'E'.

describe table itab_temp line lv_lines.

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

3 REPLIES 3
Read only

anuj_srivastava
Active Participant
0 Likes
580

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

Read only

awin_prabhu
Active Contributor
0 Likes
580

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

Read only

former_member156446
Active Contributor
0 Likes
581
itab_temp[] = itab[].

delete itab_temp where flag NE 'E'.

describe table itab_temp line lv_lines.