Internal Table with Group By(Part2)

The post Internal Table with Group By(Part1) was an introduction to how to use the Group By Clause when doing some group operation in internal table.

Group By addition in internal table is an alternative to the group processing AT New … in LOOP processing.

With Group By addition – it performs two things. 1. The group is formed and 2. Run over the group to perform the actual task.

It also offers some additional functionality such as the Group Size, Group Index and Without Members which is covered in this post.

Below is the SPFLI table entries-

The group is formed on CARRID with additions such as GROUP INDEX & GROUP SIZE.

The output- the first WRITE statement displays the group information such as the group field, group index and group size. The second loop actually runs over the group and shows the group member.

ASCENDING/DESCENDING can be additionally added, so that the group data can be processed in that order later.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s