Category > Articles
Supported by
Supported by Inetum

SELECT WHERE field IN (*, x)

images/thumbnail.jpg - Thumbnail

Ok let’s go slowly on this one.

Picture a scenario in which you have a customizing table with several levels of detail which may or may not be defined:

  1. BUKRS (empresa)

  2. WERKS (plant)

  3. LGORT (depósito)

When one of the fields is empty, we treat it as a wildcard, meaning all values are valid.

Goodbye Evernote, hello Osidian

images/thumbnail.jpg - Thumbnail

After 10 years using Evernote, this year I finally started looking for better alternatives. At first Evernote was great. But it never evolved and the world moved on. So many new concepts have appeared: jardins digitais, backlinks, Zettelkasten, Evergreen notes, MOCs, etc. And Evernote is still the same, forcing you to be a note taker instead of a note maker.

Farewell Evernote, hello Notion

images/thumbnail.jpg - Thumbnail

One of the first posts in Abapinho was about Evernote. Well, it was actually about the importance of taking notes. But it suggested Evernote was the best tool for the job.

It feels like yesterday but this was 10 years ago. 10 years using Evernote to take notes. Unfortunately whoever makes Evernote probably stopped taking notes many years ago because, since then, Evernote hardly evolved. Actually, it got worse, especially in its iOS version. After 10 years, they weren’t even able to (try to?) make a decent table editor. They’re either lazy or dumb.

The simplest route to go from SELECT to RANGE

images/thumbnail.jpg - Thumbnail

Today we’ll try to optimize the code to convert a SELECT into a RANGE

Tree of Z packages - A modest proposal

images/thumbnail.jpg - Thumbnail

If you regularly read Abapinho you probably know by now that I can’t live without ABAP Package Concept. 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).

I lay here a modest proposal (unlike the original one, mine is not sarcastic) to help organize thing a bit at system level.

Save XML data in an ST (Simple Transformation)

images/thumbnail.jpg - Thumbnail

Some days ago I was using an ST (Simple Transformation) and thought that, even though its job is to convert an input into an output, it is can be used to store XML data.

Let’s asy we have the following XML:

  <cocktails>
    <cocktail id=&quot;gt&quot; nome=&quot;Gin Tonic&quot;/>
    <cocktail id=&quot;ws&quot; nome=&quot;Whiskey Sour&quot;/>
    <cocktail id=&quot;cl&quot; nome=&quot;Campari Laranja&quot;/>
  </cocktails>

When code smells

images/thumbnail.jpg - Thumbnail

It happens very often that, while programming, I smell something strange. It’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.

You don't encapsulate for it to be reused

images/thumbnail.jpg - Thumbnail

Since 1998, I hear some ABAPer colleagues saying that it’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.

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.

Refactoring: Extract method

images/thumbnail.jpg - Thumbnail

In SAP’s world, ABAP code will forever stay wherever you leave it.

On one given day, Manuel did something badly because he was on a rush or didn’t know any better. One year later António is asked to make a small change to it. António spots Manuel’s mess but he doesn’t improve it because, for some reasons, in SAP, changing something which is working, even if it’s badly implemented, is a tabu. Instead, António will add his code to the existing one and forget about it.

This attitude, when adopted by everyone, contributes to an inevitable erosion of the system’s code which, some years later, becomes unmanageable. And still, that’s the rule.

The way I see it, this is wrong and goes against the customer’s best interests. Actually, even if the customer doesn’t want me to modify old code because it’s working… I still do it. Who is he to tell me how to program?

Test function module with data loaded from a file

images/thumbnail.jpg - Thumbnail

Transaction SE37 lets you test function modules. Sometimes these function modules use tables. And sometimes you need to load these tables with a lot of data records. But the only way to do it is manually. Or maybe not…

Here’s a trick to do it using a file.

Serialization - Clone Dolly in ABAP

images/thumbnail.jpg - Thumbnail

This article was written by José Vília:

The Dolly sheep was alive in ABAP and I didn’t know about it.

Having created a class instance, I’d like to share it with another totally independent program to use it as if the instance had been created there.

It’s an ABAP Dolly sheep factory we’re talking about here, people. Serialization in the ABAP world.

ALV Grid built in error protocol

images/thumbnail.jpg - Thumbnail

We’re all lazy. It’s just human. Programmers are human. We’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.

Let he who is free of laziness throw the first rock.

I won’t!

PlantUML - Finally UML became simple to use

images/thumbnail.jpg - Thumbnail

Foreword

When I say that I like to use UML class diagrams to document my code, people think I’m crazy.

Introduction

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.

Nowadays, fortunately, we are no longer ashamed to say that the very act of programming is already in itself a way of drawing.

ABAP used to like inverting dates

images/thumbnail.jpg - Thumbnail

Every day I learn something new in ABAP. Sometimes I’d rather not learn them. Like this one.

Table T056P has a date field. While SELECTing this table using the date as criteria I couldn’t get any result even though the code seemed correct. Using SE16N I found that the date range was also not working as expected: it would only should results if the final date was put in the LOW field and the initial date in the HIGH. Bizarre.

The transaction who wanted to call another and couldn't

images/thumbnail.jpg - Thumbnail

John created transaction ZFB01 and associated it with program ZFB01 which, after doing some stuff, does a CALL TRANSACTION on FB01. Then came his friend Mike and ran transaction ZFB01.

He managed to start running it because he had permissions to do it. But half way through he got an error because he doesn’t have permissions to run transaction FB01.

Both John and Mike knew that the system administrators would never ever give Mike permission to run FB01.