Category > Tips & tricks
Supported by
Supported by Inetum

Forget it!

images/thumbnail.jpg - Thumbnail

O SAP GUI tem boa memória. Vai decorando os valores que lhe vamos metendo nos campos e depois sugere-os quando, mais tarde, voltamos a esses campos. Mas às vezes decora coisas que mais valia esquecer. Como por exemplo quando introduzimos um valor errado e a seguir ele insiste em sugerir-nos esse valor errado. Há uns tempos descobri que este pequeno drama tem solução. Quando, no campo, aparece a combo box com as várias hipóteses, usa as setas do teclado para te posicionares no valor que queres esquecer e depois carrega na tecla DELETE.

SPLIT INTO TABLE

images/thumbnail.jpg - Thumbnail

I’m going to show you a creative way of filling out an internal table with constants that I learned in a standard program. Imagine you want to create an internal table with the following kinds of financial documents: AB AF CH DG DZ EX F3 F4. The more conventional way would be this: DATA: t_blart TYPE STANDARD TABLE OF blart, wa_blart LIKE LINE OF t_blart. wa_blart = 'AB'. APPEND wa_blart TO t_blart.

Vertical text selection in ABAP editor - really? Really.

images/thumbnail.jpg - Thumbnail

As everyone knows, you can select vertical or horizontal blocks of text almost anywhere in SAPGUI, typing CTRL-Y and then dragging the mouse to make the selection. Everyone also knows that this does not work in ABAP editor. But perhaps what some people don’t know is that there is a way of making this kind of selection in ABAP editor: press and hold ALT. Now you can select blocks of text.

Unparameterisable parameters

images/thumbnail.jpg - Thumbnail

Every now and then you get a client who asks a programmer to create a write-protected parameter on the program selection screen. It’s a bit dumb given that the whole idea of parameters is that they are parameterisable. But there you go, it takes all sorts. Clients have so much imagination that SAP should create a cinema module, SAP CI, especially so they can screen all the films they carry around in their heads.

Hopping merrily from ELSE to ELSE

images/thumbnail.jpg - Thumbnail

You have in front of you one of those giant IF ELSEIF ELSEIF ELSEIF ELSEIF ELSE ENDIF that runs through hundreds of lines of code. If you double click on the IF or any of the ELSEIF you jump to the ENDIF. If you double click on the ENDIF down below you go to the IF up above. Everybody knows this. It is handy with a small IF ENDIF. However, it’s not much use with the large ones.

Jumping within ABAP editor

images/thumbnail.jpg - Thumbnail

Have you ever found yourself programming in one of those ABAP programs that’s as long as the Bible with hundreds and hundreds of lines where you always have to jump from one code area to another? Until a few days ago, in my ignorance I was using PageUp and PageDown to jump between the two locations and I wasted loads of time looking for the exact place in the code that I was interested in.

Upside down CASE

images/thumbnail.jpg - Thumbnail

What is your favourite colour? SELECTION-SCREEN BEGIN OF BLOCK b1. PARAMETERS: p_azul BUTTONGROUP GROUP COR DEFAULT 'X', p_verde BUTTONGROUP GROUP COR, p_roxo BUTTONGROUP GROUP COR. SELECTION-SCREEN END OF BLOCK b1. If you said ‘blue’ you live and can cross the bridge. In any case, the following normally happens in ABAP to discover the colour the user chose: IF p_azul = 'X'. lv_cor = 'AZUL'. ELSE IF p_verde = 'X'. lv_cor = 'VERDE'.

I CTRL-clicked to select a word

images/thumbnail.jpg - Thumbnail

A simple but valuable tip: anywhere in the SAP GUI - including the ABAP Editor - to select a word all you have to do is CTRL-click above it. Cool, no? Unfortunately it doesn’t work on the Mac Java GUI :-( (Thank you Sérgio Fraga for the tip) Greetings from Abapinho.

Instant RANGE - just add water

images/thumbnail.jpg - Thumbnail

I’m going to teach you a magic formula for creating a RANGE that is almost as easy as just adding water. Imagine that you want to create a RANGE from a database selection to then use it in another SELECT. Obviously you can do it like this: DATA: lt_kunnr TYPE STANDARD TABLE OF kunnr, lr_kunnr TYPE RANGE OF kunnr, wa_kunnr LIKE LINE OF lr_kunnr. FIELD-SYMBOLS: <kunnr> LIKE LINE OF lt_kunnr. SELECT kunnr INTO TABLE lt_kunnr FROM kna1.

Taking a nap

images/thumbnail.jpg - Thumbnail

Whatever the case, it is necessary to put a program to sleep. And, as with almost everything else, there are several ways to do this, some better than others. The most standard way to do this in ABAP is as follows: WAIT UP TO 10 SECONDS. The advantage of WAIT UP TO N SECONDS is that the process is freed up during these 10 seconds, thereby making it available for those who want it.

Different versions of the same story

images/thumbnail.jpg - Thumbnail

Everyone knows that the SAP versions are a big mess. The lords of Heidelberg who play around with the names they give their things are either an impulsive bunch, are making fun of us, or they must always be in uproar. Here is a little table to help to unravel them: Ano | UI | Edition | Version | Version | BASIS | WebAS | ECC | NetWeaver —|—|—|—|—|—|—|—|— | Terminal

Global macros

images/thumbnail.jpg - Thumbnail

In a previous article we talked about macros, a relatively obscure and little used feature that can be both useful as well as create a huge mess. But these aren’t the only ABAP macros. There are others that are even more obscure and with even greater potential to mix up a system: the global macros. I don’t know if I should tell you this, as it’s so strange… But, I don’t think it’s a good idea to hide it… Therefore, I’ll tell all.

Start on the right footing

images/thumbnail.jpg - Thumbnail

Normally when you log on to SAP the SAP menu appears. But you can use the function module NAVIGATION_SET_START_TCODE to pre-set an initial transaction. Anyway, it’s better to know it’s there than not to know it’s there, and even better than knowing that it’s not there. Who knows – it could be good for some users. There’s also the function module NAVIGATION_GET_START_TCODE to see what is pre-set. Greetings from Abapinho.

Not even David Copperfield would do better

images/thumbnail.jpg - Thumbnail

Sometimes we want to access a transaction and we don’t have permission. That’s annoying. Luckily there’s the function module ALINK_CALL_TRANSACTION which makes things better. But use it with care or someone will get angry. Welcome to the dark side of Abapinho. If they say it was me that said it, I deny everything. Update: this function module will also do the trick: CALL_TRANSACTION_FROM_TABLE. New update: if all the above fail try this other function module: RS_HDSYS_CALL_TC_VARIANT (clearing flag AUTHORITY_CHECK).

ABAP Ninja

images/thumbnail.jpg - Thumbnail

One of the major new features in ERP 6.0 is the Enhancement Framework, a kind of “landlord’s friend” that allows you to hammer on all the SAP walls without chipping the paintwork. Unfortunately there’s still very little documentation about this and it’s always difficult to find the right Enhancement Point for the hammering you want. The a ABAP Ninja site tries to help. It’s an Enhancement search engine. They say they have more than 13,000 Enhancement Points waiting to be found.