Skip to Content

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

records in internal table

I have an internal table with fields say Field1, Field2, Field3 ....

Now say this internal table contains 10 records

Say field1 = 'A' for first record

field1 = 'B' for second record

field1 = 'B' for third record

....

Now I want to display field1 = 'A' occurs 1 times

field1 = 'B' occurs 2 times

What should be the logic for the above, can I use AT-END AT or use sy-tabix.

Edited by: M N on Oct 15, 2008 10:21 AM

Tags:
Former Member
replied

Hi

Sort the itab first then you follow as below.

LOOP AT itab INTO wa.

 ADD 1 to w_count.
AT ENDOF <field>.
  WRITE :
      / wa-field , w_count, 'TIMES'.
   CLEAR w_count.
ENDAT.

ENDLOOP>

Regards

Pavan

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question