Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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:
Former Member
Former Member 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.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question