"
Etiqueta > 7.4
Supported by

GROUP BY in LOOPs on internal tables

We’ve all sorted internal tables to use AT NEW on a LOOP.
But starting from 7.40, we can use GROUP BY on LOOPs.

The ability to group by values based on expressions or even methods is great.

The grouping is done on the first LOOP and can be processed afterwards. Try running the code below and I bet you’ll be as impressed as I was.

Ler o resto do artigo! »

Bye bye READ TABLE

Pré 7.4:


DATA l_idade type i.
READ TABLE lt_folk
  INTO ls_folk WITH KEY name = l_name.
l_age = ls_folk-age.

Pós 7.4:


data(l_age) = lt_folk[ name = l_name ]-age )

Thanks Sérgio Fraga for the tip.

Greeetings from Abapinho.

So much new stuff in 7.4, I don’t know where to begin

Abapinho will slowly start posting tips specific to AS ABAP 7.4. Slowly because there are still only a few people with access to this version. But there are so many new things to tell that I feel tempted to start posting all of them.

ABAP was a flabby middle aged guy with a beer belly. It underwent major plastic surgery and now looks like a lean 20 year old kid who can party until 9am, drink 7 gin tonics and then, before going to bed, do 100 burpees just to sleep better.

Before 7.4:


SELECT z1~campo1 z1~campo2 z1~campo3 z1~campo4 z1~campo5
       z2~campo6
 FROM z1
 INNER JOIN z2
 ON z1~campo1 = z2~campo1
 INTO CORRESPONDING FIELDS OF TABLE lt_data
 WHERE z1~campo2 = 'MALAQUIAS'.

Since 7.4:


SELECT z1~*
       z2~campo6
 FROM z1
 INNER JOIN z2
 ON z1~campo1 = z2~campo1
 INTO CORRESPONDING FIELDS OF TABLE lt_data
 WHERE z1~campo2 = 'MALAQUIAS'.

Greetings from Abapinho.


About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).