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

Count

Former Member
0 Likes
370

Hello All,

In my Report I have values like

MATNR M Type

1 MT

2 MT

3 RT

4 RT

5 ST

Then,

How can i count How MANY Times MT's REPEATED in my report

The Final output looks like

MATNR count MTYPE

1 2 MT

2 2 MT

3 2 RT

4 3 RT

5 1 ST

Would u please help me in this problem?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
350

use one more field say count.

sort itab by mtype.

l_tabix =1.

loop at itab.

at new itab-mtype.

if sy-tabix NE 1.

move sy-tabix-l_tabix to itab-count.

l_tabix = sy-tabix.

append itab.

clear itab.

endif.

endat.

endloop.

2 REPLIES 2
Read only

Former Member
0 Likes
350

HI BY USEING ONE EXTRA VARIABLE

COUNT TYPE I

WHEN EVER UR PRINTING T HE OUT PUT CHECK FOR THIS mt

IF IT IS mt THEN COUNT WILL BE +1

OTHER WISE NO INCREMENT

REWRD IF USEFULL

Read only

Former Member
0 Likes
351

use one more field say count.

sort itab by mtype.

l_tabix =1.

loop at itab.

at new itab-mtype.

if sy-tabix NE 1.

move sy-tabix-l_tabix to itab-count.

l_tabix = sy-tabix.

append itab.

clear itab.

endif.

endat.

endloop.