<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>estilo on Abapinho</title><link>https://abapinho.com/en/tags/estilo/</link><description>Recent content in estilo on Abapinho</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>&amp;copy;2009-2026 Nuno Godinho</copyright><lastBuildDate>Mon, 08 Jun 2026 09:00:00 +0000</lastBuildDate><atom:link href="https://abapinho.com/en/tags/estilo/index.xml" rel="self" type="application/rss+xml"/><item><title>Attributes that are global variables in disguise</title><link>https://abapinho.com/en/2026/06/atributos-variaveis-globais/</link><pubDate>Mon, 08 Jun 2026 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2026/06/atributos-variaveis-globais/</guid><description>&lt;p>There’s nothing worse than seeing code that abuses variables. They’re so delicate, and yet they’re treated so badly. Poor things. And to those who have to read them. The worst way to treat a variable is to make it global. It’s hard to believe, but in 2025 this crime continues to plague our systems. Well, here’s a way to show them some love.&lt;/p></description></item><item><title>Kintsugi</title><link>https://abapinho.com/en/2025/10/kintsugi/</link><pubDate>Mon, 13 Oct 2025 09:00:00 +0100</pubDate><guid>https://abapinho.com/en/2025/10/kintsugi/</guid><description>&lt;p>When a porcelain object breaks in Japan, sometimes instead of throwing it away, they mend it. But they don&amp;rsquo;t mend it just any old way; they mend it with gold. This technique is called Kintsugi.&lt;/p></description></item><item><title>Why always MODIFY?</title><link>https://abapinho.com/en/2025/10/porque-modify/</link><pubDate>Mon, 06 Oct 2025 09:00:00 +0100</pubDate><guid>https://abapinho.com/en/2025/10/porque-modify/</guid><description>&lt;p>It is a common practice in ABAP to use MODIFY instead of INSERT and UPDATE. Do you do it too? Tell me why. Is it laziness? Is it fear? Is it just a matter of &amp;ldquo;whatever&amp;rdquo;? Or is it more like &amp;ldquo;screw it&amp;rdquo;?&lt;/p></description></item><item><title>Reconstants</title><link>https://abapinho.com/en/2025/02/reconstantes/</link><pubDate>Mon, 17 Feb 2025 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2025/02/reconstantes/</guid><description>&lt;p>In my current project constants are all over the place, with confusing or wrong names. It&amp;rsquo;s a mess. I&amp;rsquo;ve found a way to reorganize and rearrange the constants so that the new code can use pretty constants without messing up the old code, which can continue to use the confusing ones.&lt;/p></description></item><item><title>We finally have FINAL</title><link>https://abapinho.com/en/2025/02/final/</link><pubDate>Mon, 03 Feb 2025 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2025/02/final/</guid><description>&lt;p>There&amp;rsquo;s nothing worse than seeing people abusing variables. They&amp;rsquo;re so delicate and yet so badly treated, poor things. Here&amp;rsquo;s a way to show them some love.&lt;/p></description></item><item><title>How do you like your blank lines?</title><link>https://abapinho.com/en/2024/12/linhas-em-branco/</link><pubDate>Mon, 30 Dec 2024 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2024/12/linhas-em-branco/</guid><description>&lt;p>Everyone uses blank lines to better organize their code. But where to use them and how many? Let&amp;rsquo;s talk about that.&lt;/p></description></item><item><title>Clean data declarations</title><link>https://abapinho.com/en/2022/11/clean-data-declarations/</link><pubDate>Mon, 07 Nov 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/11/clean-data-declarations/</guid><description>&lt;p>While writing code, you should always keep present how easy it will be to maintain. This is particularly important in data declarations. And so easy to do right.&lt;/p></description></item><item><title>IF branches should be small</title><link>https://abapinho.com/en/2022/05/ifs-curtos/</link><pubDate>Mon, 02 May 2022 09:00:00 +0100</pubDate><guid>https://abapinho.com/en/2022/05/ifs-curtos/</guid><description>&lt;p>Picture yourself as a monkey hanging from a tree branch. You want to jump to another branch but it&amp;rsquo;s so far away that you cannot see it. If you jump you&amp;rsquo;ll probably fall to the ground. That&amp;rsquo;s bad.&lt;/p></description></item><item><title>Escape from hackers</title><link>https://abapinho.com/en/2022/03/escape/</link><pubDate>Mon, 28 Mar 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/03/escape/</guid><description>&lt;p>Data entered by the user is one of the main vulnerabilities of a programme.&lt;/p></description></item><item><title>Do just one task per LOOP</title><link>https://abapinho.com/en/2022/03/split-loop/</link><pubDate>Mon, 14 Mar 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/03/split-loop/</guid><description>&lt;p>When ABAP programmers run into a LOOP they like to use it to get as many things done as possible. Even if that LOOP ends up having hundreds or thousands of lines.&lt;/p></description></item><item><title>Avoid obsolete ABAP</title><link>https://abapinho.com/en/2022/03/obsoletos/</link><pubDate>Mon, 07 Mar 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/03/obsoletos/</guid><description>&lt;p>ABAP evolves (even though it stood mostly still for too many years). And as it evolves, it leaves behind some commands and syntax constructions which are replaced by better ones.&lt;/p>
&lt;p>Besides learning what&amp;rsquo;s new it is also important to learn what becomes obsolete.&lt;/p></description></item><item><title>A program is an animal</title><link>https://abapinho.com/en/2022/02/animal/</link><pubDate>Mon, 28 Feb 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/02/animal/</guid><description>&lt;p>When a program is bad because it has duplicate code, it usually becomes shorter once we rewrite it to make it better. But, if its problem is not being properly structured into several classes and methods, if we rewrite it according to the best practices, it will probably end up longer.&lt;/p></description></item><item><title>Keep code blocks short</title><link>https://abapinho.com/en/2022/02/blocos-curtos/</link><pubDate>Mon, 07 Feb 2022 09:00:00 +0000</pubDate><guid>https://abapinho.com/en/2022/02/blocos-curtos/</guid><description>&lt;p>Unfortunately that is not what happens in most of the Z code I have seen in my life as an ABAP programmer. Both IFs and LOOPs tend to grow bigger than anyone can deal with. I recently ran into a LOOP with over 1500 lines.&lt;/p></description></item><item><title>if you love your neighbour, avoid CLEAR</title><link>https://abapinho.com/en/2021/12/evita-o-clear/</link><pubDate>Mon, 13 Dec 2021 09:00:59 +0000</pubDate><guid>https://abapinho.com/en/2021/12/evita-o-clear/</guid><description>&lt;p>Please stop. Too many regressions happen because someone forgets to CLEAR or to not CLEAR a variable.&lt;/p></description></item><item><title>IF conditions should be simple to read</title><link>https://abapinho.com/en/2021/11/as-condicoes-if-devem-ser-simples-de-entender/</link><pubDate>Mon, 01 Nov 2021 09:00:45 +0000</pubDate><guid>https://abapinho.com/en/2021/11/as-condicoes-if-devem-ser-simples-de-entender/</guid><description>&lt;p>Because&amp;hellip;why should they be complex to read? It would only make it harder to maintain in the future.&lt;/p>
&lt;p>Just because an IF condition is complex doesn&amp;rsquo;t mean it has to be complicated.&lt;/p></description></item><item><title>SELECT WHERE field IN (*, x)</title><link>https://abapinho.com/en/2021/07/select-where-field-in-a-b/</link><pubDate>Mon, 19 Jul 2021 09:00:53 +0000</pubDate><guid>https://abapinho.com/en/2021/07/select-where-field-in-a-b/</guid><description>&lt;p>Ok let&amp;rsquo;s go slowly on this one.&lt;/p>
&lt;p>Picture a scenario in which you have a customizing table with several levels of detail which may or may not be defined:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>BUKRS (empresa)&lt;/p>
&lt;/li>
&lt;li>
&lt;p>WERKS (plant)&lt;/p>
&lt;/li>
&lt;li>
&lt;p>LGORT (depósito)&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>When one of the fields is empty, we treat it as a wildcard, meaning all values are valid.&lt;/p></description></item><item><title>Insert without raising exception in internal table with unique key</title><link>https://abapinho.com/en/2021/07/insert-into-table/</link><pubDate>Mon, 05 Jul 2021 09:00:51 +0000</pubDate><guid>https://abapinho.com/en/2021/07/insert-into-table/</guid><description>&lt;p>How many times in your ABAP consultant life did you have to deal with dumps happening as a consequence of a program trying to insert duplicate lines into an internal table defined with a UNIQUE KEY?&lt;/p>
&lt;p>Enough.&lt;/p></description></item><item><title>Local dummy functions named after remote RFC functions</title><link>https://abapinho.com/en/2021/05/funcoes-manequins/</link><pubDate>Mon, 10 May 2021 09:00:54 +0000</pubDate><guid>https://abapinho.com/en/2021/05/funcoes-manequins/</guid><description>I recently started working in a new customer and noticed something they do here which I really liked. Whenever they need to call a remote function module by RFC in another SAP system, they create a local function module with the same name and leave it empty, except for a comment explaining that it is a dummy function for that remote function call.
Thanks to this simple trick, one can use the where-used tool to find out where it is being called.</description></item><item><title>Table lookup without having to deal with CX_SY_ITAB_LINE_NOT_FOUND</title><link>https://abapinho.com/en/2020/06/lookup-em-tabela-sem-ter-de-lidar-com-a-excepcao-cx_sy_itab_line_not_found/</link><pubDate>Mon, 15 Jun 2020 09:00:08 +0000</pubDate><guid>https://abapinho.com/en/2020/06/lookup-em-tabela-sem-ter-de-lidar-com-a-excepcao-cx_sy_itab_line_not_found/</guid><description>&lt;p>Before the modernization of ABAP in 7.40, a table lookup required an auxiliary variable and at least 4 lines of code.&lt;/p></description></item><item><title>Clean ABAP</title><link>https://abapinho.com/en/2020/05/clean-abap/</link><pubDate>Wed, 13 May 2020 12:54:21 +0000</pubDate><guid>https://abapinho.com/en/2020/05/clean-abap/</guid><description>&lt;p>For many years, when confronted with ABAP OO, most ABAPers I talked to, acknowledged that OO is great for most languages but never saw any real advantage in adopting it for ABAP. So they carry on using FORMs, INCLUDEs and CALL FUNCTIONs. The standard SAP code sets the example by trying to make something work while breaking every possible programming best practice.&lt;/p></description></item><item><title>NOT</title><link>https://abapinho.com/en/2020/04/nao/</link><pubDate>Tue, 28 Apr 2020 12:08:03 +0000</pubDate><guid>https://abapinho.com/en/2020/04/nao/</guid><description>&lt;p>No,
ABAP
&lt;a href="https://blogs.sap.com/2014/09/29/abap-news-for-740-sp08-logical-expressions/#comment-82607">will never have&lt;/a>
the NOT operator.&lt;/p></description></item><item><title>MOVE-CORRESPONDING between two tables with automatic look up</title><link>https://abapinho.com/en/2020/03/move-corresponding-entre-duas-tabelas-respeitando-a-chave/</link><pubDate>Mon, 23 Mar 2020 09:00:04 +0000</pubDate><guid>https://abapinho.com/en/2020/03/move-corresponding-entre-duas-tabelas-respeitando-a-chave/</guid><description>&lt;p>Abapinho hasn&amp;rsquo;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&amp;rsquo;t want to reinvent the wheel.&lt;/p>
&lt;p>But, here and there, I find small useful jewels which seem to still be under the radar. This is one of them.&lt;/p></description></item><item><title>The simplest route to go from SELECT to RANGE</title><link>https://abapinho.com/en/2019/11/o-caminho-mais-curto-para-ir-de-select-a-range/</link><pubDate>Wed, 13 Nov 2019 10:21:31 +0000</pubDate><guid>https://abapinho.com/en/2019/11/o-caminho-mais-curto-para-ir-de-select-a-range/</guid><description>&lt;p>Today we&amp;rsquo;ll try to optimize the code to convert a SELECT into a RANGE&lt;/p></description></item><item><title>It's now so simple to convert a MESSAGE into an EXCEPTION</title><link>https://abapinho.com/en/2019/11/converter-message-em-exception/</link><pubDate>Mon, 04 Nov 2019 10:30:44 +0000</pubDate><guid>https://abapinho.com/en/2019/11/converter-message-em-exception/</guid><description>&lt;p>Some years agor I &lt;a href="https://abapinho.com/en/2015/06/converter-excepcao-em-classe-de-excepcao/">showed how to convert a normal MESSAGE into a typified exception&lt;/a>. Meanwhile ABAP evolved a lot and now, since version 7.40, that complex solution is no longer needed.&lt;/p></description></item><item><title>Tree of Z packages - A modest proposal</title><link>https://abapinho.com/en/2019/10/arvore-de-pacotes-z/</link><pubDate>Wed, 23 Oct 2019 09:00:46 +0000</pubDate><guid>https://abapinho.com/en/2019/10/arvore-de-pacotes-z/</guid><description>&lt;p>If you regularly read Abapinho you probably know by now that I can&amp;rsquo;t live without &lt;a href="https://abapinho.com/en/2016/11/pacotes-locais/">ABAP Package Concept&lt;/a>. Nowadays the first thing I do when starting a new development is creating an encapsulated package to hold all its objects (in the most complex scenarios, I create it as a main package and then create multiple child sub-packages).&lt;/p>
&lt;p>I lay here a modest proposal (unlike &lt;a href="https://en.wikipedia.org/wiki/A_Modest_Proposal">the original one&lt;/a>, mine is not sarcastic) to help organize thing a bit at system level.&lt;/p></description></item><item><title>IF without IS INITIAL in boolean methods</title><link>https://abapinho.com/en/2019/08/if-sem-is-initial-em-metodos-booleanos/</link><pubDate>Tue, 27 Aug 2019 09:00:07 +0000</pubDate><guid>https://abapinho.com/en/2019/08/if-sem-is-initial-em-metodos-booleanos/</guid><description>&lt;p>My current client&amp;rsquo;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.&lt;/p>
&lt;p>There are dozens of these wonders and I don&amp;rsquo;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.&lt;/p>
&lt;p>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.&lt;/p></description></item><item><title>When code smells</title><link>https://abapinho.com/en/2019/02/quando-o-codigo-cheira-mal/</link><pubDate>Mon, 25 Feb 2019 09:00:12 +0000</pubDate><guid>https://abapinho.com/en/2019/02/quando-o-codigo-cheira-mal/</guid><description>&lt;p>It happens very often that, while programming, I smell something strange. It&amp;rsquo;s usually hard to identify it right away. It usually starts like a faint fragrance. But, as I become more aware of it, eventually it starts stinking and I understand where it comes from. Even then it is not immediately clear why that particular thing smells bad.&lt;/p></description></item><item><title>You don't encapsulate for it to be reused</title><link>https://abapinho.com/en/2019/02/nao-e-para-reutilizar-que-se-encapsula/</link><pubDate>Mon, 18 Feb 2019 09:00:18 +0000</pubDate><guid>https://abapinho.com/en/2019/02/nao-e-para-reutilizar-que-se-encapsula/</guid><description>&lt;p>Since 1998, I hear some ABAPer colleagues saying that it&amp;rsquo;s not worth encapsulating a particular piece of code in a function or method because it will never be reused again. And then they go to SE38 and create yet another report full of includes.&lt;/p>
&lt;p>The idea that you should encapsulate your code for it to be reused by you or by others is one of the biggest misunderstandings of the history of our planet.&lt;/p></description></item><item><title>Refactoring: Extract method</title><link>https://abapinho.com/en/2019/01/refactorizacao-extrair-metodo/</link><pubDate>Wed, 02 Jan 2019 09:00:23 +0000</pubDate><guid>https://abapinho.com/en/2019/01/refactorizacao-extrair-metodo/</guid><description>&lt;p>In SAP&amp;rsquo;s world, ABAP code will forever stay wherever you leave it.&lt;/p>
&lt;p>On one given day, Manuel did something badly because he was on a rush or didn&amp;rsquo;t know any better. One year later António is asked to make a small change to it. António spots Manuel&amp;rsquo;s mess but he doesn&amp;rsquo;t improve it because, for some reasons, in SAP, changing something which is working, even if it&amp;rsquo;s badly implemented, is a tabu. Instead, António will add his code to the existing one and forget about it.&lt;/p>
&lt;p>This attitude, when adopted by everyone, contributes to an inevitable erosion of the system&amp;rsquo;s code which, some years later, becomes unmanageable. And still, that&amp;rsquo;s the rule.&lt;/p>
&lt;p>The way I see it, this is wrong and goes against the customer&amp;rsquo;s best interests. Actually, even if the customer doesn&amp;rsquo;t want me to modify old code because it&amp;rsquo;s working&amp;hellip; I still do it. Who is he to tell me how to program?&lt;/p></description></item><item><title>A comment on comments</title><link>https://abapinho.com/en/2018/11/comentario-sobre-comentarios/</link><pubDate>Mon, 26 Nov 2018 09:00:19 +0000</pubDate><guid>https://abapinho.com/en/2018/11/comentario-sobre-comentarios/</guid><description>&lt;p>We learn in school that all code should have comments. Then, in real life, we find that not everyone was paying attention to what was said in school. As a consequence, most code is obscure and without proper comments.&lt;/p>
&lt;p>I was always careful to comment every relevant step of my code, specially the parts which are obscure or not self-explanatory.&lt;/p>
&lt;p>But since I recently read &lt;a href="https://en.wikipedia.org/wiki/Robert_C._Martin">Uncle Bob&lt;/a>&amp;rsquo;s &lt;em>&lt;a href="https://www.goodreads.com/book/show/3735293-clean-code">Clean Code&lt;/a>&lt;/em> , my opinion on this changed. Today I believe that the less comments the better. And yet, I don&amp;rsquo;t see this as contradictory to what I used to think.&lt;/p></description></item><item><title>ABAP, the lobotomizer</title><link>https://abapinho.com/en/2018/10/abap-o-lobotomizador/</link><pubDate>Mon, 15 Oct 2018 09:27:05 +0000</pubDate><guid>https://abapinho.com/en/2018/10/abap-o-lobotomizador/</guid><description>&lt;p>João studies Computer Science at his College where he learns Java, polymorphism, encapsulation and a lot of other programming techniques and best practices. When he graduates, he decides to join a company to work in SAP. At the introduction training which his new company offers, the first thing he learns is how to make a program in ABAP. Here&amp;rsquo;s how they teach it:&lt;/p>
&lt;p>_&amp;ldquo;Go to transaction SE38, create program ZJOAO and then create includes ZJOAO_TOP, ZJOAO_FRM and ZJOAO_SEL. You declare all variables in _TOP, the selection screen you put in _SEL and all the FORMS must go into &lt;em>FRM. Then write START-OF-SELECTION and under that put all the SELECTs and finally write END-OF-SELECTION and there you show the results in an ALV. It&amp;rsquo;s that simple. Welcome to ABAP.&amp;rdquo;&lt;/em>&lt;/p></description></item><item><title>Serialization - Clone Dolly in ABAP</title><link>https://abapinho.com/en/2017/10/serializacao-abap/</link><pubDate>Mon, 30 Oct 2017 09:00:20 +0000</pubDate><guid>https://abapinho.com/en/2017/10/serializacao-abap/</guid><description>&lt;p>This article was written by José Vília:&lt;/p>
&lt;p>The Dolly sheep was alive in ABAP and I didn&amp;rsquo;t know about it.&lt;/p>
&lt;p>Having created a class instance, I&amp;rsquo;d like to share it with another totally independent program to use it as if the instance had been created there.&lt;/p>
&lt;p>It&amp;rsquo;s an ABAP Dolly sheep factory we&amp;rsquo;re talking about here, people. Serialization in the ABAP world.&lt;/p></description></item><item><title>ALV Grid built in error protocol</title><link>https://abapinho.com/en/2017/09/alv-grid-built-in-error-protocol/</link><pubDate>Mon, 11 Sep 2017 09:00:20 +0000</pubDate><guid>https://abapinho.com/en/2017/09/alv-grid-built-in-error-protocol/</guid><description>&lt;p>We&amp;rsquo;re all lazy. It&amp;rsquo;s just human. Programmers are human. We&amp;rsquo;re often lazy when it comes to the way we program something. And usually being lazy when making a program will result in someone else having more work when maintaining it.&lt;/p>
&lt;p>Let he who is free of laziness throw the first rock.&lt;/p>
&lt;p>I won&amp;rsquo;t!&lt;/p></description></item><item><title>PlantUML - Finally UML became simple to use</title><link>https://abapinho.com/en/2017/09/plantuml-finalmente-o-uml-da-para-usar/</link><pubDate>Tue, 05 Sep 2017 09:00:59 +0000</pubDate><guid>https://abapinho.com/en/2017/09/plantuml-finalmente-o-uml-da-para-usar/</guid><description>&lt;p>&lt;strong>Foreword&lt;/strong>&lt;/p>
&lt;p>When I say that I like to use UML class diagrams to document my code, people think I&amp;rsquo;m crazy.&lt;/p>
&lt;p>&lt;strong>Introduction&lt;/strong>&lt;/p>
&lt;p>The UML has gained a bad reputation because people think that, first you make the classes diagram in UML and only then write the program. But that was in 1996, when you the good practices said the first thing to do was the whole technical spec, even if no one really did it.&lt;/p>
&lt;p>Nowadays, fortunately, we are no longer ashamed to say that the very act of programming is already in itself a way of drawing.&lt;/p></description></item><item><title>ASSERT vs Exception</title><link>https://abapinho.com/en/2017/01/excepcao-vs-assert/</link><pubDate>Mon, 23 Jan 2017 09:00:56 +0000</pubDate><guid>https://abapinho.com/en/2017/01/excepcao-vs-assert/</guid><description>&lt;p>If you read Abapinho you already know how much I like exception classes. But this is not the only ABAP mechanism for dealing with errors.&lt;/p>
&lt;p>There is another one, called ASSERT, which should be used more often.&lt;/p></description></item><item><title>Get the deepest text of chained exceptions</title><link>https://abapinho.com/en/2017/01/texto-mais-profundo-de-cadeia-de-excepcoes/</link><pubDate>Mon, 16 Jan 2017 10:34:04 +0000</pubDate><guid>https://abapinho.com/en/2017/01/texto-mais-profundo-de-cadeia-de-excepcoes/</guid><description>&lt;p>If you&amp;rsquo;re not already using ABAP Objects you&amp;rsquo;re &lt;a href="https://abapinho.com/en/2012/10/mariquinhas-pe-de-salsa/">chicken&lt;/a>.&lt;/p>
&lt;p>If you use them, I do hope you&amp;rsquo;re following the &lt;a href="https://abapinho.com/en/2015/01/usaras-classes-de-excepcao/">best practice&lt;/a> of using class exceptions.&lt;/p>
&lt;p>And if you&amp;rsquo;re using class exceptions you better understand the best way of using them, particularly the &lt;a href="https://abapinho.com/en/2015/02/cadeias-de-excepcoes/">advantages of chaining them&lt;/a>.&lt;/p>
&lt;p>This said, here&amp;rsquo;s what brings us here today. In the post about &lt;a href="https://abapinho.com/en/2015/02/cadeias-de-excepcoes/">chained exceptions&lt;/a> I showed a way to get the text of the deepest exception in the chain by using a WHILE loop:&lt;/p></description></item><item><title>How to not screw up when returning a REF TO DATA</title><link>https://abapinho.com/en/2017/01/devolver-ref-to-data/</link><pubDate>Mon, 02 Jan 2017 09:00:26 +0000</pubDate><guid>https://abapinho.com/en/2017/01/devolver-ref-to-data/</guid><description>&lt;p>I&amp;rsquo;ve been using more and more references in ABAP.&lt;/p>
&lt;p>I used to use REF TO only for classes but I&amp;rsquo;ve been finding more and more advantages in using them for other data types. But, just like in C++, care must be used when dealing with data references. Things can easily go very wrong.&lt;/p>
&lt;p>In this article, I&amp;rsquo;ll try to show you how to use and how not to use REF TO DATA. Let&amp;rsquo;s start by an example of how not to do it.&lt;/p></description></item><item><title>Local $PACKAGES</title><link>https://abapinho.com/en/2016/11/pacotes-locais/</link><pubDate>Mon, 07 Nov 2016 09:00:37 +0000</pubDate><guid>https://abapinho.com/en/2016/11/pacotes-locais/</guid><description>&lt;p>Any object created in SAP must belong to a package.&lt;/p>
&lt;p>Until recently, whenever I needed to create a program for a quick test I&amp;rsquo;d put it in the $TMP package. This way I was sure that it would never be transported to another system.&lt;/p>
&lt;p>But sometimes I have the need to create stuff in the development system which, even though it should never be transported, should stay there forever. For example, development tools like ZSAPLINK and abapGit. But if we put everything under package $TMP it will soon be a big mess.&lt;/p></description></item><item><title>INSERT wa INTO itbl REFERENCE INTO ref. Bug?</title><link>https://abapinho.com/en/2016/10/reference-into-ref-bug/</link><pubDate>Mon, 03 Oct 2016 09:00:43 +0000</pubDate><guid>https://abapinho.com/en/2016/10/reference-into-ref-bug/</guid><description>&lt;p>Every day I use more reference variables in ABAP. First I used REF TO just for classes but, as I become more familiarized with its advantages, I start using them more and more for data structures, instead of field-symbols.&lt;/p>
&lt;p>But I recently found na unfortunate behavior of the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-ABAP" data-lang="ABAP">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">INSERT&lt;/span> &lt;span style="color:#000">wa&lt;/span> &lt;span style="color:#00f">INTO&lt;/span> &lt;span style="color:#000">itbl&lt;/span> &lt;span style="color:#00f">REFERENCE INTO&lt;/span> &lt;span style="color:#000">ref&lt;/span>.&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>Let me give you some context before I complain about it.&lt;/p></description></item><item><title>We should be accountable for the crap we make</title><link>https://abapinho.com/en/2016/09/deviamos-ser-responsabilizados/</link><pubDate>Mon, 19 Sep 2016 09:00:33 +0000</pubDate><guid>https://abapinho.com/en/2016/09/deviamos-ser-responsabilizados/</guid><description>&lt;p>If, when building a bridge, a civil engineer makes a mistake in one of the calculations, the bridge falls. But the bridge won&amp;rsquo;t fall alone. Most probably that engineer will also fall with it. He is accountable for what he did because he must sign his projects.&lt;/p>
&lt;p>ABAP programmers don&amp;rsquo;t have that kind of problems.&lt;/p></description></item><item><title>GROUP BY in LOOPs on internal tables</title><link>https://abapinho.com/en/2016/03/group-by-loops-tabelas-internas/</link><pubDate>Mon, 21 Mar 2016 09:00:57 +0000</pubDate><guid>https://abapinho.com/en/2016/03/group-by-loops-tabelas-internas/</guid><description>&lt;p>We&amp;rsquo;ve all sorted internal tables to use AT NEW on a LOOP.
But starting from 7.40, we can use GROUP BY on LOOPs.&lt;/p>
&lt;p>The ability to group by values based on expressions or even methods is great.&lt;/p>
&lt;p>The grouping is done on the first LOOP and can be processed afterwards. Try running the code below and I bet you&amp;rsquo;ll be as impressed as I was.&lt;/p></description></item><item><title>In ABAP's name, I baptize you</title><link>https://abapinho.com/en/2015/10/eu-te-baptizo-em-nome-do-abap/</link><pubDate>Mon, 26 Oct 2015 09:00:05 +0000</pubDate><guid>https://abapinho.com/en/2015/10/eu-te-baptizo-em-nome-do-abap/</guid><description>&lt;p>When we learn ABAP, we are taught a series of rules on how to name variables. Not everyone uses the same rules but, still, some strict rules are shared between many people:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>Local variables must start with L: L_BUKRS;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Global variables must start with G: G_MODE;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Internal tables must have T_: LT_MARA;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Structures must have S_: LS_MARA;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Object references must have R_: R_CUSTOMER;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;em>input&lt;/em> parameters must start with I, &lt;em>output&lt;/em> with O, &lt;em>changing&lt;/em> with C and &lt;em>returning&lt;/em> with R.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>And the most stupid of all, &lt;em>field-symbols&lt;/em> must start with FS_: &amp;lt;FS_MARA&amp;gt;.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>In the early XXI century those rules made some sense (except for the &lt;em>field-symbols&lt;/em> on, which was, and still is, as stupid as writing &amp;lsquo;pencil&amp;rsquo; in all our pencils). Today they don&amp;rsquo;t make much sense anymore. Let me explain.&lt;/p></description></item><item><title>CONCATENATE LINES OF itbl</title><link>https://abapinho.com/en/2015/10/concatenate-lines-of-itbl/</link><pubDate>Mon, 05 Oct 2015 09:00:50 +0000</pubDate><guid>https://abapinho.com/en/2015/10/concatenate-lines-of-itbl/</guid><description>&lt;p>If you want to serialize a set of strings stored in an internal table there are two ways to do it. One is dull, the other one is full of style.&lt;/p></description></item><item><title>Modify one field in all lines of an internal table</title><link>https://abapinho.com/en/2015/08/modificar-uma-campo-em-todas-as-linhas-de-uma-tabela-interna/</link><pubDate>Mon, 31 Aug 2015 09:00:25 +0000</pubDate><guid>https://abapinho.com/en/2015/08/modificar-uma-campo-em-todas-as-linhas-de-uma-tabela-interna/</guid><description>&lt;p>What I’m about to show you is not exactly new. It &lt;a href="https://abapinho.com/en/2011/07/range-instantaneo/">has even been used&lt;/a> in Abapinho before. But since there is still a lot of people out there using LOOP to change a single field of an internal table, I thought it would be worth talking about it.&lt;/p></description></item><item><title>DELETE vs CLEAR vs REFRESH vs FREE</title><link>https://abapinho.com/en/2015/07/delete-vs-clear-vs-refresh-vs-free/</link><pubDate>Mon, 27 Jul 2015 09:00:01 +0000</pubDate><guid>https://abapinho.com/en/2015/07/delete-vs-clear-vs-refresh-vs-free/</guid><description>&lt;p>DELETE
CLEAR
REFRESH
FREE&lt;/p>
&lt;p>These are different ways of deleting all data from an internal table. They look the same. But they aren&amp;rsquo;t.&lt;/p></description></item><item><title>CASE inside a SELECT (available soon)</title><link>https://abapinho.com/en/2015/07/case-dentro-de-select-brevemente-em-todos-os-saps/</link><pubDate>Mon, 20 Jul 2015 09:00:42 +0000</pubDate><guid>https://abapinho.com/en/2015/07/case-dentro-de-select-brevemente-em-todos-os-saps/</guid><description>Get ready because you&amp;rsquo;ll soon be running into a lot of surprises. ABAP is learning new tricks. Look at this one:
CONSTANTS: lc_menina TYPE STRING VALUE ‘GIRL&amp;#39;, lc_menino TYPE STRING VALUE ‘BOY’, lc_senhor TYPE STRING VALUE ’GENTLEMAN’, lc_senhora TYPE STRING VALUE ‘LADY’. SELECT nome, CASE WHEN sexo_id = ‘M&amp;#39; AND idade &amp;lt; 18 THEN @lc_menino WHEN sexo_id = ‘F’ AND idade &amp;lt; 18 THEN @lc_menina WHEN sexo_id = ‘M&amp;#39; AND idade &amp;gt;=18 THEN @lc_senhor WHEN sexo_id = ‘F’ AND idade &amp;gt;=18 THEN @lc_senhora END AS titulo FROM zpessoa WHERE pessoa_id = @pessoa_id INTO CORRESPONDING FIELDS OF @lt_pessoas.</description></item><item><title>Consider converting WRITE reports into ALVs</title><link>https://abapinho.com/en/2015/07/tenta-converter-writes-para-alvs/</link><pubDate>Mon, 06 Jul 2015 09:00:46 +0000</pubDate><guid>https://abapinho.com/en/2015/07/tenta-converter-writes-para-alvs/</guid><description>Reports still writing directly to the screen are very hard to maintain whenever changes to the layout are required. On such occasions, review the code and, if the effort involved is not too big, consider converting it to ALV. Always involve the functional people in this decision.</description></item><item><title>Converting an exception into an exception</title><link>https://abapinho.com/en/2015/06/converter-excepcao-em-classe-de-excepcao/</link><pubDate>Mon, 01 Jun 2015 09:00:21 +0000</pubDate><guid>https://abapinho.com/en/2015/06/converter-excepcao-em-classe-de-excepcao/</guid><description>&lt;p>If you’re still not using exception classes, then you’re making a mistake. Cause they are very healthy for your code. They’re not only good nutrients for the system, they also make it lean and less vulnerable to diseases.&lt;/p>
&lt;p>There are cases where you still need to deal with the old exceptions. For example, when a function module is invoked.&lt;/p>
&lt;p>In this article I am presenting a suggestion that seems a little complex, but it works very well if you need to integrate the old exceptions with exception class in a simple way. And though it is sophisticated, you only need to do it once. Once it&amp;rsquo;s done, it&amp;rsquo;s easy to use.&lt;/p></description></item><item><title>Thou shalt modularize, modularize, modularize</title><link>https://abapinho.com/en/2015/05/encapsularas-encapsularas-encapsularas/</link><pubDate>Mon, 11 May 2015 11:40:10 +0000</pubDate><guid>https://abapinho.com/en/2015/05/encapsularas-encapsularas-encapsularas/</guid><description>Historically ABAP programs tend to grow very loooong. All programming best practices teach us there is not a single advantage in this approach. If any routine, be it a program, a method, a function or anything else, becomes longer than 200-300 lines, question it and seriously consider refactoring it into several sub-routines. This has the added advantage of potentially increasing code reuse. But the greatest advantage is encapsulation, isolating variables in their local context, instead of having all of them together, resulting in safer and more readable code.</description></item><item><title>Thou shalt reuse, thou shalt not rewrite</title><link>https://abapinho.com/en/2015/05/reutilizaras-nao-reescreveras/</link><pubDate>Mon, 04 May 2015 09:00:28 +0000</pubDate><guid>https://abapinho.com/en/2015/05/reutilizaras-nao-reescreveras/</guid><description>If the same piece of code is repeated at least once, question yourself why and try to avoid it by creating a reusable routine. If there is more than one SELECT for the same table in a program, make sure you can’t merge them into a single one. Sometimes a smart use of RANGEs to unify parameters can avoid the need for multiple SELECTs. If the same code is used in 2 different programs, don’t repeat the code.</description></item><item><title>Thou shalt avoid global variables</title><link>https://abapinho.com/en/2015/04/evitaras-variaveis-globais/</link><pubDate>Mon, 13 Apr 2015 09:00:36 +0000</pubDate><guid>https://abapinho.com/en/2015/04/evitaras-variaveis-globais/</guid><description>The more global variables a program has, the most obscure it becomes. Please avoid them. This is a basic rule of good programming and should always be followed. Even if several variables have to be passed by parameter, it takes slightly more effort but yields a much more readable and safer code. Exceptions can be made for simple reports which run around a single internal table, which can be declared globally without compromising clarity.</description></item><item><title>How to ask if the line exists without seeming fashioned</title><link>https://abapinho.com/en/2015/04/como-perguntar-se-a-linha-existe-sem-parecer-antiquado/</link><pubDate>Mon, 06 Apr 2015 14:08:12 +0000</pubDate><guid>https://abapinho.com/en/2015/04/como-perguntar-se-a-linha-existe-sem-parecer-antiquado/</guid><description>&lt;p>Long ago, you used the expression &amp;ldquo;groovy, man&amp;rdquo;. Later came &amp;ldquo;great, man&amp;rdquo;. Then there was &amp;ldquo;cool&amp;rdquo;. Today you say &amp;ldquo;awesome&amp;rdquo;. It&amp;rsquo;s important not to get confused and not make a fool of yourself.&lt;/p>
&lt;p>And how do you ask an internal table if a line exists exists?&lt;/p></description></item><item><title>Thou shalt use TRANSPORTING NO FIELDS</title><link>https://abapinho.com/en/2015/03/usaras-transporting-no-fields/</link><pubDate>Mon, 09 Mar 2015 09:00:02 +0000</pubDate><guid>https://abapinho.com/en/2015/03/usaras-transporting-no-fields/</guid><description>Many times we do READ TABLE itbl or LOOP AT itbl just to do a CHECK SY-SUBRC = 0. In these cases, the actual data read is not needed. For these cases always use TRANSPORTING NO FIELDS. This way is faster and avoids having to declare a target structure.</description></item><item><title>SELECT-OPTIONS default behavior</title><link>https://abapinho.com/en/2015/02/pre-definir-select-options/</link><pubDate>Mon, 09 Feb 2015 09:00:23 +0000</pubDate><guid>https://abapinho.com/en/2015/02/pre-definir-select-options/</guid><description>&lt;p>Abapinho received a letter.&lt;/p>
&lt;p>Mr. Abapinho,&lt;/p>
&lt;p>Everybody knows how to set default values in select options using the DEFAULT keyword. What some people may not know is that one can also set the default option, sign and even if allows for intervals or just fixed values.&lt;/p></description></item><item><title>Chained exceptions</title><link>https://abapinho.com/en/2015/02/cadeias-de-excepcoes/</link><pubDate>Mon, 02 Feb 2015 09:00:48 +0000</pubDate><guid>https://abapinho.com/en/2015/02/cadeias-de-excepcoes/</guid><description>Today I will teach you how to chain exceptions. It’s a very practical solution to a complicated, not so obvious problem.
Let’s start by describing the problem.
Imagine you are in the application BANANA. The application is quite complex. It has three modules: BANANA1, BANANA2 and BANANA3. Each one has its exception class ZCX_BANANA1, ZCX_BANANA2 and ZCX_BANANA3. Since the application is in fact well designed, all the exception classes inherit from the same ZCX_BANANA.</description></item><item><title>Ignore function module exceptions</title><link>https://abapinho.com/en/2015/01/ignorar-excepcoes-de-um-modulo-de-funcao/</link><pubDate>Mon, 26 Jan 2015 09:00:25 +0000</pubDate><guid>https://abapinho.com/en/2015/01/ignorar-excepcoes-de-um-modulo-de-funcao/</guid><description>&lt;p>When calling a function module which returns exceptions you normally give them sequential numbers like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-ABAP" data-lang="ABAP">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">CALL FUNCTION&lt;/span> &lt;span style="color:#5a2">&amp;#39;GO_BUT_PLEASE_COME_BACK&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#00f">EXPORTING&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">ali&lt;/span> = &lt;span style="color:#5a2">&amp;#39;To the moon&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#00f">EXCEPTIONS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">NOT_FOUND&lt;/span> = &lt;span style="color:#3af">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">GOT_LOST&lt;/span> = &lt;span style="color:#3af">2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#00f">OTHERS&lt;/span> = &lt;span style="color:#3af">3&lt;/span>.&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>But Code Inspector may be configured to report a warning if afterwards you are not careful to add an IF or a CASE to look at SY-SUBRC,&lt;/p></description></item><item><title>Let's concatenate</title><link>https://abapinho.com/en/2015/01/concatenemos/</link><pubDate>Mon, 05 Jan 2015 09:00:35 +0000</pubDate><guid>https://abapinho.com/en/2015/01/concatenemos/</guid><description>&lt;p>We start with two variables:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-ABAP" data-lang="ABAP">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">DATA&lt;/span> &lt;span style="color:#000">word1&lt;/span> &lt;span style="color:#00f">TYPE &lt;/span>&lt;span style="color:#000">string&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">DATA&lt;/span> &lt;span style="color:#000">word2&lt;/span> &lt;span style="color:#00f">TYPE &lt;/span>&lt;span style="color:#000">string&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">DATA&lt;/span>: &lt;span style="color:#000">phrase&lt;/span> &lt;span style="color:#00f">TYPE &lt;/span>&lt;span style="color:#000">string&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">word1&lt;/span> = &lt;span style="color:#f00">‘&lt;/span>&lt;span style="color:#000">this&lt;/span>&lt;span style="color:#f00">’&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">word2&lt;/span> = &lt;span style="color:#f00">‘&lt;/span>&lt;span style="color:#000">that&lt;/span>&lt;span style="color:#f00">’&lt;/span>.&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>And we want to concatenate them adding the word &amp;ldquo;plus&amp;rdquo; between them and, of course, separate them by space.&lt;/p></description></item><item><title>Where is the boolean?</title><link>https://abapinho.com/en/2014/12/onde-esta-o-booleano/</link><pubDate>Wed, 10 Dec 2014 18:12:58 +0000</pubDate><guid>https://abapinho.com/en/2014/12/onde-esta-o-booleano/</guid><description>&lt;p>It&amp;rsquo;s not.&lt;/p>
&lt;p>But they - the people who make and remake the ABAP itself - are trying to mend this unfortunate situation.&lt;/p>
&lt;p>Look at this new functionality:&lt;/p></description></item><item><title>LOOP AT tbl ASSIGNING &amp;lt;line&amp;gt; CASTING</title><link>https://abapinho.com/en/2014/12/loop-at-tbl-into-linha-casting/</link><pubDate>Mon, 01 Dec 2014 09:50:19 +0000</pubDate><guid>https://abapinho.com/en/2014/12/loop-at-tbl-into-linha-casting/</guid><description>&lt;p>Did you know that you can do a LOOP on an internal table of one type into a structure of a different type?&lt;/p></description></item><item><title>Thou shalt not use CHECKs directly in user-exits</title><link>https://abapinho.com/en/2014/11/nao-usaras-checks-directamente-em-user-exits/</link><pubDate>Mon, 10 Nov 2014 09:00:51 +0000</pubDate><guid>https://abapinho.com/en/2014/11/nao-usaras-checks-directamente-em-user-exits/</guid><description>User-exits (and enhancements) are usually crowded with CHECKs. The tragic consequence is that, if the check fails, nothing else after it will run. Not even the standard code. Always try to correct these. Encapsulating the code inside a routine (ideally a method) is enough to render it harmless.</description></item><item><title>Thou shalt use LIKE LINE OF itbl</title><link>https://abapinho.com/en/2014/10/usaras-like-line-of-itbl/</link><pubDate>Mon, 20 Oct 2014 10:25:10 +0000</pubDate><guid>https://abapinho.com/en/2014/10/usaras-like-line-of-itbl/</guid><description>When declaring structures which will receive data from an internal table, instead of declaring its type directly, use LIKE LINE OF. This way not only it becomes clear that they are related but also, if you happen to change the type of the internal table, you won’t have to worry about updating the structure’s type.</description></item><item><title>Thou shalt use a constants table</title><link>https://abapinho.com/en/2014/08/usa-uma-tabela-de-constantes/</link><pubDate>Thu, 28 Aug 2014 09:00:45 +0000</pubDate><guid>https://abapinho.com/en/2014/08/usa-uma-tabela-de-constantes/</guid><description>Whenever you feel a constant value can change and you can’t add it as a user parameter, store it in ZCONSTS. This table should never be used directly. Instead, a class like ZCL_CONSTS should be created to properly access it, like shown in this article: (portuguese only)
Resist the temptation of using T900 or similar tables for this purpose. It&amp;rsquo;s true that a lot of people do it. But it&amp;rsquo;s ugly, durty and besides these tables don&amp;rsquo;t even have an adequate key because they were not designed with this in mind.</description></item><item><title>Thou shalt build up and adopt toolkits with common tools</title><link>https://abapinho.com/en/2014/08/cria-e-adopta-bibliotecas-de-ferramentas-comuns/</link><pubDate>Thu, 21 Aug 2014 09:00:04 +0000</pubDate><guid>https://abapinho.com/en/2014/08/cria-e-adopta-bibliotecas-de-ferramentas-comuns/</guid><description>Code which is used very often should be made available centrally, if possible under a single package (ex: ZTOOLS) so that it’s easily identified.
There is a lot of code already available on the Internet to accomplish several common functions (ex: ABAP2XLSX). Adopt it;
For your most common tasks, develop your own tools which you can reuse and add them to the central library;
Advertise the existence of that library among your colleagues to avoid that they waste time come up with duplicate code wasting;</description></item><item><title>Thou shalt use command TABLES only when unavoidable</title><link>https://abapinho.com/en/2014/07/usaras-o-comando-tables-so-quando-inevitavel/</link><pubDate>Thu, 31 Jul 2014 09:00:20 +0000</pubDate><guid>https://abapinho.com/en/2014/07/usaras-o-comando-tables-so-quando-inevitavel/</guid><description>Using SELECT-OPTIONS is one of the very few reasons for using TABLES. For all other cases, explicitly declare a local variable for the equivalent structure. TABLES basically creates obscure global variables which increase ambiguity in the code. And global variables should be avoided anyway.</description></item><item><title>Thou shalt use FIELD-SYMBOLs instead of working areas</title><link>https://abapinho.com/en/2014/07/usaras-field-symbols-em-vez-de-variaveis-de-estrutura/</link><pubDate>Thu, 24 Jul 2014 09:00:50 +0000</pubDate><guid>https://abapinho.com/en/2014/07/usaras-field-symbols-em-vez-de-variaveis-de-estrutura/</guid><description>READ TABLE itbl ASSIGNING is always faster than READ TABLE itbl INTO wa. Besides, when making changes to internal tables, not only it doesn’t require the explicit MODIFY but it also does away with the auxiliary TABIX variable. The only situation in which a working area is better is when adding new lines to an internal table. Some people contend that working areas should still be used when no changes are to be made to the data.</description></item><item><title>Packages 2.0</title><link>https://abapinho.com/en/2014/07/pacotes-2-0/</link><pubDate>Mon, 21 Jul 2014 09:00:12 +0000</pubDate><guid>https://abapinho.com/en/2014/07/pacotes-2-0/</guid><description>&lt;p>SAP R/3 repository is a wonderful thing. A vast warehouse of data elements, structures, tables and much more, readily available to one and all. As developers, it is extremely convenient to quickly pick these elements and pull them into our programs as necessity conveys, while our string of thought remains virtually uninterrupted.
Well, not all is sunshine and roses. If you are not careful with the mushrooms you pick you might get a poisoned one.&lt;/p></description></item><item><title>Thou shalt group related parts together</title><link>https://abapinho.com/en/2014/07/agruparas-partes-que-estejam-relacionadas/</link><pubDate>Thu, 17 Jul 2014 09:00:16 +0000</pubDate><guid>https://abapinho.com/en/2014/07/agruparas-partes-que-estejam-relacionadas/</guid><description>Sometimes you find an IMPORT in the code but you have no idea where the corresponding EXPORT is. When communication is needed between programs, it should be done using a pair of methods belonging to the same class. This way, when we run into one, we’ll always know where the other one is. Anyway, try to use EXPORT/IMPORT only when unavoidable. If possible, use static class variables instead.</description></item><item><title>Thou shalt avoid dynamic messages</title><link>https://abapinho.com/en/2014/07/evitaras-mensagens-dinamicas/</link><pubDate>Thu, 10 Jul 2014 08:30:17 +0000</pubDate><guid>https://abapinho.com/en/2014/07/evitaras-mensagens-dinamicas/</guid><description>When you need to send a dynamic message by parameter, make sure you still use the MESSAGE command, so that the “where-used” doesn’t loose track of it. When you do MESSAGE E001 INTO V_DUMMY, the message details become available in the system variables: SY-MSGNO, SY-MSGTY, etc. Also, message texts should never be hardcoded, they should always be defined in SE91. https://abapinho.com/en/2009/09/evitar-mensagens-dinamicas/ (portuguese)</description></item><item><title>Thou shalt not use direct code in user-exits</title><link>https://abapinho.com/en/2014/06/nao-implementaras-codigo-em-user-exits-badis-enhancements-etc/</link><pubDate>Thu, 26 Jun 2014 09:00:47 +0000</pubDate><guid>https://abapinho.com/en/2014/06/nao-implementaras-codigo-em-user-exits-badis-enhancements-etc/</guid><description>All code to be put in user-exits (BADIs, enhancements, SMOD, etc.) should be encapsulated.
It’s common for an user-exit to include multiple independent parts. Each of these parts should be encapsulated in its own method. Even if it is only one line;
This should apply to both new implementations and changes to existing code;
A change to existing code should always be seen as an opportunity to organize existing code into methods, since it will have to be tested again anyway;</description></item><item><title>Thou shalt not implement in classical processing blocks</title><link>https://abapinho.com/en/2014/06/nao-implementaras-blocos-de-processamento-classico/</link><pubDate>Thu, 19 Jun 2014 09:00:32 +0000</pubDate><guid>https://abapinho.com/en/2014/06/nao-implementaras-blocos-de-processamento-classico/</guid><description>Official ABAP Programming Guidelines (page 34): [When a classical processing block is required], you should immediately delegate the execution to a suitable method (see Rule 6.37, No Implementations in Function Modules and Subroutines, and Rule 6.44, No Implementations in Dialog Modules and Event Blocks).</description></item><item><title>SELECT within SELECT</title><link>https://abapinho.com/en/2014/05/select-dentro-de-select/</link><pubDate>Mon, 26 May 2014 09:00:03 +0000</pubDate><guid>https://abapinho.com/en/2014/05/select-dentro-de-select/</guid><description>&lt;p>ABAP programmers don&amp;rsquo;t explore the possibilities of SQL, probably for historical reasons. There are many who instead of using INNER JOINs still think it&amp;rsquo;s faster to do several SELECTs for internal tables and then process the data in ABAP. But the truth is that even if there are exceptions, the rule is: the lower the number of accesses to the database, the better the performance. And it makes sense because, after all, they were written explicitly for this; relational databases are much more adept at processing relational data than an ABAP program.&lt;/p>
&lt;p>There are of course things that, due to their complexity, cannot be done with a simple INNER JOIN. Nevertheless, some of these things can be done in a single SELECT.&lt;/p></description></item><item><title>Abapinho's best practices</title><link>https://abapinho.com/en/2014/03/boas-practicas-do-abapinho/</link><pubDate>Mon, 17 Mar 2014 09:00:54 +0000</pubDate><guid>https://abapinho.com/en/2014/03/boas-practicas-do-abapinho/</guid><description>Recently, I have compiled a set of personal best practices. I decided to share them here by creating a new category (which will soon appear on the menu to the left) into which they will be grouped. The original idea was to make a PDF file but, since they are constantly being reviewed and expanded, this was largely impractical. As such, they will be published one by one.
The goal is for these practices to be visible in their entirety as a user-friendly, accessible reference.</description></item><item><title>The ABAP detective</title><link>https://abapinho.com/en/2014/03/o-detective-do-abap/</link><pubDate>Mon, 10 Mar 2014 09:00:42 +0000</pubDate><guid>https://abapinho.com/en/2014/03/o-detective-do-abap/</guid><description>&lt;p>When a development is completed in SAP, the time to send it to other systems where it can be duly tested and then executed by users has finally arrived.
Before that occurs, however, it has to be checked for lapses, errors and other problems that could lead to our programmes behaving in an unpredictable manner.
There is a very useful tool that allows some of these errors and gaps to be filtered out. It is called ABAP Code Inspector.&lt;/p></description></item><item><title>APPEND LINES OF class->method() TO itbl</title><link>https://abapinho.com/en/2014/01/append-lines-of-classe-metodo-to-itbl/</link><pubDate>Mon, 27 Jan 2014 22:33:25 +0000</pubDate><guid>https://abapinho.com/en/2014/01/append-lines-of-classe-metodo-to-itbl/</guid><description>&lt;p>ABAP is getting smarter all the time. Back in my day, no one did anything with it. And now, slowly, more than a fifth of a century late, it’s trying to imitate C and Java, and becoming more flexible.&lt;/p>
&lt;p>I was going to do something like this:&lt;/p></description></item><item><title>Always use message classes in exception classes.</title><link>https://abapinho.com/en/2013/12/classes-de-mensagens-nas-classe-de-excepcao/</link><pubDate>Mon, 16 Dec 2013 09:00:49 +0000</pubDate><guid>https://abapinho.com/en/2013/12/classes-de-mensagens-nas-classe-de-excepcao/</guid><description>&lt;p>Exception classes let you state multiple texts describing the different possible errors that they can represent.&lt;/p>
&lt;p>However, there exists an option to associate it with a message class (SE91). This allows texts to be defined as classic SE91 messages instead of being defined directly in the exception class. And it has advantages.&lt;/p></description></item><item><title>Don't mix Z functions with maintenance views!</title><link>https://abapinho.com/en/2013/06/funcoes-z-com-vistas-de-manutencao-nao/</link><pubDate>Mon, 24 Jun 2013 09:00:02 +0000</pubDate><guid>https://abapinho.com/en/2013/06/funcoes-z-com-vistas-de-manutencao-nao/</guid><description>&lt;p>Today’s hint is not a hint - it’s an advice.&lt;/p>
&lt;p>After creating a table, you create its maintenance views. The maintenance views dwell within a group of functions. This group of functions is requested from you at the time of their creation. Since, after all, that’s no more than a set of generated code, and most of it is, nonetheless, standard includes. Loads.&lt;/p>
&lt;p>I give you the problem: there are those who create their own Z functions and put them in groups of functions with maintenance views. It&amp;rsquo;s true. Some do this.&lt;/p></description></item><item><title>I like LIKE</title><link>https://abapinho.com/en/2013/06/gosto-do-like/</link><pubDate>Mon, 17 Jun 2013 09:00:16 +0000</pubDate><guid>https://abapinho.com/en/2013/06/gosto-do-like/</guid><description>&lt;p>In the ‘bad old days’ when the ABAP was even more old-fashioned than today, variable statements were all made through LIKE and were referenced to table fields:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-ABAP" data-lang="ABAP">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#00f">DATA&lt;/span>: &lt;span style="color:#000">V_KUNNR&lt;/span> &lt;span style="color:#00f">LIKE &lt;/span>&lt;span style="color:#000">KNA1&lt;/span>-&lt;span style="color:#000">KUNNR&lt;/span>.&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Writing money without any decimal worries</title><link>https://abapinho.com/en/2013/05/escrever-dinheiro-sem-preocupacoes-decimais/</link><pubDate>Mon, 13 May 2013 09:00:50 +0000</pubDate><guid>https://abapinho.com/en/2013/05/escrever-dinheiro-sem-preocupacoes-decimais/</guid><description>&lt;p>Some people read the TCURX to find out the number of decimal places of a CURRENCY when they need to write a money field to an alphanumeric variable.&lt;/p>
&lt;p>Are you one of those people? Don’t be.&lt;/p></description></item><item><title>Finally, expressions can be concatenated</title><link>https://abapinho.com/en/2013/04/expressoes-encadeadas/</link><pubDate>Mon, 15 Apr 2013 09:00:33 +0000</pubDate><guid>https://abapinho.com/en/2013/04/expressoes-encadeadas/</guid><description>&lt;p>Finally, the &lt;em>SAP NetWeaver 7.0 Enhancement Package 2&lt;/em> makes ABAP start to seem like a normal programming language.&lt;/p>
&lt;p>It even allows expressions to be concatenated, no less!&lt;/p></description></item><item><title>Decimal to alphanumeric without depending on the user</title><link>https://abapinho.com/en/2013/04/decimais-para-alfa-numericos-sem-depender-do-utilizador/</link><pubDate>Mon, 08 Apr 2013 09:00:46 +0000</pubDate><guid>https://abapinho.com/en/2013/04/decimais-para-alfa-numericos-sem-depender-do-utilizador/</guid><description>&lt;p>When reading a file with numeric values to an internal table or vice versa, the success of the conversion depends on whether the user has defined the dot or comma as the decimal separator. It is customary to then go and read the user setting and then adjust the values from the file with a dot or a comma as required.&lt;/p>
&lt;p>But this is unfortunate and rather inelegant. There should be a way of not making this depend on the user.&lt;/p>
&lt;p>And there is.&lt;/p></description></item><item><title>Share constants among several classes</title><link>https://abapinho.com/en/2013/03/partilhar-constantes-entre-varias-classes/</link><pubDate>Mon, 25 Mar 2013 09:00:35 +0000</pubDate><guid>https://abapinho.com/en/2013/03/partilhar-constantes-entre-varias-classes/</guid><description>&lt;p>Imagine you have a herd of related classes sharing between them a whole bunch of constants. Saying the same thing a different way, would you like all the classes of the herd to have easy access to the bunch of constants?&lt;/p>
&lt;p>(If you’re confused, then let me tell you that the “herd” thing was just to baffle you)&lt;/p>
&lt;p>Carrying on&amp;hellip;..&lt;/p></description></item><item><title>Create RANGEs in DDIC without getting all wound up</title><link>https://abapinho.com/en/2013/03/ranges-no-ddic/</link><pubDate>Mon, 04 Mar 2013 18:26:40 +0000</pubDate><guid>https://abapinho.com/en/2013/03/ranges-no-ddic/</guid><description>&lt;p>I am using RANGEs more and more. I use them at breakfast, lunch, and dinner and outside meal times. It’s like soy sauce. A few spoonfuls and everything is instantly tastier.&lt;/p></description></item><item><title>Benefits of LIKE LINE OF</title><link>https://abapinho.com/en/2012/11/vantagens-do-like-line-of/</link><pubDate>Mon, 26 Nov 2012 09:00:40 +0000</pubDate><guid>https://abapinho.com/en/2012/11/vantagens-do-like-line-of/</guid><description>&lt;p>Let&amp;rsquo;s start by assuming that you have some dignity and so you don&amp;rsquo;t use internal tables with HEADER LINE anymore ;)&lt;/p>
&lt;p>Given this, let&amp;rsquo;s suppose you declare an internal table:&lt;/p></description></item><item><title>INSERT and APPEND with ASSIGNING FIELD-SYMBOL</title><link>https://abapinho.com/en/2012/11/insert-initial-line-into-table/</link><pubDate>Mon, 05 Nov 2012 09:00:11 +0000</pubDate><guid>https://abapinho.com/en/2012/11/insert-initial-line-into-table/</guid><description>&lt;p>The harsh truth, at all costs, is that structures are out of date. Nowadays FIELD-SYMBOLS are in.&lt;/p>
&lt;p>When you make a LOOP to an internal table of course that you also &lt;a href="https://abapinho.com/en/2011/07/assigning-vs-into/">use ASSIGNING FIELD-SYMBOL instead of INTO Structure&lt;/a>,correct?&lt;/p>
&lt;p>But what was screwing everything over was APPEND and INSERT. I did not know how to use a structure to add records&lt;/p></description></item><item><title>If you still don't use ABAP Objects you're chicken</title><link>https://abapinho.com/en/2012/10/mariquinhas-pe-de-salsa/</link><pubDate>Mon, 01 Oct 2012 09:00:20 +0000</pubDate><guid>https://abapinho.com/en/2012/10/mariquinhas-pe-de-salsa/</guid><description>SAP has a book called Official ABAP Programming Guidelines which describes rules and best practices on how to program in ABAP. In there you can read:
Page 42: Rule 3.1: Use ABAP Objects whenever possible for new and further developments. Classic processing blocks may be newly created in exceptional cases only.
Page 45: Within such a [classic] processing block, however, you should immediately delegate the execution to a suitable method (see Rule 6.</description></item><item><title>More RANGEs, less SELECTs</title><link>https://abapinho.com/en/2012/06/mais-ranges-menos-selects/</link><pubDate>Mon, 04 Jun 2012 09:00:33 +0000</pubDate><guid>https://abapinho.com/en/2012/06/mais-ranges-menos-selects/</guid><description>&lt;p>The dictionary has the following entry for &amp;ldquo;style&amp;rdquo;: &amp;ldquo;set of formal aspects and expressive resources that characterise a text.&amp;rdquo;&lt;/p>
&lt;p>It is preferable to read a text with style than one without. If ABAP were a language, a program in ABAP would be a text. When it comes to style, there are programs that seem to have been written by the feet, while there are others that one would swear the quill that wrote them was guided by the pure hand of an eighteenth century lady plagued by the troubles of love. Fortunately, I think it’s not possible to write programs in ABAP as tacky as the last sentence.&lt;/p>
&lt;p>The &amp;ldquo;style&amp;rdquo; label is used here in Abapinho to identify articles that talk about just that: style. These articles try to find ways to improve the style of ABAP programs. This is one of Abapinho’s favourite labels, as you can see &lt;a href="https://abapinho.com/tags/estilo/">here&lt;/a>. And what you are reading is another of those articles.&lt;/p>
&lt;p>Moving on.&lt;/p></description></item><item><title>Gregarious constants</title><link>https://abapinho.com/en/2012/05/constantesgregarias/</link><pubDate>Mon, 14 May 2012 10:00:28 +0000</pubDate><guid>https://abapinho.com/en/2012/05/constantesgregarias/</guid><description>&lt;p>If you are one of those who insert the values directly in code instead of using constants, then read no more and go and stand over there in the corner on punishment for 1 hour to learn not to be lazy. If you&amp;rsquo;ve come back from punishment or you usually use constants, then please continue reading.&lt;/p></description></item><item><title>Search object attributes in an internal table</title><link>https://abapinho.com/en/2012/03/atributos-de-objectos-em-tabelas-internas/</link><pubDate>Mon, 26 Mar 2012 10:00:17 +0000</pubDate><guid>https://abapinho.com/en/2012/03/atributos-de-objectos-em-tabelas-internas/</guid><description>&lt;p>There are increasingly more objects in ABAP, gradually less fear of them and, lo and behold, more and more people are writing and using them. It is normal and desirable, if objects begin to appear everywhere, to start to stuff them into internal tables. I also stored a load of objects in tables a while back, unfortunately I did not know at that time what I am going to teach you here. It could have come in handy.&lt;/p>
&lt;p>So, what exactly am I going to teach you here?&lt;/p></description></item><item><title>What does a message say?</title><link>https://abapinho.com/en/2012/01/texto-mensagem/</link><pubDate>Mon, 02 Jan 2012 10:00:15 +0000</pubDate><guid>https://abapinho.com/en/2012/01/texto-mensagem/</guid><description>Do you want to obtain the text from a message when you only know the ID and the number, but you don’t know how? Find out here:
DATA text TYPE string. MESSAGE ID &amp;#39;00&amp;#39; TYPE &amp;#39;E&amp;#39; NUMBER &amp;#39;163&amp;#39; WITH &amp;#39;123&amp;#39; INTO text. That’s all it is. Now inside the text variable, you find the following text:
&amp;ldquo;Client 123 does not exist in the system&amp;rdquo;
Thanks to Peteris B for the photo.</description></item><item><title>Automating the ALV field catalogue</title><link>https://abapinho.com/en/2011/12/automatizar-catalogo-alv/</link><pubDate>Mon, 12 Dec 2011 10:00:00 +0000</pubDate><guid>https://abapinho.com/en/2011/12/automatizar-catalogo-alv/</guid><description>&lt;p>Sometimes I ask myself what percentage of the world’s ABAP code is unnecessary. A paradigmatic example of how time can be wasted writing code which is of no use to anyone and only creates problems is the ALV’s all-too-common field description definition sitting directly in ABAP.&lt;/p></description></item><item><title>Fair thee well DESCRIBE TABLE. And good riddance.</title><link>https://abapinho.com/en/2011/11/lines/</link><pubDate>Mon, 07 Nov 2011 10:20:18 +0000</pubDate><guid>https://abapinho.com/en/2011/11/lines/</guid><description>For twelve long years When I wanted to count The lines of an itab I did what everyone does: DESCRIBE TABLE itab LINES linhas.
Until the other day When (my eyes didn’t deceive me) I saw something so new, You wouldn’t believe me: LINES( itab ).
It gives the same outcome And does away with declaring The damn variable.
So instead of:
DATA: linhas TYPE i. DESCRIBE TABLE itabl LINES linhas.</description></item><item><title>The drag queen message</title><link>https://abapinho.com/en/2011/10/mensagem-travesti/</link><pubDate>Mon, 31 Oct 2011 10:00:55 +0000</pubDate><guid>https://abapinho.com/en/2011/10/mensagem-travesti/</guid><description>The AT SELECTION-SCREEN modules of a report can throw error messages and send you back to the selection screen. But once you get past the START-OF-SELECTION, if you get an error message, the program ends. The solution to getting an error and returning to the selection screen, is to disguise the message:
START-OF-SELECTION. IF condicao_desejada. MESSAGE S208(00) with &amp;#39;Erro!&amp;#39; DISPLAY LIKE &amp;#39;E&amp;#39;. EXIT. ENDIF. WRITE &amp;#39;Olá, eu sou o resto do programa&amp;#39;.</description></item><item><title>The round-about routes of VALUE CHECK</title><link>https://abapinho.com/en/2011/10/value-check/</link><pubDate>Mon, 24 Oct 2011 10:00:24 +0000</pubDate><guid>https://abapinho.com/en/2011/10/value-check/</guid><description>Have you ever come up against something in ABAP that seems to be one thing but is in fact another? The documentation says it is this and everything seems to indicate that it is, but after all it isn’t.
You&amp;rsquo;ve probably needed to, when setting a parameter in the report selection screen, check the possibilities of what the user can input to the available values in the data type of that parameter, right?</description></item><item><title>Stand up, all victims of oppression</title><link>https://abapinho.com/en/2011/10/importar-classes-locais/</link><pubDate>Tue, 11 Oct 2011 10:55:54 +0000</pubDate><guid>https://abapinho.com/en/2011/10/importar-classes-locais/</guid><description>Classes. They have always existed among people. But there are still few who take them into consideration in ABAP. While being a supporter of classes in society can result in pedantry, the only class struggle in ABAP is that some fight for them to be used more.
There are two types of classes: global and local. The global ones are created in the SE24 transaction. Local classes, which by the way I find myself using more and more, are done declaratively in SE38.</description></item><item><title>SPLIT INTO TABLE</title><link>https://abapinho.com/en/2011/10/split-into-table/</link><pubDate>Mon, 03 Oct 2011 10:00:13 +0000</pubDate><guid>https://abapinho.com/en/2011/10/split-into-table/</guid><description>I’m going to show you a creative way of filling out an internal table with constants that I learned in a standard program. Imagine you want to create an internal table with the following kinds of financial documents:
AB AF CH DG DZ EX F3 F4.
The more conventional way would be this:
DATA: t_blart TYPE STANDARD TABLE OF blart, wa_blart LIKE LINE OF t_blart. wa_blart = &amp;#39;AB&amp;#39;. APPEND wa_blart TO t_blart.</description></item><item><title>Unparameterisable parameters</title><link>https://abapinho.com/en/2011/09/parametros-nao-parametrizaveis/</link><pubDate>Mon, 12 Sep 2011 10:00:52 +0000</pubDate><guid>https://abapinho.com/en/2011/09/parametros-nao-parametrizaveis/</guid><description>Every now and then you get a client who asks a programmer to create a write-protected parameter on the program selection screen. It’s a bit dumb given that the whole idea of parameters is that they are parameterisable.
But there you go, it takes all sorts.
Clients have so much imagination that SAP should create a cinema module, SAP CI, especially so they can screen all the films they carry around in their heads.</description></item><item><title>Upside down CASE</title><link>https://abapinho.com/en/2011/08/case-de-pernas-para-o-ar/</link><pubDate>Mon, 08 Aug 2011 10:00:47 +0000</pubDate><guid>https://abapinho.com/en/2011/08/case-de-pernas-para-o-ar/</guid><description>What is your favourite colour?
SELECTION-SCREEN BEGIN OF BLOCK b1. PARAMETERS: p_azul BUTTONGROUP GROUP COR DEFAULT &amp;#39;X&amp;#39;, p_verde BUTTONGROUP GROUP COR, p_roxo BUTTONGROUP GROUP COR. SELECTION-SCREEN END OF BLOCK b1. If you said ‘blue’ you live and can cross the bridge.
In any case, the following normally happens in ABAP to discover the colour the user chose:
IF p_azul = &amp;#39;X&amp;#39;. lv_cor = &amp;#39;AZUL&amp;#39;. ELSE IF p_verde = &amp;#39;X&amp;#39;. lv_cor = &amp;#39;VERDE&amp;#39;.</description></item><item><title>The *_SINGLE_READ functions</title><link>https://abapinho.com/en/2011/08/funcoes-single-read/</link><pubDate>Mon, 01 Aug 2011 10:43:04 +0000</pubDate><guid>https://abapinho.com/en/2011/08/funcoes-single-read/</guid><description>When you need to derive a single record from a database table, you normally use SELECT SINGLE, which is like this in its most basic form, as everyone knows:
SELECT SINGLE * FROM KNA1 WHERE KUNNR = &amp;#39;1234567890&amp;#39;. Of course, if you are interested in just a few fields, ideally you select them explicitly to avoid copying unnecessary data from one side to the other:
DATA: lv_name1 TYPE name1. SELECT SINGLE name1 INTO lv_name1 FROM KNA1 WHERE KUNNR = &amp;#39;1234567890&amp;#39;.</description></item><item><title>Instant RANGE - just add water</title><link>https://abapinho.com/en/2011/07/range-instantaneo/</link><pubDate>Mon, 11 Jul 2011 11:07:07 +0000</pubDate><guid>https://abapinho.com/en/2011/07/range-instantaneo/</guid><description>I&amp;rsquo;m going to teach you a magic formula for creating a RANGE that is almost as easy as just adding water.
Imagine that you want to create a RANGE from a database selection to then use it in another SELECT. Obviously you can do it like this:
DATA: lt_kunnr TYPE STANDARD TABLE OF kunnr, lr_kunnr TYPE RANGE OF kunnr, wa_kunnr LIKE LINE OF lr_kunnr. FIELD-SYMBOLS: &amp;lt;kunnr&amp;gt; LIKE LINE OF lt_kunnr. SELECT kunnr INTO TABLE lt_kunnr FROM kna1.</description></item><item><title>LOOP ASSIGNING instead of LOOP INTO</title><link>https://abapinho.com/en/2011/07/assigning-vs-into/</link><pubDate>Sat, 02 Jul 2011 12:25:03 +0000</pubDate><guid>https://abapinho.com/en/2011/07/assigning-vs-into/</guid><description>&lt;p>In the beginning there was INTO.
Actually, in the beginning it was not even INTO.&lt;/p></description></item><item><title>Global macros</title><link>https://abapinho.com/en/2011/05/macros-globais/</link><pubDate>Thu, 19 May 2011 18:02:41 +0000</pubDate><guid>https://abapinho.com/en/2011/05/macros-globais/</guid><description>In a previous article we talked about macros, a relatively obscure and little used feature that can be both useful as well as create a huge mess. But these aren’t the only ABAP macros. There are others that are even more obscure and with even greater potential to mix up a system: the global macros.
I don’t know if I should tell you this, as it’s so strange… But, I don’t think it’s a good idea to hide it… Therefore, I’ll tell all.</description></item><item><title>&lt;!--:pt-->Import/Export = Contrabando&lt;!--:--></title><link>https://abapinho.com/en/2010/08/importexport/</link><pubDate>Sat, 14 Aug 2010 00:37:24 +0000</pubDate><guid>https://abapinho.com/en/2010/08/importexport/</guid><description>&lt;p>O Java, uma linguagem de programação bem pensada, ajuda o programador a organizar o seu código obrigando-o a desenvolvê-lo de forma estruturada. A sua própria filosofia potencia o pensamento estruturado e promove coerência e arrumação.&lt;/p>
&lt;p>Já o ABAP&amp;hellip; promove o caos. Está cheio de caminhos perniciosos que levam direitinho a um inferno confuso e labiríntico. E geralmente são as coisas aparentemente mais convenientes que se revelam as mais perigosas.&lt;/p>
&lt;p>Uma das conveniências piores é a parelha &lt;strong>IMPORT&lt;/strong> e &lt;strong>EXPORT&lt;/strong>.&lt;/p></description></item><item><title>&lt;!--:pt-->Macros - Velocidade de ponta&lt;!--:--></title><link>https://abapinho.com/en/2009/09/macros-velocidade-de-ponta/</link><pubDate>Wed, 16 Sep 2009 02:37:52 +0000</pubDate><guid>https://abapinho.com/en/2009/09/macros-velocidade-de-ponta/</guid><description>&lt;p>Normalmente quando há um pedaço de código que pretendemos reutilizar várias vezes, transformamo-lo numa sub-rotina que pode depois ser invocada repetidamente. Embora a SAP não saiba estruturar o seu próprio código, ainda assim, o ABAP, coitadinho, permite-o. E até disponibiliza várias alternativas para modularizar o código. Eu conto quatro alternativas que listo aqui, da mais rígida para a mais flácida: METHOD, FUNCTION, FORM, DEFINE. Se os 3 primeiros são já familiar de todos, o último - DEFINE - quase ninguém usa. O DEFINE permite definir macros em ABAP. E o que são macros? São sub-rotinas aparentes.&lt;/p>
&lt;p>Aparentes porquê?&lt;/p></description></item><item><title>&lt;!--:pt-->Evitar mensagens dinâmicas&lt;!--:--></title><link>https://abapinho.com/en/2009/09/evitar-mensagens-dinamicas/</link><pubDate>Mon, 07 Sep 2009 17:40:15 +0000</pubDate><guid>https://abapinho.com/en/2009/09/evitar-mensagens-dinamicas/</guid><description>Qual é, digam lá, a melhor coisinha que o ABAP tem? É, digo eu, poder fazer where used em cima de tudo o que mexe.
E no entanto, esta maravilhosa funcionalidade só funciona maravilhosamente quando as coisas não são invocadas dinamicamente. Eu uso o where used amiúde para descobrir onde uma determinada mensagem está a ser usada. Ora não é nada incomum encontrar chamadas dinâmicas a mensagens, principalmente em casos onde as mensagens não são enviadas directamente para o utilizador mas sim, por exemplo, para o Application Log.</description></item><item><title>&lt;!--:pt-->READ TABLE blablabla TRANSPORTING NO FIELDS&lt;!--:--></title><link>https://abapinho.com/en/2009/08/transporting-no-fields/</link><pubDate>Thu, 20 Aug 2009 04:51:19 +0000</pubDate><guid>https://abapinho.com/en/2009/08/transporting-no-fields/</guid><description>Por vezes ao fazer READ TABLE a uma tabela interna queremos apenas verificar se um determinado registo existe, e não nos preocupamos com os dados retornados. Algo tipo:
READ TABLE lt_kna1 INTO wa_kna1 WITH KEY kunnr = l_kunnr. CHECK SY-SUBRC = 0. Ora já que a estrutura WA_KNA1 não vai ser necessária de qualquer forma, mais vale não a usar, usando antes a opção TRANSPORTING NO FIELDS:
READ TABLE lt_kna1 TRANSPORTING NO FIELDS WITH KEY kunnr = l_kunnr.</description></item></channel></rss>