Supported by
Supported by Inetum

Compare a table across two systems

images/thumbnail.jpg - Thumbnail

The SCMP transaction compares the content of a table across two systems. It is very useful, especially for parameterization tables. It is very easy to use. It allows for the pre-selection of the registers and fields to compare. It also allows you to only display the differences, which is convenient for tables with lots of data. I don’t think any more explaining is required. Ite et videte. This tip recently appeared in the ex SAPtricks blog and I think it is so useful that I have reposted it here, in case you haven’t already seen it.

SELECT... ...ORDER BY PRIMARY KEY

images/thumbnail.jpg - Thumbnail

Although I have been using ABAP since 1998, I learn new features or options every week, and sometimes even new commands. It’s hard to believe. Today, I’ll share a little SQL option that I recently discovered. SELECT * FROM T001 INTO TABLE T_T001 ORDER BY PRIMARY KEY. I have known SELECT, FROM, INTO, TABLE and even ORDER BY for a long time. I just didn’t know of PRIMARY KEY. It orders the internal table by its key.

Function to create cartoons

images/thumbnail.jpg - Thumbnail

Cartoons always look good in a report. In a SAPGui that is boredom in blue, the more colours and cartoons there are the better it is. Luís Rocha showed me a very convenient function to fill up a report with icons.

SELECT comparing 2 fields of the same table

images/thumbnail.jpg - Thumbnail

This tip is simple and quick, but I bet 200.482 Portuguese escudos that few know it.

Syntax error when returning tables of a method

images/thumbnail.jpg - Thumbnail

When you create a return parameter in a method of a class that is a TABLE TYPE based on a type declared in the class proper, an error sometimes pops up that says:

“Type of RETURNING parameters must be fully specified.”

Steal data from a SALV

images/thumbnail.jpg - Thumbnail

A friend of a friend of a friend said that a friend of his knew a friend who explained to him in a shady club bar in the docks area of Lisbon how to steal data from a SALV.

/HS Command

images/thumbnail.jpg - Thumbnail

Most functionals, and even the hardcore functionals, knows that in order to start debugging an ABAP program, we use the /H command. But few programmers, even the hardcode programmers, will know the purpose of the /HS command.

Have you used regular expressions before?

images/thumbnail.jpg - Thumbnail

Regularly expressions have been around for ages. But they’re not very well known and even less used. They are a sort of descriptive language that allows for making research and very sophisticated replacements in alpha-numeric chains. A simple example: to validate an email address. If you have to do this through an algorithm you’ll have to work hard. However, with regular expressions, only two or three code lines and the regular expression "\b[A-Z0-9.

Dynamically call classes and methods

images/thumbnail.jpg - Thumbnail

Now, learn how to dynamically invoke a method.

Let’s go for it.

Read code from the web and execute it

images/thumbnail.jpg - Thumbnail

This is a 2-in-1 article. That is to say, you’ll learn two subjects at once.

But get ready, what you’ll learn is dynamite, and, in the wrong hands, it can implode your universe.

First, you’ll learn how to read content on the web. And right after that, assuming that this content is ABAP code, you’ll learn how to execute it in the blink of an eye.

Don't mix Z functions with maintenance views!

images/thumbnail.jpg - Thumbnail

Today’s hint is not a hint - it’s an advice.

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.

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’s true. Some do this.

I like LIKE

images/thumbnail.jpg - Thumbnail

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:

DATA: V_KUNNR LIKE KNA1-KUNNR.

With many fields avoid INTO CORRESPONDING FIELDS

images/thumbnail.jpg - Thumbnail

I have already advised here that, in tables with many fields, it’s always recommended to avoid using SELECT *, you must always select, explicitly, only the necessary fields.

But I didn’t warn you that there’s yet another optimisation worth making: avoid INTO CORRESPONDING FIELDS OF TABLE.

Free SAP course on HANA

images/thumbnail.jpg - Thumbnail

SAP started last week a free course on HANA. Run!

QUICKINFO: tip on how to give tips.

images/thumbnail.jpg - Thumbnail

In my opinion, this tip has arrived a few years too late, as it is now rare to use the WRITE command to directly write things to the screen. Therefore, we can say it’s a retro tip. A vintage tip. But let’s assume we are still in the twentieth century grappling with ABAP’s most Baroque command, WRITE. Then, imagine yourself sitting in front of SAP, listening to Pearl Jam, wearing black headphones and writing WRITEs of a series of values on the screen, which you would like the user to have more information on.