2007 Sep 28 8:36 AM
Hi
In my internal table, I have multiple entries for different divisions.
I need the count of all the distinct divisions.
For example: I have
2 records for division 20,
2 records for division 30, and
2 records for division 40.
then in this case the count value should be 3.
Can anyone suggest any logic for this.
Points will rewarded for correct answer.
Regards
2007 Sep 28 9:11 AM
try this:
data: counter(2) type n.
sort itab by division.
loop at itab.
at new division.
add 1 to counter.
endat.
endloop.
Hi
In my internal table, I have multiple entries for different divisions.
I need the count of all the distinct divisions.
For example: I have
2 records for division 20,
2 records for division 30, and
2 records for division 40.
then in this case the count value should be 3.
Can anyone suggest any logic for this.
Points will rewarded for correct answer.
Regards
2007 Sep 28 9:11 AM
try this:
data: counter(2) type n.
sort itab by division.
loop at itab.
at new division.
add 1 to counter.
endat.
endloop.
2007 Sep 28 9:20 AM
Hi,
Try the follwing it will resolve the problem. Use control break for internal table (AT new field name) & counter. increase the counter at each new loop pass: e.g.:
Loop at itab into wa.
AT NEW division.
count = count + 1.
ENDAT.
Endloop.
Reward points if helpful answer.
Ashvender.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |