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

getting the count

Former Member
0 Likes
654

Hi guys,

i have an internal table with user name and error id and etc as fields. and i want to count the error id s in that particular itab for the particular user name .so can any body help me with the logic for this.

6 REPLIES 6
Read only

Former Member
0 Likes
623

Hi,

First sort the internal table by user id. By using the events AT NEW, ON CHANGE increment the counters looping at the internal table. Move the counter values and user id's to an internal table for display.

Read only

Former Member
0 Likes
623

Hi,

Create one internal table and work area with the fields

User name " type c.

Error count " type should be i.

Now while looping at your internal table, assign the user name to whatever value is in the loop and assign 1 to the error count field. Use the collect statment collect wa into itab.

You will get the desired result.

regards,

Advait

Read only

faisalatsap
Active Contributor
0 Likes
623

HI,

Can you please Past the Sample Values and your requied like following.

USER Error

A 1

B 1

B 2

B 3

C 1

do you need

A = 1

B = 3

C = 1

or any else Please reply.

Kind Regards,

Faisal

Edited by: Faisal Altaf on Feb 2, 2009 7:22 PM

Read only

Former Member
0 Likes
623

u can use COLLECT statement if u hve the correct comb. of Primary keys.

Edited by: Kalyan Chakravarthi on Feb 2, 2009 3:25 PM

Edited by: Kalyan Chakravarthi on Feb 2, 2009 3:26 PM

Read only

Former Member
0 Likes
623

Hi

types: begin of struct,
           uname(10),
           errid type i,
          end of struct.
data: itab type table of struct with header line,
        v_count type I.

" fill the itab with values

sort itab by uname.

loop at itab.
        at new itab-uname.
           write: / , itab-uname , v_count.
            v_count = 0.
        endat.
        v_count = v_count + 1.
endloop.

Hope this helps

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
623

thanks a lot