# Logic needed in internal table

Hi All,

I have an internal table as follows.

PRCTR PERNR

1 101

1 102

1 103

2 104

3 105

3 106

Now i would like to calculate the total number of employees (PERNR) against each Profit Center (PRCTR) into one more table as follows....

PRCTR PERNR

1 3

2 1

3 2

How to incorporate code to meet this logic?

Kindly help me out....

Regards

Pavan

Edited by: Pavan Sanganal on Sep 11, 2008 7:26 PM

##### Tags:

##### Valter Oliveira replied

TYPES: BEGIN OF ty_totals, PRCTR TYPE PRCTR, number TYPE i, END OF ty_totals. DATA: itab2 TYPE STANDARD TABLE OF ty_totals, wa2 TYPE ty_totals. LOOP AT itab1 INTO wa1. wa2-PRCTR = wa1-PRCTR. wa2-number = 1. COLLECT wa2 INTO itab2. ENDLOOP.

Regards,

Valter Oliveira.