Application Development 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: 

Count of a field

Former Member
0 Kudos

Hi

I have a material number like 1,2,,3,4,5,6,7,8 and material group like 11,11,11,11,5,5,5,5,I have to find the count of a material number haveing material group 11 and 5.How should i do that.And also i have to print in scripts

Regards

Kumar

3 REPLIES 3

Former Member
0 Kudos

hai,

loop at itab where material group = '11'.

itab11 for counting.

endloop.

describe table itab11 lines <count>.

same for material group 5.

shan.

0 Kudos

Hi

I gave example as 11 and 5 but i want to do for all material grouop..

Former Member
0 Kudos

Hi

Modify you in internal table with following structure, i mean create count field in the last.

data : begin of itab occurs 0,

matnr like mara-matnr,

matkl like mara-matkl,

count type i,

end of itab.

Create one more internal table

data : begin of itab1 occurs 0,

matnr like mara-matnr,

matkl like mara-matkl,

count type i,

end of itab1.

loop at itab.

itab-count = 1.

modify itab.

endloop.

loop at itab.

itab1-matr = itab-matnr.

itab1-matkl = itab-matkl.

itab1-count = itab-count.

collect itab1.

endloop.

Now itab1 will have count of Material group

Regards

MD