"
Categoria > Tips & Tricks
Supported by

Copy a Code Inspector variant to another system

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 InspectorLars for making this small but useful tool. Actually, thank you for the dozens of useful tools you’ve already given us. They’re quite impressive.

Greetings from Abapinho.

Physical vs logical folders

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?

Ler o resto do artigo! »

Automatically close the doors you open

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.

Thank you, Sérgio Fraga for the tip.

Greetings from Abapinho.

The curious case of the partially protected structure

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

Ler o resto do artigo! »

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

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. I was passing it by reference. But, inside the method, ABAP automatically cleaned the SY-TABIX because there it was no longer inside a loop.

Flagging it as a value parameter was all it took. The problem was solved.

It is logical but not at all obvious.

I hope someday this tip will be useful to someone.

Greetings from Abapinho.

Convert class exception to BAPIRET2

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.

Ler o resto do artigo! »

Ignore indentions when comparing version

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:

diff

You’re welcome ;)

Greetings from Abapinho.

Use a Standadrd GUI status without copying it

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.

Ler o resto do artigo! »

Create templates in SE80 by dragging stuff into the code

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.

Ler o resto do artigo! »

DDIC structure key

Today when I want to create a SALV I always create a DDIC structure with the data elements already set to show the texts I need. This avoids the need for code to manipulate the field catalog.

Ler o resto do artigo! »

Find everything at once

The ABAP editor is full of functionalities yet to be discovered.

When I do CTRL-F to search for text, the option I usually choose is “Find next”.

Ler o resto do artigo! »

APPEND STRUCTURES do more stuff than I thought

During all my ABAPian life I was convinced that APPEND STRUCTURES had one single purpose: to add new extra fields to an existing standard table.

But I recently learned that they let you do two more things after all:

Ler o resto do artigo! »

Search form methods, attributes, types, events, etc

You remember having written a method some years ago which you need now. You know it had the word MALMEQUER somewhere in its name. But what now? How will you find it?

You could use transaction SE24 to look at every class you worked on since then. But that would probably keep you busy for ages. Don’t do that.

Try using transaction SE84 instead:

Transaction SE84

Yet another way to see a method’s parameters

Let’s say you want to call a method for which you don’t know the parameters. What do you do?

You used to have to use the “pattern” button. Or open the class in a new window to look at the method’s parameters. But then the ABAP Editor evolved and we got auto-complete which made everything much more easy.

But there is yet another way.

Ler o resto do artigo! »

Incremental search

When I want to search for a word in an ABAP program I usually press CTRL-F to use the normal search feature of the ABAP editor. I enter the word I want to find and then press “NEXT” to look for it.

But there is another way. And it’s not better nor worse. Just different: the incremental search.

Ler o resto do artigo! »


About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).