Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2161

GROUP BY.. in LOOP

$
0
0

Hi,

 

Consider the below mentioned piece of code:

 

DATA: lt_sflight TYPE TABLE OF sflight.

SELECT * FROM sflight INTO TABLE lt_sflight.

LOOP AT lt_sflight ASSIGNING FIELD-SYMBOL(<ls_sflight>) GROUP BY <ls_sflight>-carrid ASSIGNING FIELD-SYMBOL(<group>).

   LOOP AT GROUP <group> ASSIGNING FIELD-SYMBOL(<ls_group>).

     BREAK-POINT.

   ENDLOOP.

ENDLOOP.


Is there any possibility to move the data of a group into another internal table at once?

e.g., if my internal table contains 4 unique values of carrid)C1, C2, C3, C4) and total number of entries in the table is 40, 10 for each value of carrid.

Now when i loop into the internal table using group by, the first time i get the group with key value as C1 and hence all the 10 entries for that group i want to do something like append lines of the group into lt_sflight2, which is another internal table of same type.

Kindly let me know if my understanding is not correct.


Viewing all articles
Browse latest Browse all 2161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>