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

loop at issues

0 Likes
544

Hi All:

In my internal table i am getting data like:

10 25 abc

10 5 abc

20 37 xyz

30 2 vbp

30 5 vbp

30 2 vbp

I want the data like below.

10 30 abc

20 37 xyz

30 9 vbp

Please help me with it.

Regards,

Shegar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
518

use the COLLECT statement.

4 REPLIES 4
Read only

Former Member
0 Likes
519

use the COLLECT statement.

Read only

0 Likes
518

This should solve ur querry ..

LOOP AT IT_TABLE1 INTO IT_TABLE1.
COLLECT IT_TABLE1 INTO IT_TABLE2 .
ENDLOOP.

Read only

awin_prabhu
Active Contributor
0 Likes
518

Use COLLECT ITAB.

Read only

Former Member
0 Likes
518
Data: begin of itab1 occurs 0,
         Field1,
         Filed2,
         Field3,
         End of itab1.

Data: begin of itab2 occurs 0,
         Field1,
         Filed2,
         Field3,
         End of itab2.

Loop at Itab1.
Collect itab1 into itab2.
Endloop.

Check these codes will work.

Collect will add all non numeric keys fields .

Or.

Use:

Sort itab1 by field3.
Loop at itab1.
sum itab1.
At End of field3.
append itab1to itab2.
Endat.
Endloop.

Regards,

Gurpreet