Category > Tips & tricks
Supported by
Supported by Inetum

Debugging an infinite loop already in execution

images/thumbnail.jpg - Thumbnail

Imagine you have a program executing an infinite cycle or, at least, a cycle with 70x7 iterations. It is neverending, and you want to know what’s going on there.

In the past you had to go to SM50, select the process and choose from the menu “Administration | Program | Debug”.

But now there is a much easier way.

How many includes is a class made of?

images/thumbnail.jpg - Thumbnail

No matter how many times things go around in ABAP, everything ends up in SE38. Even the methods of the ABAP classes are saved in includes.

Sometimes, when there is a dump, it says the problem is, for example, here: CL_MESSAGE_HELPER=============CM001.

Unreleasing a released transport order

images/thumbnail.jpg - Thumbnail

You’ve released a transport order because you thought everything was ready. However, one more minor modification was still missing. So now you will have to create a new order and transport both of them. What a drag.

Don’t worry.

SELECT-OPTIONS default behavior

images/thumbnail.jpg - Thumbnail

Abapinho received a letter.

Mr. Abapinho,

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.

Ignore function module exceptions

images/thumbnail.jpg - Thumbnail

When calling a function module which returns exceptions you normally give them sequential numbers like this:

CALL FUNCTION 'GO_BUT_PLEASE_COME_BACK'
  EXPORTING
    ali = 'To the moon'
  EXCEPTIONS
    NOT_FOUND = 1
    GOT_LOST  = 2
    OTHERS    = 3.

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,

Let's concatenate

images/thumbnail.jpg - Thumbnail

We start with two variables:

DATA word1 TYPE string.
DATA word2 TYPE string.
DATA: phrase TYPE string.

word1 = this.
word2 = that.

And we want to concatenate them adding the word “plus” between them and, of course, separate them by space.

Write in multiple lines at the same time

images/thumbnail.jpg - Thumbnail

The ABAP editor has many curious functionalities. You can even write in multiple lines at the same time.

Where is the boolean?

images/thumbnail.jpg - Thumbnail

It’s not.

But they - the people who make and remake the ABAP itself - are trying to mend this unfortunate situation.

Look at this new functionality:

LOOP AT tbl ASSIGNING <line> CASTING

images/thumbnail.jpg - Thumbnail

Did you know that you can do a LOOP on an internal table of one type into a structure of a different type?

Block indent

images/thumbnail.jpg - Thumbnail

To indent a block of lines do the following:

Clearing the buffers of an SAP session

images/thumbnail.jpg - Thumbnail

I keep learning new transaction commands. Today I learned some which solve a problem which, although rarely, has happened to me in the past.

Did this happen to you? You make a change to a text of a data element you’re using in a table to be edited through SM30. But when you go and edit that table in SM30 the old text is still there. You activate objects, close windows, open windows, no matter what you do, the new text is not shown.

Automatic model just using CTRL-SPACE

images/thumbnail.jpg - Thumbnail

Of course you already know the “Model” button in the ABAP editor that allows you to automatically add models for function modules, calls for methods and others.

The new editor has now grown a bit (it’s now only 10 years behind Eclipse instead of 20) and it allows you to automatically complete some commands through the CTRL-SPACE shortcut.

Unlocking objects in a transport request

images/thumbnail.jpg - Thumbnail

When you touch an object and add it to a transport request, it becomes locked there by default. In a transport request you can also lock objects which are not yet locked in another order. But, once locked, how to unlock them?

Put it between parentheses

images/thumbnail.jpg - Thumbnail

Sweet little trick: when in SE38 you need to surround a word or expression with () or [] or ‘’, just select it and press ( or [ or ' and it immediately becomes (it) or [it] or ‘it’. Thank you Sérgio Fraga for the tip.

Contemplating the package

images/thumbnail.jpg - Thumbnail

You are looking at a class in SE24, a table in SE11 or a program in SE80. Now you want to see the package of this object and its content. Until recently, I would do this: first I would look in the object’s characteristics to see its package, then open a new session, go to SE80 and write the package there.

Now I’ve learned a much easier way.