Skip to Content
0
Former Member
May 27, 2008 at 05:40 PM

Internal Table (Consolidation)

19 Views

Hi Friends...

I got this problem. Imagine I have this Internal Table.

Table1

mandt datum repid dumpid

200 26052008 Ztest2 errorA

200 26052008 Ztest1 errorA

200 26052008 Ztest1 errorA

200 26052008 Ztest2 errorA

200 26052008 Ztest2 errorA

200 26052008 Ztest2 errorA

200 26052008 Ztest1 errorB

200 26052008 Ztest1 errorA

And I Need to "consolidated" this table and generate another table like this.

Table2

mandt datum repid dumpid QTD

200 26052008 Ztest1 errorA 3

200 26052008 Ztest1 errorB 1

200 26052008 Ztest2 errorA 4

My first step was to sort the main table by repid and dumpid.

mandt datum repid dumpid

200 26052008 Ztest1 errorA

200 26052008 Ztest1 errorA

200 26052008 Ztest1 errorA

200 26052008 Ztest1 errorB

200 26052008 Ztest2 errorA

200 26052008 Ztest2 errorA

200 26052008 Ztest2 errorA

200 26052008 Ztest2 errorA

But Im having problem with the loop. (using at end of).

Data: l_count type i.

loop at table1.

at new repid.

clear l_cont.

endat.

l_count = l_count + 1.

at end of dumpid.

table2-mandt = table1-mandt.

table2-datum = table1-datum.

table2-repid = table1-repid.

table2-dumpid = table1-dumpid.

table2-qtd = l_count.

append table2.

endat.

endloop.

But my l_count always get "cleared", because always enter at "at new repid". Am i forgeting something?