Don't MESH with ABAP

ABAP 7.4 brought a lot of lauded novelties. Of all of them, the one less talked about is MESH. Let’s analyse it and see how unfair that has been.
ABAP 7.4 brought a lot of lauded novelties. Of all of them, the one less talked about is MESH. Let’s analyse it and see how unfair that has been.
The new way to get data from internal tables is also the new way to put data into internal tables.
Did you know that, if you SAP is recent enough, you can use complex ABAP expressions in the middle of SQL commands?
Before the modernization of ABAP in 7.40, a table lookup required an auxiliary variable and at least 4 lines of code.
Abapinho hasn’t been talking a lot about 7.40 because most of the new possibilities have already been widely discussed in other sites and we don’t want to reinvent the wheel. But, here and there, I find small useful jewels which seem to still be under the radar. This is one of them.
Some years agor I showed how to convert a normal MESSAGE into a typified exception. Meanwhile ABAP evolved a lot and now, since version 7.40, that complex solution is no longer needed.
My current client’s system is finally being upgraded to 7.50 and, after all these years stuck with the old ABAP, I am now finally able to enjoy the wonders introduced in 7.40. There are dozens of these wonders and I don’t intend to start making a post on all of them as there is already so much quality information on most of them. Besides, Abapinho always tries to write about something new or, at least, not very known. But this simple functionality, although not that extraordinary, pleases me: you no longer need to add IS INITIAL in an IF command when the condition is a method returning a boolean.
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.
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.
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.