SELECT within SELECT

images/thumbnail.jpg - Thumbnail

ABAP programmers don’t explore the possibilities of SQL, probably for historical reasons. There are many who instead of using INNER JOINs still think it’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.

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.

Get information on a remote system by RFC

images/thumbnail.jpg - Thumbnail

Here’s a cool mini-function to obtain some details of a remote system accessible by RFC:

RFC_SYSTEM_INFO

I cannot give any example here because it would reveal very important secret information about my client which would certainly be used by the baddies to perform industrial espionage. But it is easy to test in SE37.

Thanks to kingofthebigmacs for the photo.

Greetings from Abapinho.

Class with loads of methods to deal with dates

images/thumbnail.jpg - Thumbnail

There are countless standard functions to make calculations with dates. There are too many of them, they are redundant and, in many cases, they are obscure or impossible to understand. I’ve been meaning to insert an article here with a list of the most useful ones. But now it’s no longer necessary.

How to debug a job

images/thumbnail.jpg - Thumbnail

Here’s a simple way to start debugging a job:

  1. Go to transaction SM37;

  2. Click on the job you want to debug;

  3. type JDBG in the command line (without /) and press ENTER;

  4. and… bang! you’re now debugging the job.

Thank you Ricardo Monteiro for the tip. And thank you Ingolf for the photo.

Greetings from Abapinho

Shortcut for time travelling

images/thumbnail.jpg - Thumbnail

Some months ago I showed how to transform the debugger into a time machine.

Today’s tip is simple but useful: there is a keyboard shortcut which makes it even simple to travel in time:

shift + F12

Just place the cursor in the line you want to travel to and then… shift+F12.

Thank you Maxsuel Maia for the tip.

Greetings from Abapinho.

Use a password manager in your life

images/thumbnail.jpg - Thumbnail

And there you go, if you read the title you know the hint.

Now, here are some hints about the hint:

Close the frozen window

images/thumbnail.jpg - Thumbnail

How many times have you been left with a “hanging” window when you end a debug?

Exemplary example of SALV

images/thumbnail.jpg - Thumbnail

Unless you want to do data editing, the only dignified way to use ALVs these days is through SALV classes. They are more modern and more elegant, and those who use them can achieve a social status until now only available to owners of a license plate.

Hold on… but not yet

images/thumbnail.jpg - Thumbnail

You are doing a LOOP AT in a 1000-line table, and you know that you want line 853. Until recently, you had two options: either hit F8 852 times, running the risk of hitting it 853 times and having to start all over again, or create a watchpoint with the condition SY-TABIX = 852 or something close, and pray that it worked.

Now you have a third option.

APPEND LINES OF class->method() TO itbl

images/thumbnail.jpg - Thumbnail

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.

I was going to do something like this: