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

Internal table count

Former Member
0 Likes
508

Dear friends,

I want to count the number of line items in my internal table for particular header data while in loop:

Ext : In my internal table I am having the records like this:

1 A

1 B

1 C

2 D

2 E

2 F.

  • 1,2 are header records, ABCDEF are line items

I want to know the number of line items count for each header data ( I mean to know it very first loop each time. at begin )

Thanks,

Sridhar

4 REPLIES 4
Read only

Former Member
0 Likes
484

You can do that using Control Break statement at End of .

data count type i.

loop at itab.

count = count + 1.

at end of f1.

write count.

count = 0.

endat.

endloop.

out put will be

3 , 3

Read only

Former Member
0 Likes
484

write at end of for the header..

loop at itab.

count1 = count1 + 1.

at end of f1

write 😕 count1.

clear count1.

endat.

endloop.

Read only

0 Likes
484

I want to it very first..not at endof.

In my loop at first i want to number of line item for the header data.

Read only

0 Likes
484

itab1[] = itab[].

loop at itab.

at new f1.

loop at itab1 where f1 = itab-f1.

count1 = count1 + 1. " At the very first loop U'll have the count.

endloop.

endat.

endloop.