Supported by
Supported by Inetum

Copy a Code Inspector variant to another system

images/thumbnail.jpg - Thumbnail

In my current customer, I have three development systems. There used to be only one. And that’s where I customized and fine tuned the Code Inspector_ variant I use to run Abap Test Cockpit. When the other two appeared, before manually copying the variant into them, I decided to investigate a little bit. Much to my surprise, I found in GitHun project upDOWNci which does exactly what I needed: export and import Code Inspector Now, copying the variant was a piece of cake.

Physical vs logical folders

images/thumbnail.jpg - Thumbnail

If in your report called APP1 you need to save a file in a server folder (ex.: /export/app1/) and you don’t want it to be a selection screen parameter, how do you do it?

Automatically close the doors you open

images/thumbnail.jpg - Thumbnail

You’re in the editor. You type ( or [ or { or ' and SAP is dumb and doesn’t close it right away like a proper IDE would. Well, Click on the lower right corner icon which gives you access to the SAPGui options where you configure code templates. In the formatting option, activate Enable Auto Brackets and voilá, SAP will now automatically close any doors you open. I don’t see why this isn’t set by default.

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.

ASSERT vs Exception

images/thumbnail.jpg - Thumbnail

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.

There is another one, called ASSERT, which should be used more often.

Get the deepest text of chained exceptions

images/thumbnail.jpg - Thumbnail

If you’re not already using ABAP Objects you’re chicken.

If you use them, I do hope you’re following the best practice of using class exceptions.

And if you’re using class exceptions you better understand the best way of using them, particularly the advantages of chaining them.

This said, here’s what brings us here today. In the post about chained exceptions I showed a way to get the text of the deepest exception in the chain by using a WHILE loop:

How to not screw up when returning a REF TO DATA

images/thumbnail.jpg - Thumbnail

I’ve been using more and more references in ABAP.

I used to use REF TO only for classes but I’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.

In this article, I’ll try to show you how to use and how not to use REF TO DATA. Let’s start by an example of how not to do it.

The curious case of the partially protected structure

images/thumbnail.jpg - Thumbnail

The other day I was trying (and failing) to modify a line of a SORTED TABLE.

Weird things happen when you pass SY-TABIX as a parameter

images/thumbnail.jpg - Thumbnail

The other day a very strange thing happened to me. I was sending SY-TABIX as a parameter into a method. Before the call it contained 1 but, once inside, the parameter’s value was 0. Weird. o_thingalizer->very_strange_thing(sy-tabix). I was hearing “Why?! Why?!” repeatedly inside my head. But suddenly I understood it! When you send some field of the SYST as a by parameter you have to pass it by value and not by reference.

Convert class exception to BAPIRET2

images/thumbnail.jpg - Thumbnail

Some time ago I wrote an article explaining a way to automatically convert classic exceptions to exception classes. Today I use this technique in almost all the exception classes that I create (and I’ve even improved it, but I’ll leave that for another post).

This tip explains the exact opposite.

Ignore indentions when comparing version

images/thumbnail.jpg - Thumbnail

Sometimes, when comparing versions, several differences show up even when we did not make changes to the code. These differences may simply be a consequence of a Pretty Printer that altered code indentations. This makes comparing the versions confusing. But ABAP Workbench lets you configure the diff tool to ignore indentations and even comments. Just press F5 while there or go to the “Display Format> Settings” menu and adapt it to your needs:

Use a Standadrd GUI status without copying it

images/thumbnail.jpg - Thumbnail

When you want to use CL_GUI_ALV_GRID in a CONTAINER you must copy a standard Status GUI from another program. For example, the GUI Status “STANDARD” of the function group SALV. And then, in the screen’s PAI you do:

SET PF-STATUS ‘STANDARD’.

And thus the little standard buttons show up on your screen.

ABAP popular saying

images/thumbnail.jpg - Thumbnail

Don’t put off until tomorrow what you can do SY-DATUM.

Create templates in SE80 by dragging stuff into the code

images/thumbnail.jpg - Thumbnail

While coding, it’s always good to have ways to speed up what we’re doing. A good one is automatic generation of templates for function and method calls.

I know 3 ways to achieve this.