‎2008 Feb 13 3:15 PM
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
‎2008 Feb 13 3:18 PM
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
‎2008 Feb 13 3:19 PM
write at end of for the header..
loop at itab.
count1 = count1 + 1.
at end of f1
write 😕 count1.
clear count1.
endat.
endloop.
‎2008 Feb 13 3:34 PM
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.
‎2008 Feb 13 3:38 PM
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.